geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r351637 - in /geronimo/trunk: modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/ modules/jetty-builder/src/test/org/apache/geronimo/jetty/deploymen...
Date Fri, 02 Dec 2005 08:28:39 GMT
Author: dain
Date: Fri Dec  2 00:28:29 2005
New Revision: 351637

URL: http://svn.apache.org/viewcvs?rev=351637&view=rev
Log:
Removed configuration reserialization code
Added ConfigurationDump utility

Added:
    geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/ConfigurationDump.java
  (with props)
Modified:
    geronimo/trunk/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java
    geronimo/trunk/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/EARConfigBuilderTest.java
    geronimo/trunk/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/JettyModuleBuilderTest.java
    geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java
    geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationStore.java
    geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/LocalConfigStore.java
    geronimo/trunk/modules/system/src/test/org/apache/geronimo/system/configuration/LocalConfigStoreTest.java
    geronimo/trunk/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java
    geronimo/trunk/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenConfigStore.java

Modified: geronimo/trunk/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java?rev=351637&r1=351636&r2=351637&view=diff
==============================================================================
--- geronimo/trunk/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java
(original)
+++ geronimo/trunk/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java
Fri Dec  2 00:28:29 2005
@@ -620,10 +620,6 @@
             return true;
         }
 
-        public void updateConfiguration(ConfigurationData configurationData) throws NoSuchConfigException,
Exception {
-
-        }
-
         public String getObjectName() {
             return null;
         }

Modified: geronimo/trunk/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/EARConfigBuilderTest.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/EARConfigBuilderTest.java?rev=351637&r1=351636&r2=351637&view=diff
==============================================================================
--- geronimo/trunk/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/EARConfigBuilderTest.java
(original)
+++ geronimo/trunk/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/EARConfigBuilderTest.java
Fri Dec  2 00:28:29 2005
@@ -425,10 +425,6 @@
             return true;
         }
 
-        public void updateConfiguration(ConfigurationData configurationData) throws NoSuchConfigException,
Exception {
-
-        }
-
         public String getObjectName() {
             return null;
         }

Modified: geronimo/trunk/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/JettyModuleBuilderTest.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/JettyModuleBuilderTest.java?rev=351637&r1=351636&r2=351637&view=diff
==============================================================================
--- geronimo/trunk/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/JettyModuleBuilderTest.java
(original)
+++ geronimo/trunk/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/JettyModuleBuilderTest.java
Fri Dec  2 00:28:29 2005
@@ -382,10 +382,6 @@
             return true;
         }
 
-        public void updateConfiguration(ConfigurationData configurationData) throws NoSuchConfigException,
Exception {
-
-        }
-
         public String getObjectName() {
             return null;
         }

Modified: geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java?rev=351637&r1=351636&r2=351637&view=diff
==============================================================================
--- geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java
(original)
+++ geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java
Fri Dec  2 00:28:29 2005
@@ -132,13 +132,6 @@
      */
     private final URI[] parentId;
 
-    /**
-     * The configuration store from which this configuration was loaded.  May be null if
this configuration
-     * was not loaded from a store.  The store is notified when the configurations stopps
so it can update
-     * the saved state of the configration.
-     */
-    private final ConfigurationStore configurationStore;
-
     private final List dependencies;
     private final List classPath;
     private final boolean inverseClassLoading;
@@ -184,7 +177,6 @@
         id = null;
         moduleType = null;
         parentId = null;
-        configurationStore = null;
         domain = null;
         server = null;
         objectNames = null;
@@ -223,8 +215,7 @@
             String[] nonOverridableClasses,
             byte[] gbeanState,
             Collection repositories,
-            List dependencies,
-            ConfigurationStore configurationStore) throws Exception {
+            List dependencies) throws Exception {
 
         this.kernel = kernel;
         this.objectNameString = objectName;
@@ -257,8 +248,6 @@
             this.dependencies = Collections.EMPTY_LIST;
         }
 
-        this.configurationStore = configurationStore;
-
         this.domain = domain;
         this.server = server;
         addParentDependencies(kernel, id, parentId);
@@ -448,28 +437,6 @@
         shutdown();
     }
 
