geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r620730 - in /geronimo/server/trunk: buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/ framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/jmx/ framework/modules/geroni...
Date Tue, 12 Feb 2008 09:21:42 GMT
Author: djencks
Date: Tue Feb 12 01:21:38 2008
New Revision: 620730

URL: http://svn.apache.org/viewvc?rev=620730&view=rev
Log:
GERONIMO-3841 apply batches of config.xml updates from car-maven-plugin

Added:
    geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/Override.java
  (with props)
Removed:
    geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/InstallArtifactsMojo.java
Modified:
    geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/InstallModulesMojo.java
    geronimo/server/trunk/framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/jmx/RemoteDeploymentManager.java
    geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/PluginInstaller.java
    geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java

Modified: geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/InstallModulesMojo.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/InstallModulesMojo.java?rev=620730&r1=620729&r2=620730&view=diff
==============================================================================
--- geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/InstallModulesMojo.java
(original)
+++ geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/InstallModulesMojo.java
Tue Feb 12 01:21:38 2008
@@ -36,6 +36,7 @@
 import org.apache.geronimo.system.plugin.model.PluginArtifactType;
 import org.apache.geronimo.system.plugin.model.PluginListType;
 import org.apache.geronimo.system.plugin.model.PluginType;
+import org.apache.geronimo.system.plugin.model.AttributesType;
 import org.apache.geronimo.system.resolver.AliasedArtifactResolver;
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.codehaus.mojo.pluginsupport.dependency.DependencyTree;
@@ -116,6 +117,18 @@
 
     private RepositoryConfigurationStore sourceStore;
 
+
+    /**
+     * @parameter expression="${project.build.directory}/classes/var/config/overrides"
+     * @required
+     */
+    private File overridesDir;
+
+    /**
+     * @parameter
+     */
+    private List<Override> overrides;
+
     /**
      * Set of artifacts which have already been installed, so we can skip any processing.
      */
@@ -148,6 +161,12 @@
         try {
             PluginInstallerGBean installer = new PluginInstallerGBean(targetRepositoryPath,
targetServerPath, servers, kernel, getClass().getClassLoader());
             installer.install(pluginList, sourceRepo, true, null, null, downloadPoller);
+            if (overrides != null) {
+                for (Override override: this.overrides) {
+                    AttributesType attributes = override.getOverrides(overridesDir);
+                    installer.mergeOverrides(override.getServer(), attributes);
+                }
+            }
         } finally {
             kernel.shutdown();
         }

Added: geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/Override.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/Override.java?rev=620730&view=auto
==============================================================================
--- geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/Override.java
(added)
+++ geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/Override.java
Tue Feb 12 01:21:38 2008
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.mavenplugins.car;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+
+import javax.xml.bind.JAXBException;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.stream.XMLStreamException;
+
+import org.apache.geronimo.system.configuration.AttributesXmlUtil;
+import org.apache.geronimo.system.plugin.model.AttributesType;
+import org.xml.sax.SAXException;
+
+/**
+ * @version $Rev:$ $Date:$
+ */
+public class Override {
+
+    /**
+     * server these overides apply to
+     * @parameter
+     */
+    private String server;
+
+    /**
+     * file containing overrides
+     * @parameter
+     */
+    private String overrides;
+
+    public String getServer() {
+        return server;
+    }
+
+    public AttributesType getOverrides(File base) throws IOException, JAXBException, ParserConfigurationException,
SAXException, XMLStreamException {
+        File file = new File(base, overrides);
+        FileReader input = new FileReader(file);
+        try {
+            return AttributesXmlUtil.loadAttributes(input);
+        } finally {
+            input.close();
+        }
+
+    }
+}

Propchange: geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/Override.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/Override.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/Override.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/server/trunk/framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/jmx/RemoteDeploymentManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/jmx/RemoteDeploymentManager.java?rev=620730&r1=620729&r2=620730&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/jmx/RemoteDeploymentManager.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/jmx/RemoteDeploymentManager.java
Tue Feb 12 01:21:38 2008
@@ -55,6 +55,7 @@
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.Dependency;
 import org.apache.geronimo.kernel.repository.MissingDependencyException;
+import org.apache.geronimo.kernel.InvalidGBeanException;
 import org.apache.geronimo.system.jmx.KernelDelegate;
 import org.apache.geronimo.system.plugin.DownloadPoller;
 import org.apache.geronimo.system.plugin.DownloadResults;
