geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r378707 [2/2] - in /geronimo/branches/configid: applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/handlers/ configs/client-system/src/plan/ configs/geronimo-gbean-deployer/src/plan/ configs/j2ee-system/src/plan/ ...
Date Sat, 18 Feb 2006 08:58:02 GMT
Modified: geronimo/branches/configid/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java?rev=378707&r1=378706&r2=378707&view=diff
==============================================================================
--- geronimo/branches/configid/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
(original)
+++ geronimo/branches/configid/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
Sat Feb 18 00:57:59 2006
@@ -79,6 +79,8 @@
 import org.apache.geronimo.jetty.JettyWebAppContext;
 import org.apache.geronimo.kernel.GBeanNotFoundException;
 import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.config.ConfigurationStore;
+import org.apache.geronimo.kernel.config.ConfigurationModuleType;
 import org.apache.geronimo.kernel.repository.Repository;
 import org.apache.geronimo.naming.deployment.ENCConfigBuilder;
 import org.apache.geronimo.naming.deployment.GBeanResourceEnvironmentBuilder;
@@ -372,8 +374,35 @@
         return jettyWebApp;
     }
 
-    public void installModule(JarFile earFile, EARContext earContext, Module module) throws
DeploymentException {
-        JettyWebAppType jettyWebApp = (JettyWebAppType) module.getVendorDD();
+    public void installModule(JarFile earFile, EARContext earContext, Module module, ConfigurationStore
configurationStore) throws DeploymentException {
+        EARContext moduleContext;
+        if (module.isStandAlone()) {
+            moduleContext = earContext;
+        } else {
+            Environment environment = module.getEnvironment();
+            File configurationDir = configurationStore.createNewConfigurationDir(environment.getConfigId());
+
+            // construct the app client deployment context... this is the same class used
by the ear context
+            try {
+
+                moduleContext = new EARContext(configurationDir,
+                        environment,
+                        ConfigurationModuleType.WAR,
+                        kernel,
+                        null,//????
+                        earContext.getTransactionContextManagerObjectName(),
+                        earContext.getConnectionTrackerObjectName(),
+                        earContext.getTransactedTimerName(),
+                        earContext.getNonTransactedTimerName(),
+                        earContext.getCORBAGBeanObjectName(),
+                        earContext.getRefContext());
+            } catch (Exception e) {
+                DeploymentUtil.recursiveDelete(configurationDir);
+                throw new DeploymentException("Could not create a deployment context for
the app client", e);
+            }
+
+        }
+        module.setEarContext(moduleContext);
 
         try {
             URI baseDir = URI.create(module.getTargetPath() + "/");
@@ -385,16 +414,16 @@
                 ZipEntry entry = (ZipEntry) entries.nextElement();
                 URI targetPath = baseDir.resolve(new URI(null, entry.getName(), null));
                 if (entry.getName().equals("WEB-INF/web.xml")) {
-                    earContext.addFile(targetPath, module.getOriginalSpecDD());
+                    moduleContext.addFile(targetPath, module.getOriginalSpecDD());
                 } else {
-                    earContext.addFile(targetPath, warFile, entry);
+                    moduleContext.addFile(targetPath, warFile, entry);
                 }
             }
 
             // add the manifest classpath entries declared in the war to the class loader
             // we have to explicitly add these since we are unpacking the web module
             // and the url class loader will not pick up a manifest from an unpacked dir
-            earContext.addManifestClassPath(warFile, URI.create(module.getTargetPath()));
+            moduleContext.addManifestClassPath(warFile, URI.create(module.getTargetPath()));
 
         } catch (IOException e) {
             throw new DeploymentException("Problem deploying war", e);
@@ -405,12 +434,13 @@
     }
 
     public void initContext(EARContext earContext, Module module, ClassLoader cl) throws
DeploymentException {
+        EARContext moduleContext = module.getEarContext();
         WebAppType webApp = (WebAppType) module.getSpecDD();
         MessageDestinationType[] messageDestinations = webApp.getMessageDestinationArray();
         JettyWebAppType gerWebApp = (JettyWebAppType) module.getVendorDD();
         GerMessageDestinationType[] gerMessageDestinations = gerWebApp.getMessageDestinationArray();
 
-        ENCConfigBuilder.registerMessageDestinations(earContext.getRefContext(), module.getName(),
messageDestinations, gerMessageDestinations);
+        ENCConfigBuilder.registerMessageDestinations(moduleContext.getRefContext(), module.getName(),
messageDestinations, gerMessageDestinations);
         if((webApp.getSecurityConstraintArray().length > 0 || webApp.getSecurityRoleArray().length
> 0) &&
                 !gerWebApp.isSetSecurityRealmName()) {
             throw new DeploymentException("web.xml includes security elements but Geronimo
deployment plan is not provided or does not contain <security-realm-name> element necessary
to configure security accordingly.");
@@ -420,12 +450,13 @@
                 throw new DeploymentException("You have supplied a security configuration
for web app " + module.getName() + " but no security-realm-name to allow login");
             }
             SecurityConfiguration securityConfiguration = SecurityBuilder.buildSecurityConfiguration(gerWebApp.getSecurity(),
cl);
-            earContext.setSecurityConfiguration(securityConfiguration);
+            moduleContext.setSecurityConfiguration(securityConfiguration);
         }
     }
 
     public void addGBeans(EARContext earContext, Module module, ClassLoader cl) throws DeploymentException
{
-        J2eeContext earJ2eeContext = earContext.getJ2eeContext();
+        EARContext moduleContext = module.getEarContext();
+        J2eeContext earJ2eeContext = moduleContext.getJ2eeContext();
         J2eeContext moduleJ2eeContext = J2eeContextImpl.newModuleContextFromApplication(earJ2eeContext,
NameFactory.WEB_MODULE, module.getName());
         WebModule webModule = (WebModule) module;
 
@@ -437,10 +468,10 @@
             contextPriorityClassLoader = jettyWebApp.getContextPriorityClassloader();
         }
         // construct the webClassLoader
-        ClassLoader webClassLoader = getWebClassLoader(earContext, webModule, cl, contextPriorityClassLoader);
+        ClassLoader webClassLoader = getWebClassLoader(moduleContext, webModule, cl, contextPriorityClassLoader);
 
         GbeanType[] gbeans = jettyWebApp.getGbeanArray();
-        ServiceConfigBuilder.addGBeans(gbeans, webClassLoader, moduleJ2eeContext, earContext);
+        ServiceConfigBuilder.addGBeans(gbeans, webClassLoader, moduleJ2eeContext, moduleContext);
 
         ObjectName webModuleName = null;
         try {
@@ -451,13 +482,13 @@
 
         UserTransaction userTransaction = new OnlineUserTransaction();
         //this may add to the web classpath with enhanced classes.
-        Map compContext = buildComponentContext(earContext, webModule, webApp, jettyWebApp,
userTransaction, webClassLoader);
+        Map compContext = buildComponentContext(moduleContext, webModule, webApp, jettyWebApp,
userTransaction, webClassLoader);
 
         GBeanData webModuleData = new GBeanData(webModuleName, JettyWebAppContext.GBEAN_INFO);
         try {
-            webModuleData.setReferencePattern("J2EEServer", earContext.getServerObjectName());
-            if (!earContext.getJ2EEApplicationName().equals("null")) {
-                webModuleData.setReferencePattern("J2EEApplication", earContext.getApplicationObjectName());
+            webModuleData.setReferencePattern("J2EEServer", moduleContext.getServerObjectName());
+            if (!moduleContext.getJ2EEApplicationName().equals("null")) {
+                webModuleData.setReferencePattern("J2EEApplication", moduleContext.getApplicationObjectName());
             }
 
             webModuleData.setAttribute("deploymentDescriptor", module.getOriginalSpecDD());
@@ -478,7 +509,7 @@
             //Add dependencies on managed connection factories and ejbs in this app
             //This is overkill, but allows for people not using java:comp context (even though
we don't support it)
             //and sidesteps the problem of circular references between ejbs.
-            Set dependencies = findGBeanDependencies(earContext);
+            Set dependencies = findGBeanDependencies(moduleContext);
             webModuleData.getDependencies().addAll(dependencies);
 
             webModuleData.setAttribute("componentContext", compContext);
@@ -487,13 +518,13 @@
             webModuleData.setAttribute("webClassPath", webModule.getWebClasspath());
             // unsharableResources, applicationManagedSecurityResources
             GBeanResourceEnvironmentBuilder rebuilder = new GBeanResourceEnvironmentBuilder(webModuleData);
-            ENCConfigBuilder.setResourceEnvironment(earContext, webModule.getModuleURI(),
rebuilder, webApp.getResourceRefArray(), jettyWebApp.getResourceRefArray());
+            ENCConfigBuilder.setResourceEnvironment(moduleContext, webModule.getModuleURI(),
rebuilder, webApp.getResourceRefArray(), jettyWebApp.getResourceRefArray());
 
             webModuleData.setAttribute("contextPath", webModule.getContextRoot());
             webModuleData.setAttribute("contextPriorityClassLoader", Boolean.valueOf(contextPriorityClassLoader));
 
-            webModuleData.setReferencePattern("TransactionContextManager", earContext.getTransactionContextManagerObjectName());
-            webModuleData.setReferencePattern("TrackedConnectionAssociator", earContext.getConnectionTrackerObjectName());
+            webModuleData.setReferencePattern("TransactionContextManager", moduleContext.getTransactionContextManagerObjectName());
+            webModuleData.setReferencePattern("TrackedConnectionAssociator", moduleContext.getConnectionTrackerObjectName());
             webModuleData.setReferencePattern("JettyContainer", jettyContainerObjectName);
             //stuff that jetty used to do
             if (webApp.getDisplayNameArray().length > 0) {
@@ -614,7 +645,7 @@
                 }
 
             }
-            earContext.addGBean(webModuleData);
+            moduleContext.addGBean(webModuleData);
 
             // Make sure that servlet mappings point to available servlets
             ServletType[] servletTypes = webApp.getServletArray();
@@ -659,7 +690,7 @@
                     ObjectName defaultFilterObjectName = NameFactory.getWebComponentName(null,
null, null, null, filterName, NameFactory.WEB_FILTER, moduleJ2eeContext);
                     filterGBeanData.setName(defaultFilterObjectName);
                     filterGBeanData.setReferencePattern("JettyServletRegistration", webModuleName);
-                    earContext.addGBean(filterGBeanData);
+                    moduleContext.addGBean(filterGBeanData);
                     //add a mapping to /*
 
                     GBeanData filterMappingGBeanData = new GBeanData(JettyFilterMapping.GBEAN_INFO);
@@ -677,7 +708,7 @@
                     filterMappingGBeanData.setAttribute("includeDispatch", Boolean.TRUE);
                     filterMappingGBeanData.setAttribute("errorDispatch", Boolean.FALSE);
                     filterMappingGBeanData.setReferencePattern("Filter", defaultFilterObjectName);
-                    earContext.addGBean(filterMappingGBeanData);
+                    moduleContext.addGBean(filterMappingGBeanData);
                 }
             }
 
@@ -702,7 +733,7 @@
 //                    }
 //                    filterMappingGBeanData.setName(defaultFilterMappingObjectName);
 //                    filterMappingGBeanData.setReferencePattern("JettyFilterMappingRegistration",
webModuleName);
-//                    earContext.addGBean(filterMappingGBeanData);
+//                    moduleContext.addGBean(filterMappingGBeanData);
 //                }
 //            }
 
@@ -752,7 +783,7 @@
                 filterMappingData.setAttribute("errorDispatch", Boolean.valueOf(error));
                 ObjectName filterObjectName = NameFactory.getWebComponentName(null, null,
null, null, filterName, NameFactory.WEB_FILTER, moduleJ2eeContext);
                 filterMappingData.setReferencePattern("Filter", filterObjectName);
-                earContext.addGBean(filterMappingData);
+                moduleContext.addGBean(filterMappingData);
             }
 
             FilterType[] filterArray = webApp.getFilterArray();
@@ -771,7 +802,7 @@
                 }
                 filterData.setAttribute("initParams", initParams);
                 filterData.setReferencePattern("JettyServletRegistration", webModuleName);
