geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r1096950 [2/4] - in /geronimo/server/trunk: ./ framework/buildsupport/car-maven-plugin/ framework/buildsupport/car-maven-plugin/src/main/filtered-resources/resources/etc/ framework/buildsupport/car-maven-plugin/src/main/java/org/apache/gero...
Date Tue, 26 Apr 2011 23:16:58 GMT
Modified: geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeploymentContext.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeploymentContext.java?rev=1096950&r1=1096949&r2=1096950&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeploymentContext.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeploymentContext.java Tue Apr 26 23:16:56 2011
@@ -41,11 +41,10 @@ import java.util.zip.ZipFile;
 
 import javax.xml.bind.JAXBException;
 import javax.xml.stream.XMLStreamException;
-
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.common.IllegalConfigurationException;
-import org.apache.geronimo.deployment.util.osgi.OSGiMetaDataBuilder;
 import org.apache.geronimo.deployment.util.osgi.DummyExportPackagesSelector;
+import org.apache.geronimo.deployment.util.osgi.OSGiMetaDataBuilder;
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.gbean.GAttributeInfo;
@@ -59,18 +58,15 @@ import org.apache.geronimo.kernel.GBeanN
 import org.apache.geronimo.kernel.Naming;
 import org.apache.geronimo.kernel.config.Configuration;
 import org.apache.geronimo.kernel.config.ConfigurationData;
-import org.apache.geronimo.kernel.config.ConfigurationManager;
 import org.apache.geronimo.kernel.config.ConfigurationModuleType;
 import org.apache.geronimo.kernel.config.Manifest;
 import org.apache.geronimo.kernel.config.ManifestException;
 import org.apache.geronimo.kernel.repository.Artifact;
-import org.apache.geronimo.kernel.repository.Dependency;
 import org.apache.geronimo.kernel.repository.Environment;
 import org.apache.geronimo.kernel.repository.Repository;
 import org.apache.geronimo.kernel.util.FileUtils;
 import org.apache.geronimo.kernel.util.JarUtils;
 import org.apache.geronimo.system.plugin.model.ArtifactType;
-import org.apache.geronimo.system.plugin.model.DependencyType;
 import org.apache.geronimo.system.plugin.model.PluginArtifactType;
 import org.apache.geronimo.system.plugin.model.PluginType;
 import org.apache.geronimo.system.plugin.model.PluginXmlUtil;
