Author: aadamchik
Date: Sat Mar  3 15:55:27 2012
New Revision: 1296650

URL: http://svn.apache.org/viewvc?rev=1296650&view=rev
Log:
CAY-1665 Consistent and concise property names aggregated in one place

aligning docs
adding 'getLong' to the property service
fixing typos in constant names

Modified:
    cayenne/main/trunk/docs/docbook/cayenne-guide/src/docbkx/appendix-a.xml
    
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/Constants.java
    
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/DefaultRuntimeProperties.java
    
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/RuntimeProperties.java
    
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/rop/client/HessianConnectionProvider.java

Modified: 
cayenne/main/trunk/docs/docbook/cayenne-guide/src/docbkx/appendix-a.xml
URL: 
http://svn.apache.org/viewvc/cayenne/main/trunk/docs/docbook/cayenne-guide/src/docbkx/appendix-a.xml?rev=1296650&r1=1296649&r2=1296650&view=diff
==============================================================================
--- cayenne/main/trunk/docs/docbook/cayenne-guide/src/docbkx/appendix-a.xml 
(original)
+++ cayenne/main/trunk/docs/docbook/cayenne-guide/src/docbkx/appendix-a.xml Sat 
Mar  3 15:55:27 2012
@@ -2,6 +2,8 @@
 <appendix xmlns="http://docbook.org/ns/docbook"; 
xmlns:xlink="http://www.w3.org/1999/xlink";
        version="5.0" xml:id="server-configuration-properties">
        <title>Configuration Properties</title>
+       <para>Note that the property names below are defined as constants in
+                       <code>org.apache.cayenne.configuration.Constants</code> 
interface. </para>
        <para>
                <table frame="void" width="739">
                        <caption>Configuration Properties Recognized by 
ServerRuntime and/or ClientRuntime</caption>
@@ -74,70 +76,72 @@
                                        <td>2000</td>
                                </tr>
                                <tr>
-                                       
<td><code>org.apache.cayenne.sync_contexts</code> - defines whether peer
-                                               ObjectContexts should receive 
snapshot events after commits from other
-                                               contexts. If true (default), 
the contexts would automatically synchronize
-                                               their state with peers.</td>
+                                       
<td><code>cayenne.server.contexts_sync_strategy</code> - defines whether peer 
ObjectContexts
+                                               should receive snapshot events 
after commits from other contexts. If true
+                                               (default), the contexts would 
automatically synchronize their state with
+                                               peers.</td>
                                        <td>true, false</td>
                                        <td>true</td>
                                </tr>
                                <tr>
-                                       
<td><code>org.apache.cayenne.context_object_retain_strategy</code> - defines
-                                               fetched objects retain strategy 
for ObjectContexts. When weak or soft
-                                               strategy is used, objects 
retained by ObjectContext that have no local
-                                               changes can potetially get 
garbage collected when JVM feels like doing
-                                               it.</td>
+                                       
<td><code>cayenne.server.object_retain_strategy</code> - defines fetched 
objects retain
+                                               strategy for ObjectContexts. 
When weak or soft strategy is used, objects
+                                               retained by ObjectContext that 
have no local changes can potetially get
+                                               garbage collected when JVM 
feels like doing it.</td>
                                        <td>weak, soft, hard</td>
                                        <td>weak</td>
                                </tr>
                                <tr>
-                                       
<td><code>cayenne.config.rop.service.url</code> - defines the URL of the ROP
-                                               server</td>
+                                       
<td><code>cayenne.rop.service_url</code> - defines the URL of the ROP 
server</td>
                                        <td/>
                                        <td/>
                                </tr>
                                <tr>
-                                       
<td><code>cayenne.config.rop.service.username</code> - defines the user name to
-                                               login to the ROP server.</td>
+                                       
<td><code>cayenne.rop.service_username</code> - defines the user name for an 
ROP client to
+                                               login to an ROP server.</td>
                                        <td/>
                                </tr>
                                <tr>
-                                       
<td><code>cayenne.config.rop.service.password</code> - defines the password to
-                                               login to the ROP server.</td>
+                                       
<td><code>cayenne.rop.service_password</code> - defines the password for an ROP 
client to login
+                                               to an ROP server.</td>
                                        <td/>
                                        <td/>
                                </tr>
                                <tr>
-                                       
<td><code>cayenne.config.rop.service.shared_session</code>- defines the name of
-                                               the shared session to join on 
the ROP server. If omitted a dedicated session
-                                               is created.</td>
+                                       
<td><code>cayenne.rop.shared_session_name</code>- defines the name of the 
shared session that
+                                               an ROP client wants to join on 
an ROP server. If omitted, a dedicated
+                                               session is created.</td>
                                        <td/>
                                        <td/>
                                </tr>
                                <tr>
-                                       
<td><code>cayenne.config.rop.client.channel.events</code> - defines whether
-                                               client-side DataChannel should 
dispatch events to child ObjectContexts. If
-                                               set to true, ObjectContexts 
will receive commit events and merge changes
-                                               committed by peer contexts that 
passed through the common client
-                                               DataChannel.</td>
+                                       
<td><code>cayenne.rop.service.timeout</code> - a value in milliseconds for the
+                                               ROP client-server connection 
read operation timeout</td>
+                                       <td>any positive long value</td>
+                                       <td/>
+                               </tr>
+                               <tr>
+                                       
<td><code>cayenne.rop.channel_events</code> - defines whether client-side 
DataChannel should
+                                               dispatch events to child 
ObjectContexts. If set to true, ObjectContexts will
+                                               receive commit events and merge 
changes committed by peer contexts that
+                                               passed through the common 
client DataChannel.</td>
                                        <td>true, false</td>
                                        <td>false</td>
                                </tr>
                                <tr>
