geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r1221393 - in /geronimo/server/trunk/framework: buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/ buildsupport/car-maven-plugin/src/main/resources/META-INF/maven/ modules/geronimo-plugin/src/main/java/org/apa...
Date Tue, 20 Dec 2011 18:05:15 GMT
Author: djencks
Date: Tue Dec 20 18:05:14 2011
New Revision: 1221393

URL: http://svn.apache.org/viewvc?rev=1221393&view=rev
Log:
GERONIMO-6240 Fix the InstallModulesMojo to work without osgi or a kernel

Modified:
    geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/InstallModulesMojo.java
    geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/resources/META-INF/maven/plugin.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/configuration/LocalAttributeManager.java

Modified: geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/InstallModulesMojo.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/InstallModulesMojo.java?rev=1221393&r1=1221392&r2=1221393&view=diff
==============================================================================
--- geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/InstallModulesMojo.java
(original)
+++ geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/InstallModulesMojo.java
Tue Dec 20 18:05:14 2011
@@ -64,7 +64,7 @@ public class InstallModulesMojo extends 
     /**
      * The location of the target repository.
      *
-     * @parameter expression="repository"
+     * @parameter expression="system"
      * @required
      */
     private String targetRepositoryPath = null;
@@ -145,16 +145,9 @@ public class InstallModulesMojo extends 
      */
     private Set installedArtifacts = new HashSet();
 
