You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rave.apache.org by ja...@apache.org on 2011/09/12 13:56:06 UTC

svn commit: r1169704 - in /incubator/rave/trunk: rave-commons/src/main/java/org/apache/rave/util/ rave-commons/src/test/resources/ rave-portal/src/main/resources/ rave-shindig/ rave-shindig/src/main/resources/ rave-shindig/src/test/resources/

Author: jasha
Date: Mon Sep 12 11:56:05 2011
New Revision: 1169704

URL: http://svn.apache.org/viewvc?rev=1169704&view=rev
Log:
RAVE-244 override Spring managed properties in rave-shindig

Added:
    incubator/rave/trunk/rave-shindig/src/test/resources/log4j.xml
      - copied, changed from r1169630, incubator/rave/trunk/rave-commons/src/test/resources/log4j.xml
Modified:
    incubator/rave/trunk/rave-commons/src/main/java/org/apache/rave/util/OverridablePropertyPlaceholderConfigurer.java
    incubator/rave/trunk/rave-commons/src/test/resources/applicationContext-test.xml
    incubator/rave/trunk/rave-portal/src/main/resources/applicationContext.xml
    incubator/rave/trunk/rave-shindig/pom.xml
    incubator/rave/trunk/rave-shindig/src/main/resources/rave-shindig-applicationContext.xml
    incubator/rave/trunk/rave-shindig/src/main/resources/rave.shindig.properties
    incubator/rave/trunk/rave-shindig/src/test/resources/rave-shindig-test-applicationContext.xml
    incubator/rave/trunk/rave-shindig/src/test/resources/rave.shindig.properties
    incubator/rave/trunk/rave-shindig/src/test/resources/shindig.test.properties

