You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openjpa.apache.org by pc...@apache.org on 2006/07/01 00:37:29 UTC

svn commit: r418401 [9/32] - in /incubator/openjpa/trunk: openjpa-lib/ openjpa-lib/src/main/java/org/apache/openjpa/lib/ant/ openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ openjpa-lib/src/main/java/org/apache/openjpa/lib/jdbc/ openjpa-lib/src/m...

Modified: incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/rop/ResultObjectProviderIterator.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/rop/ResultObjectProviderIterator.java?rev=418401&r1=418400&r2=418401&view=diff
==============================================================================
--- incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/rop/ResultObjectProviderIterator.java (original)
+++ incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/rop/ResultObjectProviderIterator.java Fri Jun 30 15:37:18 2006
@@ -1,13 +1,10 @@
 /*
  * Copyright 2006 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
+ *  Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *  Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
@@ -15,38 +12,33 @@
  */
 package org.apache.openjpa.lib.rop;
 
-import org.apache.openjpa.lib.util.*;
-
 import java.util.*;
-
+import org.apache.openjpa.lib.util.*;
 
 /**
- *  <p>Iterator wrapped around a {@link ResultObjectProvider}.</p>
- *
- *  @author Abe White
- *  @nojavadoc */
+ * Iterator wrapped around a {@link ResultObjectProvider}.
+ * 
+ * @author Abe White
+ * @nojavadoc
+ */
 public class ResultObjectProviderIterator implements Iterator, Closeable {
     private final ResultObjectProvider _rop;
     private Boolean _hasNext = null;
     private Boolean _open = null;
 
     /**
-     *  Constructor.  Supply object provider.
+     * Constructor. Supply object provider.
      */
     public ResultObjectProviderIterator(ResultObjectProvider rop) {
         _rop = rop;
     }
 
     /**
-     *  Close the underlying result object provider.
+     * Close the underlying result object provider.
      */
     public void close() {
         if (_open == Boolean.TRUE) {
-            try {
-                _rop.close();
-            } catch (Exception e) {
-            }
-
+            try { _rop.close(); } catch (Exception e) {}
             _open = Boolean.FALSE;
         }
     }
@@ -56,9 +48,8 @@
     }
 
     public boolean hasNext() {
-        if (_open == Boolean.FALSE) {
+        if (_open == Boolean.FALSE)
             return false;
-        }
 
         if (_hasNext == null) {
             try {
@@ -66,7 +57,6 @@
                     _rop.open();
                     _open = Boolean.TRUE;
                 }
-
                 _hasNext = (_rop.next()) ? Boolean.TRUE : Boolean.FALSE;
             } catch (RuntimeException re) {
                 close();
@@ -74,7 +64,6 @@
             } catch (Exception e) {
                 close();
                 _rop.handleCheckedException(e);
-
                 return false;
             }
         }
@@ -82,22 +71,17 @@
         // close if we reach the end of the list
         if (!_hasNext.booleanValue()) {
             close();
-
             return false;
         }
-
         return true;
     }
 
     public Object next() {
-        if (!hasNext()) {
+        if (!hasNext())
             throw new NoSuchElementException();
-        }
-
         try {
             Object ret = _rop.getResultObject();
             _hasNext = null;
-
             return ret;
         } catch (RuntimeException re) {
             close();
@@ -105,7 +89,6 @@
         } catch (Exception e) {
             close();
             _rop.handleCheckedException(e);
-
             return null;
         }
     }

