geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r708650 - in /geronimo/server/trunk: assemblies/geronimo-boilerplate/ assemblies/geronimo-boilerplate/src/main/assembly/ assemblies/geronimo-boilerplate/src/main/underlay/ assemblies/geronimo-boilerplate/src/main/underlay/bin/ assemblies/ge...
Date Tue, 28 Oct 2008 19:48:31 GMT
Author: djencks
Date: Tue Oct 28 12:48:22 2008
New Revision: 708650

URL: http://svn.apache.org/viewvc?rev=708650&view=rev
Log:
GERONIMO-4382 Use plugin installing to create a new server instance in a geronimo installation.
 Also requires separating boilerplate into the installation and server (var) bits

Added:
    geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/contents/
    geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/contents/DISCLAIMER
      - copied unchanged from r707296, geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/DISCLAIMER
    geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/contents/LICENSE
      - copied unchanged from r707296, geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/LICENSE
    geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/contents/NOTICE
      - copied unchanged from r707296, geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/NOTICE
    geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/contents/bin/
      - copied from r707296, geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/bin/
    geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/contents/bin/client.bat
      - copied unchanged from r708647, geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/bin/client.bat
    geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/contents/bin/client.sh
      - copied unchanged from r708647, geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/bin/client.sh
    geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/contents/bin/deploy.bat
      - copied unchanged from r708647, geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/bin/deploy.bat
    geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/contents/bin/deploy.sh
      - copied unchanged from r708647, geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/bin/deploy.sh
    geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/contents/bin/geronimo.bat
      - copied unchanged from r708647, geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/bin/geronimo.bat
    geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/contents/bin/geronimo.sh
      - copied unchanged from r708647, geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/bin/geronimo.sh
    geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/contents/bin/gsh
      - copied unchanged from r708647, geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/bin/gsh
    geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/contents/bin/gsh.bat
      - copied unchanged from r708647, geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/bin/gsh.bat
    geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/contents/bin/setjavaenv.bat
      - copied unchanged from r708647, geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/bin/setjavaenv.bat
    geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/contents/bin/setjavaenv.sh
      - copied unchanged from r708647, geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/bin/setjavaenv.sh
    geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/contents/bin/shutdown.bat
      - copied unchanged from r708647, geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/bin/shutdown.bat
    geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/contents/bin/shutdown.sh
      - copied unchanged from r708647, geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/bin/shutdown.sh
    geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/contents/bin/start-server
      - copied unchanged from r708647, geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/bin/start-server
    geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/contents/bin/start-server.bat
      - copied unchanged from r708647, geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/bin/start-server.bat
    geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/contents/bin/startup.bat
      - copied unchanged from r708647, geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/bin/startup.bat
    geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/contents/bin/startup.sh
      - copied unchanged from r708647, geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/bin/startup.sh
    geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/contents/bin/stop-server
      - copied unchanged from r708647, geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/bin/stop-server
    geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/contents/bin/stop-server.bat
      - copied unchanged from r708647, geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/bin/stop-server.bat
    geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/contents/etc/
      - copied from r707296, geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/etc/
    geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/contents/etc/META-INF/
      - copied from r708647, geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/etc/META-INF/
    geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/contents/etc/gsh-classworlds.conf
      - copied unchanged from r708647, geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/etc/gsh-classworlds.conf
    geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/contents/etc/gsh-log4j.properties
      - copied unchanged from r708647, geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/etc/gsh-log4j.properties
    geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/contents/etc/layout.xml
      - copied, changed from r708647, geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/etc/layout.xml
    geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/contents/etc/rc.d/
      - copied from r708647, geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/etc/rc.d/
    geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/instance/
    geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/instance/var/
      - copied from r707296, geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/var/
    geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/instance/var/config/
      - copied from r708647, geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/var/config/
    geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/instance/var/log/
      - copied from r708647, geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/var/log/
    geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/instance/var/temp/
      - copied from r708647, geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/var/temp/
    geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/NewServerInstance.java
  (with props)
    geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/NewServerInstanceGBean.java
  (with props)
Removed:
    geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/DISCLAIMER
    geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/LICENSE
    geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/NOTICE
    geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/bin/
    geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/etc/
    geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/var/
Modified:
    geronimo/server/trunk/assemblies/geronimo-boilerplate/pom.xml
    geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/assembly/boilerplate.xml
    geronimo/server/trunk/framework/configs/plugin/src/main/plan/plan.xml
    geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java
    geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/ServerInstanceData.java
    geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/serverinfo/BasicServerInfo.java