-                earContext.addGBean(filterData);
+                moduleContext.addGBean(filterData);
             }
 
             //add default servlets
@@ -785,17 +816,17 @@
                     Set defaultServletMappings = new HashSet((Collection) servletGBeanData.getAttribute("servletMappings"));
                     defaultServletMappings.removeAll(knownServletMappings);
                     servletGBeanData.setAttribute("servletMappings", defaultServletMappings);
-                    earContext.addGBean(servletGBeanData);
+                    moduleContext.addGBean(servletGBeanData);
                 }
             }
 
             //set up servlet gbeans.
             Map portMap = webModule.getPortMap();
 
-            addServlets(webModuleName, webModule.getModuleFile(), servletTypes, servletMappings,
securityRoles, rolePermissions, portMap, webClassLoader, moduleJ2eeContext, earContext);
+            addServlets(webModuleName, webModule.getModuleFile(), servletTypes, servletMappings,
securityRoles, rolePermissions, portMap, webClassLoader, moduleJ2eeContext, moduleContext);
 
             if (jettyWebApp.isSetSecurityRealmName()) {
-                if (earContext.getSecurityConfiguration() == null) {
+                if (moduleContext.getSecurityConfiguration() == null) {
                      throw new DeploymentException("You have specified a <security-realm-name>
for the webapp " + webModuleName + " but no <security> configuration (role mapping)
is supplied in the Geronimo plan for the web application (or the Geronimo plan for the EAR
if the web app is in an EAR)");
                 }
                 String securityRealmName = jettyWebApp.getSecurityRealmName().trim();
@@ -820,11 +851,11 @@
                 }
                 webModuleData.setAttribute("checkedPermissions", checkedPermissions);
 
-                earContext.addSecurityContext(policyContextID, componentPermissions);
-                DefaultPrincipal defaultPrincipal = earContext.getSecurityConfiguration().getDefaultPrincipal();
+                moduleContext.addSecurityContext(policyContextID, componentPermissions);
+                DefaultPrincipal defaultPrincipal = moduleContext.getSecurityConfiguration().getDefaultPrincipal();
                 webModuleData.setAttribute("defaultPrincipal", defaultPrincipal);
 
-                webModuleData.setReferencePattern("RoleDesignateSource", earContext.getJaccManagerName());
+                webModuleData.setReferencePattern("RoleDesignateSource", moduleContext.getJaccManagerName());
             }
         } catch (DeploymentException de) {
             throw de;

Modified: geronimo/branches/configid/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/JettyModuleBuilderTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/JettyModuleBuilderTest.java?rev=378707&r1=378706&r2=378707&view=diff
==============================================================================
--- geronimo/branches/configid/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/JettyModuleBuilderTest.java
(original)
+++ geronimo/branches/configid/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/JettyModuleBuilderTest.java
Sat Feb 18 00:57:59 2006
@@ -31,7 +31,6 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import java.util.HashMap;
 import javax.management.MalformedObjectNameException;
 import javax.management.ObjectName;
 import javax.naming.Reference;
@@ -121,6 +120,7 @@
         UnpackedJarFile jarFile = new UnpackedJarFile(path);
         Module module = builder.createModule(null, jarFile);
         EARContext earContext = createEARContext(outputPath, defaultEnvironment);
+        module.setEarContext(earContext);
         ObjectName serverName = earContext.getServerObjectName();
         GBeanData server = new GBeanData(serverName, J2EEServerImpl.GBEAN_INFO);
         start(server);
@@ -362,7 +362,7 @@
             return null;
         }
 
