geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ammul...@apache.org
Subject svn commit: r264619 - in /geronimo/trunk/modules: assembly/src/plan/client-system-plan.xml assembly/src/plan/deployer-system-plan.xml system/src/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java
Date Mon, 29 Aug 2005 19:13:01 GMT
Author: ammulder
Date: Mon Aug 29 12:12:56 2005
New Revision: 264619

URL: http://svn.apache.org/viewcvs?rev=264619&view=rev
Log:
Make the attribute store read-only for deployer and client configurations
  to make sure we don't overwrite the file unnecessarily

Modified:
    geronimo/trunk/modules/assembly/src/plan/client-system-plan.xml
    geronimo/trunk/modules/assembly/src/plan/deployer-system-plan.xml
    geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java

Modified: geronimo/trunk/modules/assembly/src/plan/client-system-plan.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/assembly/src/plan/client-system-plan.xml?rev=264619&r1=264618&r2=264619&view=diff
==============================================================================
--- geronimo/trunk/modules/assembly/src/plan/client-system-plan.xml (original)
+++ geronimo/trunk/modules/assembly/src/plan/client-system-plan.xml Mon Aug 29 12:12:56 2005
@@ -1,72 +1 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
-    Copyright 2004 The Apache Software Foundation
-
-    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
-    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
-    limitations under the License.
--->
-  
-
-<!--
-Configuration for the innermost ring of a Geronimo server.
-This configuration should only contain critical services needed to
-run other Configurations - for example, the ServerInfo, Logging
-and Repository services used to load them.
-
-This configuration should *NOT* be used to provide server or application
-specific services - those should be provided by children.
--->
-<configuration
-    xmlns="http://geronimo.apache.org/xml/ns/deployment"
-    configId="org/apache/geronimo/ClientSystem"
-    domain="geronimo.client"
-    server="client"
-    >
-
-    <!-- ServerInfo service -->
-    <gbean name="ServerInfo" class="org.apache.geronimo.system.serverinfo.BasicServerInfo"/>
-
-    <!-- URLFactory service -->
-    <gbean name="URLFactory" class="org.apache.geronimo.system.url.GeronimoURLFactory"/>
-
-    <!-- Configuration Manager service -->
-    <gbean name="ConfigurationManager" class="org.apache.geronimo.kernel.config.ConfigurationManagerImpl">
-        <reference name="Stores"><gbean-name>*:j2eeType=ConfigurationStore,*</gbean-name></reference>
-    </gbean>
-
-    <!-- User-editable attribute service -->
-    <gbean name="AttributeManager" class="org.apache.geronimo.system.configuration.LocalAttributeManager">
-        <reference name="ServerInfo"><name>ServerInfo</name></reference>
-        <attribute name="configFile">var/config/config.xml</attribute>
-    </gbean>
-
-    <!-- Configuration Store service -->
-    <gbean name="Local" class="org.apache.geronimo.system.configuration.LocalConfigStore">
-        <attribute name="root">config-store</attribute>
-        <reference name="ServerInfo"><name>ServerInfo</name></reference>
-        <reference name="AttributeStore"><name>AttributeManager</name></reference>
-    </gbean>
-
-    <!-- Repository -->
-    <gbean name="Repository" class="org.apache.geronimo.system.repository.ReadOnlyRepository">
-        <attribute name="root">repository/</attribute>
-        <reference name="ServerInfo"><name>ServerInfo</name></reference>
-    </gbean>
-
-    <!-- Logging service -->
-    <gbean name="Logger" class="org.apache.geronimo.system.logging.log4j.Log4jService">
-        <attribute name="configFileName">var/log/client-log4j.properties</attribute>
-        <attribute name="refreshPeriodSeconds">60</attribute>
-        <reference name="ServerInfo"><name>ServerInfo</name></reference>
-    </gbean>
-</configuration>
\ No newline at end of file
+<?xml version="1.0" encoding="UTF-8"?>
<!--

    Copyright 2004 The Apache Software
Foundation

    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
    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
    limitations under
the License.
-->
  

<!--
Configuration for the innermost ring of a Geronimo server.
This
configuration should only contain critical services needed to
run other Configurations - for
example, the ServerInfo, Logging
and Repository services used to load them.

This configuration
should *NOT* be used to provide server or application
specific s
 ervices - those should be provided by children.
-->
<configuration
    xmlns="http://geronimo.apache.org/xml/ns/deployment"
   configId="org/apache/geronimo/ClientSystem"
    domain="geronimo.client"
    server="client"
   >

    <!-- ServerInfo service -->
    <gbean name="ServerInfo" class="org.apache.geronimo.system.serverinfo.BasicServerInfo"/>

   <!-- URLFactory service -->
    <gbean name="URLFactory" class="org.apache.geronimo.system.url.GeronimoURLFactory"/>

   <!-- Configuration Manager service -->
    <gbean name="ConfigurationManager"