-                                       
<td><code>cayenne.config.rop.client.context.change_events</code>- defines 
whether object
-                                               property changes in the client 
context result in firing events. Client UI
-                                               components can listen to these 
events and update the UI. Disabled by
-                                               default.</td>
+                                       
<td><code>cayenne.rop.context_change_events</code>- defines whether object 
property changes in
+                                               the client context result in 
firing events. Client UI components can listen
+                                               to these events and update the 
UI. Disabled by default.</td>
                                        <td>true, false</td>
                                        <td>false</td>
                                </tr>
                                <tr>
-                                       
<td><code>cayenne.config.rop.client.context.lifecycle_events</code> -  defines 
whether object
-                                               commit and rollback operations 
in the client context result in firing
-                                               events. Client UI components 
can listen to these events and update the UI.
-                                               Disabled by default.</td>
+                                       
<td><code>cayenne.rop.context_lifecycle_events</code> - defines whether object 
commit and
+                                               rollback operations in the 
client context result in firing events. Client UI
+                                               components can listen to these 
events and update the UI. Disabled by
+                                               default.</td>
                                        <td>true,false</td>
-                                       <td>\false</td>
+                                       <td>false</td>
                                </tr>
                        </tbody>
                </table>

Modified: 
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/Constants.java
URL: 
http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/Constants.java?rev=1296650&r1=1296649&r2=1296650&view=diff
==============================================================================
--- 
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/Constants.java
 (original)
+++ 
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/Constants.java
 Sat Mar  3 15:55:27 2012
@@ -106,7 +106,7 @@ public interface Constants {
 
     public static final String ROP_SERVICE_USERNAME_PROPERTY = 
"cayenne.rop.service_username";
 
-    public static final String ROP_SERVICE_PASSWORD_PROPERTY = 
"cayenne.rop.service_password ";
+    public static final String ROP_SERVICE_PASSWORD_PROPERTY = 
"cayenne.rop.service_password";
 
     public static final String ROP_SERVICE_SHARED_SESSION_PROPERTY = 
"cayenne.rop.shared_session_name";
 

Modified: 
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/DefaultRuntimeProperties.java
URL: 
http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/DefaultRuntimeProperties.java?rev=1296650&r1=1296649&r2=1296650&view=diff
==============================================================================
--- 
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/DefaultRuntimeProperties.java
 (original)
+++ 
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/DefaultRuntimeProperties.java
 Sat Mar  3 15:55:27 2012
@@ -50,6 +50,21 @@ public class DefaultRuntimeProperties im
 
         return properties.get(key);
     }
+    
+    public long getLong(String key, long defaultValue) {
+        String string = get(key);
+        if (string == null) {
+            return defaultValue;
+        }
+
+        try {
+            return Long.parseLong(string);
+        }
+        catch (NumberFormatException e) {
+            // incorrect property format, should we rethrow?
+            return defaultValue;
+        }
+    }
 
     public int getInt(String key, int defaultValue) {
         String string = get(key);

Modified: 
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/RuntimeProperties.java
URL: 
http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/RuntimeProperties.java?rev=1296650&r1=1296649&r2=1296650&view=diff
==============================================================================
--- 
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/RuntimeProperties.java
 (original)
+++ 
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/RuntimeProperties.java
 Sat Mar  3 15:55:27 2012
@@ -32,5 +32,7 @@ public interface RuntimeProperties {
     
     int getInt(String key, int defaultValue);
     
+    long getLong(String key, long defaultValue);
+    
     boolean getBoolean(String key, boolean defaultValue);
 }

Modified: 
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/rop/client/HessianConnectionProvider.java
URL: 
http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/rop/client/HessianConnectionProvider.java?rev=1296650&r1=1296649&r2=1296650&view=diff
==============================================================================
--- 
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/rop/client/HessianConnectionProvider.java
 (original)
+++ 
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/rop/client/HessianConnectionProvider.java
 Sat Mar  3 15:55:27 2012
@@ -44,8 +44,9 @@ public class HessianConnectionProvider i
         String password = 
runtimeProperties.get(Constants.ROP_SERVICE_PASSWORD_PROPERTY);
         String sharedSession = runtimeProperties
                 .get(Constants.ROP_SERVICE_SHARED_SESSION_PROPERTY);
-        String readTimeoutStr = runtimeProperties
-                .get(Constants.ROP_SERVICE_TIMEOUT_PROPERTY);
+        long readTimeout = runtimeProperties.getLong(
+                Constants.ROP_SERVICE_TIMEOUT_PROPERTY,
+                -1l);
 
         HessianConnection result = new HessianConnection(
                 url,
@@ -53,8 +54,8 @@ public class HessianConnectionProvider i
                 password,
                 sharedSession);
 
-        if (readTimeoutStr != null && readTimeoutStr.length() != 0) {
-            result.setReadTimeout(Long.parseLong(readTimeoutStr));
+        if (readTimeout > 0) {
+            result.setReadTimeout(readTimeout);
         }
 
         return result;


Reply via email to