-        public void install(ConfigurationData configurationData, File source) throws IOException,
InvalidConfigException {
+        public void install(ConfigurationData configurationData) throws IOException, InvalidConfigException
{
         }
 
         public void uninstall(Artifact configID) throws NoSuchConfigException, IOException
{
@@ -398,7 +398,7 @@
             return null;
         }
 
-        public File createNewConfigurationDir() {
+        public File createNewConfigurationDir(Artifact configId) {
             return null;
         }
 

Modified: geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationData.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationData.java?rev=378707&r1=378706&r2=378707&view=diff
==============================================================================
--- geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationData.java
(original)
+++ geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationData.java
Sat Feb 18 00:57:59 2006
@@ -24,6 +24,7 @@
 import java.util.Collections;
 import java.util.LinkedHashSet;
 import java.util.List;
+import java.io.File;
 
 /**
  * @version $Rev$ $Date$
@@ -53,12 +54,15 @@
 
     private final Environment environment;
 
-    public ConfigurationData(ConfigurationModuleType moduleType, LinkedHashSet classPath,
List gbeans, List childConfigurations, Environment environment) {
+    private final File configurationDir;
+
+    public ConfigurationData(ConfigurationModuleType moduleType, LinkedHashSet classPath,
List gbeans, List childConfigurations, Environment environment, File configurationDir) {
         this.moduleType = moduleType;
         this.classPath = classPath;
         this.gbeans = gbeans;
         this.childConfigurations = childConfigurations;
         this.environment = environment;
+        this.configurationDir = configurationDir;
     }
 
     public Artifact getId() {
@@ -83,6 +87,10 @@
 
     public Environment getEnvironment() {
         return environment;
+    }
+
+    public File getConfigurationDir() {
+        return configurationDir;
     }
 
 }

Modified: geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationStore.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationStore.java?rev=378707&r1=378706&r2=378707&view=diff
==============================================================================
--- geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationStore.java
(original)
+++ geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationStore.java
Sat Feb 18 00:57:59 2006
@@ -48,11 +48,10 @@
      * Move the unpacked configuration directory into this store
      *
      * @param configurationData the configuration data
-     * @param source the directory which contains a contiguration
      * @throws IOException if the direcotyr could not be moved into the store
      * @throws InvalidConfigException if there is a configuration problem within the source
direcotry
      */
-    void install(ConfigurationData configurationData, File source) throws IOException, InvalidConfigException;
+    void install(ConfigurationData configurationData) throws IOException, InvalidConfigException;
 
     /**
      * Removes a configuration from the store
@@ -94,7 +93,7 @@
      */
     List listConfigurations();
 
-    File createNewConfigurationDir();
+    File createNewConfigurationDir(Artifact configId);
 
     /**
      * Locate the classpath component for the supplied uri in the given artifact

Modified: geronimo/branches/configid/modules/service-builder/src/java/org/apache/geronimo/deployment/service/EnvironmentBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/service-builder/src/java/org/apache/geronimo/deployment/service/EnvironmentBuilder.java?rev=378707&r1=378706&r2=378707&view=diff
==============================================================================
--- geronimo/branches/configid/modules/service-builder/src/java/org/apache/geronimo/deployment/service/EnvironmentBuilder.java
(original)
+++ geronimo/branches/configid/modules/service-builder/src/java/org/apache/geronimo/deployment/service/EnvironmentBuilder.java
Sat Feb 18 00:57:59 2006
@@ -103,6 +103,10 @@
 
     public static void mergeEnvironments(Environment environment, Environment additionalEnvironment)
{
         if (additionalEnvironment != null) {
+            //TODO merge configIds??
+            if (environment.getConfigId() == null){
+                environment.setConfigId(additionalEnvironment.getConfigId());
+            }
             environment.addProperties(additionalEnvironment.getProperties());
             environment.addImports(additionalEnvironment.getImports());
             environment.addDependencies(additionalEnvironment.getDependencies());

Modified: geronimo/branches/configid/modules/service-builder/src/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/service-builder/src/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java?rev=378707&r1=378706&r2=378707&view=diff
==============================================================================
--- geronimo/branches/configid/modules/service-builder/src/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java
(original)
+++ geronimo/branches/configid/modules/service-builder/src/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java
Sat Feb 18 00:57:59 2006
@@ -41,6 +41,7 @@
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.config.ConfigurationData;
 import org.apache.geronimo.kernel.config.ConfigurationModuleType;
+import org.apache.geronimo.kernel.config.ConfigurationStore;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.Environment;
 import org.apache.geronimo.kernel.repository.MissingDependencyException;
@@ -79,7 +80,7 @@
     private static final Map xmlReferenceBuilderMap = new HashMap();
     private Map attrRefMap;
     private Map refRefMap;
-    private static final QName SERVICE_QNAME = new QName("http://geronimo.apache.org/xml/ns/deployment-1.0",
"configuration");
+    private static final QName SERVICE_QNAME = ConfigurationDocument.type.getDocumentElementName();
 
 
     public ServiceConfigBuilder(Environment defaultEnvironment, Repository repository) {
@@ -147,29 +148,25 @@
         }
     }
 
-    public URI getConfigurationID(Object plan, JarFile module) throws IOException, DeploymentException
{
+    public Artifact getConfigurationID(Object plan, JarFile module) throws IOException, DeploymentException
{
         ConfigurationType configType = (ConfigurationType) plan;
         EnvironmentType environmentType = configType.getEnvironment();
+        //TODO default id based on name?
         Environment environment = EnvironmentBuilder.buildEnvironment(environmentType, defaultEnvironment);
-        Artifact configId = environment.getConfigId();
-        try {
-            return configId.toURI();
-        } catch (URISyntaxException e) {
-            throw new DeploymentException("Invalid configId " + configId, e);
-        }
+        return environment.getConfigId();
     }
 
-    public ConfigurationData buildConfiguration(Object plan, JarFile unused, File outfile)
throws IOException, DeploymentException {
+    public ConfigurationData buildConfiguration(Object plan, JarFile unused, ConfigurationStore
configurationStore) throws IOException, DeploymentException {
         ConfigurationType configType = (ConfigurationType) plan;
 
-        return buildConfiguration(configType, outfile);
+        return buildConfiguration(configType, configurationStore);
     }
 
-    public ConfigurationData buildConfiguration(ConfigurationType configurationType, File
outfile) throws DeploymentException, IOException {
+    public ConfigurationData buildConfiguration(ConfigurationType configurationType, ConfigurationStore
configurationStore) throws DeploymentException, IOException {
 
         Environment environment = EnvironmentBuilder.buildEnvironment(configurationType.getEnvironment(),
defaultEnvironment);
-
-
+        Artifact configId = environment.getConfigId();
+        File outfile = configurationStore.createNewConfigurationDir(configId);
         DeploymentContext context = new DeploymentContext(outfile, environment, ConfigurationModuleType.SERVICE,
kernel);
         ClassLoader cl = context.getClassLoader(repository);
 

Modified: geronimo/branches/configid/modules/system/src/java/org/apache/geronimo/system/configuration/ExecutableConfigurationUtil.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/system/src/java/org/apache/geronimo/system/configuration/ExecutableConfigurationUtil.java?rev=378707&r1=378706&r2=378707&view=diff
==============================================================================
--- geronimo/branches/configid/modules/system/src/java/org/apache/geronimo/system/configuration/ExecutableConfigurationUtil.java
(original)
+++ geronimo/branches/configid/modules/system/src/java/org/apache/geronimo/system/configuration/ExecutableConfigurationUtil.java
Sat Feb 18 00:57:59 2006
@@ -48,7 +48,8 @@
     private ExecutableConfigurationUtil() {
     }
 
-    public static void createExecutableConfiguration(ConfigurationData configurationData,
Manifest manifest, File configurationDir, File destinationFile) throws IOException, InvalidConfigException
{
+    public static void createExecutableConfiguration(ConfigurationData configurationData,
Manifest manifest, File destinationFile) throws IOException, InvalidConfigException {
+        File configurationDir = configurationData.getConfigurationDir();
         JarOutputStream out = null;
         try {
             byte[] buffer = new byte[4096];

Modified: geronimo/branches/configid/modules/system/src/java/org/apache/geronimo/system/configuration/LocalConfigStore.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/system/src/java/org/apache/geronimo/system/configuration/LocalConfigStore.java?rev=378707&r1=378706&r2=378707&view=diff
==============================================================================
--- geronimo/branches/configid/modules/system/src/java/org/apache/geronimo/system/configuration/LocalConfigStore.java
(original)
+++ geronimo/branches/configid/modules/system/src/java/org/apache/geronimo/system/configuration/LocalConfigStore.java
Sat Feb 18 00:57:59 2006
@@ -208,7 +208,13 @@
         }
     }
 
-    public File createNewConfigurationDir() {
+    /**
+     * we don't use the configId to locate the target directory.  Some callers send null.
+     *
+     * @param configId
+     * @return directory to put the new configuration into, unpacked.
+     */
+    public File createNewConfigurationDir(Artifact configId) {
         // loop until we find a directory that doesn't alredy exist
         // this can happen when a deployment fails (leaving an bad directory)
         // and the server reboots without saving out the index.propreties file
@@ -222,6 +228,9 @@
             configurationDir = new File(rootDir, newId);
         } while (configurationDir.exists());
         configurationDir.mkdir();
+        // create the meta-inf dir
+        File metaInf = new File(configurationDir, "META-INF");
+        metaInf.mkdirs();
         return configurationDir;
     }
 
@@ -234,7 +243,8 @@
     }
 
     public GBeanData install2(URL source) throws IOException, InvalidConfigException {
-        File configurationDir = createNewConfigurationDir();
+        //this  implementation doesn't use the artifactId to locate the target
+        File configurationDir = createNewConfigurationDir(null);
 
         InputStream is = source.openStream();
         try {
@@ -265,7 +275,8 @@
         return config;
     }
 
-    public void install(ConfigurationData configurationData, File source) throws IOException,
InvalidConfigException {
+    public void install(ConfigurationData configurationData) throws IOException, InvalidConfigException
{
+        File source = configurationData.getConfigurationDir();
         if (!source.isDirectory()) {
             throw new InvalidConfigException("Source must be a directory: source=" + source);
         }

Modified: geronimo/branches/configid/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java?rev=378707&r1=378706&r2=378707&view=diff
==============================================================================
--- geronimo/branches/configid/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
(original)
+++ geronimo/branches/configid/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
Sat Feb 18 00:57:59 2006
@@ -67,6 +67,7 @@
 import org.apache.geronimo.j2ee.j2eeobjectnames.J2eeContextImpl;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.kernel.StoredObject;
+import org.apache.geronimo.kernel.config.ConfigurationStore;
 import org.apache.geronimo.kernel.repository.Repository;
 import org.apache.geronimo.naming.deployment.ENCConfigBuilder;
 import org.apache.geronimo.naming.deployment.GBeanResourceEnvironmentBuilder;
@@ -315,7 +316,7 @@
         return tomcatWebApp;
     }
 
-    public void installModule(JarFile earFile, EARContext earContext, Module module) throws
DeploymentException {
+    public void installModule(JarFile earFile, EARContext earContext, Module module, ConfigurationStore
configurationStore) throws DeploymentException {
         TomcatWebAppType tomcatWebApp = (TomcatWebAppType) module.getVendorDD();
 
         try {

Modified: geronimo/branches/configid/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java?rev=378707&r1=378706&r2=378707&view=diff
==============================================================================
--- geronimo/branches/configid/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java
(original)
+++ geronimo/branches/configid/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java
Sat Feb 18 00:57:59 2006
@@ -500,7 +500,7 @@
             return null;
         }
 
-        public void install(ConfigurationData configurationData, File source) throws IOException,
InvalidConfigException {
+        public void install(ConfigurationData configurationData) throws IOException, InvalidConfigException
{
         }
 
         public void uninstall(Artifact configID) throws NoSuchConfigException, IOException
{
@@ -536,7 +536,7 @@
             return null;
         }
 
-        public File createNewConfigurationDir() {
+        public File createNewConfigurationDir(Artifact configId) {
             return null;
         }
 

Modified: geronimo/branches/configid/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenConfigStore.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenConfigStore.java?rev=378707&r1=378706&r2=378707&view=diff
==============================================================================
--- geronimo/branches/configid/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenConfigStore.java
(original)
+++ geronimo/branches/configid/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenConfigStore.java
Sat Feb 18 00:57:59 2006
@@ -104,7 +104,7 @@
         return repository.contains(configID);
     }
 
-    public File createNewConfigurationDir() {
+    public File createNewConfigurationDir(Artifact configId) {
         try {
             File tmpFile = File.createTempFile("package", ".tmpdir");
             tmpFile.delete();
@@ -112,6 +112,9 @@
             if (!tmpFile.isDirectory()) {
                 return null;
             }
+            // create the meta-inf dir
+            File metaInf = new File(tmpFile, "META-INF");
+            metaInf.mkdirs();
             return tmpFile;
         } catch (IOException e) {
             // doh why can't I throw this?
@@ -128,13 +131,14 @@
         throw new UnsupportedOperationException();
     }
 
-    public void install(ConfigurationData configurationData, File source) throws IOException,
InvalidConfigException {
+    public void install(ConfigurationData configurationData) throws IOException, InvalidConfigException
{
+        File source = configurationData.getConfigurationDir();
         if (!source.isDirectory()) {
             throw new InvalidConfigException("Source must be a directory: source=" + source);
         }
         Artifact configId = configurationData.getId();
         File targetFile =repository.getLocation(configId);
-        ExecutableConfigurationUtil.createExecutableConfiguration(configurationData, null,
source, targetFile);
+        ExecutableConfigurationUtil.createExecutableConfiguration(configurationData, null,
targetFile);
     }
 
     public void uninstall(Artifact configID) throws NoSuchConfigException, IOException {

Modified: geronimo/branches/configid/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PlanProcessor.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PlanProcessor.java?rev=378707&r1=378706&r2=378707&view=diff
==============================================================================
--- geronimo/branches/configid/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PlanProcessor.java
(original)
+++ geronimo/branches/configid/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PlanProcessor.java
Sat Feb 18 00:57:59 2006
@@ -167,22 +167,14 @@
                 Environment oldEnvironment = null;
                 if (childName.equals(ENVIRONMENT_QNAME)) {
                     XmlObject xmlObject = xmlCursor.getObject();
-                    System.out.println("Expected EnvironmentType, actual: " + xmlObject.getClass().getName());
-                    System.out.println(xmlObject.toString());
                     EnvironmentType environmentType = (EnvironmentType) xmlObject.copy().changeType(EnvironmentType.type);
                     oldEnvironment = EnvironmentBuilder.buildEnvironment(environmentType);
                     xmlCursor.removeXml();
                 } else {
-                    xmlCursor.beginElement(ENVIRONMENT_QNAME);
-                    XmlCursor element = EnvironmentType.Factory.newInstance().newCursor();
-                    try {
-                        element.copyXmlContents(xmlCursor);
-                    } finally {
-                        element.dispose();
-                    }
+                    oldEnvironment = new Environment();
                 }
 
-                   org.apache.geronimo.kernel.repository.Artifact configId = new org.apache.geronimo.kernel.repository.Artifact(groupId,
artifactId, version, "car");
+                org.apache.geronimo.kernel.repository.Artifact configId = new org.apache.geronimo.kernel.repository.Artifact(groupId,
artifactId, version, "car");
 
                 Collection imports = toArtifacts(IMPORT_PROPERTY);
 //                Collection includes = toArtifacts(INCLUDE_PROPERTY);



Mime
View raw message