@@ -91,7 +87,7 @@ public class DeploymentContext {
     protected final File inPlaceConfigurationDir;
     protected final ResourceContext resourceContext;
     protected final Map<String, ConfigurationData> childConfigurationDatas = new LinkedHashMap<String, ConfigurationData>();
-    protected final ConfigurationManager configurationManager;
+//    protected final ConfigurationManager configurationManager;
     protected final Naming naming;
     protected final List<ConfigurationData> additionalDeployment = new ArrayList<ConfigurationData>();
     protected final AbstractName moduleName;
@@ -112,11 +108,10 @@ public class DeploymentContext {
                              AbstractName moduleName,
                              ConfigurationModuleType moduleType,
                              Naming naming,
-                             ConfigurationManager configurationManager,
                              Collection<Repository> repositories,
                              BundleContext bundleContext) throws DeploymentException {
         this(baseDir, inPlaceConfigurationDir, environment, moduleName, moduleType, naming,
-             createConfigurationManager(configurationManager, repositories, bundleContext), bundleContext);
+                bundleContext);
     }
 
     public DeploymentContext(File baseDir,
@@ -125,11 +120,10 @@ public class DeploymentContext {
                              AbstractName moduleName,
                              ConfigurationModuleType moduleType,
                              Naming naming,
-                             ConfigurationManager configurationManager,
                              BundleContext bundleContext) throws DeploymentException {
         if (environment == null) throw new NullPointerException("environment is null");
         if (moduleType == null) throw new NullPointerException("type is null");
-        if (configurationManager == null) throw new NullPointerException("configurationManager is null");
+//        if (configurationManager == null) throw new NullPointerException("configurationManager is null");
         if (baseDir == null) throw new NullPointerException("baseDir is null");
         if (!baseDir.exists() && !baseDir.mkdirs()) {
             throw new DeploymentException("Could not create directory for deployment context assembly: " + baseDir);
@@ -144,7 +138,7 @@ public class DeploymentContext {
         this.naming = naming;
         this.moduleType = moduleType;
         this.environment = environment;
-        this.configurationManager = createConfigurationManager(configurationManager, Collections.<Repository> emptyList(), bundleContext);
+//        this.configurationManager = createConfigurationManager(configurationManager, Collections.<Repository> emptyList(), bundleContext);
         this.bundleContext = bundleContext;
 
         if (null == inPlaceConfigurationDir) {
@@ -161,7 +155,6 @@ public class DeploymentContext {
                                 AbstractName moduleName,
                                 ConfigurationModuleType moduleType,
                                 Naming naming,
-                                ConfigurationManager configurationManager,
                                 ResourceContext resourceContext,
                                 BundleContext bundleContext) throws DeploymentException {
         if (bundleContext == null) {
@@ -173,18 +166,18 @@ public class DeploymentContext {
         this.naming = naming;
         this.moduleType = moduleType;
         this.environment = environment;
-        this.configurationManager = createConfigurationManager(configurationManager, Collections.<Repository> emptyList(), bundleContext);
+//        this.configurationManager = createConfigurationManager(configurationManager, Collections.<Repository> emptyList(), bundleContext);
         this.resourceContext = resourceContext;
         this.bundleContext = bundleContext;
     }
 
-    private static ConfigurationManager createConfigurationManager(ConfigurationManager configurationManager, Collection<Repository> repositories, BundleContext bundleContext) {
-        //TODO Hack for KernelConfigurationManager, while creating temp configuration, we have to start the configuration, but do not want to start those sub gbeans.
-        if (configurationManager instanceof DeploymentConfigurationManager) {
-            return configurationManager;
-        }
-        return new DeploymentConfigurationManager(configurationManager, repositories, bundleContext);
-    }
+//    private static ConfigurationManager createConfigurationManager(ConfigurationManager configurationManager, Collection<Repository> repositories, BundleContext bundleContext) {
+//        //TODO Hack for KernelConfigurationManager, while creating temp configuration, we have to start the configuration, but do not want to start those sub gbeans.
+//        if (configurationManager instanceof DeploymentConfigurationManager) {
+//            return configurationManager;
+//        }
+//        return new DeploymentConfigurationManager(configurationManager, repositories, bundleContext);
+//    }
 
     /**
      * call to set up the (empty) Configuration we will use to store the gbeans we add to the context. It will use a temporary BundleContext/Bundle for classloading.
@@ -204,13 +197,15 @@ public class DeploymentContext {
             JarUtils.jarDirectory(this.getConfigurationDir(), tempBundleFile);
             String location = "reference:" + tempBundleFile.toURI().toURL();
             tempBundle = bundleContext.installBundle(location);
+            configurationData.setBundle(tempBundle);
             if (BundleUtils.canStart(tempBundle)) {
                 tempBundle.start(Bundle.START_TRANSIENT);
             }
-            configurationData.setBundle(tempBundle);
-            configurationManager.loadConfiguration(configurationData);
-            configurationManager.startConfiguration(environment.getConfigId());
-            return configurationManager.getConfiguration(environment.getConfigId());
+            return new Configuration(configurationData, null);
+//            configurationData.setBundle(tempBundle);
+//            configurationManager.loadConfiguration(configurationData);
+//            configurationManager.startConfiguration(environment.getConfigId());
+//            return configurationManager.getConfiguration(environment.getConfigId());
         } catch (Exception e) {
             throw new DeploymentException("Unable to create configuration for deployment: dependencies: " + resolvedParentIds, e);
         }
@@ -273,9 +268,9 @@ public class DeploymentContext {
         return (inPlaceConfigurationDir == null) ? baseDir : inPlaceConfigurationDir;
     }
 
-    public ConfigurationManager getConfigurationManager() {
-        return configurationManager;
-    }
+//    public ConfigurationManager getConfigurationManager() {
+//        return configurationManager;
+//    }
 
     public Artifact getConfigID() {
         return environment.getConfigId();
@@ -512,12 +507,12 @@ public class DeploymentContext {
     }
 
     public void close() throws IOException, DeploymentException {
-        if (configurationManager != null && configuration != null) {
-            try {
-                configurationManager.unloadConfiguration(configuration.getId());
-            } catch (Exception ignored) {
-            }
-        }
+//        if (configurationManager != null && configuration != null) {
+//            try {
+//                configurationManager.unloadConfiguration(configuration.getId());
+//            } catch (Exception ignored) {
+//            }
+//        }
         if (tempBundle != null && BundleUtils.canUninstall(tempBundle)) {
             try {
                 tempBundle.uninstall();

Modified: geronimo/server/trunk/framework/modules/geronimo-deployment/src/test/java/org/apache/geronimo/deployment/DeploymentContextTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deployment/src/test/java/org/apache/geronimo/deployment/DeploymentContextTest.java?rev=1096950&r1=1096949&r2=1096950&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deployment/src/test/java/org/apache/geronimo/deployment/DeploymentContextTest.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-deployment/src/test/java/org/apache/geronimo/deployment/DeploymentContextTest.java Tue Apr 26 23:16:56 2011
@@ -26,12 +26,10 @@ import java.util.Map;
 import java.util.jar.JarFile;
 
 import junit.framework.TestCase;
-import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.kernel.Jsr77Naming;
 import org.apache.geronimo.kernel.config.ConfigurationData;
 import org.apache.geronimo.kernel.config.ConfigurationModuleType;
-import org.apache.geronimo.kernel.mock.MockConfigurationManager;
 import org.apache.geronimo.kernel.osgi.MockBundleContext;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.Environment;
@@ -161,7 +159,7 @@ public class DeploymentContextTest exten
         data.put(URI.create("lib1.jar"), "lib1.jar lib2.jar");
 
         ClassPathUtils.JarFileFactory factory = new MockJarFileFactory(data);
-        DeploymentContext context = new DeploymentContext(new File("."), null, new Environment(Artifact.create("test/foo/1/ear")), new AbstractName(URI.create("test/foo/1/ear?name=test")), ConfigurationModuleType.EAR, new Jsr77Naming(), new MockConfigurationManager(), bundleContext);
+        DeploymentContext context = new DeploymentContext(new File("."), null, new Environment(Artifact.create("test/foo/1/ear")), new AbstractName(URI.create("test/foo/1/ear?name=test")), ConfigurationModuleType.EAR, new Jsr77Naming(), bundleContext);
         ArrayList<String> classPathList = new ArrayList<String>();
         ClassPathUtils.getCompleteManifestClassPath(start, start.getRelativeURI(), resolutionURI, classPathList, exclusions, factory);
         assertEquals(2, classPathList.size());
@@ -177,7 +175,7 @@ public class DeploymentContextTest exten
         data.put(URI.create("lib2/lib2a.jar"), "../lib3.jar ../lib1/lib1/lib1.jar");
 
         ClassPathUtils.JarFileFactory factory = new MockJarFileFactory(data);
-        DeploymentContext context = new DeploymentContext(new File("."), null, new Environment(Artifact.create("test/foo/1/ear")), new AbstractName(URI.create("test/foo/1/ear?name=test")), ConfigurationModuleType.EAR, new Jsr77Naming(), new MockConfigurationManager(), bundleContext);
+        DeploymentContext context = new DeploymentContext(new File("."), null, new Environment(Artifact.create("test/foo/1/ear")), new AbstractName(URI.create("test/foo/1/ear?name=test")), ConfigurationModuleType.EAR, new Jsr77Naming(), bundleContext);
         ArrayList<String> classPathList = new ArrayList<String>();
         ClassPathUtils.getCompleteManifestClassPath(start, start.getRelativeURI(), resolutionURI, classPathList, exclusions, factory);
         assertEquals(4, classPathList.size());
@@ -199,7 +197,7 @@ public class DeploymentContextTest exten
         data.put(URI.create("libfolder/b.jar"), "");
 
         ClassPathUtils.JarFileFactory factory = new MockJarFileFactory(data);
-        DeploymentContext context = new DeploymentContext(new File("."), null, new Environment(Artifact.create("test/foo/1/ear")), new AbstractName(URI.create("test/foo/1/ear?name=test")), ConfigurationModuleType.EAR, new Jsr77Naming(), new MockConfigurationManager(), bundleContext);
+        DeploymentContext context = new DeploymentContext(new File("."), null, new Environment(Artifact.create("test/foo/1/ear")), new AbstractName(URI.create("test/foo/1/ear?name=test")), ConfigurationModuleType.EAR, new Jsr77Naming(), bundleContext);
         ArrayList<String> classPathList = new ArrayList<String>();
         ClassPathUtils.getCompleteManifestClassPath(start, start.getRelativeURI(), resolutionURI, classPathList, exclusions, factory);
         assertEquals(6, classPathList.size());
@@ -220,7 +218,7 @@ public class DeploymentContextTest exten
         data.put(URI.create("lib1.jar"), "lib1.jar lib2.jar");
 
         ClassPathUtils.JarFileFactory factory = new MockJarFileFactory(data);
-        DeploymentContext context = new DeploymentContext(new File("."), null, new Environment(Artifact.create("test/foo/1/ear")), new AbstractName(URI.create("test/foo/1/ear?name=test")), ConfigurationModuleType.EAR, new Jsr77Naming(), new MockConfigurationManager(), bundleContext);
+        DeploymentContext context = new DeploymentContext(new File("."), null, new Environment(Artifact.create("test/foo/1/ear")), new AbstractName(URI.create("test/foo/1/ear?name=test")), ConfigurationModuleType.EAR, new Jsr77Naming(), bundleContext);
         ArrayList<String> classPathList = new ArrayList<String>();
         ClassPathUtils.getCompleteManifestClassPath(start, start.getRelativeURI(), resolutionURI, classPathList, exclusions, factory);
         assertEquals(2, classPathList.size());
@@ -239,7 +237,7 @@ public class DeploymentContextTest exten
         data.put(URI.create("lib2/lib2a/lib2a.jar"), "../../lib3/lib3/lib3.jar ../../lib1/lib1/lib1.jar");
 
         ClassPathUtils.JarFileFactory factory = new MockJarFileFactory(data);
-        DeploymentContext context = new DeploymentContext(new File("."), null, new Environment(Artifact.create("test/foo/1/ear")), new AbstractName(URI.create("test/foo/1/ear?name=test")), ConfigurationModuleType.EAR, new Jsr77Naming(), new MockConfigurationManager(), bundleContext);
+        DeploymentContext context = new DeploymentContext(new File("."), null, new Environment(Artifact.create("test/foo/1/ear")), new AbstractName(URI.create("test/foo/1/ear?name=test")), ConfigurationModuleType.EAR, new Jsr77Naming(), bundleContext);
         ArrayList<String> classPathList = new ArrayList<String>();
         ClassPathUtils.getCompleteManifestClassPath(start, start.getRelativeURI(), resolutionURI, classPathList, exclusions, factory);
         assertEquals(4, classPathList.size());
@@ -259,7 +257,7 @@ public class DeploymentContextTest exten
         data.put(URI.create("lib2/lib2a.jar"), "../lib3.jar ../lib1/lib1/lib1.jar");
 
         ClassPathUtils.JarFileFactory factory = new MockJarFileFactory(data);
-        DeploymentContext context = new DeploymentContext(new File("."), null, new Environment(Artifact.create("test/foo/1/ear")), new AbstractName(URI.create("test/foo/1/ear?name=test")), ConfigurationModuleType.EAR, new Jsr77Naming(), new MockConfigurationManager(), bundleContext);
+        DeploymentContext context = new DeploymentContext(new File("."), null, new Environment(Artifact.create("test/foo/1/ear")), new AbstractName(URI.create("test/foo/1/ear?name=test")), ConfigurationModuleType.EAR, new Jsr77Naming(), bundleContext);
         ArrayList<String> classPathList = new ArrayList<String>();
         ClassPathUtils.getCompleteManifestClassPath(start, start.getRelativeURI(), resolutionURI, classPathList, exclusions, factory);
         assertEquals(4, classPathList.size());
@@ -281,7 +279,7 @@ public class DeploymentContextTest exten
         data.put(URI.create("ejb2.jar"), "lib3.jar lib4.jar");
 
         ClassPathUtils.JarFileFactory factory = new MockJarFileFactory(data);
-        DeploymentContext context = new DeploymentContext(new File("."), null, new Environment(Artifact.create("test/foo/1/ear")), new AbstractName(URI.create("test/foo/1/ear?name=test")), ConfigurationModuleType.EAR, new Jsr77Naming(), new MockConfigurationManager(), bundleContext);
+        DeploymentContext context = new DeploymentContext(new File("."), null, new Environment(Artifact.create("test/foo/1/ear")), new AbstractName(URI.create("test/foo/1/ear?name=test")), ConfigurationModuleType.EAR, new Jsr77Naming(), bundleContext);
         ArrayList<String> classPathList = new ArrayList<String>();
         ClassPathUtils.getCompleteManifestClassPath(start, start.getRelativeURI(), resolutionURI, classPathList, exclusions, factory);
         assertEquals(2, classPathList.size());

Modified: geronimo/server/trunk/framework/modules/geronimo-deployment/src/test/java/org/apache/geronimo/deployment/SingleFileHotDeployerTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deployment/src/test/java/org/apache/geronimo/deployment/SingleFileHotDeployerTest.java?rev=1096950&r1=1096949&r2=1096950&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deployment/src/test/java/org/apache/geronimo/deployment/SingleFileHotDeployerTest.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-deployment/src/test/java/org/apache/geronimo/deployment/SingleFileHotDeployerTest.java Tue Apr 26 23:16:56 2011
@@ -36,7 +36,6 @@ import org.apache.geronimo.kernel.config
 import org.apache.geronimo.kernel.config.LifecycleException;
 import org.apache.geronimo.kernel.config.LifecycleResults;
 import org.apache.geronimo.kernel.config.NoSuchConfigException;
-import org.apache.geronimo.kernel.config.SimpleConfigurationManager;
 import org.apache.geronimo.kernel.mock.MockConfigStore;
 import org.apache.geronimo.kernel.osgi.MockBundleContext;
 import org.apache.geronimo.kernel.repository.Artifact;
@@ -281,7 +280,7 @@ public class SingleFileHotDeployerTest e
                     null,
                     ConfigurationModuleType.CAR,
                     new Jsr77Naming(),
-                    new SimpleConfigurationManager(Collections.<ConfigurationStore>singletonList(store), artifactResolver, Collections.<Repository>emptySet(), bundleContext), bundleContext);
+                    bundleContext);
         }
     }
 

Modified: geronimo/server/trunk/framework/modules/geronimo-kernel/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/pom.xml?rev=1096950&r1=1096949&r2=1096950&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-kernel/pom.xml (original)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/pom.xml Tue Apr 26 23:16:56 2011
@@ -126,6 +126,10 @@
                 </configuration>
             </plugin>
             <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-scr-plugin</artifactId>
+            </plugin>
+            <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-antrun-plugin</artifactId>
                 <executions>

Modified: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/Configuration.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/Configuration.java?rev=1096950&r1=1096949&r2=1096950&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/Configuration.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/Configuration.java Tue Apr 26 23:16:56 2011
@@ -413,9 +413,9 @@ public class Configuration implements GB
      *
      * @return customization source for gbeans
      */
-    ManageableAttributeStore getManageableAttributeStore() {
-        return attributeStore;
-    }
+//    ManageableAttributeStore getManageableAttributeStore() {
+//        return attributeStore;
+//    }
 
     public synchronized AbstractName addGBean(String name, GBeanData gbean) throws GBeanAlreadyExistsException {
         AbstractName abstractName = gbean.getAbstractName();

Modified: geronimo/server/trunk/framework/modules/geronimo-service-builder/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-service-builder/pom.xml?rev=1096950&r1=1096949&r2=1096950&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-service-builder/pom.xml (original)
+++ geronimo/server/trunk/framework/modules/geronimo-service-builder/pom.xml Tue Apr 26 23:16:56 2011
@@ -78,10 +78,10 @@
 
     <build>
         <plugins>
-            <plugin>
-                <groupId>org.codehaus.mojo</groupId>
-                <artifactId>xmlbeans-maven-plugin</artifactId>
-            </plugin>
+            <!--<plugin>-->
+                <!--<groupId>org.codehaus.mojo</groupId>-->
+                <!--<artifactId>xmlbeans-maven-plugin</artifactId>-->
+            <!--</plugin>-->
             <plugin>
                 <groupId>org.apache.felix</groupId>
                 <artifactId>maven-bundle-plugin</artifactId>
@@ -89,26 +89,52 @@
                     <instructions>
                         <!--<_versionpolicy>[$(version;==;$(@)),$(version;+;$(@)))</_versionpolicy>-->
                         <Import-Package>
-                            org.apache.xmlbeans.impl.schema;version="2.4",
+                            javax.enterprise.deploy.*;resolution:=optional,
+                            org.apache.xmlbeans.*;resolution:=optional,
                             *
                         </Import-Package>
                         <Export-Package>
-                            org.apache.geronimo.deployment.xbeans.impl,
-                            org.apache.geronimo.deployment.javabean.xbeans.impl,
-                            org.apache.geronimo.deployment.xbeans,
-                            org.apache.geronimo.deployment.javabean.xbeans,
                             org.apache.geronimo.deployment.dconfigbean,
                             org.apache.geronimo.deployment.service,
-                            org.apache.geronimo.deployment.service.jsr88
                         </Export-Package>
-                        <_exportcontents>schemaorg_apache_xmlbeans*</_exportcontents>
-                        <DynamicImport-Package>schemaorg_apache_xmlbeans.*</DynamicImport-Package>
                     </instructions>
                 </configuration>
             </plugin>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-scr-plugin</artifactId>
+            </plugin>
 
         </plugins>
     </build>
+    <profiles>
+        <profile>
+            <id>jaxb</id>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.codehaus.mojo</groupId>
+                        <artifactId>jaxb2-maven-plugin</artifactId>
+                        <!--<version>1.3</version>-->
+                        <executions>
+                            <execution>
+                                <goals>
+                                    <goal>xjc</goal>
+                                </goals>
+                            </execution>
+                        </executions>
+                        <configuration>
+                            <schemaDirectory>src/main/xsd</schemaDirectory>
+                            <packageName>org.apache.geronimo.deployment.service.plan</packageName>
+                            <!--<schemaListFileName>src/main/xsdlist/xsdlist.txt</schemaListFileName>-->
+                            <extension>true</extension>
+                        </configuration>
+                    </plugin>
+
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
 
 </project>
 

Modified: geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/EnvironmentBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/EnvironmentBuilder.java?rev=1096950&r1=1096949&r2=1096950&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/EnvironmentBuilder.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/EnvironmentBuilder.java Tue Apr 26 23:16:56 2011
@@ -18,60 +18,37 @@
 package org.apache.geronimo.deployment.service;
 
 import java.beans.PropertyEditorSupport;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Iterator;
 import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Set;
 
-import javax.xml.namespace.QName;
-
-import org.apache.geronimo.common.DeploymentException;
-import org.apache.geronimo.common.propertyeditor.PropertyEditorException;
-import org.apache.geronimo.deployment.xbeans.ArtifactType;
-import org.apache.geronimo.deployment.xbeans.ClassFilterType;
-import org.apache.geronimo.deployment.xbeans.DependenciesType;
-import org.apache.geronimo.deployment.xbeans.EnvironmentDocument;
-import org.apache.geronimo.deployment.xbeans.EnvironmentType;
-import org.apache.geronimo.deployment.xbeans.ImportType;
-import org.apache.geronimo.deployment.xbeans.DependencyType;
+import org.apache.geronimo.deployment.service.plan.ArtifactType;
+import org.apache.geronimo.deployment.service.plan.EnvironmentType;
+import org.apache.geronimo.deployment.service.plan.ObjectFactory;
 import org.apache.geronimo.kernel.repository.Artifact;
-import org.apache.geronimo.kernel.repository.Dependency;
 import org.apache.geronimo.kernel.repository.Environment;
-import org.apache.xmlbeans.XmlException;
-import org.apache.xmlbeans.XmlObject;
-import org.apache.xmlbeans.XmlOptions;
-import org.osgi.framework.Bundle;
 
 /**
  * @version $Rev$ $Date$
  */
-public class EnvironmentBuilder extends PropertyEditorSupport implements XmlAttributeBuilder {
-    private final static QName QNAME = EnvironmentDocument.type.getDocumentElementName();
-    private final static String NAMESPACE = QNAME.getNamespaceURI();
+public class EnvironmentBuilder extends PropertyEditorSupport /*implements XmlAttributeBuilder*/ {
+//    private final static QName QNAME = EnvironmentDocument.type.getDocumentElementName();
+//    private final static String NAMESPACE = QNAME.getNamespaceURI();
 
     public static Environment buildEnvironment(EnvironmentType environmentType) {
         Environment environment = new Environment();
         if (environmentType != null) {
-            if (environmentType.isSetModuleId()) {
                 environment.setConfigId(toArtifact(environmentType.getModuleId(), null));
-            }
 
-            if (environmentType.isSetBundleActivator()) {
                 environment.setBundleActivator(trim(environmentType.getBundleActivator()));
-            }
-            for (String importPackage: environmentType.getImportPackageArray()) {
+            for (String importPackage: environmentType.getImportPackage()) {
                 environment.addImportPackage(trim(importPackage));
             }
-            for (String exportPackage: environmentType.getExportPackageArray()) {
+            for (String exportPackage: environmentType.getExportPackage()) {
                 environment.addExportPackage(trim(exportPackage));
             }
-            for (String requireBundle : environmentType.getRequireBundleArray()) {
+            for (String requireBundle : environmentType.getRequireBundle()) {
                 environment.addRequireBundle(requireBundle);
             }
-            for (String dynamicImportPackage: environmentType.getDynamicImportPackageArray()) {
+            for (String dynamicImportPackage: environmentType.getDynamicImportPackage()) {
                 environment.addDynamicImportPackage(trim(dynamicImportPackage));
             }
                         
@@ -104,52 +81,23 @@ public class EnvironmentBuilder extends 
     }
 
     public static EnvironmentType buildEnvironmentType(Environment environment) {
-        EnvironmentType environmentType = EnvironmentType.Factory.newInstance();
+        EnvironmentType environmentType = new ObjectFactory().createEnvironmentType();
         if (environment.getConfigId() != null) {
             ArtifactType configId = toArtifactType(environment.getConfigId());
             environmentType.setModuleId(configId);
         }
 
-        if (environment.getBundleActivator() != null) {
             environmentType.setBundleActivator(environment.getBundleActivator());
-        }
-        for (String bundleClassPath: environment.getBundleClassPath()) {
-            environmentType.addBundleClassPath(bundleClassPath);
-        }
-        for (String importPackage: environment.getImportPackages()) {
-            environmentType.addImportPackage(importPackage);
-        }
-        for (String exportPackage: environment.getExportPackages()) {
-            environmentType.addExportPackage(exportPackage);
-        }
-        for (String requireBundle : environment.getRequireBundles()) {
-            environmentType.addRequireBundle(requireBundle);
-        }
-        for (String dynamicImportPackage: environment.getDynamicImportPackages()) {
-            environmentType.addDynamicImportPackage(dynamicImportPackage);
-        }
+            environmentType.getBundleClassPath().addAll(environment.getBundleClassPath());
+            environmentType.getImportPackage().addAll(environment.getImportPackages());
+            environmentType.getExportPackage().addAll(environment.getExportPackages());
+            environmentType.getRequireBundle().addAll(environment.getRequireBundles());
+            environmentType.getDynamicImportPackage().addAll(environment.getDynamicImportPackages());
                 return environmentType;
     }
 
-    private static ClassFilterType toFilterType(Set filters) {
-        String[] classFilters = (String[]) filters.toArray(new String[filters.size()]);
-        ClassFilterType classFilter = ClassFilterType.Factory.newInstance();
-        classFilter.setFilterArray(classFilters);
-        return classFilter;
-    }
-
-    private static List<DependencyType> toDependencyTypes(Collection artifacts) {
-        List<DependencyType> dependencies = new ArrayList<DependencyType>();
-        for (Iterator iterator = artifacts.iterator(); iterator.hasNext();) {
-            Dependency dependency = (Dependency) iterator.next();
-            DependencyType artifactType = toDependencyType(dependency);
-            dependencies.add(artifactType);
-        }
-        return dependencies;
-    }
-
     private static ArtifactType toArtifactType(Artifact artifact) {
-        ArtifactType artifactType = ArtifactType.Factory.newInstance();
+        ArtifactType artifactType = new ObjectFactory().createArtifactType();
         fillArtifactType(artifact, artifactType);
         return artifactType;
     }
@@ -169,32 +117,6 @@ public class EnvironmentBuilder extends 
         }
     }
 
-    private static DependencyType toDependencyType(Dependency dependency) {
-        DependencyType dependencyType = DependencyType.Factory.newInstance();
-        fillArtifactType(dependency.getArtifact(), dependencyType);
-
-        org.apache.geronimo.kernel.repository.ImportType importType = dependency.getImportType();
-        if (importType == org.apache.geronimo.kernel.repository.ImportType.CLASSES) {
-            dependencyType.setImport(ImportType.CLASSES);
-        } else if (importType == org.apache.geronimo.kernel.repository.ImportType.SERVICES) {
-            dependencyType.setImport(ImportType.SERVICES);
-        }
-
-        return dependencyType;
-    }
-
-    private static Set toFilters(ClassFilterType filterType) {
-        Set filters = new HashSet();
-        if (filterType != null) {
-            String[] filterArray = filterType.getFilterArray();
-            for (int i = 0; i < filterArray.length; i++) {
-                String filter = filterArray[i].trim();
-                filters.add(filter);
-            }
-        }
-        return filters;
-    }
-
     //package level for testing
     static LinkedHashSet toArtifacts(ArtifactType[] artifactTypes) {
         LinkedHashSet artifacts = new LinkedHashSet();
@@ -206,34 +128,11 @@ public class EnvironmentBuilder extends 
         return artifacts;
     }
 
-    private static LinkedHashSet<Dependency> toDependencies(DependencyType[] dependencyArray) {
-        LinkedHashSet<Dependency> dependencies = new LinkedHashSet<Dependency>();
-        for (int i = 0; i < dependencyArray.length; i++) {
-            DependencyType artifactType = dependencyArray[i];
-            Dependency dependency = toDependency(artifactType);
-            dependencies.add(dependency);
-        }
-        return dependencies;
-    }
-
-    private static Dependency toDependency(DependencyType dependencyType) {
-        Artifact artifact = toArtifact(dependencyType, null);
-        if (ImportType.CLASSES.equals(dependencyType.getImport())) {
-            return new Dependency(artifact, org.apache.geronimo.kernel.repository.ImportType.CLASSES);
-        } else if (ImportType.SERVICES.equals(dependencyType.getImport())) {
-            return new Dependency(artifact, org.apache.geronimo.kernel.repository.ImportType.SERVICES);
-        } else if (dependencyType.getImport() == null) {
-            return new Dependency(artifact, org.apache.geronimo.kernel.repository.ImportType.ALL);
-        } else {
-            throw new IllegalArgumentException("Unknown import type: " + dependencyType.getImport());
-        }
-    }
-
     private static Artifact toArtifact(ArtifactType artifactType, String defaultType) {
-        String groupId = artifactType.isSetGroupId() ? trim(artifactType.getGroupId()) : null;
-        String type = artifactType.isSetType() ? trim(artifactType.getType()) : defaultType;
+        String groupId = trim(artifactType.getGroupId());
+        String type = trim(artifactType.getType());
         String artifactId = trim(artifactType.getArtifactId());
-        String version = artifactType.isSetVersion() ? trim(artifactType.getVersion()) : null;
+        String version = trim(artifactType.getVersion());
         return new Artifact(groupId, artifactId, version, type);
     }
 
@@ -246,54 +145,54 @@ public class EnvironmentBuilder extends 
 
 
     public String getNamespace() {
-        return NAMESPACE;
+        return null;//NAMESPACE;
     }
 
-    public Object getValue(XmlObject xmlObject, XmlObject enclosing, String type, Bundle bundle) throws DeploymentException {
-
-        EnvironmentType environmentType;
-        if (xmlObject instanceof EnvironmentType) {
-            environmentType = (EnvironmentType) xmlObject;
-        } else {
-            environmentType = (EnvironmentType) xmlObject.copy().changeType(EnvironmentType.type);
-        }
-        try {
-            XmlOptions xmlOptions = new XmlOptions();
-            xmlOptions.setLoadLineNumbers();
-            Collection errors = new ArrayList();
-            xmlOptions.setErrorListener(errors);
-            if (!environmentType.validate(xmlOptions)) {
-                throw new XmlException("Invalid deployment descriptor: " + errors + "\nDescriptor: " + environmentType.toString(), null, errors);
-            }
-        } catch (XmlException e) {
-            throw new DeploymentException(e);
-        }
-
-        return buildEnvironment(environmentType);
-    }
-
-    public String getAsText() {
-        Environment environment = (Environment) getValue();
-        EnvironmentType environmentType = buildEnvironmentType(environment);
-        XmlOptions xmlOptions = new XmlOptions();
-        xmlOptions.setSaveSyntheticDocumentElement(QNAME);
-        xmlOptions.setSavePrettyPrint();
-        return environmentType.xmlText(xmlOptions);
-    }
-
-    public void setAsText(String text) {
-        try {
-            EnvironmentDocument environmentDocument = EnvironmentDocument.Factory.parse(text);
-            EnvironmentType environmentType = environmentDocument.getEnvironment();
-            Environment environment = (Environment) getValue(environmentType, null, null, null);
-            setValue(environment);
-
-        } catch (XmlException e) {
-            throw new PropertyEditorException(e);
-        } catch (DeploymentException e) {
-            throw new PropertyEditorException(e);
-        }
-    }
+//    public Object getValue(XmlObject xmlObject, XmlObject enclosing, String type, Bundle bundle) throws DeploymentException {
+//
+//        EnvironmentType environmentType;
+//        if (xmlObject instanceof EnvironmentType) {
+//            environmentType = (EnvironmentType) xmlObject;
+//        } else {
+//            environmentType = (EnvironmentType) xmlObject.copy().changeType(EnvironmentType.type);
+//        }
+//        try {
+//            XmlOptions xmlOptions = new XmlOptions();
+//            xmlOptions.setLoadLineNumbers();
+//            Collection errors = new ArrayList();
+//            xmlOptions.setErrorListener(errors);
+//            if (!environmentType.validate(xmlOptions)) {
+//                throw new XmlException("Invalid deployment descriptor: " + errors + "\nDescriptor: " + environmentType.toString(), null, errors);
+//            }
+//        } catch (XmlException e) {
+//            throw new DeploymentException(e);
+//        }
+//
+//        return buildEnvironment(environmentType);
+//    }
+
+//    public String getAsText() {
+//        Environment environment = (Environment) getValue();
+//        EnvironmentType environmentType = buildEnvironmentType(environment);
+//        XmlOptions xmlOptions = new XmlOptions();
+//        xmlOptions.setSaveSyntheticDocumentElement(QNAME);
+//        xmlOptions.setSavePrettyPrint();
+//        return environmentType.xmlText(xmlOptions);
+//    }
+
+//    public void setAsText(String text) {
+//        try {
+//            EnvironmentDocument environmentDocument = EnvironmentDocument.Factory.parse(text);
+//            EnvironmentType environmentType = environmentDocument.getEnvironment();
+//            Environment environment = (Environment) getValue(environmentType, null, null, null);
+//            setValue(environment);
+//
+//        } catch (XmlException e) {
+//            throw new PropertyEditorException(e);
+//        } catch (DeploymentException e) {
+//            throw new PropertyEditorException(e);
+//        }
+//    }
 
 
     //This is added by hand to the xmlAttributeBuilders since it is needed to bootstrap the ServiceConfigBuilder.

Modified: geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/GBeanBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/GBeanBuilder.java?rev=1096950&r1=1096949&r2=1096950&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/GBeanBuilder.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/GBeanBuilder.java Tue Apr 26 23:16:56 2011
@@ -17,49 +17,38 @@
 
 package org.apache.geronimo.deployment.service;
 
-import java.beans.PropertyEditorManager;
 import java.util.Collection;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
-import javax.xml.namespace.QName;
-
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.deployment.DeploymentContext;
-import org.apache.geronimo.deployment.NamespaceDrivenBuilder;
-import org.apache.geronimo.deployment.xbeans.AttributeType;
-import org.apache.geronimo.deployment.xbeans.GbeanDocument;
-import org.apache.geronimo.deployment.xbeans.GbeanType;
-import org.apache.geronimo.deployment.xbeans.PatternType;
-import org.apache.geronimo.deployment.xbeans.ReferenceType;
-import org.apache.geronimo.deployment.xbeans.ReferencesType;
-import org.apache.geronimo.deployment.xbeans.ServiceDocument;
-import org.apache.geronimo.deployment.xbeans.XmlAttributeType;
-import org.apache.geronimo.deployment.xmlbeans.XmlBeansUtil;
+import org.apache.geronimo.deployment.service.plan.AttributeType;
+import org.apache.geronimo.deployment.service.plan.GbeanType;
+import org.apache.geronimo.deployment.service.plan.PatternType;
+import org.apache.geronimo.deployment.service.plan.ReferenceType;
+import org.apache.geronimo.deployment.service.plan.ReferencesType;
+import org.apache.geronimo.deployment.service.plan.XmlAttributeType;
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.GBeanData;
 import org.apache.geronimo.gbean.GBeanInfo;
-import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.GBeanInfoFactory;
 import org.apache.geronimo.gbean.MultiGBeanInfoFactory;
 import org.apache.geronimo.gbean.ReferenceMap;
 import org.apache.geronimo.kernel.GBeanAlreadyExistsException;
-import org.apache.geronimo.kernel.repository.Environment;
-import org.apache.xmlbeans.QNameSet;
-import org.apache.xmlbeans.XmlException;
-import org.apache.xmlbeans.XmlObject;
 import org.osgi.framework.Bundle;
 
 /**
  * @version $Rev$ $Date$
  */
-public class GBeanBuilder implements NamespaceDrivenBuilder {
+public class GBeanBuilder {
     protected Map attrRefMap;
     protected Map refRefMap;
     private final GBeanInfoFactory infoFactory;
-    public static final QName SERVICE_QNAME = ServiceDocument.type.getDocumentElementName();
-    private static final QName GBEAN_QNAME = GbeanDocument.type.getDocumentElementName();
-    private static final QNameSet GBEAN_QNAME_SET = QNameSet.singleton(GBEAN_QNAME);
+//    public static final QName SERVICE_QNAME = ServiceDocument.type.getDocumentElementName();
+//    private static final QName GBEAN_QNAME = GbeanDocument.type.getDocumentElementName();
+//    private static final QNameSet GBEAN_QNAME_SET = QNameSet.singleton(GBEAN_QNAME);
 
     public GBeanBuilder(Collection xmlAttributeBuilders, Collection xmlReferenceBuilders) {
         if (xmlAttributeBuilders != null) {
@@ -93,86 +82,58 @@ public class GBeanBuilder implements Nam
         return new MultiGBeanInfoFactory();
     }
 
-    public void buildEnvironment(XmlObject container, Environment environment) throws DeploymentException {
-    }
+//    public void buildEnvironment(XmlObject container, Environment environment) throws DeploymentException {
+//    }
 
-    public void build(XmlObject container, DeploymentContext applicationContext, DeploymentContext moduleContext) throws DeploymentException {
-        XmlObject[] items = container.selectChildren(GBEAN_QNAME_SET);
-        for (int i = 0; i < items.length; i++) {
-            GbeanType gbean;
-            try {
-                gbean = (GbeanType) XmlBeansUtil.typedCopy(items[i], GbeanType.type);
-            } catch (XmlException e) {
-                throw new DeploymentException("Could not validate gbean xml", e);
-            }
+    public void build(List<GbeanType> gbeans, DeploymentContext applicationContext, DeploymentContext moduleContext) throws DeploymentException {
+        for (GbeanType gbean: gbeans) {
             addGBeanData(gbean, moduleContext.getModuleName(), moduleContext.getDeploymentBundle(), moduleContext);
         }
     }
 
     private AbstractName addGBeanData(GbeanType gbean, AbstractName moduleName, Bundle bundle, DeploymentContext context) throws DeploymentException {
-        GBeanInfo gBeanInfo = infoFactory.getGBeanInfo(gbean.getClass1(), bundle);
+        GBeanInfo gBeanInfo = infoFactory.getGBeanInfo(gbean.getClazz(), bundle);
         String namePart = gbean.getName();
         String j2eeType = gBeanInfo.getJ2eeType();
         AbstractName abstractName = context.getNaming().createChildName(moduleName, namePart, j2eeType);
         SingleGBeanBuilder builder = new SingleGBeanBuilder(abstractName, gBeanInfo, bundle, context, moduleName, attrRefMap , refRefMap);
 
         // set up attributes
-        AttributeType[] attributeArray = gbean.getAttributeArray();
-        if (attributeArray != null) {
-            for (int j = 0; j < attributeArray.length; j++) {
-                builder.setAttribute(attributeArray[j].getName().trim(), attributeArray[j].getType(), attributeArray[j].getStringValue());
+            for (AttributeType attributeType: gbean.getAttribute()) {
+                builder.setAttribute(attributeType.getName().trim(), attributeType.getType(), attributeType.getValue());
             }
-        }
 
-        XmlAttributeType[] xmlAttributeArray = gbean.getXmlAttributeArray();
-        if (xmlAttributeArray != null) {
-            for (int i = 0; i < xmlAttributeArray.length; i++) {
-                XmlAttributeType xmlAttributeType = xmlAttributeArray[i];
-                String name = xmlAttributeType.getName().trim();
-                XmlObject[] anys = xmlAttributeType.selectChildren(XmlAttributeType.type.qnameSetForWildcardElements());
-                if (anys.length != 1) {
-                    throw new DeploymentException("Unexpected count of xs:any elements in xml-attribute " + anys.length + " qnameset: " + XmlAttributeType.type.qnameSetForWildcardElements());
-                }
-                builder.setXmlAttribute(name, anys[0], xmlAttributeType);
+            for (XmlAttributeType xmlAttributeType: gbean.getXmlAttribute()) {
+                String name = xmlAttributeType.getName();
+//                XmlObject[] anys = xmlAttributeType.selectChildren(XmlAttributeType.type.qnameSetForWildcardElements());
+//                if (anys.length != 1) {
+//                    throw new DeploymentException("Unexpected count of xs:any elements in xml-attribute " + anys.length + " qnameset: " + XmlAttributeType.type.qnameSetForWildcardElements());
+//                }
+                builder.setXmlAttribute(name, xmlAttributeType.getAny(), xmlAttributeType);
             }
-        }
 
         // set up all single pattern references
-        ReferenceType[] referenceArray = gbean.getReferenceArray();
-        if (referenceArray != null) {
-            for (int j = 0; j < referenceArray.length; j++) {
-                builder.setReference(referenceArray[j].getName2(), referenceArray[j], moduleName);
+            for (ReferenceType referenceType: gbean.getReference()) {
+                builder.setReference(referenceType.getRefName(), referenceType, moduleName);
             }
-        }
 
         // set up app multi-patterned references
-        ReferencesType[] referencesArray = gbean.getReferencesArray();
-        if (referencesArray != null) {
-            for (int j = 0; j < referencesArray.length; j++) {
-                builder.setReference(referencesArray[j].getName(), referencesArray[j].getPatternArray(), moduleName);
+            for (ReferencesType referencesType: gbean.getReferences()) {
+                builder.setReference(referencesType.getName(), referencesType.getPattern(), moduleName);
             }
-        }
 
-        XmlAttributeType[] xmlReferenceArray = gbean.getXmlReferenceArray();
-        if (xmlReferenceArray != null) {
-            for (int i = 0; i < xmlReferenceArray.length; i++) {
-                XmlAttributeType xmlAttributeType = xmlReferenceArray[i];
-                String name = xmlAttributeType.getName().trim();
-                XmlObject[] anys = xmlAttributeType.selectChildren(XmlAttributeType.type.qnameSetForWildcardElements());
-                if (anys.length != 1) {
-                    throw new DeploymentException("Unexpected count of xs:any elements in xml-attribute " + anys.length + " qnameset: " + XmlAttributeType.type.qnameSetForWildcardElements());
-                }
-                builder.setXmlReference(name, anys[0]);
+            for (XmlAttributeType xmlAttributeType:  gbean.getXmlReference()) {
+                String name = xmlAttributeType.getName();
+//                XmlObject[] anys = xmlAttributeType.selectChildren(XmlAttributeType.type.qnameSetForWildcardElements());
+//                if (anys.length != 1) {
+//                    throw new DeploymentException("Unexpected count of xs:any elements in xml-attribute " + anys.length + " qnameset: " + XmlAttributeType.type.qnameSetForWildcardElements());
+//                }
+                builder.setXmlReference(name, xmlAttributeType.getAny());
             }
-        }
 
-        PatternType[] dependencyArray = gbean.getDependencyArray();
-        if (dependencyArray != null) {
-            for (int i = 0; i < dependencyArray.length; i++) {
-                PatternType patternType = dependencyArray[i];
-                builder.addDependency(patternType);
+            for (PatternType dependency: gbean.getDependency()) {
+                builder.addDependency(dependency);
             }
-        }
 
         GBeanData gbeanData = builder.getGBeanData();
         try {
@@ -183,37 +144,37 @@ public class GBeanBuilder implements Nam
         return abstractName;
     }
 
-    public QNameSet getSpecQNameSet() {
-        return QNameSet.EMPTY;
-    }
-
-    public QNameSet getPlanQNameSet() {
-        return GBEAN_QNAME_SET;
-    }
-
-    public QName getBaseQName() {
-        return SERVICE_QNAME;
-    }
-
-    public static final GBeanInfo GBEAN_INFO;
-
-    static {
-        PropertyEditorManager.registerEditor(Environment.class, EnvironmentBuilder.class);
-
-        GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(GBeanBuilder.class, "ModuleBuilder");
-
-        infoBuilder.addInterface(NamespaceDrivenBuilder.class);
-
-        infoBuilder.addReference("XmlAttributeBuilders", XmlAttributeBuilder.class, "XmlAttributeBuilder");
-        infoBuilder.addReference("XmlReferenceBuilders", XmlReferenceBuilder.class, "XmlReferenceBuilder");
-
-        infoBuilder.setConstructor(new String[]{"XmlAttributeBuilders", "XmlReferenceBuilders"});
-
-        GBEAN_INFO = infoBuilder.getBeanInfo();
-    }
-
-    public static GBeanInfo getGBeanInfo() {
-        return GBEAN_INFO;
-    }
-
+//    public QNameSet getSpecQNameSet() {
+//        return QNameSet.EMPTY;
+//    }
+//
+//    public QNameSet getPlanQNameSet() {
+//        return GBEAN_QNAME_SET;
+//    }
+//
+//    public QName getBaseQName() {
+//        return SERVICE_QNAME;
+//    }
+
+//    public static final GBeanInfo GBEAN_INFO;
+//
+//    static {
+//        PropertyEditorManager.registerEditor(Environment.class, EnvironmentBuilder.class);
+//
+//        GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(GBeanBuilder.class, "ModuleBuilder");
+//
+//        infoBuilder.addInterface(NamespaceDrivenBuilder.class);
+//
+//        infoBuilder.addReference("XmlAttributeBuilders", XmlAttributeBuilder.class, "XmlAttributeBuilder");
+//        infoBuilder.addReference("XmlReferenceBuilders", XmlReferenceBuilder.class, "XmlReferenceBuilder");
+//
+//        infoBuilder.setConstructor(new String[]{"XmlAttributeBuilders", "XmlReferenceBuilders"});
+//
+//        GBEAN_INFO = infoBuilder.getBeanInfo();
+//    }
+//
+//    public static GBeanInfo getGBeanInfo() {
+//        return GBEAN_INFO;
+//    }
+//
 }

Modified: geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/JavaBeanXmlAttributeBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/JavaBeanXmlAttributeBuilder.java?rev=1096950&r1=1096949&r2=1096950&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/JavaBeanXmlAttributeBuilder.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/JavaBeanXmlAttributeBuilder.java Tue Apr 26 23:16:56 2011
@@ -25,13 +25,12 @@ import java.lang.reflect.Method;
 
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.common.propertyeditor.PropertyEditors;
-import org.apache.geronimo.deployment.javabean.xbeans.JavabeanType;
-import org.apache.geronimo.deployment.javabean.xbeans.PropertyType;
-import org.apache.geronimo.deployment.javabean.xbeans.BeanPropertyType;
+import org.apache.geronimo.deployment.service.plan.BeanPropertyType;
+import org.apache.geronimo.deployment.service.plan.JavabeanType;
+import org.apache.geronimo.deployment.service.plan.PropertyType;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.crypto.EncryptionManager;
-import org.apache.xmlbeans.XmlObject;
 import org.osgi.framework.Bundle;
 
 /**
@@ -45,15 +44,15 @@ public class JavaBeanXmlAttributeBuilder
         return NAMESPACE;
     }
 
-    public Object getValue(XmlObject xmlObject, XmlObject enclosing, String type, Bundle bundle) throws DeploymentException {
-        JavabeanType javabean = (JavabeanType) xmlObject.copy().changeType(JavabeanType.type);
+    public Object getValue(Object xmlObject, Object enclosing, String type, Bundle bundle) throws DeploymentException {
+        JavabeanType javabean = (JavabeanType) xmlObject;
         return internalGetValue(javabean, type, bundle);
     }
 
     private Object internalGetValue(JavabeanType javabean, String type, Bundle bundle) throws DeploymentException {
         String className = type;
-        if (javabean.isSetClass1()) {
-            className = javabean.getClass1();
+        if (javabean.getClazz() != null) {
+            className = javabean.getClazz();
         }
         Class clazz = null;
         try {
@@ -79,11 +78,9 @@ public class JavaBeanXmlAttributeBuilder
             throw new DeploymentException("Could not analyze java bean class", e);
         }
 
-        PropertyType[] properties = javabean.getPropertyArray();
-        for (int i = 0; i < properties.length; i++) {
-            PropertyType property = properties[i];
+        for (PropertyType property: javabean.getProperty()) {
             String propertyName = Introspector.decapitalize(property.getName());
-            String propertyString = property.getStringValue().trim();
+            String propertyString = property.getValue();
             for (int j = 0; j < propertyDescriptors.length; j++) {
                 PropertyDescriptor propertyDescriptor = propertyDescriptors[j];
                 if (propertyName.equals(propertyDescriptor.getName())) {
@@ -116,9 +113,7 @@ public class JavaBeanXmlAttributeBuilder
             }
         }
 
-        BeanPropertyType[] beanProperties = javabean.getBeanPropertyArray();
-        for (int i = 0; i < beanProperties.length; i++) {
-            BeanPropertyType beanProperty = beanProperties[i];
+        for (BeanPropertyType beanProperty: javabean.getBeanProperty()) {
             String propertyName = Introspector.decapitalize(beanProperty.getName().trim());
             JavabeanType innerBean = beanProperty.getJavabean();
             for (int j = 0; j < propertyDescriptors.length; j++) {

Modified: geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/JavaBeanXmlAttributeEditor.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/JavaBeanXmlAttributeEditor.java?rev=1096950&r1=1096949&r2=1096950&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/JavaBeanXmlAttributeEditor.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/JavaBeanXmlAttributeEditor.java Tue Apr 26 23:16:56 2011
@@ -24,19 +24,20 @@ import java.beans.IntrospectionException
 import java.beans.Introspector;
 import java.beans.PropertyDescriptor;
 import java.beans.PropertyEditorSupport;
+import java.io.StringReader;
+import java.io.StringWriter;
 import java.lang.reflect.Method;
 
-import javax.xml.namespace.QName;
-
+import javax.xml.bind.JAXBException;
+import javax.xml.stream.XMLStreamException;
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.common.propertyeditor.PropertyEditorException;
-import org.apache.geronimo.deployment.javabean.xbeans.BeanPropertyType;
-import org.apache.geronimo.deployment.javabean.xbeans.JavabeanDocument;
-import org.apache.geronimo.deployment.javabean.xbeans.JavabeanType;
-import org.apache.geronimo.deployment.javabean.xbeans.PropertyType;
 import org.apache.geronimo.crypto.EncryptionManager;
-import org.apache.xmlbeans.XmlException;
-import org.apache.xmlbeans.XmlOptions;
+import org.apache.geronimo.deployment.service.plan.BeanPropertyType;
+import org.apache.geronimo.deployment.service.plan.JavabeanType;
+import org.apache.geronimo.deployment.service.plan.JaxbUtil;
+import org.apache.geronimo.deployment.service.plan.ObjectFactory;
+import org.apache.geronimo.deployment.service.plan.PropertyType;
 import org.osgi.framework.Bundle;
 
 /**
@@ -44,7 +45,7 @@ import org.osgi.framework.Bundle;
  * @version $Rev:$ $Date:$
  */
 public class JavaBeanXmlAttributeEditor extends PropertyEditorSupport {
-    private static final QName QNAME = JavabeanDocument.type.getDocumentElementName();
+//    private static final QName QNAME = JavabeanDocument.type.getDocumentElementName();
     private static final Class[] PRIMITIVES_CLASSES = new Class[] {String.class,
         Boolean.class,
         Character.class,
@@ -77,35 +78,39 @@ public class JavaBeanXmlAttributeEditor 
     @Override
     public void setAsText(String text) throws IllegalArgumentException {
         try {
-            JavabeanDocument document = JavabeanDocument.Factory.parse(text);
-            JavabeanType javaBeanType = document.getJavabean();
+            StringReader reader = new StringReader(text);
+            JavabeanType javaBeanType = JaxbUtil.unmarshalJavabean(reader, false);
             
             Object javabean = xmlAttributeBuilder.getValue(javaBeanType,
-                    document, javaBeanClazz.getName(),
+                    null, javaBeanClazz.getName(),
                 bundle);
 
             setValue(javabean);
-        } catch (XmlException e) {
-            throw new PropertyEditorException(e);
         } catch (DeploymentException e) {
             throw new PropertyEditorException(e);
+        } catch (JAXBException e) {
+            throw new PropertyEditorException(e);
+        } catch (XMLStreamException e) {
+            throw new PropertyEditorException(e);
         }
     }
 
     @Override
     public String getAsText() {
         JavabeanType javabeanType = getJavabeanType(getValue());
-        
-        XmlOptions xmlOptions = new XmlOptions();
-        xmlOptions.setSaveSyntheticDocumentElement(QNAME);
-        xmlOptions.setSavePrettyPrint();
-        return javabeanType.xmlText(xmlOptions);
+        StringWriter writer = new StringWriter();
+        try {
+            JaxbUtil.marshal(JavabeanType.class, javabeanType, writer);
+        } catch (JAXBException e) {
+            throw new PropertyEditorException("Could not marshal javabean " + javabeanType, e);
+        }
+        return writer.toString();
     }
 
     protected JavabeanType getJavabeanType(Object javaBean) {
-        JavabeanType javabeanType = JavabeanType.Factory.newInstance();
+        JavabeanType javabeanType = new ObjectFactory().createJavabeanType();
 
-        javabeanType.setClass1(javaBean.getClass().getName());
+        javabeanType.setClazz(javaBean.getClass().getName());
         
         PropertyDescriptor[] propertyDescriptors;
         try {
@@ -141,7 +146,7 @@ public class JavaBeanXmlAttributeEditor 
         }
         
         if (isPrimitive(value)) {
-            PropertyType propertyType = javabeanType.addNewProperty();
+            PropertyType propertyType = new ObjectFactory().createPropertyType();
             propertyType.setName(propertyDescriptor.getName());
             
             String valueAsString = value.toString();
@@ -149,13 +154,15 @@ public class JavaBeanXmlAttributeEditor 
                 valueAsString = EncryptionManager.encrypt(valueAsString);
             }
             
-            propertyType.setStringValue(valueAsString);
+            propertyType.setValue(valueAsString);
+            javabeanType.getProperty().add(propertyType);
         } else {
             JavabeanType nestedJavabeanType = getJavabeanType(value);
             
-            BeanPropertyType propertyType = javabeanType.addNewBeanProperty();
+            BeanPropertyType propertyType = new ObjectFactory().createBeanPropertyType();
             propertyType.setName(propertyDescriptor.getName());
             propertyType.setJavabean(nestedJavabeanType);
+            javabeanType.getBeanProperty().add(propertyType);
         }
     }
     

Modified: geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java?rev=1096950&r1=1096949&r2=1096950&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java Tue Apr 26 23:16:56 2011
@@ -18,115 +18,91 @@
 package org.apache.geronimo.deployment.service;
 
 import java.io.File;
+import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.IOException;
+import java.io.InputStream;
 import java.net.URI;
 import java.net.URL;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
 import java.util.jar.JarFile;
 
-import javax.xml.namespace.QName;
-
+import javax.xml.bind.JAXBException;
+import javax.xml.stream.XMLStreamException;
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Service;
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.deployment.ConfigurationBuilder;
 import org.apache.geronimo.deployment.DeploymentContext;
 import org.apache.geronimo.deployment.ModuleIDBuilder;
-import org.apache.geronimo.deployment.NamespaceDrivenBuilder;
-import org.apache.geronimo.deployment.NamespaceDrivenBuilderCollection;
-import org.apache.geronimo.deployment.xbeans.ArtifactType;
-import org.apache.geronimo.deployment.xbeans.EnvironmentType;
-import org.apache.geronimo.deployment.xbeans.ModuleDocument;
-import org.apache.geronimo.deployment.xbeans.ModuleType;
-import org.apache.geronimo.deployment.xmlbeans.XmlBeansUtil;
+import org.apache.geronimo.deployment.service.plan.ArtifactType;
+import org.apache.geronimo.deployment.service.plan.EnvironmentType;
+import org.apache.geronimo.deployment.service.plan.JaxbUtil;
+import org.apache.geronimo.deployment.service.plan.ModuleType;
 import org.apache.geronimo.gbean.AbstractName;
-import org.apache.geronimo.gbean.GBeanLifecycle;
-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.GBeanNotFoundException;
-import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.Jsr77Naming;
 import org.apache.geronimo.kernel.Naming;
 import org.apache.geronimo.kernel.config.ConfigurationAlreadyExistsException;
-import org.apache.geronimo.kernel.config.ConfigurationManager;
 import org.apache.geronimo.kernel.config.ConfigurationModuleType;
 import org.apache.geronimo.kernel.config.ConfigurationStore;
-import org.apache.geronimo.kernel.config.ConfigurationUtil;
-import org.apache.geronimo.kernel.config.SimpleConfigurationManager;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.ArtifactResolver;
 import org.apache.geronimo.kernel.repository.Environment;
-import org.apache.geronimo.kernel.repository.Repository;
 import org.apache.geronimo.kernel.util.FileUtils;
 import org.apache.geronimo.kernel.util.JarUtils;
-import org.apache.xmlbeans.XmlCursor;
-import org.apache.xmlbeans.XmlException;
-import org.apache.xmlbeans.XmlObject;
 import org.osgi.framework.BundleContext;
 
 /**
  * @version $Rev$ $Date$
  */
-@GBean(j2eeType = "ConfigBuilder")
-public class ServiceConfigBuilder implements ConfigurationBuilder, GBeanLifecycle {
-    private final Environment defaultEnvironment;
-    private final Collection<Repository> repositories;
+@Component
+@Service
+public class ServiceConfigBuilder implements ConfigurationBuilder {
 
-    private static final QName MODULE_QNAME = ModuleDocument.type.getDocumentElementName();
+//    private static final QName MODULE_QNAME = ModuleDocument.type.getDocumentElementName();
     public static final String SERVICE_MODULE = "ServiceModule";
-    private static final Map<String, String> NAMESPACE_UPDATES = new HashMap<String, String>();
-    static {
-        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/deployment", "http://geronimo.apache.org/xml/ns/deployment-1.2");
-        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/deployment-1.1", "http://geronimo.apache.org/xml/ns/deployment-1.2");
-        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/deployment/javabean", "http://geronimo.apache.org/xml/ns/deployment/javabean-1.0");
-    }
-
-    private final Naming naming;
-    private final ConfigurationManager configurationManager;
-    private final NamespaceDrivenBuilderCollection serviceBuilders;
-    private final BundleContext bundleContext;
-
-    public ServiceConfigBuilder(Environment defaultEnvironment, Collection<Repository> repositories, Naming naming, BundleContext bundleContext) {
-        this(defaultEnvironment, repositories, Collections.<NamespaceDrivenBuilder>emptyList(), naming, null, bundleContext);
-    }
-
-    public ServiceConfigBuilder(@ParamAttribute(name="defaultEnvironment")Environment defaultEnvironment,
-                                @ParamReference(name="Repository", namingType = "Repository")Collection<Repository> repositories,
-                                @ParamReference(name="ServiceBuilders", namingType = "ModuleBuilder")Collection<NamespaceDrivenBuilder> serviceBuilders,
-                                @ParamSpecial(type = SpecialAttributeType.kernel)Kernel kernel,
-                                @ParamSpecial(type = SpecialAttributeType.bundleContext) BundleContext bundleContext) throws GBeanNotFoundException {
-        this(defaultEnvironment, repositories, serviceBuilders, kernel.getNaming(), ConfigurationUtil.getConfigurationManager(kernel), bundleContext);
-    }
+//    private static final Map<String, String> NAMESPACE_UPDATES = new HashMap<String, String>();
+//    static {
+//        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/deployment", "http://geronimo.apache.org/xml/ns/deployment-1.2");
+//        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/deployment-1.1", "http://geronimo.apache.org/xml/ns/deployment-1.2");
+//        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/deployment/javabean", "http://geronimo.apache.org/xml/ns/deployment/javabean-1.0");
+//    }
+
+    private final Naming naming = new Jsr77Naming();
+//    private final NamespaceDrivenBuilder serviceBuilders = new GBeanBuilder(Collections.emptyList(), Collections.emptyList());
+    private final GBeanBuilder serviceBuilders = new GBeanBuilder(Collections.emptyList(), Collections.emptyList());
+    private BundleContext bundleContext;
+
+//    public ServiceConfigBuilder(@ParamReference(name="Repository", namingType = "Repository")Collection<Repository> repositories,
+//                                @ParamReference(name="ServiceBuilders", namingType = "ModuleBuilder")Collection<NamespaceDrivenBuilder> serviceBuilders,
+//                                @ParamSpecial(type = SpecialAttributeType.kernel)Kernel kernel,
+//                                @ParamSpecial(type = SpecialAttributeType.bundleContext) BundleContext bundleContext) throws GBeanNotFoundException {
+//        this(repositories, serviceBuilders, kernel.getNaming(), bundleContext);
+//    }
+
+//    public void doStart() throws Exception {
+//        XmlBeansUtil.registerNamespaceUpdates(NAMESPACE_UPDATES);
+//    }
+//
+//    public void doStop() {
+//        XmlBeansUtil.unregisterNamespaceUpdates(NAMESPACE_UPDATES);
+//    }
+//
+//    public void doFail() {
+//        doStop();
+//    }
+
+    public ServiceConfigBuilder() {
+//        this.naming = new Jsr77Naming();
 
-    public ServiceConfigBuilder(Environment defaultEnvironment, Collection<Repository> repositories, Collection<NamespaceDrivenBuilder> serviceBuilders, Naming naming, BundleContext bundleContext) {
-        this(defaultEnvironment, repositories, serviceBuilders, naming, null, bundleContext);
+//        this.serviceBuilders = new NamespaceDrivenBuilderCollection(serviceBuilders);
+//        this.bundleContext = bundleContext;
     }
 
-    public void doStart() throws Exception {
-        XmlBeansUtil.registerNamespaceUpdates(NAMESPACE_UPDATES);
-    }
-
-    public void doStop() {
-        XmlBeansUtil.unregisterNamespaceUpdates(NAMESPACE_UPDATES);
-    }
-
-    public void doFail() {
-        doStop();
-    }
-
-    private ServiceConfigBuilder(Environment defaultEnvironment, Collection<Repository> repositories, Collection<NamespaceDrivenBuilder> serviceBuilders, Naming naming, ConfigurationManager configurationManager, BundleContext bundleContext) {
-        this.naming = naming;
-        this.configurationManager = configurationManager;
-
-//        EnvironmentBuilder environmentBuilder = new EnvironmentBuilder();
-        this.defaultEnvironment = defaultEnvironment;
-
-        this.repositories = repositories;
-        this.serviceBuilders = new NamespaceDrivenBuilderCollection(serviceBuilders);
+    @Activate
+    public void activate(BundleContext bundleContext) {
         this.bundleContext = bundleContext;
     }
 
@@ -136,68 +112,83 @@ public class ServiceConfigBuilder implem
         }
 
         try {
-            XmlObject xmlObject;
+            ModuleType moduleType = null;
             if (planFile != null) {
-                xmlObject = XmlBeansUtil.parse(planFile.toURI().toURL(), getClass().getClassLoader());
+                InputStream in = new FileInputStream(planFile);
+                try {
+                    moduleType = JaxbUtil.unmarshalModule(in, false);
+                } catch (XMLStreamException e) {
+                     return null;
+                } catch (JAXBException e) {
+                    return null;
+                } finally {
+                    in.close();
+                }
+//                xmlObject = XmlBeansUtil.parse(planFile.toURI().toURL(), getClass().getClassLoader());
             } else {
                 URL path = JarUtils.createJarURL(jarFile, "META-INF/geronimo-service.xml");
                 try {
-                    xmlObject = XmlBeansUtil.parse(path, getClass().getClassLoader());
+                    InputStream in = path.openStream();
+                    try {
+                        moduleType = JaxbUtil.unmarshalModule(in, false);
+                    } finally {
+                        in.close();
+                    }
                 } catch (FileNotFoundException e) {
                     // It has a JAR but no plan, and nothing at META-INF/geronimo-service.xml,
                     // therefore it's not a service deployment
                     return null;
                 }
             }
-            if(xmlObject == null) {
-                return null;
-            }
-
-            XmlCursor cursor = xmlObject.newCursor();
-            try {
-                cursor.toFirstChild();
-                if (!MODULE_QNAME.equals(cursor.getName())) {
-                    return null;
-                }
-            } finally {
-                cursor.dispose();
-            }
-            ModuleDocument moduleDoc;
-            if (xmlObject instanceof ModuleDocument) {
-                moduleDoc = (ModuleDocument) xmlObject;
-            } else {
-                moduleDoc = (ModuleDocument) xmlObject.changeType(ModuleDocument.type);
-            }
-            XmlBeansUtil.validateDD(moduleDoc);
+//            if(moduleType == null) {
+//                return null;
+//            }
+
+//            XmlCursor cursor = xmlObject.newCursor();
+//            try {
+//                cursor.toFirstChild();
+//                if (!MODULE_QNAME.equals(cursor.getName())) {
+//                    return null;
+//                }
+//            } finally {
+//                cursor.dispose();
+//            }
+//            ModuleDocument moduleDoc;
+//            if (xmlObject instanceof ModuleDocument) {
+//                moduleDoc = (ModuleDocument) xmlObject;
+//            } else {
+//                moduleDoc = (ModuleDocument) xmlObject.changeType(ModuleDocument.type);
+//            }
+//            XmlBeansUtil.validateDD(moduleDoc);
             // If there's no artifact ID and we won't be able to figure one out later, use the plan file name.  Bit of a hack.
-            if(jarFile == null && (moduleDoc.getModule().getEnvironment() == null ||
-                        moduleDoc.getModule().getEnvironment().getModuleId() == null ||
-                        moduleDoc.getModule().getEnvironment().getModuleId().getArtifactId() == null)) {
-                if(moduleDoc.getModule().getEnvironment() == null) {
-                    moduleDoc.getModule().addNewEnvironment();
+            if(jarFile == null && (moduleType.getEnvironment() == null ||
+                        moduleType.getEnvironment().getModuleId() == null ||
+                        moduleType.getEnvironment().getModuleId().getArtifactId() == null)) {
+                if(moduleType.getEnvironment() == null) {
+//                    moduleType.addNewEnvironment();
                 }
-                if(moduleDoc.getModule().getEnvironment().getModuleId() == null) {
-                    moduleDoc.getModule().getEnvironment().addNewModuleId();
+                if(moduleType.getEnvironment().getModuleId() == null) {
+//                    moduleType.getEnvironment().addNewModuleId();
                 }
                 String name = planFile.getName();
                 int pos = name.lastIndexOf('.');
                 if(pos > -1) {
                     name = name.substring(0, pos);
                 }
-                moduleDoc.getModule().getEnvironment().getModuleId().setArtifactId(name);
+                moduleType.getEnvironment().getModuleId().setArtifactId(name);
             }
-            return moduleDoc.getModule();
-        } catch (XmlException e) {
+            return moduleType;
+        } catch (Exception e) {
             throw new DeploymentException("Could not parse xml in plan", e);
-        } catch (IOException e) {
-            throw new DeploymentException("no plan at " + planFile, e);
+//        } catch (IOException e) {
+//            throw new DeploymentException("no plan at " + planFile, e);
         }
     }
 
     public Artifact getConfigurationID(Object plan, JarFile module, ModuleIDBuilder idBuilder) throws IOException, DeploymentException {
         ModuleType configType = (ModuleType) plan;
         EnvironmentType environmentType = configType.getEnvironment();
-        Environment environment = EnvironmentBuilder.buildEnvironment(environmentType, defaultEnvironment);
+        Environment environment = EnvironmentBuilder.buildEnvironment(environmentType);
         idBuilder.resolve(environment, module == null ? "" : new File(module.getName()).getName(), "car");
         if(!environment.getConfigId().isResolved()) {
             throw new IllegalStateException("Service Module ID is not fully populated ("+environment.getConfigId()+")");
@@ -212,12 +203,12 @@ public class ServiceConfigBuilder implem
     }
 
     private DeploymentContext buildConfiguration(boolean inPlaceDeployment, Artifact configId, ModuleType moduleType, JarFile jar, Collection<ConfigurationStore> configurationStores, ArtifactResolver artifactResolver, ConfigurationStore targetConfigurationStore) throws DeploymentException, IOException {
-        ArtifactType type = moduleType.getEnvironment().isSetModuleId() ? moduleType.getEnvironment().getModuleId() : moduleType.getEnvironment().addNewModuleId();
+        ArtifactType type = moduleType.getEnvironment().getModuleId();
         type.setArtifactId(configId.getArtifactId());
         type.setGroupId(configId.getGroupId());
         type.setType(configId.getType());
         type.setVersion(configId.getVersion().toString());
-        Environment environment = EnvironmentBuilder.buildEnvironment(moduleType.getEnvironment(), defaultEnvironment);
+        Environment environment = EnvironmentBuilder.buildEnvironment(moduleType.getEnvironment());
         if(!environment.getConfigId().isResolved()) {
             throw new IllegalStateException("Module ID should be fully resolved by now (not "+environment.getConfigId()+")");
         }
@@ -229,10 +220,10 @@ public class ServiceConfigBuilder implem
 
         DeploymentContext context = null;
         try {
-            ConfigurationManager configurationManager = this.configurationManager;
-            if (configurationManager == null) {
-                configurationManager = new SimpleConfigurationManager(configurationStores, artifactResolver, repositories, bundleContext);
-            }
+//            ConfigurationManager configurationManager = this.configurationManager;
+//            if (configurationManager == null) {
+//                configurationManager = new SimpleConfigurationManager(configurationStores, artifactResolver, repositories, bundleContext);
+//            }
 
             AbstractName moduleName = naming.createRootName(configId, configId.toString(), SERVICE_MODULE);
             File tempDirectory = FileUtils.createTempDir();
@@ -242,14 +233,13 @@ public class ServiceConfigBuilder implem
                     moduleName,
                     ConfigurationModuleType.SERVICE,
                     naming,
-                    configurationManager,
-                    repositories, bundleContext);
+                    bundleContext);
             if(jar != null) {
                 File file = new File(jar.getName());
                 context.addIncludeAsPackedJar(URI.create(file.getName()), jar);
             }
             context.initializeConfiguration();
-            serviceBuilders.build(moduleType, context, context);
+            serviceBuilders.build(moduleType.getGbean(), context, context);
             return context;
         } catch (DeploymentException de) {
             cleanupContext(context);



Mime
View raw message