Modified: incubator/rave/trunk/rave-commons/src/main/java/org/apache/rave/util/OverridablePropertyPlaceholderConfigurer.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-commons/src/main/java/org/apache/rave/util/OverridablePropertyPlaceholderConfigurer.java?rev=1169704&r1=1169703&r2=1169704&view=diff
==============================================================================
--- incubator/rave/trunk/rave-commons/src/main/java/org/apache/rave/util/OverridablePropertyPlaceholderConfigurer.java (original)
+++ incubator/rave/trunk/rave-commons/src/main/java/org/apache/rave/util/OverridablePropertyPlaceholderConfigurer.java Mon Sep 12 11:56:05 2011
@@ -26,17 +26,21 @@ import org.springframework.core.io.FileS
 import org.springframework.core.io.Resource;
 
 /**
- * Reads property from the default location unless a system property {@literal portal.override.properties} is set
+ * Reads property from the default location unless a system property is set.
+ * The name of the system property is set by the parameter {@literal systemPropertyName}.
  */
 public class OverridablePropertyPlaceholderConfigurer extends PropertyPlaceholderConfigurer {
 
-    private static final String PORTAL_OVERRIDE_PROPERTIES = "portal.override.properties";
     private static final String CLASSPATH = "classpath:";
+    private String systemPropertyName;
 
     @Override
     public void setLocation(Resource location) {
+        if (StringUtils.isBlank(getSystemPropertyName())) {
+            throw new IllegalArgumentException("Missing value for 'systemPropertyName'.");
+        }
         Resource locationResource;
-        final String overrideProperty = System.getProperty(PORTAL_OVERRIDE_PROPERTIES);
+        final String overrideProperty = System.getProperty(getSystemPropertyName());
         
         if (StringUtils.isBlank(overrideProperty)) {
             locationResource = location;
@@ -48,4 +52,11 @@ public class OverridablePropertyPlacehol
         super.setLocation(locationResource);
     }
 
+    public void setSystemPropertyName(String systemPropertyName) {
+        this.systemPropertyName = systemPropertyName;
+    }
+
+    public String getSystemPropertyName() {
+        return systemPropertyName;
+    }
 }

Modified: incubator/rave/trunk/rave-commons/src/test/resources/applicationContext-test.xml
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-commons/src/test/resources/applicationContext-test.xml?rev=1169704&r1=1169703&r2=1169704&view=diff
==============================================================================
--- incubator/rave/trunk/rave-commons/src/test/resources/applicationContext-test.xml (original)
+++ incubator/rave/trunk/rave-commons/src/test/resources/applicationContext-test.xml Mon Sep 12 11:56:05 2011
@@ -22,6 +22,7 @@
 
     <bean id="portalPropertyPlaceholder" class="org.apache.rave.util.OverridablePropertyPlaceholderConfigurer">
         <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE"/>
+        <property name="systemPropertyName" value="portal.override.properties"/>
         <property name="location" value="classpath:portal-test.properties"/>
     </bean>
 

Modified: incubator/rave/trunk/rave-portal/src/main/resources/applicationContext.xml
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/resources/applicationContext.xml?rev=1169704&r1=1169703&r2=1169704&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal/src/main/resources/applicationContext.xml (original)
+++ incubator/rave/trunk/rave-portal/src/main/resources/applicationContext.xml Mon Sep 12 11:56:05 2011
@@ -34,6 +34,7 @@
      be overridden by setting a system property "portal.override.properties" -->
     <bean id="portalPropertyPlaceholder" class="org.apache.rave.util.OverridablePropertyPlaceholderConfigurer">
         <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE"/>
+        <property name="systemPropertyName" value="portal.override.properties"/>
         <property name="location" value="classpath:portal.properties"/>
     </bean>
 

Modified: incubator/rave/trunk/rave-shindig/pom.xml
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-shindig/pom.xml?rev=1169704&r1=1169703&r2=1169704&view=diff
==============================================================================
--- incubator/rave/trunk/rave-shindig/pom.xml (original)
+++ incubator/rave/trunk/rave-shindig/pom.xml Mon Sep 12 11:56:05 2011
@@ -125,6 +125,27 @@
             <artifactId>spring-test</artifactId>
             <scope>test</scope>
         </dependency>
+
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>jcl-over-slf4j</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-log4j12</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>log4j</groupId>
+            <artifactId>log4j</artifactId>
+            <scope>provided</scope>
+        </dependency>
     </dependencies>
 
     <build>

Modified: incubator/rave/trunk/rave-shindig/src/main/resources/rave-shindig-applicationContext.xml
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-shindig/src/main/resources/rave-shindig-applicationContext.xml?rev=1169704&r1=1169703&r2=1169704&view=diff
==============================================================================
--- incubator/rave/trunk/rave-shindig/src/main/resources/rave-shindig-applicationContext.xml (original)
+++ incubator/rave/trunk/rave-shindig/src/main/resources/rave-shindig-applicationContext.xml Mon Sep 12 11:56:05 2011
@@ -26,7 +26,17 @@
         http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
         http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
 
-    <context:property-placeholder location="classpath:rave.shindig.properties"/>
+    <!-- make the the rave.shindig.properties props available to autowire injectors, location of the properties can
+     be overridden by setting a system property "rave-shindig.override.properties" -->
+    <bean id="shindigPropertyPlaceholder" class="org.apache.rave.util.OverridablePropertyPlaceholderConfigurer">
+        <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE"/>
+        <property name="systemPropertyName" value="rave-shindig.override.properties"/>
+        <property name="location" value="classpath:rave.shindig.properties"/>
+    </bean>
+
+    <!-- bean post-processor for JPA annotations -->
+    <context:annotation-config/>
+
     <context:component-scan base-package="org.apache.rave" annotation-config="true"/>
 
 

Modified: incubator/rave/trunk/rave-shindig/src/main/resources/rave.shindig.properties
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-shindig/src/main/resources/rave.shindig.properties?rev=1169704&r1=1169703&r2=1169704&view=diff
==============================================================================
--- incubator/rave/trunk/rave-shindig/src/main/resources/rave.shindig.properties (original)
+++ incubator/rave/trunk/rave-shindig/src/main/resources/rave.shindig.properties Mon Sep 12 11:56:05 2011
@@ -16,6 +16,11 @@
 # specific language governing permissions and limitations
 # under the License.
 #
+
+##############################################################
+## These are the SPRING managed properties for Rave-Shindig ##
+##############################################################
+
 shindig.spring.base-package=org.apache.rave
 
 shindig.signing.key-name=

Copied: incubator/rave/trunk/rave-shindig/src/test/resources/log4j.xml (from r1169630, incubator/rave/trunk/rave-commons/src/test/resources/log4j.xml)
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-shindig/src/test/resources/log4j.xml?p2=incubator/rave/trunk/rave-shindig/src/test/resources/log4j.xml&p1=incubator/rave/trunk/rave-commons/src/test/resources/log4j.xml&r1=1169630&r2=1169704&rev=1169704&view=diff
==============================================================================
--- incubator/rave/trunk/rave-commons/src/test/resources/log4j.xml (original)
+++ incubator/rave/trunk/rave-shindig/src/test/resources/log4j.xml Mon Sep 12 11:56:05 2011
@@ -32,12 +32,12 @@
 
   <!-- Springframework logger -->
   <logger name="org.springframework">
-    <level value="info" />
+    <level value="error" />
   </logger>
 
   <!-- Rave logger -->
   <logger name="org.apache.rave">
-    <level value="debug" />
+    <level value="error" />
   </logger>
   
   <!-- Root Logger -->

Modified: incubator/rave/trunk/rave-shindig/src/test/resources/rave-shindig-test-applicationContext.xml
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-shindig/src/test/resources/rave-shindig-test-applicationContext.xml?rev=1169704&r1=1169703&r2=1169704&view=diff
==============================================================================
--- incubator/rave/trunk/rave-shindig/src/test/resources/rave-shindig-test-applicationContext.xml (original)
+++ incubator/rave/trunk/rave-shindig/src/test/resources/rave-shindig-test-applicationContext.xml Mon Sep 12 11:56:05 2011
@@ -21,5 +21,5 @@
        xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
 
     <import resource="classpath:rave-shindig-applicationContext.xml"/>
-    
+
 </beans>

Modified: incubator/rave/trunk/rave-shindig/src/test/resources/rave.shindig.properties
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-shindig/src/test/resources/rave.shindig.properties?rev=1169704&r1=1169703&r2=1169704&view=diff
==============================================================================
--- incubator/rave/trunk/rave-shindig/src/test/resources/rave.shindig.properties (original)
+++ incubator/rave/trunk/rave-shindig/src/test/resources/rave.shindig.properties Mon Sep 12 11:56:05 2011
@@ -16,6 +16,11 @@
 # specific language governing permissions and limitations
 # under the License.
 #
+
+##############################################################
+## These are the SPRING managed properties for Rave-Shindig ##
+##############################################################
+
 shindig.spring.base-package=org.apache.rave
 
 shindig.signing.key-name=

Modified: incubator/rave/trunk/rave-shindig/src/test/resources/shindig.test.properties
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-shindig/src/test/resources/shindig.test.properties?rev=1169704&r1=1169703&r2=1169704&view=diff
==============================================================================
--- incubator/rave/trunk/rave-shindig/src/test/resources/shindig.test.properties (original)
+++ incubator/rave/trunk/rave-shindig/src/test/resources/shindig.test.properties Mon Sep 12 11:56:05 2011
@@ -15,6 +15,10 @@
 # specific language governing permissions and limitations
 # under the License.
 
+#############################################################
+## These are the GUICE managed properties for Rave-Shindig ##
+#############################################################
+
 # Location of feature manifests (comma separated)
 shindig.features.default=res://features/features.txt