Modified: geronimo/server/trunk/assemblies/geronimo-boilerplate/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/assemblies/geronimo-boilerplate/pom.xml?rev=708650&r1=708649&r2=708650&view=diff
==============================================================================
--- geronimo/server/trunk/assemblies/geronimo-boilerplate/pom.xml (original)
+++ geronimo/server/trunk/assemblies/geronimo-boilerplate/pom.xml Tue Oct 28 12:48:22 2008
@@ -249,6 +249,7 @@
                             <instance>
                                 <plugin-artifact>
                                     <copy-file relative-to="geronimo" dest-dir="">contents/</copy-file>
+                                    <copy-file relative-to="server" dest-dir="">instance/</copy-file>
                                 </plugin-artifact>
                             </instance>
                         </configuration>

Modified: geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/assembly/boilerplate.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/assembly/boilerplate.xml?rev=708650&r1=708649&r2=708650&view=diff
==============================================================================
--- geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/assembly/boilerplate.xml
(original)
+++ geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/assembly/boilerplate.xml
Tue Oct 28 12:48:22 2008
@@ -24,7 +24,7 @@
     <fileSets>
         <fileSet>
             <directory>src/main/underlay</directory>
-            <outputDirectory>contents</outputDirectory>
+            <outputDirectory></outputDirectory>
         </fileSet>
     </fileSets>
     

Copied: geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/contents/etc/layout.xml
(from r708647, geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/etc/layout.xml)
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/contents/etc/layout.xml?p2=geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/contents/etc/layout.xml&p1=geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/etc/layout.xml&r1=708647&r2=708650&rev=708650&view=diff
==============================================================================
--- geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/etc/layout.xml
(original)
+++ geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/contents/etc/layout.xml
Tue Oct 28 12:48:22 2008
@@ -200,6 +200,11 @@
                     <name>install-plugin</name>
                     <id>geronimo-commands:install-plugin</id>
                 </command>
+
+                <command>
+                    <name>new-instance</name>
+                    <id>geronimo-commands:new-server-instance</id>
+                </command>
             </nodes>
         </group>
 

Modified: geronimo/server/trunk/framework/configs/plugin/src/main/plan/plan.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/configs/plugin/src/main/plan/plan.xml?rev=708650&r1=708649&r2=708650&view=diff
==============================================================================
--- geronimo/server/trunk/framework/configs/plugin/src/main/plan/plan.xml (original)
+++ geronimo/server/trunk/framework/configs/plugin/src/main/plan/plan.xml Tue Oct 28 12:48:22
2008
@@ -22,6 +22,7 @@
 
     <!-- Configuration Installer -->
     <gbean name="PluginInstaller" class="org.apache.geronimo.system.plugin.PluginInstallerGBean">
+        <!-- TODO no artifactManager specified-->
         <attribute name="installedPluginsList">var/config/installed-plugins.properties</attribute>
         <reference name="Repository">
             <name>Repository</name>
@@ -109,4 +110,19 @@
         </reference>
     </gbean>
 
+    <gbean name="NewServerInstance" class="org.apache.geronimo.system.plugin.NewServerInstanceGBean">
+        <attribute name="defaultPlugins">org.apache.geronimo.plugingroups/framework/${version}/car</attribute>
+        <reference name="PluginInstallerGBean">
+            <name>PluginInstaller</name>
+        </reference>
+        <reference name="ConfigManager">
+            <name>ConfigurationManager</name>
+        </reference>
+        <references name="PersistentConfigurationLists">
+            <pattern>
+                <name>AttributeManager</name>
+            </pattern>
+        </references>
+    </gbean>
+
 </module>

Added: geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/NewServerInstance.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/NewServerInstance.java?rev=708650&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/NewServerInstance.java
(added)
+++ geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/NewServerInstance.java
Tue Oct 28 12:48:22 2008
@@ -0,0 +1,28 @@
+/*
+ * 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.system.plugin;
+
+/**
+ * @version $Rev:$ $Date:$
+ */
+public interface NewServerInstance {
+    void newServerInstance(String serverName) throws Exception;
+}