-    public synchronized void saveState() throws Exception {
-        GBeanData[] gbeans = storeCurrentGBeans();
-        // update the configuration store
-        if (configurationStore != null) {
-            ConfigurationData configurationData = new ConfigurationData();
-            configurationData.setId(id);
-            configurationData.setModuleType(moduleType);
-            configurationData.setDomain(domain);
-            configurationData.setServer(server);
-            if (parentId != null && parentId.length > 0) {
-                configurationData.setParentId(Arrays.asList(parentId));
-            } else {
-                configurationData.setParentId(Collections.EMPTY_LIST);
-            }
-            configurationData.setGBeans(Arrays.asList(gbeans));
-            configurationData.setDependencies(dependencies);
-            configurationData.setClassPath(classPath);
-            configurationStore.updateConfiguration(configurationData);
-        }
-
-    }
-
     /**
      * Return the unique id of this Configuration's parent
      *
@@ -532,11 +499,6 @@
         } finally {
             Thread.currentThread().setContextClassLoader(oldCl);
         }
-        try {
-            saveState(); //todo: once the attribute store can save new GBean data, won't
need to update the config store any more
-        } catch (Exception e) {
-            log.error("Unable to save new GBean", e);
-        }
     }
 
     public synchronized void removeGBean(ObjectName name) throws GBeanNotFoundException {
@@ -683,13 +645,11 @@
         infoFactory.addAttribute("configurationClassLoader", ClassLoader.class, false);
 
         infoFactory.addReference("Repositories", Repository.class, "GBean");
-        infoFactory.addReference("ConfigurationStore", ConfigurationStore.class);
-//        infoFactory.addReference("AttributeStore", ManageableAttributeStore.class);
 
         infoFactory.addOperation("addGBean", new Class[]{GBeanData.class, boolean.class});
         infoFactory.addOperation("removeGBean", new Class[]{ObjectName.class});
         infoFactory.addOperation("containsGBean", new Class[]{ObjectName.class});
-        infoFactory.addOperation("saveState");
+        infoFactory.addOperation("loadGBeans", new Class[]{});
         infoFactory.addOperation("loadGBeans", new Class[]{ManageableAttributeStore.class});
         infoFactory.addOperation("startRecursiveGBeans");
         infoFactory.addOperation("stopGBeans");
@@ -711,7 +671,6 @@
             "gBeanState",
             "Repositories",
             "dependencies",
-            "ConfigurationStore"
         });
 
         GBEAN_INFO = infoFactory.getBeanInfo();

Modified: geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationStore.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationStore.java?rev=351637&r1=351636&r2=351637&view=diff
==============================================================================
--- geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationStore.java
(original)
+++ geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationStore.java
Fri Dec  2 00:28:29 2005
@@ -79,13 +79,6 @@
     boolean containsConfiguration(URI configID);
 
     /**
-     * Updates the saved state of the configuration.
-     *
-     * @param configurationData the configuration to update
-     */
-    void updateConfiguration(ConfigurationData configurationData) throws NoSuchConfigException,
Exception;
-
-    /**
      * Return the object name for the store.
      *
      * @return the object name for the store

Added: geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/ConfigurationDump.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/ConfigurationDump.java?rev=351637&view=auto
==============================================================================
--- geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/ConfigurationDump.java
(added)
+++ geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/ConfigurationDump.java
Fri Dec  2 00:28:29 2005
@@ -0,0 +1,300 @@
+/**
+ *
+ * Copyright 2005 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.
+ */
+package org.apache.geronimo.system.configuration;
+
+import java.io.File;
+import java.io.PrintWriter;
+import java.net.URI;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.gbean.GBeanData;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.KernelFactory;
+import org.apache.geronimo.kernel.config.Configuration;
+import org.apache.geronimo.kernel.config.ConfigurationInfo;
+import org.apache.geronimo.kernel.config.ConfigurationModuleType;
+import org.apache.geronimo.kernel.config.ConfigurationStore;
+import org.apache.geronimo.kernel.log.GeronimoLogging;
+import org.apache.geronimo.kernel.management.State;
+import org.apache.geronimo.system.repository.ReadOnlyRepository;
+import org.apache.geronimo.system.serverinfo.BasicServerInfo;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ConfigurationDump {
+    private static Log log;
+    static {
+        // This MUST be done before the first log is acquired
+        GeronimoLogging.initialize(GeronimoLogging.WARN);
+        log = LogFactory.getLog(ConfigurationDump.class.getName());
+    }
+    private static ClassLoader classLoader = ConfigurationDump.class.getClassLoader();
+
+    public static void main(String[] args) throws Exception {
+        File geronimoBaseDir = new File(args[0]);
+        System.setProperty("geronimo.base.dir", geronimoBaseDir.getAbsolutePath());
+
+        // create the kernel
+        Kernel kernel = KernelFactory.newInstance().createKernel("geronimo");
+        kernel.boot();
+
+        PrintWriter out = new PrintWriter(System.out, true);
+        try {
+            ObjectName serverInfoName = new ObjectName("configdump:name=ServerInfo");
+            GBeanData serverInfoData = new GBeanData(serverInfoName, BasicServerInfo.GBEAN_INFO);
+            startGBean(kernel, serverInfoData);
+
+            // add the repositories
+            ObjectName geronimoRepositoryName = new ObjectName("configdump:name=Repository,type=Geronimo");
+            GBeanData geronimoRepositoryData = new GBeanData(geronimoRepositoryName, ReadOnlyRepository.GBEAN_INFO);
+            geronimoRepositoryData.setAttribute("root", URI.create("repository"));
+            geronimoRepositoryData.setReferencePattern("ServerInfo", serverInfoName);
+            startGBean(kernel, geronimoRepositoryData);
+
+            String mavenLocalRepo = System.getProperty("maven.repo.local");
+            File mavenRepositoryDir;
+            if (mavenLocalRepo != null) {
+                mavenRepositoryDir = new File(mavenLocalRepo);
+            } else {
+                mavenRepositoryDir = new File(System.getProperty("user.home"), ".maven");
+                mavenRepositoryDir = new File(mavenRepositoryDir, "repository");
+            }
+            if (mavenRepositoryDir.isDirectory()) {
+                ObjectName mavenRepositoryName = new ObjectName("configdump:name=Repository,type=Maven");
+                GBeanData mavenRepositoryData = new GBeanData(mavenRepositoryName, ReadOnlyRepository.GBEAN_INFO);
+                mavenRepositoryData.setAttribute("root", mavenRepositoryDir.getAbsoluteFile().toURI());
+                mavenRepositoryData.setReferencePattern("ServerInfo", serverInfoName);
+                startGBean(kernel, mavenRepositoryData);
+            }
+
+            ObjectName localConfigStoreName = new ObjectName("configdump:name=LocalConfigStore");
+            GBeanData localConfigStoreData = new GBeanData(localConfigStoreName, LocalConfigStore.GBEAN_INFO);
+            localConfigStoreData.setAttribute("root", URI.create("config-store"));
+            localConfigStoreData.setReferencePattern("ServerInfo", serverInfoName);
+            startGBean(kernel, localConfigStoreData);
+
+            ConfigurationStore configurationStore = (ConfigurationStore) kernel.getProxyManager().createProxy(localConfigStoreName,
classLoader);
+            List configurationInfos = configurationStore.listConfigurations();
+            for (Iterator iterator = configurationInfos.iterator(); iterator.hasNext();)
{
+                ConfigurationInfo configurationInfo = (ConfigurationInfo) iterator.next();
+                URI configID = configurationInfo.getConfigID();
+                dumpConfiguration(kernel, configurationStore, configID, out);
+            }
+
+        } catch (StartUpError e) {
+            // ignore
+        } finally {
+            // shutdown the kernel
+            kernel.shutdown();
+        }
+    }
+
+    private static void startGBean(Kernel kernel, GBeanData gbeanData) throws Exception {
+        kernel.loadGBean(gbeanData, classLoader);
+        kernel.startGBean(gbeanData.getName());
+        if (kernel.getGBeanState(gbeanData.getName()) != State.RUNNING_INDEX) {
+            System.out.println("Failed to start " + gbeanData.getName());
+            throw new StartUpError();
+        }
+    }
+
+    private static void dumpConfiguration(Kernel kernel, ConfigurationStore configurationStore,
URI id, PrintWriter out) throws Exception {
+        out.println("==================================================");
+        out.println("= " + id);
+        out.println("==================================================");
+
+        loadRecursive(kernel, configurationStore, id);
+        ObjectName name = null;
+        try {
+            name = Configuration.getConfigurationObjectName(id);
+        } catch (MalformedObjectNameException e) {
+        }
+        out.println("objectName: " + name);
+
+        GBeanData config = kernel.getGBeanData(name);
+        ConfigurationModuleType moduleType = (ConfigurationModuleType) config.getAttribute("type");
+        out.println("type: " + moduleType);
+
+        String domain = (String) config.getAttribute("domain");
+        out.println("domain: " + domain);
+
+        String server = (String) config.getAttribute("server");
+        out.println("server: " + server);
+
+        URI[] parentIds = (URI[]) config.getAttribute("parentId");
+        if (parentIds != null && parentIds.length > 0) {
+            out.println("parents: ");
+            for (int i = 0; i < parentIds.length; i++) {
+                URI parentId = parentIds[i];
+                out.println("  " + parentId);
+            }
+        } else {
+            out.println("parents: none");
+        }
+
+        List dependencies = (List) config.getAttribute("dependencies");
+        if (dependencies != null && !dependencies.isEmpty()) {
+            out.println("dependencies: ");
+            for (Iterator iterator = dependencies.iterator(); iterator.hasNext();) {
+                URI path = (URI) iterator.next();
+                out.println("  " + path);
+            }
+        } else {
+            out.println("dependencies: none");
+        }
+
+        List classPath = (List) config.getAttribute("classPath");
+        if (classPath != null && !classPath.isEmpty()) {
+            out.println("classPath: ");
+            for (Iterator iterator = classPath.iterator(); iterator.hasNext();) {
+                URI path = (URI) iterator.next();
+                out.println("  " + path);
+            }
+        } else {
+            out.println("classPath: none");
+        }
+
+        boolean inverseClassLoading = ((Boolean) config.getAttribute("inverseClassLoading")).booleanValue();
+        out.println("inverseClassLoading: " + inverseClassLoading);
+
+
+        String[] hiddenClasses = (String[]) config.getAttribute("hiddenClasses");
+        if (hiddenClasses != null && hiddenClasses.length > 0) {
+            out.println("hiddenClasses: ");
+            for (int i = 0; i < hiddenClasses.length; i++) {
+                String hiddenClass = hiddenClasses[i];
+                out.println("  " + hiddenClass);
+            }
+        } else {
+            out.println("hiddenClasses: none");
+        }
+
+        String[] nonOverridableClasses = (String[]) config.getAttribute("nonOverridableClasses");
+        if (nonOverridableClasses != null && nonOverridableClasses.length > 0)
{
+            out.println("nonOverridableClasses: ");
+            for (int i = 0; i < hiddenClasses.length; i++) {
+                String nonOverridableClass = nonOverridableClasses[i];
+                out.println("  " + nonOverridableClass);
+            }
+        } else {
+            out.println("nonOverridableClasses: none");
+        }
+
+        kernel.startGBean(name);
+        if (kernel.getGBeanState(name) != State.RUNNING_INDEX) {
+            System.out.println("Failed to start " + name);
+            return;
+        }
+
+        Configuration configuration = (Configuration) kernel.getProxyManager().createProxy(name,
Configuration.class);
+        Collection collection = configuration.loadGBeans();
+        for (Iterator iterator = collection.iterator(); iterator.hasNext();) {
+            GBeanData gbeanData = (GBeanData) iterator.next();
+            out.println();
+            out.println();
+            out.println("gbean: " + gbeanData.getName());
+            out.println("gbeanInfo: " + gbeanData.getGBeanInfo().getSourceClass());
+
+            Map attributes = gbeanData.getAttributes();
+            if (attributes != null && !attributes.isEmpty()) {
+                out.println("attributes: ");
+                for (Iterator attributeIterator = attributes.entrySet().iterator(); attributeIterator.hasNext();)
{
+                    Map.Entry entry = (Map.Entry) attributeIterator.next();
+                    String attributeName = (String) entry.getKey();
+                    Object attributeValue = entry.getValue();
+                    out.println("    " + attributeName + " := " + attributeValue);
+                }
+            } else {
+                out.println("attributes: none");
+            }
+            Map references = gbeanData.getReferences();
+            if (references != null && !attributes.isEmpty()) {
+                out.println("references: ");
+                for (Iterator referenceIterator = references.entrySet().iterator(); referenceIterator.hasNext();)
{
+                    Map.Entry entry = (Map.Entry) referenceIterator.next();
+                    String referenceName = (String) entry.getKey();
+                    Collection referencePatterns = (Collection) entry.getValue();
+                    if (referencePatterns.size() == 1) {
+                        out.println("    " + referenceName + " := " + referencePatterns.iterator().next());
+                    } else {
+                        out.println("    " + referenceName + " := ");
+                        for (Iterator patternIterator = referencePatterns.iterator(); patternIterator.hasNext();)
{
+                            ObjectName pattern = (ObjectName) patternIterator.next();
+                            out.println("        " + pattern);
+                        }
+                    }
+                }
+            } else {
+                out.println("references: none");
+            }
+        }
+    }
+
+    private static final ObjectName CONFIGURATION_NAME_QUERY;
+    static {
+        try {
+            CONFIGURATION_NAME_QUERY = new ObjectName("geronimo.config:*");
+        } catch (MalformedObjectNameException e) {
+            throw new RuntimeException("could not create object name... bug", e);
+        }
+    }
+
+    public static void loadRecursive(Kernel kernel, ConfigurationStore configurationStore,
URI configID) throws Exception {
+        LinkedList ancestors = new LinkedList();
+        Set preloaded = kernel.listGBeans(CONFIGURATION_NAME_QUERY);
+        loadRecursive(kernel, configurationStore, configID, ancestors, preloaded);
+
+        for (Iterator iterator = ancestors.iterator(); iterator.hasNext();) {
+            URI name = (URI) iterator.next();
+            ObjectName configName = Configuration.getConfigurationObjectName(name);
+            kernel.startGBean(configName);
+        }
+    }
+
+    private static void loadRecursive(Kernel kernel, ConfigurationStore configurationStore,
URI configID, LinkedList ancestors, Set preloaded) throws Exception {
+        ObjectName name = Configuration.getConfigurationObjectName(configID);
+        if (preloaded.contains(name)) {
+            return;
+        }
+        if (!kernel.isLoaded(name)) {
+            configurationStore.loadConfiguration(configID);
+        }
+        //put the earliest ancestors first, even if we have already started them.
+        ancestors.remove(configID);
+        ancestors.addFirst(configID);
+        URI[] parents = (URI[]) kernel.getAttribute(name, "parentId");
+        if (parents != null) {
+            for (int i = 0; i < parents.length; i++) {
+                URI parent = parents[i];
+                loadRecursive(kernel, configurationStore, parent, ancestors, preloaded);
+            }
+        }
+    }
+
+    private static class StartUpError extends Error {
+    }
+}

