geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r355300 - in /geronimo/branches/1.0/plugins/geronimo-packaging-plugin: ./ src/java/org/apache/geronimo/plugin/packaging/
Date Fri, 09 Dec 2005 01:31:48 GMT
Author: djencks
Date: Thu Dec  8 17:31:46 2005
New Revision: 355300

URL: http://svn.apache.org/viewcvs?rev=355300&view=rev
Log:
merge of GERONIMO-1312, make packagin plugin able to deploy app clients

Added:
    geronimo/branches/1.0/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackagingCommandLine.java
      - copied unchanged from r355299, geronimo/trunk/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackagingCommandLine.java
Modified:
    geronimo/branches/1.0/plugins/geronimo-packaging-plugin/project.xml
    geronimo/branches/1.0/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenConfigStore.java
    geronimo/branches/1.0/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilder.java
    geronimo/branches/1.0/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilderShell.java

Modified: geronimo/branches/1.0/plugins/geronimo-packaging-plugin/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.0/plugins/geronimo-packaging-plugin/project.xml?rev=355300&r1=355299&r2=355300&view=diff
==============================================================================
--- geronimo/branches/1.0/plugins/geronimo-packaging-plugin/project.xml (original)
+++ geronimo/branches/1.0/plugins/geronimo-packaging-plugin/project.xml Thu Dec  8 17:31:46
2005
@@ -35,6 +35,15 @@
         </dependency>
 
         <dependency>
+            <groupId>geronimo</groupId>
+            <artifactId>geronimo-system</artifactId>
+            <version>1.0-SNAPSHOT</version>
+            <properties>
+                <packaging.classpath>true</packaging.classpath>
+            </properties>
+        </dependency>
+
+        <dependency>
             <groupId>cglib</groupId>
             <artifactId>cglib-nodep</artifactId>
             <version>2.1_2</version>

Modified: geronimo/branches/1.0/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenConfigStore.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.0/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenConfigStore.java?rev=355300&r1=355299&r2=355300&view=diff
==============================================================================
--- geronimo/branches/1.0/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenConfigStore.java
(original)
+++ geronimo/branches/1.0/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenConfigStore.java
Thu Dec  8 17:31:46 2005
@@ -37,6 +37,7 @@
 import org.apache.geronimo.kernel.config.ManageableAttributeStore;
 import org.apache.geronimo.kernel.repository.Repository;
 import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.system.configuration.ExecutableConfigurationUtil;
 
 /**
  * Implementation of ConfigurationStore that loads Configurations from a repository.
@@ -126,7 +127,13 @@
     }
 
     public void install(ConfigurationData configurationData, File source) throws IOException,
InvalidConfigException {
-        throw new UnsupportedOperationException();
+        if (!source.isDirectory()) {
+            throw new InvalidConfigException("Source must be a directory: source=" + source);
+        }
+        URI configId = configurationData.getId();
+        URL targetURL = repository.getURL(configId);
+        File targetFile = new File(targetURL.getPath());
+        ExecutableConfigurationUtil.createExecutableConfiguration(configurationData, null,
source, targetFile);
     }
 
     public void uninstall(URI configID) throws NoSuchConfigException, IOException {

Modified: geronimo/branches/1.0/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.0/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilder.java?rev=355300&r1=355299&r2=355300&view=diff
==============================================================================
--- geronimo/branches/1.0/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilder.java
(original)
+++ geronimo/branches/1.0/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilder.java
Thu Dec  8 17:31:46 2005
@@ -20,17 +20,19 @@
 import java.net.URI;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Set;
 import javax.management.MalformedObjectNameException;
 import javax.management.ObjectName;
 
 import org.apache.geronimo.gbean.GBeanData;
+import org.apache.geronimo.gbean.GReferenceInfo;
+import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.KernelFactory;
 import org.apache.geronimo.kernel.KernelRegistry;
 import org.apache.geronimo.kernel.config.ConfigurationManager;
 import org.apache.geronimo.kernel.config.ConfigurationManagerImpl;
 import org.apache.geronimo.kernel.config.ConfigurationUtil;
-import org.apache.geronimo.kernel.config.InvalidConfigException;
 import org.apache.log4j.BasicConfigurator;
 
 /**
@@ -89,6 +91,9 @@
         }
     }
 
+    private String repositoryClass;
+    private String configurationStoreClass;
+
     private File repository;
     private String deploymentConfigString;
     private URI[] deploymentConfig;
@@ -102,6 +107,23 @@
     private String endorsedDirs;
     private String extensionDirs;
 
+    public String getRepositoryClass() {
+        return repositoryClass;
+    }
+
+    public void setRepositoryClass(String repositoryClass) {
+        this.repositoryClass = repositoryClass;
+    }
+
+    public String getConfigurationStoreClass() {
+        return configurationStoreClass;
+    }
+
+    public void setConfigurationStoreClass(String configurationStoreClass) {
+        this.configurationStoreClass = configurationStoreClass;
+    }
+
+
     public File getRepository() {
         return repository;
     }
@@ -228,7 +250,7 @@
     }
 
     public void execute() throws Exception {
-        Kernel kernel = createKernel(repository);
+        Kernel kernel = createKernel(repository, repositoryClass, configurationStoreClass);
 
         // start the Configuration we're going to use for this deployment
         ConfigurationManager configurationManager = ConfigurationUtil.getConfigurationManager(kernel);
@@ -260,7 +282,7 @@
     /**
      * Create a Geronimo Kernel to contain the deployment configurations.
      */