Propchange: geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/NewServerInstance.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/NewServerInstance.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/NewServerInstance.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/NewServerInstanceGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/NewServerInstanceGBean.java?rev=708650&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/NewServerInstanceGBean.java
(added)
+++ geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/NewServerInstanceGBean.java
Tue Oct 28 12:48:22 2008
@@ -0,0 +1,113 @@
+/*
+ * 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.system.plugin;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.geronimo.gbean.annotation.GBean;
+import org.apache.geronimo.gbean.annotation.ParamAttribute;
+import org.apache.geronimo.gbean.annotation.ParamReference;
+import org.apache.geronimo.gbean.annotation.ParamSpecial;
+import org.apache.geronimo.gbean.annotation.SpecialAttributeType;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.basic.BasicKernel;
+import org.apache.geronimo.kernel.config.ConfigurationManager;
+import org.apache.geronimo.kernel.config.PersistentConfigurationList;
+import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.system.plugin.model.ArtifactType;
+import org.apache.geronimo.system.plugin.model.PluginArtifactType;
+import org.apache.geronimo.system.plugin.model.PluginListType;
+import org.apache.geronimo.system.plugin.model.PluginType;
+
+/**
+ * @version $Rev:$ $Date:$
+ */
+@GBean
+public class NewServerInstanceGBean implements NewServerInstance {
+
+    private final Set<String> defaultPlugins;
+    private final Collection<PersistentConfigurationList> persistentConfigurationLists;
+    private final PluginInstallerGBean oldPluginInstallerGBean;
+    private final ConfigurationManager configManager;
+    private final Kernel kernel;
+
+    public NewServerInstanceGBean(@ParamAttribute(name = "defaultPlugins")Map<String,
String> defaultPlugins,
+                                  @ParamReference(name = "PersistentConfigurationLists")Collection<PersistentConfigurationList>
persistentConfigurationLists,
+                                  @ParamReference(name = "PluginInstallerGBean")PluginInstallerGBean
pluginInstallerGBean,
+                                  @ParamReference(name = "ConfigManager", namingType = "ConfigurationManager")ConfigurationManager
configManager,
+                                  @ParamSpecial(type = SpecialAttributeType.kernel)Kernel
kernel) {
+        this.persistentConfigurationLists = persistentConfigurationLists;
+        this.oldPluginInstallerGBean = pluginInstallerGBean;
+        this.configManager = configManager;
+        this.defaultPlugins = defaultPlugins == null ? Collections.<String>emptySet()
: defaultPlugins.keySet();
+        this.kernel = kernel;
+    }
+
+    public void newServerInstance(String serverName) throws Exception {
+        try {
+            PluginListType pluginList = new PluginListType();
+            for (String artifactString : defaultPlugins) {
+                Artifact artifact = Artifact.create(artifactString);
+                PluginType plugin = getPlugin(artifact);
+                pluginList.getPlugin().add(plugin);
+            }
+            Artifact query = Artifact.createPartial("///");
+            for (PersistentConfigurationList persistentConfigurationList : persistentConfigurationLists)
{
+                for (Artifact installed : persistentConfigurationList.getListedConfigurations(query))
{
+                    PluginType plugin = getPlugin(installed);
+                    pluginList.getPlugin().add(plugin);
+                }
+            }
+
+            Kernel kernel = new BasicKernel("assembly");
+
+            try {
+                PluginInstallerGBean pluginInstallerGBean = oldPluginInstallerGBean.pluginInstallerCopy(serverName,
kernel);
+                GeronimoSourceRepository localSourceRepository = new GeronimoSourceRepository(configManager.getRepositories(),
configManager.getArtifactResolver());
+
+                DownloadResults downloadPoller = new DownloadResults();
+                pluginInstallerGBean.install(pluginList, localSourceRepository, true, null,
null, downloadPoller);
+            } finally {
+                kernel.shutdown();
+            }
+        } catch (Throwable t) {
+            t.printStackTrace();
+        }
+    }
+
+    public PluginType getPlugin(Artifact sourceArtifact) {
+        PluginType plugin = new PluginType();
+        PluginArtifactType pluginArtifact = new PluginArtifactType();
+        ArtifactType artifact = new ArtifactType();
+        artifact.setGroupId(sourceArtifact.getGroupId());
+        artifact.setArtifactId(sourceArtifact.getArtifactId());
+        artifact.setVersion(sourceArtifact.getVersion().toString());
+        artifact.setType(sourceArtifact.getType());
+        pluginArtifact.setModuleId(artifact);
+        plugin.getPluginArtifact().add(pluginArtifact);
+        return plugin;
+    }
+
+
+}