Propchange: geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/ConfigurationDump.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/ConfigurationDump.java
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Id"

Modified: geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/LocalConfigStore.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/LocalConfigStore.java?rev=351637&r1=351636&r2=351637&view=diff
==============================================================================
--- geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/LocalConfigStore.java
(original)
+++ geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/LocalConfigStore.java
Fri Dec  2 00:28:29 2005
@@ -26,7 +26,6 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
 import java.io.OutputStream;
 import java.net.URI;
 import java.net.URL;
@@ -46,15 +45,14 @@
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.GBeanLifecycle;
 import org.apache.geronimo.kernel.Kernel;
-import org.apache.geronimo.kernel.management.State;
 import org.apache.geronimo.kernel.config.Configuration;
-import org.apache.geronimo.kernel.config.ConfigurationStore;
-import org.apache.geronimo.kernel.config.InvalidConfigException;
-import org.apache.geronimo.kernel.config.NoSuchConfigException;
 import org.apache.geronimo.kernel.config.ConfigurationData;
 import org.apache.geronimo.kernel.config.ConfigurationInfo;
 import org.apache.geronimo.kernel.config.ConfigurationModuleType;
-import org.apache.geronimo.kernel.config.ManageableAttributeStore;
+import org.apache.geronimo.kernel.config.ConfigurationStore;
+import org.apache.geronimo.kernel.config.InvalidConfigException;
+import org.apache.geronimo.kernel.config.NoSuchConfigException;
+import org.apache.geronimo.kernel.management.State;
 import org.apache.geronimo.system.serverinfo.ServerInfo;
 
 /**
@@ -270,27 +268,6 @@
         return name;
     }
 
-    public synchronized void updateConfiguration(ConfigurationData configurationData) throws
NoSuchConfigException, Exception {
-        File root = getRoot(configurationData.getId());
-        File stateFile = new File(root, "META-INF/state.ser");
-        try {
-            FileOutputStream fos = new FileOutputStream(stateFile);
-            ObjectOutputStream oos;
-            try {
-                oos = new ObjectOutputStream(fos);
-                GBeanData configurationGBeanData = ExecutableConfigurationUtil.getConfigurationGBeanData(configurationData);
-                configurationGBeanData.writeExternal(oos);
-                oos.flush();
-            } finally {
-                fos.close();
-            }
-        } catch (Exception e) {
-            log.error("state store failed", e);
-            stateFile.delete();
-            throw e;
-        }
-    }
-
     public List listConfigurations() {
         List configs;
         synchronized (this) {
@@ -338,12 +315,9 @@
     }
 
     private GBeanData loadConfig(File configRoot) throws IOException, InvalidConfigException
{
-        File file = new File(configRoot, "META-INF/state.ser");
+        File file = new File(configRoot, "META-INF/config.ser");
         if (!file.isFile()) {
-            file = new File(configRoot, "META-INF/config.ser");
-            if (!file.isFile()) {
-                throw new InvalidConfigException("Configuration does not contain a META-INF/config.ser
file");
-            }
+            throw new InvalidConfigException("Configuration does not contain a META-INF/config.ser
file");
         }
 
         FileInputStream fis = new FileInputStream(file);
@@ -358,7 +332,6 @@
             } catch (Exception e) {
                 throw new InvalidConfigException("Unable to set attribute ", e);
             }
-            config.setReferencePattern("ConfigurationStore", objectName);
             return config;
         } finally {
             fis.close();

Modified: geronimo/trunk/modules/system/src/test/org/apache/geronimo/system/configuration/LocalConfigStoreTest.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/system/src/test/org/apache/geronimo/system/configuration/LocalConfigStoreTest.java?rev=351637&r1=351636&r2=351637&view=diff
==============================================================================
--- geronimo/trunk/modules/system/src/test/org/apache/geronimo/system/configuration/LocalConfigStoreTest.java
(original)
+++ geronimo/trunk/modules/system/src/test/org/apache/geronimo/system/configuration/LocalConfigStoreTest.java
Fri Dec  2 00:28:29 2005
@@ -73,47 +73,6 @@
         assertTrue(new File(root, "6/META-INF/config.ser").exists());
     }
 
-    public void testUpdateConfig() throws Exception {
-        // install the config
-        kernel.invoke(storeName, "install", new Object[] {source}, new String[] {"java.net.URL"});
-
-        // load and start the config
-        ObjectName configName = configurationManager.load(uri);
-        configurationManager.loadGBeans(uri);
-        configurationManager.start(uri);
-
-        // make sure the config and the enabled gbean are running
-        assertEquals(State.RUNNING_INDEX, kernel.getGBeanState(configName));
-        assertEquals(State.RUNNING_INDEX, kernel.getGBeanState(gbeanName1));
-
-        // make sure the config and the disabled gbean are NOT running
-        assertEquals(State.STOPPED_INDEX, kernel.getGBeanState(gbeanName2));
-
-        // set the value
-        kernel.setAttribute(gbeanName1, "value", "9900990099");
-        assertEquals("9900990099", kernel.getAttribute(gbeanName1, "value"));
-
-        kernel.invoke(configName, "saveState");
-        // stop and unload the config
-        configurationManager.stop(uri);
-        configurationManager.unload(uri);
-
-        // assure it was unloaded
-        assertFalse(kernel.isLoaded(configName));
-
-        // now reload and restart the config
-        configName = configurationManager.load(uri);
-        configurationManager.loadGBeans(uri);
-        configurationManager.start(uri);
-
-        // make sure the value was reloaded correctly
-        assertEquals("9900990099", kernel.getAttribute(gbeanName1, "value"));
-
-        // stop and unload the config
-        kernel.stopGBean(configName);
-        kernel.unloadGBean(configName);
-    }
-
     protected void setUp() throws Exception {
         try {
             kernel = KernelFactory.newInstance().createKernel("test.kernel");

Modified: geronimo/trunk/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java?rev=351637&r1=351636&r2=351637&view=diff
==============================================================================
--- geronimo/trunk/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java
(original)
+++ geronimo/trunk/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java
Fri Dec  2 00:28:29 2005
@@ -521,10 +521,6 @@
             return true;
         }
 
-        public void updateConfiguration(ConfigurationData configurationData) throws NoSuchConfigException,
Exception {
-
-        }
-
         public String getObjectName() {
             return null;
         }

Modified: geronimo/trunk/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenConfigStore.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenConfigStore.java?rev=351637&r1=351636&r2=351637&view=diff
==============================================================================
--- geronimo/trunk/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenConfigStore.java
(original)
+++ geronimo/trunk/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenConfigStore.java
Fri Dec  2 00:28:29 2005
@@ -134,10 +134,6 @@
         throw new UnsupportedOperationException();
     }
 
-    public void updateConfiguration(ConfigurationData configurationData) throws NoSuchConfigException,
Exception {
-        // we don't store persistent state
-    }
-
     public List listConfigurations() {
         throw new UnsupportedOperationException();
     }



Mime
View raw message