-    private static synchronized Kernel createKernel(File repository) throws Exception {
+    private static synchronized Kernel createKernel(File repository, String repoClass, String
configStoreClass) throws Exception {
         // first return our cached version
         if (kernel != null) {
             return kernel;
@@ -271,13 +293,13 @@
         if (kernel != null) {
             return kernel;
         }
-        
+
         BasicConfigurator.configure();
         // boot one ourselves
         kernel = KernelFactory.newInstance().createKernel(KERNEL_NAME);
         kernel.boot();
 
-        bootDeployerSystem(kernel, repository);
+        bootDeployerSystem(kernel, repository, repoClass, configStoreClass);
 
         return kernel;
     }
@@ -287,15 +309,24 @@
      * This contains Repository and ConfigurationStore GBeans that map to
      * the local maven installation.
      */
-    private static void bootDeployerSystem(Kernel kernel, File repository) throws Exception
{
+    private static void bootDeployerSystem(Kernel kernel, File repository, String repoClass,
String configStoreClass) throws Exception {
         ClassLoader cl = PackageBuilder.class.getClassLoader();
-        GBeanData repoGBean = new GBeanData(REPOSITORY_NAME, MavenRepository.GBEAN_INFO);
+        GBeanInfo repoInfo = GBeanInfo.getGBeanInfo(repoClass, cl);
+        GBeanData repoGBean = new GBeanData(REPOSITORY_NAME, repoInfo);
         repoGBean.setAttribute("root", repository);
         kernel.loadGBean(repoGBean, cl);
         kernel.startGBean(REPOSITORY_NAME);
 
-        GBeanData storeGBean = new GBeanData(CONFIGSTORE_NAME, MavenConfigStore.GBEAN_INFO);
-        storeGBean.setReferencePattern("Repository", REPOSITORY_NAME);
+        GBeanInfo configStoreInfo = GBeanInfo.getGBeanInfo(configStoreClass, cl);
+        GBeanData storeGBean = new GBeanData(CONFIGSTORE_NAME, configStoreInfo);
+        Set refs = configStoreInfo.getReferences();
+        for (Iterator iterator = refs.iterator(); iterator.hasNext();) {
+            GReferenceInfo refInfo = (GReferenceInfo) iterator.next();
+            if ("Repository".equals(refInfo.getName())) {
+                storeGBean.setReferencePattern("Repository", REPOSITORY_NAME);
+                break;
+            }
+        }
         kernel.loadGBean(storeGBean, cl);
         kernel.startGBean(CONFIGSTORE_NAME);
 

Modified: geronimo/branches/1.0/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilderShell.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.0/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilderShell.java?rev=355300&r1=355299&r2=355300&view=diff
==============================================================================
--- geronimo/branches/1.0/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilderShell.java
(original)
+++ geronimo/branches/1.0/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilderShell.java
Thu Dec  8 17:31:46 2005
@@ -211,6 +211,8 @@
         set("setPackageFile", packageFile, File.class, packageBuilder);
         set("setPlanFile", planFile, File.class, packageBuilder);
         set("setRepository", repository, File.class, packageBuilder);
+        set("setRepositoryClass", MavenRepository.class.getName(), String.class, packageBuilder);
+        set("setConfigurationStoreClass", MavenConfigStore.class.getName(), String.class,
packageBuilder);
 
         Method m = packageBuilder.getClass().getMethod("execute", new Class[]{});
         m.invoke(packageBuilder, new Object[]{});



Mime
View raw message