Propchange: geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/NewServerInstanceGBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/NewServerInstanceGBean.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/NewServerInstanceGBean.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

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=708650&r1=708649&r2=708650&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 Oct 28 12:48:22 2008
@@ -164,12 +164,29 @@
                                 @ParamReference(name = "PersistentConfigurationLists", namingType
= "AttributeStore")Collection<PersistentConfigurationList> persistentConfigurationLists,
                                 @ParamReference(name = "PluginRepositoryList")PluginRepositoryList
pluginRepositoryList,
                                 @ParamSpecial(type = SpecialAttributeType.classLoader) final
ClassLoader classLoader) throws IOException {
+        this(installedPluginsList, configManager, repository, configStore, serverInstanceDatas,
serverInfo, threadPool, artifactManager, persistentConfigurationLists, pluginRepositoryList,
classLoader, true);
+    }
+
+    private PluginInstallerGBean(String installedPluginsList,
+                                 ConfigurationManager configManager,
+                                 WritableListableRepository repository,
+                                 ConfigurationStore configStore,
+                                 Collection<? extends ServerInstanceData> serverInstanceDatas,
+                                 ServerInfo serverInfo,
+                                 ThreadPool threadPool,
+                                 ArtifactManager artifactManager,
+                                 Collection<PersistentConfigurationList> persistentConfigurationLists,
+                                 PluginRepositoryList pluginRepositoryList,
+                                 ClassLoader classLoader,
+                                 boolean live) throws IOException {
         this.writeableRepo = repository;
         this.configStore = configStore;
         this.serverInfo = serverInfo;
         this.threadPool = threadPool;
         asyncKeys = Collections.synchronizedMap(new HashMap<Object, DownloadResults>());
         this.serverInstanceDatas = serverInstanceDatas;
+        if (artifactManager == null) artifactManager = new DefaultArtifactManager();
+        setUpServerInstances(serverInstanceDatas, serverInfo, artifactManager, servers, writeableRepo,
live);
         this.persistentConfigurationLists = persistentConfigurationLists == null ? Collections.<PersistentConfigurationList>emptyList()
: persistentConfigurationLists;
         this.classLoader = classLoader;
         if (configManager == null) {
@@ -177,7 +194,6 @@
         }
         this.configManager = configManager;
         localSourceRepository = new GeronimoSourceRepository(configManager.getRepositories(),
configManager.getArtifactResolver());
-        setUpServerInstances(serverInstanceDatas, serverInfo, artifactManager, servers, writeableRepo,
true);
         this.pluginRepositoryList = pluginRepositoryList;
         this.installedPluginsList = installedPluginsList;
         loadHistory();
@@ -193,6 +209,7 @@
      * @param pluginRepositoryList
      * @param kernel               kernel for current server
      * @param classLoader          classLoader @throws IOException if layouts can't be loaded
+     * @deprecated only used by car-maven-plugin
      */
     public PluginInstallerGBean(String targetRepositoryPath,
                                 String targetServerPath,
@@ -222,6 +239,32 @@
         loadHistory();
     }
 
+    public PluginInstallerGBean pluginInstallerCopy(String serverName, Kernel kernel) throws
Exception {
+        ServerInfo newServerInfo = new BasicServerInfo(serverInfo.getCurrentBaseDirectory(),
serverName);
+        final ArtifactManager artifactManager = new DefaultArtifactManager();
+        ConfigurationManager configManager = buildConfigurationManager(artifactManager, writeableRepo,
kernel, configStore, classLoader, servers);
+//        ArrayList<ServerInstanceData> serverInstanceDatasCopy = new ArrayList<ServerInstanceData>(serverInstanceDatas.size());
+//        for (ServerInstanceData serverInstance: serverInstanceDatas) {
+//            if (serverInstance instanceof ReferenceServerInstanceData) {
+//                serverInstance = new ServerInstanceData(serverInstance);
+//            }
+//            serverInstanceDatasCopy.add(serverInstance);
+//        }
+        return new PluginInstallerGBean(
+                installedPluginsList,
+                configManager,
+                writeableRepo,
+                configStore,
+                serverInstanceDatas,
+                newServerInfo,
+                threadPool,
+                artifactManager,
+                persistentConfigurationLists,
+                pluginRepositoryList,
+                classLoader,
+                false);
+    }
+
     private static void setUpServerInstances(Collection<? extends ServerInstanceData>
serverInstanceDatas,
                                              final ServerInfo serverInfo, final ArtifactManager
artifactManager,
                                              final Map<String, ServerInstance> servers,
@@ -404,13 +447,27 @@
 
         try {
 //            kernel.boot();
+            final ArtifactManager artifactManager = new DefaultArtifactManager();
+
+            FileUtils.forceMkdir(new File(targetServerPathName));
+            ServerInfo serverInfo = new BasicServerInfo(targetServerPathName, false);
+            File targetRepositoryFile = serverInfo.resolve(targetRepositoryPath);
+            FileUtils.forceMkdir(targetRepositoryFile);
+            WritableListableRepository writeableRepo = new Maven2Repository(targetRepositoryFile);
+            ConfigurationStore configStore = new RepositoryConfigurationStore(writeableRepo);
             PluginInstallerGBean installer = new PluginInstallerGBean(
-                    targetRepositoryPath,
-                    targetServerPathName,
                     installedPluginsList,
+                    configManager,
+                    writeableRepo,
+                    configStore,
                     serverInstanceDatas,
-                    pluginRepositoryList, kernel,
-                    classLoader);
+                    serverInfo,
+                    threadPool,
+                    artifactManager,
+                    persistentConfigurationLists,
+                    pluginRepositoryList,
+                    classLoader,
+                    false);
 
             installer.install(pluginList, localSourceRepository, true, null, null, downloadPoller);
         } finally {
@@ -1140,7 +1197,7 @@
             if (result == null) {
                 throw new IllegalArgumentException("Could not find " + configID + " in any
repo: " + repos);
             }
-            // Check if the result is already in server's repository
+            // Check if the result is already in server's repository (maybe the actual configId
is not what was expected?)
             if (configManager.getArtifactResolver().queryArtifacts(result.getArtifact()).length
> 0) {
                 String msg = "Not downloading " + configID + ". Query for " + configID +
" resulted in " + result.getArtifact()
                         + " which is already available in server's repository.";
@@ -1234,6 +1291,12 @@
             // Download the dependencies
             parentStack.push(configID);
             if (instance == null) {
+                PluginType currentPlugin = getPluginMetadata(configID);
+                if (currentPlugin != null) {
+                    instance = currentPlugin.getPluginArtifact().get(0);
+                }
+            }
+            if (instance == null) {
                 //no plugin metadata, guess with something else
                 Dependency[] dependencies = data == null ? getDependencies(writeableRepo,
configID) : getDependencies(data);
                 for (Dependency dep : dependencies) {
@@ -1265,12 +1328,6 @@
                 return;
             }
         }
-        if (instance == null) {
-            PluginType currentPlugin = getPluginMetadata(configID);
-            if (currentPlugin != null) {
-                instance = currentPlugin.getPluginArtifact().get(0);
-            }
-        }
         if (instance != null) {
             installedArtifacts.add(configID);
             try {

Modified: geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/ServerInstanceData.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/ServerInstanceData.java?rev=708650&r1=708649&r2=708650&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/ServerInstanceData.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/ServerInstanceData.java
Tue Oct 28 12:48:22 2008
@@ -45,6 +45,17 @@
     private String configSubstitutionsPrefix = "org.apache.geronimo.config.substitution.";
     private String artifactAliasesFile = "var/config/artifact_aliases.properties";
 
+    public ServerInstanceData() {
+    }
+
+    public ServerInstanceData(ServerInstanceData toCopy) {
+        this.name = toCopy.getName();
+        this.attributeManagerFrom = toCopy.getAttributeManagerFrom();
+        this.configFile = toCopy.getConfigFile();
+        this.configSubstitutionsFile = toCopy.getConfigSubstitutionsFile();
+        this.configSubstitutionsPrefix = toCopy.getConfigSubstitutionsPrefix();
+        this.artifactAliasesFile = toCopy.getArtifactAliasesFile();
+    }
 
     public String getName() {
         return name;

Modified: geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/serverinfo/BasicServerInfo.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/serverinfo/BasicServerInfo.java?rev=708650&r1=708649&r2=708650&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/serverinfo/BasicServerInfo.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/serverinfo/BasicServerInfo.java
Tue Oct 28 12:48:22 2008
@@ -47,6 +47,7 @@
         baseURI = null;
         baseServerURI = null;
     }
+
     public BasicServerInfo(String defaultBaseDirectory) throws Exception {
         this(defaultBaseDirectory, true);
     }
@@ -84,6 +85,14 @@
         System.setProperty("java.io.tmpdir", tmpDir);
     }
 
+    public BasicServerInfo(String baseDirectory, String serverName) {
+        this.baseDirectory = baseDirectory;
+        this.base = new File(baseDirectory);
+        this.baseURI = base.toURI();
+        this.baseServerURI = baseURI.resolve(serverName);
+        this.baseServer = new File(baseServerURI);
+    }
+
     /**
      * Resolves an abstract pathname to an absolute one.
      *



Mime
View raw message