@@ -63,6 +64,7 @@
 import org.apache.geronimo.system.plugin.ServerArchiver;
 import org.apache.geronimo.system.plugin.model.PluginListType;
 import org.apache.geronimo.system.plugin.model.PluginType;
+import org.apache.geronimo.system.plugin.model.AttributesType;
 import org.codehaus.plexus.archiver.ArchiverException;
 
 /**
@@ -344,6 +346,15 @@
         PluginInstaller installer = getPluginInstaller();
         try {
             return installer.installPluginList(targetRepositoryPath, relativeTargetServerPath,
pluginList);
+        } finally {
+            kernel.getProxyManager().destroyProxy(installer);
+        }
+    }
+
+    public void mergeOverrides(String server, AttributesType overrides) throws InvalidGBeanException,
IOException {
+        PluginInstaller installer = getPluginInstaller();
+        try {
+            installer.mergeOverrides(server, overrides);
         } finally {
             kernel.getProxyManager().destroyProxy(installer);
         }

Modified: geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/PluginInstaller.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/PluginInstaller.java?rev=620730&r1=620729&r2=620730&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/PluginInstaller.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/PluginInstaller.java
Tue Feb 12 01:21:38 2008
@@ -26,13 +26,15 @@
 import org.apache.geronimo.kernel.repository.MissingDependencyException;
 import org.apache.geronimo.kernel.config.ConfigurationManager;
 import org.apache.geronimo.kernel.config.NoSuchStoreException;
+import org.apache.geronimo.kernel.InvalidGBeanException;
 import org.apache.geronimo.system.plugin.model.PluginListType;
 import org.apache.geronimo.system.plugin.model.PluginType;
+import org.apache.geronimo.system.plugin.model.AttributesType;
 
 /**
  * Knows how to import and export configurations
  *
- * @version $Rev: 601152 $ $Date: 2007-12-04 15:49:03 -0800 (Tue, 04 Dec 2007) $
+ * @version $Rev$ $Date$
  */
 public interface PluginInstaller {
     /**
@@ -189,4 +191,6 @@
     public Artifact installLibrary(File libFile, String groupId) throws IOException;
 
     DownloadResults installPluginList(String targetRepositoryPath, String relativeTargetServerPath,
PluginListType pluginList) throws Exception;
+
+    void mergeOverrides(String server, AttributesType overrides) throws InvalidGBeanException,
IOException;
 }

Modified: geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java?rev=620730&r1=620729&r2=620730&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java
Tue Feb 12 01:21:38 2008
@@ -81,6 +81,7 @@
 import org.apache.geronimo.kernel.util.XmlUtil;
 import org.apache.geronimo.system.configuration.ConfigurationStoreUtil;
 import org.apache.geronimo.system.configuration.RepositoryConfigurationStore;
+import org.apache.geronimo.system.configuration.PluginAttributeStore;
 import org.apache.geronimo.system.plugin.model.ArtifactType;
 import org.apache.geronimo.system.plugin.model.ConfigXmlContentType;
 import org.apache.geronimo.system.plugin.model.CopyFileType;
@@ -92,6 +93,8 @@
 import org.apache.geronimo.system.plugin.model.PluginType;
 import org.apache.geronimo.system.plugin.model.PrerequisiteType;
 import org.apache.geronimo.system.plugin.model.PropertyType;
+import org.apache.geronimo.system.plugin.model.AttributesType;
+import org.apache.geronimo.system.plugin.model.ModuleType;
 import org.apache.geronimo.system.repository.Maven2Repository;
 import org.apache.geronimo.system.serverinfo.BasicServerInfo;
 import org.apache.geronimo.system.serverinfo.ServerInfo;
@@ -339,6 +342,22 @@
             kernel.shutdown();
         }
         return downloadPoller;
+    }
+
+    public void mergeOverrides(String server, AttributesType overrides) throws InvalidGBeanException,
IOException {
+        ServerInstance serverInstance = servers.get(server);
+        if (serverInstance == null) {
+            throw new NullPointerException("No such server: " + server + ", known servers:
" + servers.keySet());
+        }
+        PluginAttributeStore attributeStore = serverInstance.getAttributeStore();
+        for (ModuleType module: overrides.getModule()) {
+            Artifact artifact = Artifact.create(module.getName());
+            attributeStore.setModuleGBeans(artifact, module.getGbean(), module.isLoad(),
module.getCondition());
+            attributeStore.save();
+        }
+        if (overrides.getConfiguration().size() > 0) {
+            throw new UnsupportedOperationException("Use modules, not configurations");
+        }
     }
 
 



Mime
View raw message