Modified: incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/rop/SimpleResultList.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/rop/SimpleResultList.java?rev=418401&r1=418400&r2=418401&view=diff
==============================================================================
--- incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/rop/SimpleResultList.java (original)
+++ incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/rop/SimpleResultList.java Fri Jun 30 15:37:18 2006
@@ -1,13 +1,10 @@
 /*
  * Copyright 2006 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
+ *  Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *  Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
@@ -16,18 +13,17 @@
 package org.apache.openjpa.lib.rop;
 
 import java.io.*;
-
 import java.util.*;
 
-
 /**
- *  <p>An almost stateless {@link ResultList} designed for use with result
- *  object providers backed by efficient random-access data structures, such
- *  as the {@link ListResultObjectProvider}.  This result list does not
- *  perform any caching.</p>
- *
- *  @author Abe White
- *  @nojavadoc */
+ * An almost stateless {@link ResultList} designed for use with result
+ * object providers backed by efficient random-access data structures, such
+ * as the {@link ListResultObjectProvider}. This result list does not
+ * perform any caching.
+ * 
+ * @author Abe White
+ * @nojavadoc
+ */
 public class SimpleResultList extends AbstractNonSequentialResultList {
     private final transient ResultObjectProvider _rop;
     private boolean _closed = false;
@@ -35,7 +31,6 @@
 
     public SimpleResultList(ResultObjectProvider rop) {
         _rop = rop;
-
         try {
             _rop.open();
         } catch (RuntimeException re) {
@@ -58,20 +53,14 @@
     public void close() {
         if (!_closed) {
             _closed = true;
-
-            try {
-                _rop.close();
-            } catch (Exception e) {
-            }
+            try { _rop.close(); } catch (Exception e) {}
         }
     }
 
     public Object getInternal(int index) {
         try {
-            if (!_rop.absolute(index)) {
+            if (!_rop.absolute(index))
                 return PAST_END;
-            }
-
             return _rop.getResultObject();
         } catch (RuntimeException re) {
             close();
@@ -79,21 +68,16 @@
         } catch (Exception e) {
             close();
             _rop.handleCheckedException(e);
-
             return PAST_END;
         }
     }
 
     public int size() {
         assertOpen();
-
-        if (_size != -1) {
+        if (_size != -1)
             return _size;
-        }
-
         try {
             _size = _rop.size();
-
             return _size;
         } catch (RuntimeException re) {
             close();
@@ -101,22 +85,18 @@
         } catch (Exception e) {
             close();
             _rop.handleCheckedException(e);
-
             return -1;
         }
     }
 
     public Object writeReplace() throws ObjectStreamException {
-        if (_closed) {
+        if (_closed)
             return this;
-        }
 
         // load results into list
         List list = new ArrayList();
-
         for (Iterator itr = iterator(); itr.hasNext();)
             list.add(itr.next());
-
         return list;
     }
 }

Modified: incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/rop/SoftRandomAccessResultList.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/rop/SoftRandomAccessResultList.java?rev=418401&r1=418400&r2=418401&view=diff
==============================================================================
--- incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/rop/SoftRandomAccessResultList.java (original)
+++ incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/rop/SoftRandomAccessResultList.java Fri Jun 30 15:37:18 2006
@@ -1,13 +1,10 @@
 /*
  * Copyright 2006 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
+ *  Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *  Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
@@ -15,17 +12,16 @@
  */
 package org.apache.openjpa.lib.rop;
 
-import org.apache.commons.collections.*;
-
 import java.util.*;
-
+import org.apache.commons.collections.*;
 
 /**
- *  <p>Specialization of the {@link RandomAccessResultList} that only maintains
- *  soft references to instantiated objects.</p>
- *
- *  @author Abe White
- *  @nojavadoc */
+ * Specialization of the {@link RandomAccessResultList} that only maintains
+ * soft references to instantiated objects.
+ * 
+ * @author Abe White
+ * @nojavadoc
+ */
 public class SoftRandomAccessResultList extends RandomAccessResultList {
     public SoftRandomAccessResultList(ResultObjectProvider rop) {
         super(rop);

Modified: incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/rop/WindowResultList.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/rop/WindowResultList.java?rev=418401&r1=418400&r2=418401&view=diff
==============================================================================
--- incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/rop/WindowResultList.java (original)
+++ incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/rop/WindowResultList.java Fri Jun 30 15:37:18 2006
@@ -1,13 +1,10 @@
 /*
  * Copyright 2006 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
+ *  Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *  Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
@@ -16,20 +13,19 @@
 package org.apache.openjpa.lib.rop;
 
 import java.io.*;
-
 import java.util.*;
 
-
 /**
- *  <p>ResultList implementation that uses a forward-scrolling window of
- *  results.</p>
- *
- *  @author Abe White
- *  @nojavadoc */
+ * ResultList implementation that uses a forward-scrolling window of results.
+ * 
+ * @author Abe White
+ * @nojavadoc
+ */
 public class WindowResultList extends AbstractNonSequentialResultList {
     private static final int OPEN = 0;
     private static final int FREED = 1;
     private static final int CLOSED = 2;
+
     private final Object[] _window;
     private int _pos = -1;
     private ResultObjectProvider _rop = null;
@@ -44,10 +40,8 @@
     public WindowResultList(ResultObjectProvider rop, int windowSize) {
         _rop = rop;
 
-        if (windowSize <= 0) {
+        if (windowSize <= 0)
             windowSize = 10;
-        }
-
         _window = new Object[windowSize];
 
         try {
@@ -79,14 +73,10 @@
 
     public int size() {
         assertOpen();
-
-        if (_size != -1) {
+        if (_size != -1)
             return _size;
-        }
-
         try {
             _size = _rop.size();
-
             return _size;
         } catch (RuntimeException re) {
             close();
@@ -94,58 +84,48 @@
         } catch (Exception e) {
             close();
             _rop.handleCheckedException(e);
-
             return -1;
         }
     }
 
     public Object getInternal(int index) {
         // out of range?
-        if ((index < 0) || ((_size != -1) && (index >= _size))) {
+        if (index < 0 || (_size != -1 && index >= _size))
             return PAST_END;
-        }
 
         try {
             // if this is before window range, move window back
             if (index < _pos) {
-                if (!_random || (index == 0)) {
+                if (!_random || index == 0)
                     _rop.reset();
-                }
-
                 _pos = -1;
             }
 
             // if this is the first get or past window range, move window
-            if ((_pos == -1) || (index >= (_pos + _window.length))) {
+            if (_pos == -1 || index >= _pos + _window.length) {
                 // position result provider just before requested index
-                if (_random && (index != 0)) {
-                    if (!_rop.absolute(index - 1)) {
+                if (_random && index != 0) {
+                    if (!_rop.absolute(index - 1))
                         return PAST_END;
-                    }
                 } else {
-                    int begin = (_pos == -1) ? 0 : (_pos + _window.length);
-
+                    int begin = (_pos == -1) ? 0 : _pos + _window.length;
                     for (int i = begin; i < index; i++)
-                        if (!_rop.next()) {
+                        if (!_rop.next())
                             return PAST_END;
-                        }
                 }
 
                 // create window starting at requested index
                 int end = -1;
-
                 for (int i = 0; i < _window.length; i++) {
-                    if ((end == -1) && !_rop.next()) {
+                    if (end == -1 && !_rop.next())
                         end = i;
-                    }
-
-                    _window[i] = (end == -1) ? _rop.getResultObject() : PAST_END;
+                    _window[i] = (end == -1) ? _rop.getResultObject()
+                        : PAST_END;
                 }
-
                 _pos = index;
 
                 // if the window spans the entire result list, free
-                if ((end != -1) && (_pos == 0)) {
+                if (end != -1 && _pos == 0) {
                     _size = end;
                     free();
                 }
@@ -159,33 +139,25 @@
         } catch (Exception e) {
             close();
             _rop.handleCheckedException(e);
-
             return null;
         }
     }
 
     private void free() {
         if (_state == OPEN) {
-            try {
-                _rop.close();
-            } catch (Exception e) {
-            }
-
+            try { _rop.close(); } catch (Exception e) {}
             _state = FREED;
         }
     }
 
     public Object writeReplace() throws ObjectStreamException {
-        if (_state != OPEN) {
+        if (_state != OPEN)
             return this;
-        }
 
         // load results into list
         List list = new ArrayList();
-
         for (Iterator itr = iterator(); itr.hasNext();)
             list.add(itr.next());
-
         return list;
     }
 }

Modified: incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/AbstractEventManager.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/AbstractEventManager.java?rev=418401&r1=418400&r2=418401&view=diff
==============================================================================
--- incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/AbstractEventManager.java (original)
+++ incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/AbstractEventManager.java Fri Jun 30 15:37:18 2006
@@ -1,13 +1,10 @@
 /*
  * Copyright 2006 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
+ *  Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *  Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
@@ -17,110 +14,93 @@
 
 import java.util.*;
 
-
 /**
- *  <p>Base event manager that handles adding/removing listeners
- *  and firing events.  This class is reentrant-safe; listeners can be added
- *  and removed by other listeners when they receive events.  The changes will
- *  not be visible until the event fire that initiated the recursive sequence
- *  of calls completes, however.</p>
- *
- *  @author Abe White
+ * Base event manager that handles adding/removing listeners
+ * and firing events. This class is reentrant-safe; listeners can be added
+ * and removed by other listeners when they receive events. The changes will
+ * not be visible until the event fire that initiated the recursive sequence
+ * of calls completes, however.
+ * 
+ * @author Abe White
  */
 public abstract class AbstractEventManager implements EventManager {
     private static Exception[] EMPTY_EXCEPTIONS = new Exception[0];
+
     private boolean _firing = false;
     private Collection _listeners = null;
     private Collection _newListeners = null;
 
     /**
-     *  Register an event listener.
+     * Register an event listener.
      */
     public synchronized void addListener(Object listener) {
-        if (listener == null) {
+        if (listener == null)
             return;
-        }
-
         if (_firing) {
-            if (_newListeners == null) {
+            if (_newListeners == null)
                 _newListeners = newListenerCollection();
-            }
-
             _newListeners.addAll(_listeners);
             _newListeners.add(listener);
         } else {
-            if (_listeners == null) {
+            if (_listeners == null)
                 _listeners = newListenerCollection();
-            }
-
             _listeners.add(listener);
         }
     }
 
     /**
-     *  Remove an event listener.
+     * Remove an event listener.
      */
     public synchronized boolean removeListener(Object listener) {
-        if (listener == null) {
+        if (listener == null)
             return false;
-        }
-
         if (_firing && _listeners.contains(listener)) {
-            if (_newListeners == null) {
+            if (_newListeners == null)
                 _newListeners = newListenerCollection();
-            }
-
             _newListeners.addAll(_listeners);
-
             return _newListeners.remove(listener);
         }
-
-        return (_listeners != null) && _listeners.remove(listener);
+        return _listeners != null && _listeners.remove(listener);
     }
 
     /**
-     *  Return whether the given instance is in the list of listeners.
+     * Return whether the given instance is in the list of listeners.
      */
     public synchronized boolean hasListener(Object listener) {
-        return (_listeners != null) && _listeners.contains(listener);
+        return _listeners != null && _listeners.contains(listener);
     }
 
     /**
-     *  Return true if there are any registered listeners.
+     * Return true if there are any registered listeners.
      */
     public synchronized boolean hasListeners() {
-        return (_listeners != null) && !_listeners.isEmpty();
+        return _listeners != null && !_listeners.isEmpty();
     }
 
     /**
-     *  Return a read-only list of listeners.
+     * Return a read-only list of listeners.
      */
     public synchronized Collection getListeners() {
-        return (_listeners == null) ? Collections.EMPTY_LIST
-                                    : Collections.unmodifiableCollection(_listeners);
+        return(_listeners == null) ? Collections.EMPTY_LIST
+            : Collections.unmodifiableCollection(_listeners);
     }
 
     /**
-     *  Fire the given event to all listeners.
+     * Fire the given event to all listeners.
      */
     public synchronized Exception[] fireEvent(Object event) {
-        if ((_listeners == null) || _listeners.isEmpty()) {
+        if (_listeners == null || _listeners.isEmpty())
             return EMPTY_EXCEPTIONS;
-        }
 
         boolean reentrant = _firing;
         _firing = true;
-
         List exceptions = null;
-
         for (Iterator itr = _listeners.iterator(); itr.hasNext();) {
             try {
                 fireEvent(event, itr.next());
             } catch (Exception e) {
-                if (exceptions == null) {
+                if (exceptions == null)
                     exceptions = new LinkedList();
-                }
-
                 exceptions.add(e);
             }
         }
@@ -130,29 +110,25 @@
         // list with the set of new listeners
         if (!reentrant) {
             _firing = false;
-
-            if (_newListeners != null) {
+            if (_newListeners != null)
                 _listeners = _newListeners;
-            }
-
             _newListeners = null;
         }
 
-        if (exceptions == null) {
+        if (exceptions == null)
             return EMPTY_EXCEPTIONS;
-        }
-
-        return (Exception[]) exceptions.toArray(new Exception[exceptions.size()]);
+        return(Exception[]) exceptions.toArray
+            (new Exception[exceptions.size()]);
     }
 
     /**
-     *  Implement this method to fire the given event to the given listener.
+     * Implement this method to fire the given event to the given listener.
      */
     protected abstract void fireEvent(Object event, Object listener)
         throws Exception;
 
     /**
-     *  Return a new container for listeners.  Uses a linked list by default.
+     * Return a new container for listeners. Uses a linked list by default.
      */
     protected Collection newListenerCollection() {
         return new LinkedList();

Modified: incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/Base16Encoder.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/Base16Encoder.java?rev=418401&r1=418400&r2=418401&view=diff
==============================================================================
--- incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/Base16Encoder.java (original)
+++ incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/Base16Encoder.java Fri Jun 30 15:37:18 2006
@@ -1,13 +1,10 @@
 /*
  * Copyright 2006 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
+ *  Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *  Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
@@ -15,57 +12,47 @@
  */
 package org.apache.openjpa.lib.util;
 
-
 /**
- *  <p>Base 16 encoder.</p>
- *
- *  @author Marc Prud'hommeaux
- *  @nojavadoc */
+ * Base 16 encoder.
+ * 
+ * @author Marc Prud'hommeaux
+ * @nojavadoc
+ */
 public class Base16Encoder {
     private final static char[] HEX = new char[] {
-            '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D',
-            'E', 'F'
-        };
+        '0', '1', '2', '3', '4', '5', '6', '7',
+        '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
 
     /**
-     *  Convert bytes to a base16 string.
+     * Convert bytes to a base16 string.
      */
     public static String encode(byte[] byteArray) {
         StringBuffer hexBuffer = new StringBuffer(byteArray.length * 2);
-
         for (int i = 0; i < byteArray.length; i++)
             for (int j = 1; j >= 0; j--)
                 hexBuffer.append(HEX[(byteArray[i] >> (j * 4)) & 0xF]);
-
         return hexBuffer.toString();
     }
 
     /**
-     *  Convert a base16 string into a byte array.
+     * Convert a base16 string into a byte array.
      */
     public static byte[] decode(String s) {
         int len = s.length();
         byte[] r = new byte[len / 2];
-
         for (int i = 0; i < r.length; i++) {
-            int digit1 = s.charAt(i * 2);
-            int digit2 = s.charAt((i * 2) + 1);
-
-            if ((digit1 >= '0') && (digit1 <= '9')) {
+            int digit1 = s.charAt(i * 2), digit2 = s.charAt(i * 2 + 1);
+            if (digit1 >= '0' && digit1 <= '9')
                 digit1 -= '0';
-            } else if ((digit1 >= 'A') && (digit1 <= 'F')) {
-                digit1 -= ('A' - 10);
-            }
-
-            if ((digit2 >= '0') && (digit2 <= '9')) {
+            else if (digit1 >= 'A' && digit1 <= 'F')
+                digit1 -= 'A' - 10;
+            if (digit2 >= '0' && digit2 <= '9')
                 digit2 -= '0';
-            } else if ((digit2 >= 'A') && (digit2 <= 'F')) {
-                digit2 -= ('A' - 10);
-            }
+            else if (digit2 >= 'A' && digit2 <= 'F')
+                digit2 -= 'A' - 10;
 
             r[i] = (byte) ((digit1 << 4) + digit2);
         }
-
         return r;
     }
 }

Modified: incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/BytecodeWriter.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/BytecodeWriter.java?rev=418401&r1=418400&r2=418401&view=diff
==============================================================================
--- incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/BytecodeWriter.java (original)
+++ incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/BytecodeWriter.java Fri Jun 30 15:37:18 2006
@@ -1,13 +1,10 @@
 /*
  * Copyright 2006 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
+ *  Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *  Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
@@ -15,15 +12,13 @@
  */
 package org.apache.openjpa.lib.util;
 
-import serp.bytecode.*;
-
 import java.io.*;
-
+import serp.bytecode.*;
 
 /**
- *  Control how enhanced bytecode is written.
- *
- *  @author Steve Kim
+ * Control how enhanced bytecode is written.
+ * 
+ * @author Steve Kim
  */
 public interface BytecodeWriter {
     public void write(BCClass type) throws IOException;

Modified: incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/Closeable.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/Closeable.java?rev=418401&r1=418400&r2=418401&view=diff
==============================================================================
--- incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/Closeable.java (original)
+++ incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/Closeable.java Fri Jun 30 15:37:18 2006
@@ -1,13 +1,10 @@
 /*
  * Copyright 2006 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
+ *  Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *  Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
@@ -15,12 +12,11 @@
  */
 package org.apache.openjpa.lib.util;
 
-
 /**
- *  <p>Generic interface for components that can be closed so that helpers
- *  can treate them in a generic way.</p>
- *
- *  @author Abe White
+ * Generic interface for components that can be closed so that helpers
+ * can treate them in a generic way.
+ * 
+ * @author Abe White
  */
 public interface Closeable {
     public void close() throws Exception;

Modified: incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/CodeFormat.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/CodeFormat.java?rev=418401&r1=418400&r2=418401&view=diff
==============================================================================
--- incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/CodeFormat.java (original)
+++ incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/CodeFormat.java Fri Jun 30 15:37:18 2006
@@ -1,13 +1,10 @@
 /*
  * Copyright 2006 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
+ *  Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *  Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
@@ -15,15 +12,15 @@
  */
 package org.apache.openjpa.lib.util;
 
-
 /**
- *  <p>Encapsulates some common Java source code formatting options.  The
- *  class can also be used as a buffer for formatted Java code.</p>
- *
- *  @author Abe White
+ * Encapsulates some common Java source code formatting options. The
+ * class can also be used as a buffer for formatted Java code.
+ * 
+ * @author Abe White
  */
 public final class CodeFormat implements Cloneable {
     private static final String _sep = System.getProperty("line.separator");
+
     private String _tab = "\t";
     private boolean _spaceBeforeParen = false;
     private boolean _spaceInParen = false;
@@ -31,603 +28,540 @@
     private boolean _braceAtSameTabLevel = false;
     private boolean _scoreBeforeFieldName = false;
     private int _linesBetweenSections = 2;
+
     private StringBuffer _buf = new StringBuffer();
 
     /**
-     *  The number of spaces to use for tabs; 0 means to use actual tab
-     *  characters.  Defaults to 0.
+     * The number of spaces to use for tabs; 0 means to use actual tab
+     * characters. Defaults to 0.
      */
     public int getTabSpaces() {
-        return (_tab.equals("\t")) ? 0 : _tab.length();
+        return(_tab.equals("\t")) ? 0 : _tab.length();
     }
 
     /**
-     *  The number of spaces to use for tabs; 0 means to use actual tab
-     *  characters.  Defaults to 0.
+     * The number of spaces to use for tabs; 0 means to use actual tab
+     * characters. Defaults to 0.
      */
     public void setTabSpaces(int tab) {
-        if (tab == 0) {
+        if (tab == 0)
             _tab = "\t";
-        } else {
+        else {
             StringBuffer tabs = new StringBuffer(tab);
-
             for (int i = 0; i < tab; i++)
                 tabs.append(" ");
-
             _tab = tabs.toString();
         }
     }
 
     /**
-     *  Whether to place a space before parentheses.  Defaults to false.
+     * Whether to place a space before parentheses. Defaults to false.
      */
     public boolean getSpaceBeforeParen() {
         return _spaceBeforeParen;
     }
 
     /**
-     *  Whether to place a space before parentheses.  Defaults to false.
+     * Whether to place a space before parentheses. Defaults to false.
      */
     public void setSpaceBeforeParen(boolean spaceBeforeParen) {
         _spaceBeforeParen = spaceBeforeParen;
     }
 
     /**
-     *  Whether to place a space within parentheses.  Defaults to false.
+     * Whether to place a space within parentheses. Defaults to false.
      */
     public boolean getSpaceInParen() {
         return _spaceInParen;
     }
 
     /**
-     *  Whether to place a space within parentheses.  Defaults to false.
+     * Whether to place a space within parentheses. Defaults to false.
      */
     public void setSpaceInParen(boolean spaceInParen) {
         _spaceInParen = spaceInParen;
     }
 
     /**
-     *  Whether to place opening braces on the same line as the
-     *  block declaration, or on the next line.  Defaults to same line.
+     * Whether to place opening braces on the same line as the
+     * block declaration, or on the next line. Defaults to same line.
      */
     public boolean getBraceOnSameLine() {
         return _braceOnSameLine;
     }
 
     /**
-     *  Whether to place opening braces on the same line as the
-     *  block declaration, or on the next line.  Defaults to same line.
+     * Whether to place opening braces on the same line as the
+     * block declaration, or on the next line. Defaults to same line.
      */
     public void setBraceOnSameLine(boolean braceOnSameLine) {
         _braceOnSameLine = braceOnSameLine;
     }
 
     /**
-     *  Whether to place braces at the same tab level as the code within
-     *  the block.  Defaults to false.
+     * Whether to place braces at the same tab level as the code within
+     * the block. Defaults to false.
      */
     public boolean getBraceAtSameTabLevel() {
         return _braceAtSameTabLevel;
     }
 
     /**
-     *  Whether to place braces at the same tab level as the code within
-     *  the block.  Defaults to false.
+     * Whether to place braces at the same tab level as the code within
+     * the block. Defaults to false.
      */
     public void setBraceAtSameTabLevel(boolean braceAtSameTabLevel) {
         _braceAtSameTabLevel = braceAtSameTabLevel;
     }
 
     /**
-     *  Whether to place an underscore before private field names.  Defaults
-     *  to false.
+     * Whether to place an underscore before private field names. Defaults
+     * to false.
      */
     public boolean getScoreBeforeFieldName() {
         return _scoreBeforeFieldName;
     }
 
     /**
-     *  Whether to place an underscore before private field names.  Defaults
-     *  to false.
+     * Whether to place an underscore before private field names. Defaults
+     * to false.
      */
     public void setScoreBeforeFieldName(boolean scoreBeforeFieldName) {
         _scoreBeforeFieldName = scoreBeforeFieldName;
     }
 
     /**
-     *  The number of empty lines between code sections.  Defaults to 2.
+     * The number of empty lines between code sections. Defaults to 2.
      */
     public int getLinesBetweenSections() {
         return _linesBetweenSections;
     }
 
     /**
-     *  The number of empty lines between sections.  Defaults to 2.
+     * The number of empty lines between sections. Defaults to 2.
      */
     public void setLinesBetweenSections(int linesBetweenSections) {
         _linesBetweenSections = linesBetweenSections;
     }
 
     /**
-     *  Return a new line character.
+     * Return a new line character.
      */
     public String getEndl() {
         return getEndl(1);
     }
 
     /**
-     *  Return the given number of new line characters.
+     * Return the given number of new line characters.
      */
     public String getEndl(int num) {
-        if (num == 0) {
+        if (num == 0)
             return "";
-        }
-
-        if (num == 1) {
+        if (num == 1)
             return _sep;
-        }
 
         StringBuffer buf = new StringBuffer(_sep.length() * num);
-
         for (int i = 0; i < num; i++)
             buf.append(_sep);
-
         return buf.toString();
     }
 
     /**
-     *  Return the given number of new line characters, followed by
-     *  the given tab level indentation.
+     * Return the given number of new line characters, followed by
+     * the given tab level indentation.
      */
     public String getEndl(int num, int tabs) {
         return getEndl(num) + getTab(tabs);
     }
 
     /**
-     *  Return {#getLinesBetweenSections} + 1 new line characters.
+     * Return {#getLinesBetweenSections} + 1 new line characters.
      */
     public String getAfterSection() {
         return getEndl(getLinesBetweenSections() + 1);
     }
 
     /**
-     *  Open parentheses string.  Users can choose to place spaces before
-     *  and within parentheses.
+     * Open parentheses string. Users can choose to place spaces before
+     * and within parentheses.
      */
     public String getOpenParen(boolean methodOrIf) {
-        if ((_spaceBeforeParen && methodOrIf) && _spaceInParen) {
+        if ((_spaceBeforeParen && methodOrIf) && _spaceInParen)
             return " ( ";
-        }
-
-        if (_spaceBeforeParen && methodOrIf) {
+        if (_spaceBeforeParen && methodOrIf)
             return " (";
-        }
-
-        if (_spaceInParen) {
+        if (_spaceInParen)
             return "( ";
-        }
-
         return "(";
     }
 
     /**
-     *  Close parentheses string.  Users can choose to place spaces within
-     *  parentheses.
+     * Close parentheses string. Users can choose to place spaces within
+     * parentheses.
      */
     public String getCloseParen() {
-        if (_spaceInParen) {
+        if (_spaceInParen)
             return " )";
-        }
-
         return ")";
     }
 
     /**
-     *  Paired parentheses for empty method parameters.  Users can choose
-     *  to place spaces before parentheses.
+     * Paired parentheses for empty method parameters. Users can choose
+     * to place spaces before parentheses.
      */
     public String getParens() {
-        if (_spaceBeforeParen) {
+        if (_spaceBeforeParen)
             return " ()";
-        }
-
         return "()";
     }
 
     /**
-     *  Open brace string.  Users can choose to place braces on the same
-     *  line, or on a new line, and can choose the indenting level.
-     *
-     *  @param tabLevel        the tab level of code within the brace
+     * Open brace string. Users can choose to place braces on the same
+     * line, or on a new line, and can choose the indenting level.
+     * 
+     * @param tabLevel the tab level of code within the brace
      */
     public String getOpenBrace(int tabLevel) {
-        if (_braceOnSameLine) {
+        if (_braceOnSameLine)
             return " {";
-        }
-
-        if (_braceAtSameTabLevel) {
+        if (_braceAtSameTabLevel)
             return getEndl() + getTab(tabLevel) + "{";
-        }
-
         return getEndl() + getTab(tabLevel - 1) + "{";
     }
 
     /**
-     *  Close brace string.  Users can choose to place braces on the same
-     *  line, or on a new line, and can choose the indenting level.
-     *
-     *  @param tabLevel        the tab level of code within the brace
+     * Close brace string. Users can choose to place braces on the same
+     * line, or on a new line, and can choose the indenting level.
+     * 
+     * @param tabLevel the tab level of code within the brace
      */
     public String getCloseBrace(int tabLevel) {
-        if (_braceAtSameTabLevel) {
+        if (_braceAtSameTabLevel)
             return getTab(tabLevel) + "}";
-        }
-
         return getTab(tabLevel - 1) + "}";
     }
 
     /**
-     *  Extends declaration.  Uses configuration of {@link #openBrace},
-     *  but prints "extends" instead of a brace.
+     * Extends declaration. Uses configuration of {@link #openBrace},
+     * but prints "extends" instead of a brace.
      */
     public String getExtendsDec(int tabLevel) {
-        if (_braceOnSameLine) {
+        if (_braceOnSameLine)
             return " extends";
-        }
-
-        if (_braceAtSameTabLevel) {
+        if (_braceAtSameTabLevel)
             return getEndl() + getTab(tabLevel) + "extends";
-        }
-
         return getEndl() + getTab(tabLevel) + "extends";
     }
 
     /**
-     *  Implements declaration.  Uses configuration of {@link #openBrace},
-     *  but prints "implements" instead of a brace.
+     * Implements declaration. Uses configuration of {@link #openBrace},
+     * but prints "implements" instead of a brace.
      */
     public String getImplementsDec(int tabLevel) {
-        if (_braceOnSameLine) {
+        if (_braceOnSameLine)
             return " implements";
-        }
-
-        if (_braceAtSameTabLevel) {
+        if (_braceAtSameTabLevel)
             return getEndl() + getTab(tabLevel) + "implements";
-        }
-
         return getEndl() + getTab(tabLevel) + "implements";
     }
 
     /**
-     *  Throws declaration.  Uses configuration of {@link #openBrace},
-     *  but prints "throws" instead of a brace.
+     * Throws declaration. Uses configuration of {@link #openBrace},
+     * but prints "throws" instead of a brace.
      */
     public String getThrowsDec(int tabLevel) {
-        if (_braceOnSameLine) {
+        if (_braceOnSameLine)
             return " throws";
-        }
-
-        if (_braceAtSameTabLevel) {
+        if (_braceAtSameTabLevel)
             return getEndl() + getTab(tabLevel) + "throws";
-        }
-
         return getEndl() + getTab(tabLevel) + "throws";
     }
 
     /**
-     *  Tab string.  Users can choose to use spaces or tab characters.
+     * Tab string. Users can choose to use spaces or tab characters.
      */
     public String getTab() {
         return getTab(1);
     }
 
     /**
-     *  Tab string.  Users can choose to use spaces or tab characters.
-     *
-     *  @param tabLevel        the number of tabs
+     * Tab string. Users can choose to use spaces or tab characters.
+     * 
+     * @param tabLevel the number of tabs
      */
     public String getTab(int tabLevel) {
-        if (tabLevel == 0) {
+        if (tabLevel == 0)
             return "";
-        }
-
-        if (tabLevel == 1) {
+        if (tabLevel == 1)
             return _tab;
-        }
 
         StringBuffer tabs = new StringBuffer(_tab.length() * tabLevel);
-
         for (int i = 0; i < tabLevel; i++)
             tabs.append(_tab);
-
         return tabs.toString();
     }
 
     /**
-     *  Return the field name for given suggested name, possibly adding
-     *  leading underscore.
+     * Return the field name for given suggested name, possibly adding
+     * leading underscore.
      */
     public String getFieldName(String fieldName) {
-        return (_scoreBeforeFieldName) ? ("_" + fieldName) : fieldName;
+        return(_scoreBeforeFieldName) ? "_" + fieldName : fieldName;
     }
 
     /**
-     *  Return the internal code buffer.
+     * Return the internal code buffer.
      */
     public StringBuffer getBuffer() {
         return _buf;
     }
 
     /**
-     *  Append the given value to the internal buffer.
+     * Append the given value to the internal buffer.
      */
     public CodeFormat append(boolean val) {
         _buf.append(val);
-
         return this;
     }
 
     /**
-     *  Append the given value to the internal buffer.
+     * Append the given value to the internal buffer.
      */
     public CodeFormat append(byte val) {
         _buf.append(val);
-
         return this;
     }
 
     /**
-     *  Append the given value to the internal buffer.
+     * Append the given value to the internal buffer.
      */
     public CodeFormat append(char val) {
         _buf.append(val);
-
         return this;
     }
 
     /**
-     *  Append the given value to the internal buffer.
+     * Append the given value to the internal buffer.
      */
     public CodeFormat append(double val) {
         _buf.append(val);
-
         return this;
     }
 
     /**
-     *  Append the given value to the internal buffer.
+     * Append the given value to the internal buffer.
      */
     public CodeFormat append(float val) {
         _buf.append(val);
-
         return this;
     }
 
     /**
-     *  Append the given value to the internal buffer.
+     * Append the given value to the internal buffer.
      */
     public CodeFormat append(int val) {
         _buf.append(val);
-
         return this;
     }
 
     /**
-     *  Append the given value to the internal buffer.
+     * Append the given value to the internal buffer.
      */
     public CodeFormat append(long val) {
         _buf.append(val);
-
         return this;
     }
 
     /**
-     *  Append the given value to the internal buffer.
+     * Append the given value to the internal buffer.
      */
     public CodeFormat append(short val) {
         _buf.append(val);
-
         return this;
     }
 
     /**
-     *  Append the given value to the internal buffer.
+     * Append the given value to the internal buffer.
      */
     public CodeFormat append(Object val) {
         _buf.append(val);
-
         return this;
     }
 
     /**
-     *  Append the given value to the internal buffer.
-     *
-     *  @see #getEndl()
+     * Append the given value to the internal buffer.
+     * 
+     * @see #getEndl()
      */
     public CodeFormat endl() {
         _buf.append(getEndl());
-
         return this;
     }
 
     /**
-     *  Append the given value to the internal buffer.
-     *
-     *  @see #getEndl(int)
+     * Append the given value to the internal buffer.
+     * 
+     * @see #getEndl(int)
      */
     public CodeFormat endl(int num) {
         _buf.append(getEndl(num));
-
         return this;
     }
 
     /**
-     *  Append the given value to the internal buffer.
-     *
-     *  @see #getEndl(int, int)
+     * Append the given value to the internal buffer.
+     * 
+     * @see #getEndl(int, int)
      */
     public CodeFormat endl(int num, int tabs) {
         _buf.append(getEndl(num, tabs));
-
         return this;
     }
 
     /**
-     *  Append the given value to the internal buffer.
-     *
-     *  @see #getAfterSection
+     * Append the given value to the internal buffer.
+     * 
+     * @see #getAfterSection
      */
     public CodeFormat afterSection() {
         _buf.append(getAfterSection());
-
         return this;
     }
 
     /**
-     *  Append the given value to the internal buffer.
-     *
-     *  @see #getOpenParen
+     * Append the given value to the internal buffer.
+     * 
+     * @see #getOpenParen
      */
     public CodeFormat openParen(boolean methodOrIf) {
         _buf.append(getOpenParen(methodOrIf));
-
         return this;
     }
 
     /**
-     *  Append the given value to the internal buffer.
-     *
-     *  @see #getCloseParen
+     * Append the given value to the internal buffer.
+     * 
+     * @see #getCloseParen
      */
     public CodeFormat closeParen() {
         _buf.append(getCloseParen());
-
         return this;
     }
 
     /**
-     *  Append the given value to the internal buffer.
-     *
-     *  @see #getParens
+     * Append the given value to the internal buffer.
+     * 
+     * @see #getParens
      */
     public CodeFormat parens() {
         _buf.append(getParens());
-
         return this;
     }
 
     /**
-     *  Append the given value to the internal buffer.
-     *
-     *  @see #getOpenBrace
+     * Append the given value to the internal buffer.
+     * 
+     * @see #getOpenBrace
      */
     public CodeFormat openBrace(int tabLevel) {
         _buf.append(getOpenBrace(tabLevel));
-
         return this;
     }
 
     /**
-     *  Append the given value to the internal buffer.
-     *
-     *  @see #getCloseBrace
+     * Append the given value to the internal buffer.
+     * 
+     * @see #getCloseBrace
      */
     public CodeFormat closeBrace(int tabLevel) {
         _buf.append(getCloseBrace(tabLevel));
-
         return this;
     }
 
     /**
-     *  Append the given value to the internal buffer.
-     *
-     *  @see #getExtendsDec
+     * Append the given value to the internal buffer.
+     * 
+     * @see #getExtendsDec
      */
     public CodeFormat extendsDec(int tabLevel) {
         _buf.append(getExtendsDec(tabLevel));
-
         return this;
     }
 
     /**
-     *  Append the given value to the internal buffer.
-     *
-     *  @see #getImplementsDec
+     * Append the given value to the internal buffer.
+     * 
+     * @see #getImplementsDec
      */
     public CodeFormat implementsDec(int tabLevel) {
         _buf.append(getImplementsDec(tabLevel));
-
         return this;
     }
 
     /**
-     *  Append the given value to the internal buffer.
-     *
-     *  @see #getThrowsDec
+     * Append the given value to the internal buffer.
+     * 
+     * @see #getThrowsDec
      */
     public CodeFormat throwsDec(int tabLevel) {
         _buf.append(getThrowsDec(tabLevel));
-
         return this;
     }
 
     /**
-     *  Append the given value to the internal buffer.
-     *
-     *  @see #getTab
+     * Append the given value to the internal buffer.
+     * 
+     * @see #getTab
      */
     public CodeFormat tab() {
         _buf.append(getTab());
-
         return this;
     }
 
     /**
-     *  Append the given value to the internal buffer.
-     *
-     *  @see #getTab
+     * Append the given value to the internal buffer.
+     * 
+     * @see #getTab
      */
     public CodeFormat tab(int tabLevel) {
         _buf.append(getTab(tabLevel));
-
         return this;
     }
 
     /**
-     *  Append the given value to the internal buffer.
-     *
-     *  @see #getFieldName
+     * Append the given value to the internal buffer.
+     * 
+     * @see #getFieldName
      */
     public CodeFormat fieldName(String name) {
         _buf.append(getFieldName(name));
-
         return this;
     }
 
     /**
-     *  Clear the internal code buffer.
+     * Clear the internal code buffer.
      */
     public void clear() {
         _buf = new StringBuffer();
     }
 
     /**
-     *  Return the internal buffer as a string.
+     * Return the internal buffer as a string.
      */
     public String toString() {
         return _buf.toString();
     }
 
     /**
-     *  Return the length of the internal buffer.
+     * Return the length of the internal buffer.
      */
     public int length() {
         return _buf.length();
     }
 
     /**
-     *  Make a copy of this code format object with all the same formatting
-     *  settings.
+     * Make a copy of this code format object with all the same formatting
+     * settings.
      */
     public Object clone() {
         CodeFormat format = new CodeFormat();
@@ -638,7 +572,6 @@
         format._braceAtSameTabLevel = _braceAtSameTabLevel;
         format._scoreBeforeFieldName = _scoreBeforeFieldName;
         format._linesBetweenSections = _linesBetweenSections;
-
         return format;
     }
 }

Modified: incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/EventManager.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/EventManager.java?rev=418401&r1=418400&r2=418401&view=diff
==============================================================================
--- incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/EventManager.java (original)
+++ incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/EventManager.java Fri Jun 30 15:37:18 2006
@@ -1,13 +1,10 @@
 /*
  * Copyright 2006 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
+ *  Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *  Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
@@ -17,40 +14,39 @@
 
 import java.util.*;
 
-
 /**
- *  <p>Basic event manager interface.</p>
- *
- *  @author Abe White
+ * Basic event manager interface.
+ * 
+ * @author Abe White
  */
 public interface EventManager {
     /**
-     *  Add an event listener.
+     * Add an event listener.
      */
     public void addListener(Object listener);
 
     /**
-     *  Remove an event listener.
+     * Remove an event listener.
      */
     public boolean removeListener(Object listener);
 
     /**
-     *  Return whether the given instance is in the list of listeners.
+     * Return whether the given instance is in the list of listeners.
      */
     public boolean hasListener(Object listener);
 
     /**
-     *  Return true if there are any registered listeners.
+     * Return true if there are any registered listeners.
      */
     public boolean hasListeners();
 
     /**
-     *  Return a read-only list of listeners.
+     * Return a read-only list of listeners.
      */
     public Collection getListeners();
 
     /**
-     *  Fire the given event to all listeners, returning any exceptions.
+     * Fire the given event to all listeners, returning any exceptions.
      */
     public Exception[] fireEvent(Object event);
 }

Modified: incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/Files.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/Files.java?rev=418401&r1=418400&r2=418401&view=diff
==============================================================================
--- incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/Files.java (original)
+++ incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/Files.java Fri Jun 30 15:37:18 2006
@@ -1,13 +1,10 @@
 /*
  * Copyright 2006 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
+ *  Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *  Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
@@ -15,38 +12,31 @@
  */
 package org.apache.openjpa.lib.util;
 
-import org.apache.commons.lang.exception.*;
-
-import serp.util.*;
-
 import java.io.*;
-
 import java.net.*;
-
+import org.apache.commons.lang.exception.*;
+import serp.util.*;
 
 /**
- *  <p>Utility operations on files.</p>
- *
- *  @author Abe White
- *  @nojavadoc */
+ * Utility operations on files.
+ * 
+ * @author Abe White
+ * @nojavadoc
+ */
 public class Files {
     /**
-     *  Backup the given file to a new file called &lt;file-name&gt;~.  If
-     *  the file does not exist or a backup could not be created, returns null.
+     * Backup the given file to a new file called &lt;file-name&gt;~. If
+     * the file does not exist or a backup could not be created, returns null.
      */
     public static File backup(File file, boolean copy) {
-        if ((file == null) || !file.exists()) {
+        if (file == null || !file.exists())
             return null;
-        }
 
         // create new file object copy so we don't modify the original
         File clone = new File(file.getAbsolutePath());
         File bk = new File(file.getAbsolutePath() + "~");
-
-        if (!clone.renameTo(bk)) {
+        if (!clone.renameTo(bk))
             return null;
-        }
-
         if (copy) {
             try {
                 copy(bk, file);
@@ -54,38 +44,28 @@
                 throw new NestableRuntimeException(ioe);
             }
         }
-
         return bk;
     }
 
     /**
-     *  Revert the given backup file to the original location.  If the given
-     *  file's name does not end in '~', the '~' is appended before proceeding.
-     *  If the backup file does not exist or could not be reverted,
-     *  returns null.
+     * Revert the given backup file to the original location. If the given
+     * file's name does not end in '~', the '~' is appended before proceeding.
+     * If the backup file does not exist or could not be reverted, returns null.
      */
     public static File revert(File backup, boolean copy) {
-        if (backup == null) {
+        if (backup == null)
             return null;
-        }
-
-        if (!backup.getName().endsWith("~")) {
+        if (!backup.getName().endsWith("~"))
             backup = new File(backup.getPath() + "~");
-        }
-
-        if (!backup.exists()) {
+        if (!backup.exists())
             return null;
-        }
 
         // create new file object copy so we don't modify the original
         String path = backup.getAbsolutePath();
         File clone = new File(path);
         File orig = new File(path.substring(0, path.length() - 1));
-
-        if (!clone.renameTo(orig)) {
+        if (!clone.renameTo(orig))
             return null;
-        }
-
         if (copy) {
             try {
                 copy(orig, backup);
@@ -93,126 +73,102 @@
                 throw new NestableRuntimeException(ioe);
             }
         }
-
         return orig;
     }
 
     /**
-     *  Return the source file for the given class, or null if the
-     *  source is not in the CLASSPATH.
+     * Return the source file for the given class, or null if the
+     * source is not in the CLASSPATH.
      */
     public static File getSourceFile(Class cls) {
         return getClassFile(cls, ".java");
     }
 
     /**
-     *  Return the class file of the given class, or null if the
-     *  class is in a jar.
-      */
+     * Return the class file of the given class, or null if the
+     * class is in a jar.
+     */
     public static File getClassFile(Class cls) {
         return getClassFile(cls, ".class");
     }
 
     /**
-     *  Return the file for the class resource with the given extension.
+     * Return the file for the class resource with the given extension.
      */
     private static File getClassFile(Class cls, String ext) {
         String name = Strings.getClassName(cls);
 
         // if it's an inner class, use the parent class name
         int innerIdx = name.indexOf('$');
-
-        if (innerIdx != -1) {
+        if (innerIdx != -1)
             name = name.substring(0, innerIdx);
-        }
 
         URL rsrc = cls.getResource(name + ext);
-
-        if ((rsrc != null) && rsrc.getProtocol().equals("file")) {
+        if (rsrc != null && rsrc.getProtocol().equals("file"))
             return new File(URLDecoder.decode(rsrc.getFile()));
-        }
-
         return null;
     }
 
     /**
-      *  Return the file for the given package.  If the given base directory
-     *  matches the given package structure, it will be used as-is.  If not,
-     *  the package structure will be added beneath the base directory.  If
-     *  the base directory is null, the current working directory will be
-     *  used as the base.
+     * Return the file for the given package. If the given base directory
+     * matches the given package structure, it will be used as-is. If not,
+     * the package structure will be added beneath the base directory. If
+     * the base directory is null, the current working directory will be
+     * used as the base.
      */
     public static File getPackageFile(File base, String pkg, boolean mkdirs) {
-        if (base == null) {
+        if (base == null)
             base = new File(System.getProperty("user.dir"));
-        }
-
-        if ((pkg == null) || (pkg.length() == 0)) {
-            if (mkdirs && !base.exists()) {
+        if (pkg == null || pkg.length() == 0) {
+            if (mkdirs && !base.exists())
                 base.mkdirs();
-            }
-
             return base;
         }
 
         pkg = pkg.replace('.', File.separatorChar);
-
         File file = null;
-
         try {
-            if (base.getCanonicalPath().endsWith(pkg)) {
+            if (base.getCanonicalPath().endsWith(pkg))
                 file = base;
-            } else {
+            else
                 file = new File(base, pkg);
-            }
         } catch (IOException ioe) {
             throw new NestableRuntimeException(ioe);
         }
 
-        if (mkdirs && !file.exists()) {
+        if (mkdirs && !file.exists())
             file.mkdirs();
-        }
-
         return file;
     }
 
     /**
-     *  Check the given string for a matching file.  The string is first
-     *  tested to see if it is an existing file path.  If it does not
-     *  represent an existing file, it is checked as a resource name of a
-     *  file.  If no resource exists, then it is interpreted as a path
-     *  to a file that does not exist yet.
-     *
-     *  @param name        the file path or resource name
-     *  @param loader        a class loader to use in resource lookup, or null
-     *                                  to use the thread's context loader
+     * Check the given string for a matching file. The string is first
+     * tested to see if it is an existing file path. If it does not
+     * represent an existing file, it is checked as a resource name of a
+     * file. If no resource exists, then it is interpreted as a path
+     * to a file that does not exist yet.
+     * 
+     * @param name the file path or resource name
+     * @param loader a class loader to use in resource lookup, or null
+     * to use the thread's context loader
      */
     public static File getFile(String name, ClassLoader loader) {
-        if (name == null) {
+        if (name == null)
             return null;
-        }
 
         File file = new File(name);
-
-        if (file.exists()) {
+        if (file.exists())
             return file;
-        }
 
-        if (loader == null) {
+        if (loader == null)
             loader = Thread.currentThread().getContextClassLoader();
-        }
-
         URL url = loader.getResource(name);
-
         if (url != null) {
             String urlFile = url.getFile();
-
             if (urlFile != null) {
                 File rsrc = new File(URLDecoder.decode(urlFile));
-
-                if (rsrc.exists()) {
+                if (rsrc.exists())
                     return rsrc;
-                }
             }
         }
 
@@ -221,25 +177,19 @@
     }
 
     /**
-     *  Return a writer to the stream (stdout or stderr) or file named by the
-     *  given string.
-     *
-     *  @see #getFile
+     * Return a writer to the stream(stdout or stderr) or file named by the
+     * given string.
+     * 
+     * @see #getFile
      */
     public static Writer getWriter(String file, ClassLoader loader)
         throws IOException {
-        if (file == null) {
+        if (file == null)
             return null;
-        }
-
-        if ("stdout".equals(file)) {
+        if ("stdout".equals(file))
             return new PrintWriter(System.out);
-        }
-
-        if ("stderr".equals(file)) {
+        if ("stderr".equals(file))
             return new PrintWriter(System.err);
-        }
-
         try {
             return new FileWriter(getFile(file, loader));
         } catch (IOException ioe) {
@@ -248,24 +198,18 @@
     }
 
     /**
-     *  Return an output stream to the stream (stdout or stderr) or file named
-     *  by the given string.
-     *
-     *  @see #getFile
+     * Return an output stream to the stream(stdout or stderr) or file named
+     * by the given string.
+     * 
+     * @see #getFile
      */
     public static OutputStream getOutputStream(String file, ClassLoader loader) {
-        if (file == null) {
+        if (file == null)
             return null;
-        }
-
-        if ("stdout".equals(file)) {
+        if ("stdout".equals(file))
             return System.out;
-        }
-
-        if ("stderr".equals(file)) {
+        if ("stderr".equals(file))
             return System.err;
-        }
-
         try {
             return new FileOutputStream(getFile(file, loader));
         } catch (IOException ioe) {
@@ -274,44 +218,28 @@
     }
 
     /**
-     *  Copy a file.  Return false if <code>from</code> does not exist.
+     * Copy a file. Return false if <code>from</code> does not exist.
      */
     public static boolean copy(File from, File to) throws IOException {
-        if ((from == null) || (to == null) || !from.exists()) {
+        if (from == null || to == null || !from.exists())
             return false;
-        }
 
         FileInputStream in = null;
         FileOutputStream out = null;
-
         try {
             in = new FileInputStream(from);
-
             BufferedInputStream inbuf = new BufferedInputStream(in);
             out = new FileOutputStream(to);
-
             BufferedOutputStream outbuf = new BufferedOutputStream(out);
-
-            for (int b; (b = inbuf.read()) != -1; outbuf.write(b))
-                ;
-
+            for (int b; (b = inbuf.read()) != -1; outbuf.write(b));
             outbuf.flush();
-
             return true;
-        } finally {
-            if (in != null) {
-                try {
-                    in.close();
-                } catch (Exception e) {
-                }
-            }
-
-            if (out != null) {
-                try {
-                    out.close();
-                } catch (Exception e) {
-                }
-            }
+        }
+        finally {
+            if (in != null)
+                try { in.close(); } catch (Exception e) {}
+            if (out != null)
+                try { out.close(); } catch (Exception e) {}
         }
     }
 }