class="org.apache.geronimo.kernel.config.ConfigurationManagerImpl">
        <reference
name="Stores"><gbean-name>*:j2eeType=ConfigurationStore,*</gbean-name></reference>
   </gbean>

    <!-- User-editable attribute service -->
    <gbean name="AttributeManager"
class="org.apache.geronimo.system.configuration.LocalAttributeManager">
        <reference
name="ServerInfo"><name>ServerInfo</name></reference>
        <attribute
nam
 e="configFile">var/config/config.xml</attribute>
        <!-- The client container
should not alter the saved configuration -->
        <attribute name="readOnly">true</attribute>
   </gbean>

    <!-- Configuration Store service -->
    <gbean name="Local"
class="org.apache.geronimo.system.configuration.LocalConfigStore">
        <attribute
name="root">config-store</attribute>
        <reference name="ServerInfo"><name>ServerInfo</name></reference>
       <reference name="AttributeStore"><name>AttributeManager</name></reference>
   </gbean>

    <!-- Repository -->
    <gbean name="Repository" class="org.apache.geronimo.system.repository.ReadOnlyRepository">
       <attribute name="root">repository/</attribute>
        <reference name="ServerInfo"><name>ServerInfo</name></reference>
   </gbean>

    <!-- Logging service -->
    <gbean name="Logger" class="org.apache.geronimo.system.logging.log4j.Log4jService">
       <attribute name="configFileName">var/log/client-log
 4j.properties</attribute>
        <attribute name="refreshPeriodSeconds">60</attribute>
       <reference name="ServerInfo"><name>ServerInfo</name></reference>
   </gbean>
</configuration>
\ No newline at end of file

Modified: geronimo/trunk/modules/assembly/src/plan/deployer-system-plan.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/assembly/src/plan/deployer-system-plan.xml?rev=264619&r1=264618&r2=264619&view=diff
==============================================================================
--- geronimo/trunk/modules/assembly/src/plan/deployer-system-plan.xml (original)
+++ geronimo/trunk/modules/assembly/src/plan/deployer-system-plan.xml Mon Aug 29 12:12:56
2005
@@ -41,6 +41,8 @@
     <gbean name="AttributeManager" class="org.apache.geronimo.system.configuration.LocalAttributeManager">
         <reference name="ServerInfo"><name>ServerInfo</name></reference>
         <attribute name="configFile">var/config/config.xml</attribute>
+        <!-- The deploy tool should not alter the saved configuration -->
+        <attribute name="readOnly">true</attribute>
     </gbean>
 
     <!-- Configuration Store service -->

Modified: geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java?rev=264619&r1=264618&r2=264619&view=diff
==============================================================================
--- geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java
(original)
+++ geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java
Mon Aug 29 12:12:56 2005
@@ -56,6 +56,7 @@
 
     private final ServerInfo serverInfo;
     private final String configFile;
+    private boolean readOnly = false;
     private String objectName;
 
     private File attributeFile;
@@ -70,6 +71,14 @@
         this.objectName = objectName;
     }
 
+    public boolean isReadOnly() {
+        return readOnly;
+    }
+
+    public void setReadOnly(boolean readOnly) {
+        this.readOnly = readOnly;
+    }
+
     public String getObjectName() {
         return objectName;
     }
@@ -107,6 +116,9 @@
     }
 
     public synchronized void setValue(String configurationName, ObjectName gbean, GAttributeInfo
attribute, Object value) {
+        if(readOnly) {
+            return;
+        }
         Map config = (Map) configurations.get(configurationName);
         if(config == null) {
             config = new HashMap();
@@ -199,6 +211,9 @@
     }
 
     public synchronized void save() throws IOException {
+        if(readOnly) {
+            return;
+        }
         ensureParentDirectory();
         if(!tempFile.exists() && !tempFile.createNewFile()) {
             throw new IOException("Unable to create manageable attribute working file for
save "+tempFile.getAbsolutePath());
@@ -248,8 +263,10 @@
 
     public void doStart() throws Exception {
         load();
-        updater = new UpdateThread();
-        updater.start();
+        if(!readOnly) {
+            updater = new UpdateThread();
+            updater.start();
+        }
         log.info("Started LocalAttributeManager with data on "+configurations.size()+" configurations");
     }
 
@@ -375,6 +392,7 @@
         GBeanInfoBuilder infoFactory = new GBeanInfoBuilder(LocalAttributeManager.class,
"AttributeStore");//does not use jsr-77 naming
         infoFactory.addReference("ServerInfo", ServerInfo.class, "GBean");
         infoFactory.addAttribute("configFile", String.class, true);
+        infoFactory.addAttribute("readOnly", boolean.class, true);
         infoFactory.addAttribute("objectName", String.class, false);
         infoFactory.addInterface(ManageableAttributeStore.class);
 



Mime
View raw message