-    //TODO OSGI figure out what this might be
-    private BundleContext bundleContext;
 
     public void execute() throws MojoExecutionException, MojoFailureException {
-        // boot one ourselves
-        try {
-            bundleContext = getFramework().getBundleContext();
-        } catch (BundleException e) {
-            throw new MojoExecutionException("Could not create osqi framework", e);
-        }
+
         getDependencies(project, false);
         Maven2RepositoryAdapter.ArtifactLookup lookup = new ArtifactLookupImpl();
         SourceRepository sourceRepo = new Maven2RepositoryAdapter(dependencyArtifacts, lookup);
@@ -177,15 +170,9 @@ public class InstallModulesMojo extends 
         DownloadResults downloadPoller = new DownloadResults();
         String targetServerPath = targetServerDirectory.getAbsolutePath();
 
-        Kernel kernel = null;
-        try {
-            kernel = new BasicKernel("Assembly", bundleContext);
-        } catch (Exception e) {
-            throw new MojoExecutionException("Could not create kernel", e);
-        }
         PluginRepositoryList pluginRepoList = new PluginRepositoryDownloader(Collections.singletonMap(localRepo,
(String[]) null), true);
         try {
-            PluginInstallerGBean installer = new PluginInstallerGBean(targetRepositoryPath,
targetServerPath, installedPluginsList, servers, pluginRepoList, kernel, bundleContext);
+            PluginInstallerGBean installer = new PluginInstallerGBean(targetRepositoryPath,
targetServerPath, installedPluginsList, servers, pluginRepoList, null, null);
             installer.install(pluginList, sourceRepo, true, null, null, downloadPoller);
             if (overrides != null) {
                 for (Override override: this.overrides) {
@@ -195,13 +182,6 @@ public class InstallModulesMojo extends 
             }
         } catch (Exception e) {
             throw new MojoExecutionException("Could not use plugin installer bean", e);
-        } finally {
-            kernel.shutdown();            
-            try {
-                bundleContext.getBundle().stop();
-            } catch (BundleException e) {
-                // ignore
-            }
         }
         getLog().info("Installed plugins: ");
         for (Artifact artifact: downloadPoller.getInstalledConfigIDs()) {

Modified: geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/resources/META-INF/maven/plugin.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/resources/META-INF/maven/plugin.xml?rev=1221393&r1=1221392&r2=1221393&view=diff
==============================================================================
--- geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/resources/META-INF/maven/plugin.xml
(original)
+++ geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/resources/META-INF/maven/plugin.xml
Tue Dec 20 18:05:14 2011
@@ -430,7 +430,7 @@ if none specified, plugin will install a
         <session implementation="org.apache.maven.execution.MavenSession">${session}</session>
         <encoding implementation="java.lang.String" default-value="${project.build.sourceEncoding}">${encoding}</encoding>
         <localRepository implementation="org.apache.maven.artifact.repository.ArtifactRepository">${localRepository}</localRepository>
-        <targetRepositoryPath implementation="java.lang.String">repository</targetRepositoryPath>
+        <targetRepositoryPath implementation="java.lang.String">system</targetRepositoryPath>
       </configuration>
       <requirements>
         <requirement>

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=1221393&r1=1221392&r2=1221393&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 Dec 20 18:05:14 2011
@@ -73,6 +73,7 @@ import org.apache.geronimo.kernel.config
 import org.apache.geronimo.kernel.config.NoSuchConfigException;
 import org.apache.geronimo.kernel.config.NoSuchStoreException;
 import org.apache.geronimo.kernel.config.PersistentConfigurationList;
+import org.apache.geronimo.kernel.config.SimpleConfigurationManager;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.ArtifactManager;
 import org.apache.geronimo.kernel.repository.DefaultArtifactManager;
@@ -330,16 +331,11 @@ public class PluginInstallerGBean implem
                                                                   Map<String, org.apache.geronimo.system.plugin.ServerInstance>
servers) throws IOException {
         for (ServerInstance instance : servers.values()) {
             if ("default".equals(instance.getServerName())) {
-                KernelConfigurationManager configurationManager = new KernelConfigurationManager(kernel,
-                        Collections.singleton(targetStore),
-                        instance.getAttributeStore(),
-                        (PersistentConfigurationList) instance.getAttributeStore(),
-                        artifactManager,
+                ConfigurationManager configurationManager = new SimpleConfigurationManager(Collections.singleton(targetStore),
                         instance.getArtifactResolver(),
                         Collections.<ListableRepository>singleton(targetRepo),
-                        null,
-                        bundleContext);
-                configurationManager.setOnline(false);
+                        null);
+//                configurationManager.setOnline(false);
                 return configurationManager;
             }
         }

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=1221393&r1=1221392&r2=1221393&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 Dec 20 18:05:14 2011
@@ -22,6 +22,7 @@ package org.apache.geronimo.system.plugi
 
 import java.io.IOException;
 import java.util.Collections;
+import java.util.HashMap;
 import java.util.Map;
 
 import org.apache.geronimo.gbean.GBeanInfo;
@@ -116,20 +117,22 @@ public class ServerInstanceData {
         //TODO osgi LocalPluginAttributeStore?
         PluginAttributeStore attributeStore;
         if (attributeManagerFrom == null) {
-            attributeStore = new LocalAttributeManager();
-            //TODO configure osgi
-//            getConfigFile(),
-//                    getConfigSubstitutionsFile(),
-//                    getConfigSubstitutionsPrefix(),
-//                    false,
-//                    serverInfo);
-//            ((LocalAttributeManager)attributeStore).load();
+            LocalAttributeManager attributeStorex = new LocalAttributeManager();
+            attributeStorex.setServerInfo(serverInfo);
+            Map<String, Object> config = new HashMap<String, Object>();
+            config.put(LocalAttributeManager.CONFIG_FILE_KEY, getConfigFile());
+            config.put(LocalAttributeManager.CONFIG_SUBSTITUTIONS_FILE_KEY, getConfigSubstitutionsFile());
+            config.put(LocalAttributeManager.PREFIX_KEY, getConfigSubstitutionsPrefix());
+            config.put(LocalAttributeManager.READ_ONLY_KEY, false);
+            attributeStorex.activate(config);
+            attributeStorex.load();
+            attributeStore = attributeStorex;
         } else {
             ServerInstance shared = serverInstances.get(attributeManagerFrom);
             if (shared == null) {
                 throw new IllegalArgumentException("Incorrect configuration: no server instance
named '" + attributeManagerFrom + "' defined before being shared from '" + name + "'");
             }
-            attributeStore = (LocalPluginAttributeStore) shared.getAttributeStore();
+            attributeStore = shared.getAttributeStore();
         }
         return new ServerInstance(name, attributeStore, geronimoArtifactResolver);
     }

Modified: geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java?rev=1221393&r1=1221392&r2=1221393&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java
Tue Dec 20 18:05:14 2011
@@ -94,11 +94,11 @@ public class LocalAttributeManager imple
     private ServerInfo serverInfo;
 
     @Property(value = "var/config/config.xml")
-    static final String CONFIG_FILE_KEY = ".configFile";
+    public static final String CONFIG_FILE_KEY = ".configFile";
     private String configFile;
 
     @Property(value = "var/config/config-substitutions.properties")
-    static final String CONFIG_SUBSTITUTIONS_FILE_KEY = ".configSubstitutionsFile";
+    public static final String CONFIG_SUBSTITUTIONS_FILE_KEY = ".configSubstitutionsFile";
     private String configSubstitutionsFileName;
 
 
@@ -130,14 +130,14 @@ public class LocalAttributeManager imple
             + "# For example, try PortOffset=10 \n").getBytes();
 
     @Property(value = "org.apache.geronimo.config.substitution.")
-    static final String PREFIX_KEY = ".configSubstitutionsPrefix";
+    public static final String PREFIX_KEY = ".configSubstitutionsPrefix";
 
     @Property(boolValue = false)
-    static final String READ_ONLY_KEY = "readOnly";
+    public static final String READ_ONLY_KEY = "readOnly";
     private boolean readOnly;
 
     @Property(value = "default")
-    static final String SERVER_NAME_KEY = "serverName";
+    public static final String SERVER_NAME_KEY = "serverName";
     private String serverName;
 
 /*



Mime
View raw message