geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r1221390 [5/8] - in /geronimo/server/trunk: ./ framework/buildsupport/car-maven-plugin/ framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/ framework/buildsupport/car-maven-plugin/src/main/resources/M...
Date Tue, 20 Dec 2011 18:05:05 GMT
Modified: geronimo/server/trunk/framework/modules/geronimo-naming/src/test/java/org/apache/geronimo/gjndi/JavaCompGBeanTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-naming/src/test/java/org/apache/geronimo/gjndi/JavaCompGBeanTest.java?rev=1221390&r1=1221389&r2=1221390&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-naming/src/test/java/org/apache/geronimo/gjndi/JavaCompGBeanTest.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-naming/src/test/java/org/apache/geronimo/gjndi/JavaCompGBeanTest.java Tue Dec 20 18:04:59 2011
@@ -23,11 +23,10 @@ import org.apache.geronimo.kernel.config
 import org.apache.geronimo.kernel.config.ConfigurationManager;
 import org.apache.geronimo.kernel.config.ConfigurationUtil;
 import org.apache.geronimo.kernel.config.KernelConfigurationManager;
-import org.apache.geronimo.kernel.osgi.MockBundleContext;
 import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.kernel.repository.ArtifactManager;
 import org.apache.geronimo.kernel.repository.DefaultArtifactManager;
 import org.apache.geronimo.kernel.repository.DefaultArtifactResolver;
-import org.apache.geronimo.naming.enc.EnterpriseNamingContext;
 import org.apache.geronimo.naming.java.RootContext;
 import org.apache.geronimo.naming.java.javaURLContextFactory;
 import org.apache.xbean.naming.context.ImmutableContext;
@@ -87,22 +86,20 @@ public class JavaCompGBeanTest extends A
         super.setUp();
 
         kernel = KernelFactory.newInstance(bundleContext).createKernel("test");
-        kernel.boot();
+        kernel.boot(bundleContext);
 
-        ConfigurationData bootstrap = new ConfigurationData(new Artifact("bootstrap", "bootstrap", "", "car"), kernel.getNaming());
+        ArtifactManager artifactManager = new DefaultArtifactManager();
 
-        GBeanData artifactManagerData = bootstrap.addGBean("ArtifactManager", DefaultArtifactManager.GBEAN_INFO);
+        DefaultArtifactResolver artifactResolver = new DefaultArtifactResolver();
+        artifactResolver.setArtifactManager(artifactManager);
 
-        GBeanData artifactResolverData = bootstrap.addGBean("ArtifactResolver", DefaultArtifactResolver.class);
-        artifactResolverData.setReferencePattern("ArtifactManager", artifactManagerData.getAbstractName());
+        KernelConfigurationManager configurationManager = new KernelConfigurationManager();
+        configurationManager.setArtifactManager(artifactManager);
+        configurationManager.setArtifactResolver(artifactResolver);
+        configurationManager.setKernel(kernel);
+        configurationManager.activate(bundleContext);
 
-        GBeanData configurationManagerData = bootstrap.addGBean("ConfigurationManager", KernelConfigurationManager.class);
-        configurationManagerData.setReferencePattern("ArtifactManager", artifactManagerData.getAbstractName());
-        configurationManagerData.setReferencePattern("ArtifactResolver", artifactResolverData.getAbstractName());
-
-        ConfigurationUtil.loadBootstrapConfiguration(kernel, bootstrap, bundleContext);
-
-        ConfigurationManager configurationManager = ConfigurationUtil.getConfigurationManager(kernel);
+        artifactResolver.setConfigurationManager(configurationManager);
 
         ConfigurationData configurationData = new ConfigurationData(new Artifact("test", "test", "", "car"), kernel.getNaming());
         configurationData.setBundleContext(bundleContext);

Modified: geronimo/server/trunk/framework/modules/geronimo-naming/src/test/java/org/apache/geronimo/gjndi/KernelContextGBeanTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-naming/src/test/java/org/apache/geronimo/gjndi/KernelContextGBeanTest.java?rev=1221390&r1=1221389&r2=1221390&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-naming/src/test/java/org/apache/geronimo/gjndi/KernelContextGBeanTest.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-naming/src/test/java/org/apache/geronimo/gjndi/KernelContextGBeanTest.java Tue Dec 20 18:04:59 2011
@@ -18,20 +18,17 @@ package org.apache.geronimo.gjndi;
 
 import java.util.Collections;
 import java.util.HashMap;
-import java.util.Hashtable;
 import java.util.Iterator;
 import java.util.Map;
 
 import javax.naming.Context;
 import javax.naming.InitialContext;
-import javax.sql.DataSource;
 
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.gbean.GBeanData;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
-import org.apache.geronimo.gbean.annotation.AnnotationGBeanInfoBuilder;
 import org.apache.geronimo.gjndi.binding.ResourceBinding;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.KernelFactory;
@@ -41,11 +38,11 @@ import org.apache.geronimo.kernel.config
 import org.apache.geronimo.kernel.config.ConfigurationUtil;
 import org.apache.geronimo.kernel.config.KernelConfigurationManager;
 import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.kernel.repository.ArtifactManager;
 import org.apache.geronimo.kernel.repository.DefaultArtifactManager;
 import org.apache.geronimo.kernel.repository.DefaultArtifactResolver;
 import org.apache.geronimo.naming.java.RootContext;
 import org.apache.xbean.naming.context.ImmutableContext;
-import org.apache.xbean.naming.global.GlobalContextManager;
 
 /**
  * @version $Rev$ $Date$
@@ -178,22 +175,21 @@ public class KernelContextGBeanTest exte
         super.setUp();
 
         kernel = KernelFactory.newInstance(bundleContext).createKernel("test");
-        kernel.boot();
+        kernel.boot(bundleContext);
 
-        ConfigurationData bootstrap = new ConfigurationData(new Artifact("bootstrap", "bootstrap", "", "car"), kernel.getNaming());
+        ArtifactManager artifactManager = new DefaultArtifactManager();
 
-        GBeanData artifactManagerData = bootstrap.addGBean("ArtifactManager", DefaultArtifactManager.GBEAN_INFO);
+        DefaultArtifactResolver artifactResolver = new DefaultArtifactResolver();
+        artifactResolver.setArtifactManager(artifactManager);
 
-        GBeanData artifactResolverData = bootstrap.addGBean("ArtifactResolver", DefaultArtifactResolver.class);
-        artifactResolverData.setReferencePattern("ArtifactManager", artifactManagerData.getAbstractName());
+        KernelConfigurationManager configurationManager = new KernelConfigurationManager();
+        configurationManager.setArtifactManager(artifactManager);
+        configurationManager.setArtifactResolver(artifactResolver);
+        configurationManager.setKernel(kernel);
+        configurationManager.activate(bundleContext);
+        this.configurationManager = configurationManager;
 
-        GBeanData configurationManagerData = bootstrap.addGBean("ConfigurationManager", KernelConfigurationManager.class);
-        configurationManagerData.setReferencePattern("ArtifactManager", artifactManagerData.getAbstractName());
-        configurationManagerData.setReferencePattern("ArtifactResolver", artifactResolverData.getAbstractName());
-
-        ConfigurationUtil.loadBootstrapConfiguration(kernel, bootstrap, bundleContext);
-
-        configurationManager = ConfigurationUtil.getConfigurationManager(kernel);
+        artifactResolver.setConfigurationManager(configurationManager);
 
         configurationData = new ConfigurationData(new Artifact("test", "test", "", "car"), kernel.getNaming());
         configurationData.setBundleContext(bundleContext);

Modified: geronimo/server/trunk/framework/modules/geronimo-naming/src/test/java/org/apache/geronimo/gjndi/binding/GBeanBindingTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-naming/src/test/java/org/apache/geronimo/gjndi/binding/GBeanBindingTest.java?rev=1221390&r1=1221389&r2=1221390&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-naming/src/test/java/org/apache/geronimo/gjndi/binding/GBeanBindingTest.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-naming/src/test/java/org/apache/geronimo/gjndi/binding/GBeanBindingTest.java Tue Dec 20 18:04:59 2011
@@ -28,12 +28,11 @@ import org.apache.geronimo.kernel.config
 import org.apache.geronimo.kernel.config.ConfigurationManager;
 import org.apache.geronimo.kernel.config.ConfigurationUtil;
 import org.apache.geronimo.kernel.config.KernelConfigurationManager;
-import org.apache.geronimo.kernel.osgi.MockBundleContext;
 import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.kernel.repository.ArtifactManager;
 import org.apache.geronimo.kernel.repository.DefaultArtifactManager;
 import org.apache.geronimo.kernel.repository.DefaultArtifactResolver;
 
-import javax.naming.InitialContext;
 import javax.sql.DataSource;
 import java.util.Collections;
 import java.util.HashMap;
@@ -91,22 +90,20 @@ public class GBeanBindingTest extends Ab
         super.setUp();
 
         kernel = KernelFactory.newInstance(bundleContext).createKernel("test");
-        kernel.boot();
+        kernel.boot(bundleContext);
 
-        ConfigurationData bootstrap = new ConfigurationData(new Artifact("bootstrap", "bootstrap", "", "car"), kernel.getNaming());
+        ArtifactManager artifactManager = new DefaultArtifactManager();
 
-        GBeanData artifactManagerData = bootstrap.addGBean("ArtifactManager", DefaultArtifactManager.GBEAN_INFO);
+        DefaultArtifactResolver artifactResolver = new DefaultArtifactResolver();
+        artifactResolver.setArtifactManager(artifactManager);
 
-        GBeanData artifactResolverData = bootstrap.addGBean("ArtifactResolver", DefaultArtifactResolver.class);
-        artifactResolverData.setReferencePattern("ArtifactManager", artifactManagerData.getAbstractName());
+        KernelConfigurationManager configurationManager = new KernelConfigurationManager();
+        configurationManager.setArtifactManager(artifactManager);
+        configurationManager.setArtifactResolver(artifactResolver);
+        configurationManager.setKernel(kernel);
+        configurationManager.activate(bundleContext);
 
-        GBeanData configurationManagerData = bootstrap.addGBean("ConfigurationManager", KernelConfigurationManager.class);
-        configurationManagerData.setReferencePattern("ArtifactManager", artifactManagerData.getAbstractName());
-        configurationManagerData.setReferencePattern("ArtifactResolver", artifactResolverData.getAbstractName());
-
-        ConfigurationUtil.loadBootstrapConfiguration(kernel, bootstrap, bundleContext);
-
-        ConfigurationManager configurationManager = ConfigurationUtil.getConfigurationManager(kernel);
+        artifactResolver.setConfigurationManager(configurationManager);
 
         ConfigurationData configurationData = new ConfigurationData(new Artifact("test", "test", "", "car"), kernel.getNaming());
         configurationData.setBundleContext(bundleContext);

Modified: geronimo/server/trunk/framework/modules/geronimo-obr/src/main/java/org/apache/geronimo/obr/GeronimoOBRGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-obr/src/main/java/org/apache/geronimo/obr/GeronimoOBRGBean.java?rev=1221390&r1=1221389&r2=1221390&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-obr/src/main/java/org/apache/geronimo/obr/GeronimoOBRGBean.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-obr/src/main/java/org/apache/geronimo/obr/GeronimoOBRGBean.java Tue Dec 20 18:04:59 2011
@@ -143,6 +143,9 @@ public class GeronimoOBRGBean implements
     }
 
     public static void marshallOBRModel(Repository repo, File obrFile) throws JAXBException {
+        if (!obrFile.getParentFile().exists()) {
+            obrFile.getParentFile().mkdirs();
+        }
         JAXBContext context = JAXBContext.newInstance(Repository.class);
         Marshaller marshaller = context.createMarshaller();
         marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);

Modified: geronimo/server/trunk/framework/modules/geronimo-plugin/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-plugin/pom.xml?rev=1221390&r1=1221389&r2=1221390&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-plugin/pom.xml (original)
+++ geronimo/server/trunk/framework/modules/geronimo-plugin/pom.xml Tue Dec 20 18:04:59 2011
@@ -47,25 +47,25 @@
             <scope>test</scope>
         </dependency>
 
-        <dependency>
-            <groupId>org.apache.geronimo.bundles</groupId>
-            <artifactId>jaxb-impl</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>org.apache.geronimo.specs</groupId>
-            <artifactId>geronimo-activation_1.1_spec</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>org.apache.geronimo.bundles</groupId>
-            <artifactId>woodstox-core-asl</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>org.codehaus.woodstox</groupId>
-            <artifactId>stax2-api</artifactId>        
-        </dependency>
+        <!--<dependency>-->
+            <!--<groupId>org.apache.geronimo.bundles</groupId>-->
+            <!--<artifactId>jaxb-impl</artifactId>-->
+        <!--</dependency>-->
+
+        <!--<dependency>-->
+            <!--<groupId>org.apache.geronimo.specs</groupId>-->
+            <!--<artifactId>geronimo-activation_1.1_spec</artifactId>-->
+        <!--</dependency>-->
+
+        <!--<dependency>-->
+            <!--<groupId>org.apache.geronimo.bundles</groupId>-->
+            <!--<artifactId>woodstox-core-asl</artifactId>-->
+        <!--</dependency>-->
+
+        <!--<dependency>-->
+            <!--<groupId>org.codehaus.woodstox</groupId>-->
+            <!--<artifactId>stax2-api</artifactId>        -->
+        <!--</dependency>-->
 
         <dependency>
             <groupId>org.apache.servicemix.bundles</groupId>

Modified: geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java?rev=1221390&r1=1221389&r2=1221390&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java Tue Dec 20 18:04:59 2011
@@ -224,7 +224,7 @@ public class PluginInstallerGBean implem
         final ArtifactManager artifactManager = new DefaultArtifactManager();
 
         forceMkdir(new File(targetServerPath));
-        serverInfo = new BasicServerInfo(targetServerPath, false, null);
+        serverInfo = new BasicServerInfo(targetServerPath, false);
         File targetRepositoryFile = serverInfo.resolve(targetRepositoryPath);
         forceMkdir(targetRepositoryFile);
         writeableRepo = new Maven2Repository(targetRepositoryFile);
@@ -1873,16 +1873,16 @@ public class PluginInstallerGBean implem
             return;
         }
         if (!pluginData.getConfigSubstitution().isEmpty()) {
-            Map<String, Properties> propertiesMap = toPropertiesMap(pluginData.getConfigSubstitution());
-            for (Map.Entry<String, Properties> entry : propertiesMap.entrySet()) {
+            Map<String, Map<String, String>> propertiesMap = toPropertiesMap(pluginData.getConfigSubstitution());
+            for (Map.Entry<String, Map<String, String>> entry : propertiesMap.entrySet()) {
                 String serverName = entry.getKey();
                 ServerInstance serverInstance = getServerInstance(serverName, servers);
                 serverInstance.getAttributeStore().addConfigSubstitutions(entry.getValue());
             }
         }
         if (!pluginData.getArtifactAlias().isEmpty()) {
-            Map<String, Properties> propertiesMap = toPropertiesMap(pluginData.getArtifactAlias());
-            for (Map.Entry<String, Properties> entry : propertiesMap.entrySet()) {
+            Map<String, Map<String, String>> propertiesMap = toPropertiesMap(pluginData.getArtifactAlias());
+            for (Map.Entry<String, Map<String, String>> entry : propertiesMap.entrySet()) {
                 String serverName = entry.getKey();
                 ServerInstance serverInstance = getServerInstance(serverName, servers);
                 serverInstance.getArtifactResolver().addAliases(entry.getValue());
@@ -1898,16 +1898,16 @@ public class PluginInstallerGBean implem
         return serverInstance;
     }
 
-    private Map<String, Properties> toPropertiesMap(List<PropertyType> propertyTypes) {
-        Map<String, Properties> propertiesMap = new HashMap<String, Properties>();
+    private Map<String, Map<String, String>> toPropertiesMap(List<PropertyType> propertyTypes) {
+        Map<String, Map<String, String>> propertiesMap = new HashMap<String, Map<String, String>>();
         for (PropertyType propertyType : propertyTypes) {
             String serverName = propertyType.getServer();
-            Properties properties = propertiesMap.get(serverName);
+            Map<String, String> properties = propertiesMap.get(serverName);
             if (properties == null) {
-                properties = new Properties();
+                properties = new HashMap<String, String>();
                 propertiesMap.put(serverName, properties);
             }
-            properties.setProperty(propertyType.getKey(), propertyType.getValue());
+            properties.put(propertyType.getKey(), propertyType.getValue());
         }
         return propertiesMap;
     }

Modified: geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/ServerInstanceData.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/ServerInstanceData.java?rev=1221390&r1=1221389&r2=1221390&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/ServerInstanceData.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/ServerInstanceData.java Tue Dec 20 18:04:59 2011
@@ -30,6 +30,7 @@ import org.apache.geronimo.kernel.reposi
 import org.apache.geronimo.kernel.repository.ListableRepository;
 import org.apache.geronimo.system.configuration.LocalAttributeManager;
 import org.apache.geronimo.system.configuration.LocalPluginAttributeStore;
+import org.apache.geronimo.system.configuration.PluginAttributeStore;
 import org.apache.geronimo.system.resolver.ExplicitDefaultArtifactResolver;
 import org.apache.geronimo.system.serverinfo.ServerInfo;
 
@@ -112,14 +113,17 @@ public class ServerInstanceData {
                 artifactManager,
                 Collections.singleton(targetRepo),
                 serverInfo);
-        LocalPluginAttributeStore attributeStore;
+        //TODO osgi LocalPluginAttributeStore?
+        PluginAttributeStore attributeStore;
         if (attributeManagerFrom == null) {
-            attributeStore = new LocalAttributeManager(getConfigFile(),
-                    getConfigSubstitutionsFile(),
-                    getConfigSubstitutionsPrefix(),
-                    false,
-                    serverInfo);
-            ((LocalAttributeManager)attributeStore).load();
+            attributeStore = new LocalAttributeManager();
+            //TODO configure osgi
+//            getConfigFile(),
+//                    getConfigSubstitutionsFile(),
+//                    getConfigSubstitutionsPrefix(),
+//                    false,
+//                    serverInfo);
+//            ((LocalAttributeManager)attributeStore).load();
         } else {
             ServerInstance shared = serverInstances.get(attributeManagerFrom);
             if (shared == null) {

Modified: geronimo/server/trunk/framework/modules/geronimo-security/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-security/pom.xml?rev=1221390&r1=1221389&r2=1221390&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-security/pom.xml (original)
+++ geronimo/server/trunk/framework/modules/geronimo-security/pom.xml Tue Dec 20 18:04:59 2011
@@ -52,7 +52,14 @@
 
         <dependency>
             <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-ejb_3.1_spec</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
             <artifactId>geronimo-servlet_3.0_spec</artifactId>
+            <scope>provided</scope>
         </dependency>
 
         <dependency>
@@ -63,12 +70,13 @@
         <dependency>
             <groupId>org.apache.geronimo.specs</groupId>
             <artifactId>geronimo-saaj_1.3_spec</artifactId>
+            <scope>provided</scope>
         </dependency>
 
         <dependency>
             <groupId>org.apache.karaf.jaas</groupId>
             <artifactId>org.apache.karaf.jaas.boot</artifactId>
-            <!--<scope>provided</scope>-->
+            <scope>provided</scope>
         </dependency>
 
         <dependency>
@@ -101,6 +109,18 @@
     <build>
         <plugins>
             <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <configuration>
+                    <instructions>
+                        <Import-Package>javax.ejb;resolution:=optional,
+                        javax.servlet.http;resolution:=optional,
+                        javax.xml.soap;resolution:=optional,
+                        *</Import-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
+            <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-surefire-plugin</artifactId>
                 <configuration>

Modified: geronimo/server/trunk/framework/modules/geronimo-security/src/test/java/org/apache/geronimo/security/AbstractTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-security/src/test/java/org/apache/geronimo/security/AbstractTest.java?rev=1221390&r1=1221389&r2=1221390&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-security/src/test/java/org/apache/geronimo/security/AbstractTest.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-security/src/test/java/org/apache/geronimo/security/AbstractTest.java Tue Dec 20 18:04:59 2011
@@ -66,7 +66,7 @@ public abstract class AbstractTest exten
         bundleContext = new MockBundleContext(getClass().getClassLoader(), BASEDIR.getAbsolutePath(), null, null);
 
         kernel = KernelFactory.newInstance(bundleContext).createKernel("test.kernel");
-        kernel.boot();
+        kernel.boot(bundleContext);
 
         GBeanData gbean;
 

Modified: geronimo/server/trunk/framework/modules/geronimo-security/src/test/java/org/apache/geronimo/security/jaas/ConfigurationEntryTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-security/src/test/java/org/apache/geronimo/security/jaas/ConfigurationEntryTest.java?rev=1221390&r1=1221389&r2=1221390&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-security/src/test/java/org/apache/geronimo/security/jaas/ConfigurationEntryTest.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-security/src/test/java/org/apache/geronimo/security/jaas/ConfigurationEntryTest.java Tue Dec 20 18:04:59 2011
@@ -114,7 +114,7 @@ public class ConfigurationEntryTest exte
 //        super.setUp();
         bundleContext = new MockBundleContext(getClass().getClassLoader(), BASEDIR.getAbsolutePath(), null, null);
         kernel = KernelFactory.newInstance(bundleContext).createKernel("test.kernel");
-        kernel.boot();
+        kernel.boot(bundleContext);
 
         GBeanData gbean;
 

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=1221390&r1=1221389&r2=1221390&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-service-builder/pom.xml (original)
+++ geronimo/server/trunk/framework/modules/geronimo-service-builder/pom.xml Tue Dec 20 18:04:59 2011
@@ -33,6 +33,11 @@
     <name>Geronimo Framework, Modules :: Service Builder</name>
 
     <dependencies>
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.scr.annotations</artifactId>
+            <scope>provided</scope>
+        </dependency>
         <!-- required for base xbean definitions -->
         <!--<dependency>-->
             <!--<groupId>org.apache.geronimo.schema</groupId>-->
@@ -84,6 +89,10 @@
             </plugin>
             <plugin>
                 <groupId>org.apache.felix</groupId>
+                <artifactId>maven-scr-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
                 <artifactId>maven-bundle-plugin</artifactId>
                 <configuration>
                     <instructions>

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=1221390&r1=1221389&r2=1221390&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 Dec 20 18:04:59 2011
@@ -61,7 +61,7 @@ public class GBeanBuilder implements Nam
     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) {
+    public GBeanBuilder(Collection<XmlAttributeBuilder> xmlAttributeBuilders, Collection<XmlReferenceBuilder> xmlReferenceBuilders) {
         if (xmlAttributeBuilders != null) {
             ReferenceMap.Key key = new ReferenceMap.Key() {
 

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=1221390&r1=1221389&r2=1221390&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 Dec 20 18:04:59 2011
@@ -25,11 +25,18 @@ import java.net.URL;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.LinkedHashSet;
 import java.util.Map;
 import java.util.jar.JarFile;
 
 import javax.xml.namespace.QName;
-
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Deactivate;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.ReferenceCardinality;
+import org.apache.felix.scr.annotations.ReferencePolicy;
+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;
@@ -42,24 +49,17 @@ import org.apache.geronimo.deployment.xb
 import org.apache.geronimo.deployment.xbeans.ModuleType;
 import org.apache.geronimo.deployment.xmlbeans.XmlBeansUtil;
 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.ListableRepository;
 import org.apache.geronimo.kernel.repository.Repository;
 import org.apache.geronimo.kernel.util.FileUtils;
 import org.apache.geronimo.kernel.util.JarUtils;
@@ -71,10 +71,9 @@ 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(immediate = true, metatype = true)
+@Service
+public class ServiceConfigBuilder implements ConfigurationBuilder {
 
     private static final QName MODULE_QNAME = ModuleDocument.type.getDocumentElementName();
     public static final String SERVICE_MODULE = "ServiceModule";
@@ -85,49 +84,84 @@ public class ServiceConfigBuilder implem
         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;
+    private final Naming naming = new Jsr77Naming();
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY, policy = ReferencePolicy.DYNAMIC)
+    private ConfigurationManager configurationManager;
+
+    @Reference(name = "serviceBuilder", referenceInterface = NamespaceDrivenBuilder.class, cardinality = ReferenceCardinality.OPTIONAL_MULTIPLE, policy = ReferencePolicy.DYNAMIC)
+    private final Collection<NamespaceDrivenBuilder> serviceBuilders = new LinkedHashSet<NamespaceDrivenBuilder>();
 
-    public ServiceConfigBuilder(Environment defaultEnvironment, Collection<Repository> repositories, Naming naming, BundleContext bundleContext) {
-        this(defaultEnvironment, repositories, Collections.<NamespaceDrivenBuilder>emptyList(), naming, null, bundleContext);
+    @Reference(name = "repository", referenceInterface = Repository.class, cardinality = ReferenceCardinality.OPTIONAL_MULTIPLE, policy = ReferencePolicy.DYNAMIC)
+    private final Collection<Repository> repositories = new LinkedHashSet<Repository>();
+
+    private BundleContext bundleContext;
+//    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 doFail() {
+//        doStop();
+//    }
+
+    public ServiceConfigBuilder() {
+//        this.naming = new Jsr77Naming();
+
+//        this.serviceBuilders = new NamespaceDrivenBuilderCollection(serviceBuilders);
+//        this.bundleContext = bundleContext;
+        serviceBuilders.add(new GBeanBuilder(Collections.<XmlAttributeBuilder>emptySet(), Collections.<XmlReferenceBuilder>emptySet()));
     }
 
-    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);
+    public void setConfigurationManager(ConfigurationManager configurationManager) {
+        this.configurationManager = configurationManager;
     }
 
-    public ServiceConfigBuilder(Environment defaultEnvironment, Collection<Repository> repositories, Collection<NamespaceDrivenBuilder> serviceBuilders, Naming naming, BundleContext bundleContext) {
-        this(defaultEnvironment, repositories, serviceBuilders, naming, null, bundleContext);
+    public void unsetConfigurationManager(ConfigurationManager configurationManager) {
+        if (this.configurationManager == configurationManager) {
+            this.configurationManager = null;
+        }
     }
 
-    public void doStart() throws Exception {
-        XmlBeansUtil.registerNamespaceUpdates(NAMESPACE_UPDATES);
+    public void bindRepository(Repository repository) {
+        repositories.add(repository);
     }
 
-    public void doStop() {
-        XmlBeansUtil.unregisterNamespaceUpdates(NAMESPACE_UPDATES);
+    public void unbindRepository(Repository repository) {
+        repositories.remove(repository);
     }
 
-    public void doFail() {
-        doStop();
+    public void bindServiceBuilder(NamespaceDrivenBuilder namespaceDrivenBuilder) {
+        serviceBuilders.add(namespaceDrivenBuilder);
+    }
+
+    public void unbindServiceBuilder(NamespaceDrivenBuilder namespaceDrivenBuilder) {
+        serviceBuilders.remove(namespaceDrivenBuilder);
     }
 
-    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;
+        XmlBeansUtil.registerNamespaceUpdates(NAMESPACE_UPDATES);
+    }
+
+    @Deactivate
+    public void doStop() {
+        XmlBeansUtil.unregisterNamespaceUpdates(NAMESPACE_UPDATES);
     }
 
     public Object getDeploymentPlan(File planFile, JarFile jarFile, ModuleIDBuilder idBuilder) throws DeploymentException {
@@ -197,7 +231,7 @@ public class ServiceConfigBuilder implem
     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()+")");
@@ -217,7 +251,7 @@ public class ServiceConfigBuilder implem
         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()+")");
         }
@@ -249,7 +283,9 @@ public class ServiceConfigBuilder implem
                 context.addIncludeAsPackedJar(URI.create(file.getName()), jar);
             }
             context.initializeConfiguration();
-            serviceBuilders.build(moduleType, context, context);
+            for (NamespaceDrivenBuilder builder: serviceBuilders) {
+                builder.build(moduleType, context, context);
+            }
             return context;
         } catch (DeploymentException de) {
             cleanupContext(context);

Modified: geronimo/server/trunk/framework/modules/geronimo-service-builder/src/test/java/org/apache/geronimo/deployment/service/ServiceConfigBuilderTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-service-builder/src/test/java/org/apache/geronimo/deployment/service/ServiceConfigBuilderTest.java?rev=1221390&r1=1221389&r2=1221390&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-service-builder/src/test/java/org/apache/geronimo/deployment/service/ServiceConfigBuilderTest.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-service-builder/src/test/java/org/apache/geronimo/deployment/service/ServiceConfigBuilderTest.java Tue Dec 20 18:04:59 2011
@@ -71,7 +71,9 @@ public class ServiceConfigBuilderTest ex
         File file = new File(url.getPath());
         JarFile jar = new JarFile(file);
         assertTrue(file.exists());
-        ServiceConfigBuilder builder = new ServiceConfigBuilder(parentEnvironment, null, new Jsr77Naming(), bundleContext);
+        ServiceConfigBuilder builder = new ServiceConfigBuilder();
+        builder.activate(bundleContext);
+        //parentEnvironment, null, new Jsr77Naming(), bundleContext);
         assertNull(builder.getDeploymentPlan(null, jar, new ModuleIDBuilder()));
         jar.close();
     }

Modified: geronimo/server/trunk/framework/modules/geronimo-system/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-system/pom.xml?rev=1221390&r1=1221389&r2=1221390&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-system/pom.xml (original)
+++ geronimo/server/trunk/framework/modules/geronimo-system/pom.xml Tue Dec 20 18:04:59 2011
@@ -34,6 +34,18 @@
 
     <dependencies>
         <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.scr.annotations</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.karaf</groupId>
+            <artifactId>org.apache.karaf.main</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
             <groupId>log4j</groupId>
             <artifactId>log4j</artifactId>
             <scope>provided</scope>
@@ -95,35 +107,35 @@
         </dependency>
 
         <!-- plugin management -->
-        <dependency>
-            <groupId>org.apache.geronimo.specs</groupId>
-            <artifactId>geronimo-jaxb_2.2_spec</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>org.apache.geronimo.specs</groupId>
-            <artifactId>geronimo-stax-api_1.2_spec</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>org.apache.geronimo.bundles</groupId>
-            <artifactId>jaxb-impl</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>org.apache.geronimo.specs</groupId>
-            <artifactId>geronimo-activation_1.1_spec</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>org.apache.geronimo.bundles</groupId>
-            <artifactId>woodstox-core-asl</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>org.codehaus.woodstox</groupId>
-            <artifactId>stax2-api</artifactId>        
-        </dependency>
+        <!--<dependency>-->
+            <!--<groupId>org.apache.geronimo.specs</groupId>-->
+            <!--<artifactId>geronimo-jaxb_2.2_spec</artifactId>-->
+        <!--</dependency>-->
+
+        <!--<dependency>-->
+            <!--<groupId>org.apache.geronimo.specs</groupId>-->
+            <!--<artifactId>geronimo-stax-api_1.2_spec</artifactId>-->
+        <!--</dependency>-->
+
+        <!--<dependency>-->
+            <!--<groupId>org.apache.geronimo.bundles</groupId>-->
+            <!--<artifactId>jaxb-impl</artifactId>-->
+        <!--</dependency>-->
+
+        <!--<dependency>-->
+            <!--<groupId>org.apache.geronimo.specs</groupId>-->
+            <!--<artifactId>geronimo-activation_1.1_spec</artifactId>-->
+        <!--</dependency>-->
+
+        <!--<dependency>-->
+            <!--<groupId>org.apache.geronimo.bundles</groupId>-->
+            <!--<artifactId>woodstox-core-asl</artifactId>-->
+        <!--</dependency>-->
+
+        <!--<dependency>-->
+            <!--<groupId>org.codehaus.woodstox</groupId>-->
+            <!--<artifactId>stax2-api</artifactId>        -->
+        <!--</dependency>-->
 
         <dependency>
             <groupId>org.apache.felix</groupId>
@@ -151,6 +163,10 @@
 
         <plugins>
             <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-system/src/main/java/org/apache/geronimo/system/configuration/DependencyManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/DependencyManager.java?rev=1221390&r1=1221389&r2=1221390&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/DependencyManager.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/DependencyManager.java Tue Dec 20 18:04:59 2011
@@ -29,6 +29,7 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -36,9 +37,13 @@ import java.util.WeakHashMap;
 import java.util.concurrent.ConcurrentHashMap;
 
 import org.apache.felix.bundlerepository.RepositoryAdmin;
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Deactivate;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.ReferenceCardinality;
+import org.apache.felix.scr.annotations.ReferencePolicy;
 import org.apache.geronimo.gbean.GBeanLifecycle;
-import org.apache.geronimo.gbean.annotation.GBean;
-import org.apache.geronimo.gbean.annotation.OsgiService;
 import org.apache.geronimo.gbean.annotation.ParamReference;
 import org.apache.geronimo.gbean.annotation.ParamSpecial;
 import org.apache.geronimo.gbean.annotation.SpecialAttributeType;
@@ -74,19 +79,21 @@ import org.slf4j.LoggerFactory;
 /**
  * @version $Rev$ $Date$
  */
-@GBean
-@OsgiService
-public class DependencyManager implements SynchronousBundleListener, GBeanLifecycle {
+@Component
+public class DependencyManager implements SynchronousBundleListener {
 
     private static final Logger log = LoggerFactory.getLogger(DependencyManager.class);
 
-    private final BundleContext bundleContext;
+    private BundleContext bundleContext;
 
-    private final Collection<Repository> repositories;
+    @Reference(name = "repository", referenceInterface = Repository.class, cardinality = ReferenceCardinality.OPTIONAL_MULTIPLE, policy = ReferencePolicy.DYNAMIC)
+    private final Collection<Repository> repositories = new LinkedHashSet<Repository>();
 
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
     private RepositoryAdmin repositoryAdmin;
 
-    private final ArtifactResolver artifactResolver;
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    private ArtifactResolver artifactResolver;
 
     private final Map<Long, PluginArtifactType> pluginMap = Collections.synchronizedMap(new WeakHashMap<Long, PluginArtifactType>());
 
@@ -100,16 +107,45 @@ public class DependencyManager implement
 
     private final Map<Long, Artifact> bundleIdArtifactMap = new ConcurrentHashMap<Long, Artifact>();
 
-    private ServiceReference respositoryAdminReference;
-
     public DependencyManager(@ParamSpecial(type = SpecialAttributeType.bundleContext) BundleContext bundleContext,
             @ParamReference(name = "Repositories", namingType = "Repository") Collection<Repository> repositories,
             @ParamReference(name = "ArtifactResolver", namingType = "ArtifactResolver") ArtifactResolver artifactResolver) {
         this.bundleContext = bundleContext;
-        this.repositories = repositories;
+        this.repositories.addAll(repositories);
+        this.artifactResolver = artifactResolver;
+    }
+
+    public DependencyManager() {
+    }
+
+    public void setArtifactResolver(ArtifactResolver artifactResolver) {
         this.artifactResolver = artifactResolver;
     }
 
+    public void unsetArtifactResolver(ArtifactResolver artifactResolver) {
+        if (this.artifactResolver == artifactResolver) {
+            this.artifactResolver = null;
+        }
+    }
+
+    public void setRepositoryAdminr(RepositoryAdmin repositoryAdmin) {
+        this.repositoryAdmin = repositoryAdmin;
+    }
+
+    public void unsetRepositoryAdmin(RepositoryAdmin repositoryAdmin) {
+        if (this.repositoryAdmin == repositoryAdmin) {
+            this.repositoryAdmin = null;
+        }
+    }
+
+    public void bindRepository(Repository repository) {
+        repositories.add(repository);
+    }
+
+    public void unbindRepository(Repository repository) {
+        repositories.remove(repository);
+    }
+
     public void bundleChanged(BundleEvent bundleEvent) {
         int eventType = bundleEvent.getType();
         //TODO Need to optimize the codes, as we will not receive the INSTALLED event after the cache is created
@@ -290,8 +326,14 @@ public class DependencyManager implement
         }
     }
 
-    private void addArtifactBundleEntry(Bundle bundle) {
-        Artifact artifact = toArtifact(bundle.getLocation());
+    private PluginArtifactType addArtifactBundleEntry(Bundle bundle) {
+        PluginArtifactType pluginArtifactType = getCachedPluginMetadata(bundle);
+        Artifact artifact;
+        if (pluginArtifactType == null) {
+            artifact = toArtifact(bundle.getLocation());
+        } else {
+            artifact = pluginArtifactType.getModuleId().toArtifact();
+        }
         if (artifact != null) {
             artifactBundleMap.put(artifact, bundle);
             bundleIdArtifactMap.put(bundle.getBundleId(), artifact);
@@ -300,6 +342,7 @@ public class DependencyManager implement
                 log.debug("fail to resovle artifact from the bundle location " + bundle.getLocation());
             }
         }
+        return pluginArtifactType;
     }
 
     private void removeArtifactBundleEntry(Bundle bundle) {
@@ -428,8 +471,7 @@ public class DependencyManager implement
         if (bundleIdArtifactMap.containsKey(bundle.getBundleId())) {
             return;
         }
-        addArtifactBundleEntry(bundle);
-        PluginArtifactType pluginArtifactType = getCachedPluginMetadata(bundle);
+        PluginArtifactType pluginArtifactType = addArtifactBundleEntry(bundle);
         if (pluginArtifactType == null) {
             return;
         }
@@ -489,7 +531,23 @@ public class DependencyManager implement
                         artifact = artifactResolver.resolveInClassLoader(artifact);
                     }
                     String location = locateBundle(artifact);
-                    Bundle b = bundleContext.installBundle(location);
+                    Bundle b = null;
+                    try {
+                        b = bundleContext.installBundle(location);
+                    } catch (BundleException e) {
+                        if (e.getType() == 9) {
+                            String name = e.getMessage().substring(e.getMessage().indexOf(":") + 2);
+                            for (Bundle test: bundleContext.getBundles()) {
+                                if (name.startsWith(test.getSymbolicName()) && name.endsWith(test.getVersion().toString())) {
+                                    b = test;
+                                    break;
+                                }
+                            }
+                        }
+                        if (b == null) {
+                            throw e;
+                        }
+                    }
                     if (dependencyHierarchyBuildingRequired) {
                         long startingBundleId = b.getBundleId();
                         dependentBundleIds.add(startingBundleId);
@@ -530,19 +588,24 @@ public class DependencyManager implement
             return "mvn:" + configurationId.getGroupId() + "/" + configurationId.getArtifactId() + "/" + configurationId.getVersion()
                     + ("jar".equals(configurationId.getType()) ? "" : "/" + configurationId.getType());
         }
-        for (Repository repo : repositories) {
-            if (repo.contains(configurationId)) {
-                return "reference:file://" + repo.getLocation(configurationId).getAbsolutePath();
+        if (System.getProperty("geronimo.build.car") != null) {
+            for (Repository repo : repositories) {
+                if (repo.contains(configurationId)) {
+                    return "reference:file://" + repo.getLocation(configurationId).getAbsolutePath();
+                }
             }
         }
-        throw new NoSuchConfigException(configurationId);
+        return "mvn:" + configurationId.getGroupId() + "/" + configurationId.getArtifactId() + "/" + configurationId.getVersion()
+                + ("jar".equals(configurationId.getType()) ? "" : "/" + configurationId.getType());
+//        throw new NoSuchConfigException(configurationId);
     }
 
-    @Override
-    public void doStart() throws Exception {
+    @Activate
+    public void doStart(BundleContext bundleContext) throws Exception {
+        this.bundleContext = bundleContext;
         bundleContext.addBundleListener(this);
-        respositoryAdminReference = bundleContext.getServiceReference(RepositoryAdmin.class.getName());
-        repositoryAdmin = respositoryAdminReference == null ? null : (RepositoryAdmin) bundleContext.getService(respositoryAdminReference);
+//        respositoryAdminReference = bundleContext.getServiceReference(RepositoryAdmin.class.getName());
+//        repositoryAdmin = respositoryAdminReference == null ? null : (RepositoryAdmin) bundleContext.getService(respositoryAdminReference);
         //init installed bundles
         for (Bundle bundle : bundleContext.getBundles()) {
             installed(bundle);
@@ -567,14 +630,14 @@ public class DependencyManager implement
         }
     }
 
-    @Override
+    @Deactivate
     public void doStop() throws Exception {
-        if (respositoryAdminReference != null) {
-            try {
-                bundleContext.ungetService(respositoryAdminReference);
-            } catch (Exception e) {
-            }
-        }
+//        if (respositoryAdminReference != null) {
+//            try {
+//                bundleContext.ungetService(respositoryAdminReference);
+//            } catch (Exception e) {
+//            }
+//        }
         bundleContext.removeBundleListener(this);
         //Some clean up work
         pluginMap.clear();
@@ -585,11 +648,4 @@ public class DependencyManager implement
         bundleIdArtifactMap.clear();
     }
 
-    @Override
-    public void doFail() {
-        try {
-            doStop();
-        } catch (Exception e) {
-        }
-    }
 }

Modified: geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java?rev=1221390&r1=1221389&r2=1221390&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java Tue Dec 20 18:04:59 2011
@@ -38,23 +38,26 @@ import java.util.TimerTask;
 import javax.xml.bind.JAXBException;
 import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.stream.XMLStreamException;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Deactivate;
+import org.apache.felix.scr.annotations.Modified;
+import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.ReferenceCardinality;
+import org.apache.felix.scr.annotations.Service;
+import org.apache.felix.utils.properties.Properties;
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.GAttributeInfo;
 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.GBeanLifecycle;
 import org.apache.geronimo.gbean.GReferenceInfo;
 import org.apache.geronimo.gbean.MultiGBeanInfoFactory;
 import org.apache.geronimo.gbean.ReferencePatterns;
 import org.apache.geronimo.kernel.InvalidGBeanException;
 import org.apache.geronimo.kernel.config.Configuration;
 import org.apache.geronimo.kernel.config.InvalidConfigException;
-import org.apache.geronimo.kernel.config.ManageableAttributeStore;
 import org.apache.geronimo.kernel.config.PersistentConfigurationList;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.system.configuration.condition.JexlExpressionParser;
@@ -63,16 +66,20 @@ import org.apache.geronimo.system.plugin
 import org.apache.geronimo.system.plugin.model.GbeanType;
 import org.apache.geronimo.system.plugin.model.ModuleType;
 import org.apache.geronimo.system.serverinfo.ServerInfo;
-import org.xml.sax.SAXException;
 import org.osgi.framework.Bundle;
-import org.apache.felix.utils.properties.Properties;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.xml.sax.SAXException;
 
 /**
  * Stores managed attributes in an XML file on the local filesystem.
  *
  * @version $Rev$ $Date$
  */
-public class LocalAttributeManager implements LocalPluginAttributeStore, PersistentConfigurationList, GBeanLifecycle {
+
+@Service()
+@Component(metatype = true)
+public class LocalAttributeManager implements LocalPluginAttributeStore, PersistentConfigurationList {
     private static final Logger log = LoggerFactory.getLogger(LocalAttributeManager.class);
 
     private static final String CONFIG_FILE_PROPERTY = "org.apache.geronimo.config.file";
@@ -83,15 +90,24 @@ public class LocalAttributeManager imple
     private static final String TEMP_EXTENSION = ".working";
     private static final int SAVE_BUFFER_MS = 5000;
 
-    private final ServerInfo serverInfo;
-    private final String configFile;
-    private final boolean readOnly;
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    private ServerInfo serverInfo;
+
+    @Property(value = "var/config/config.xml")
+    static final String CONFIG_FILE_KEY = ".configFile";
+    private String configFile;
+
+    @Property(value = "var/config/config-substitutions.properties")
+    static final String CONFIG_SUBSTITUTIONS_FILE_KEY = ".configSubstitutionsFile";
+    private String configSubstitutionsFileName;
+
+
     private JexlExpressionParser expressionParser;
 
     private File attributeFile;
     private File backupFile;
     private File tempFile;
-    private ServerOverride serverOverride;
+    private ServerOverride serverOverride = new ServerOverride();
 
     private Timer timer;
     private TimerTask currentTask;
@@ -102,7 +118,8 @@ public class LocalAttributeManager imple
     private File configSubstitutionsFile;
     private Properties localConfigSubstitutions;
     private String resolvedPropertiesFile;
-    private final GBeanInfoFactory infoFactory;
+    private final GBeanInfoFactory infoFactory = new MultiGBeanInfoFactory();
+    static final String OVERRIDES_KEY = ".overrides";
     private static final byte[] INSTRUCTION = ("# Put variables and their substitution values in this file. \n"
             + "# They will be used when processing the corresponding config.xml. \n"
             + "# Values in this file can be overridden by environment variables and system properties \n"
@@ -112,6 +129,18 @@ public class LocalAttributeManager imple
             + "# When running multiple instances of Geronimo choose a PortOffset value such that none of the ports conflict. \n"
             + "# For example, try PortOffset=10 \n").getBytes();
 
+    @Property(value = "org.apache.geronimo.config.substitution.")
+    static final String PREFIX_KEY = ".configSubstitutionsPrefix";
+
+    @Property(boolValue = false)
+    static final String READ_ONLY_KEY = "readOnly";
+    private boolean readOnly;
+
+    @Property(value = "default")
+    static final String SERVER_NAME_KEY = "serverName";
+    private String serverName;
+
+/*
     public LocalAttributeManager(String configFile, String configSubstitutionsFileName, String configSubstitutionsPrefix, boolean readOnly, ServerInfo serverInfo) {
         this.configFile = System.getProperty(CONFIG_FILE_PROPERTY, configFile);
         resolvedPropertiesFile = System.getProperty(SUBSTITUTIONS_FILE_PROPERTY, configSubstitutionsFileName);
@@ -123,21 +152,92 @@ public class LocalAttributeManager imple
         this.readOnly = readOnly;
         this.serverInfo = serverInfo;
         serverOverride = new ServerOverride();
-        
+
         log.debug("setting configSubstitutionsFile to: {}", configSubstitutionsFile);
-        
-        infoFactory = newGBeanInfoFactory();
+
+    }
+*/
+
+    public void setServerInfo(ServerInfo serverInfo) {
+        this.serverInfo = serverInfo;
+    }
+
+    public void unsetServerInfo(ServerInfo serverInfo) {
+        if (serverInfo == this.serverInfo) {
+            this.serverInfo = null;
+        }
     }
 
-    protected GBeanInfoFactory newGBeanInfoFactory() {
-        return new MultiGBeanInfoFactory();
+    @Activate
+    public void activate(Map<String, Object> properties) throws IOException {
+        readOnly = (Boolean) properties.get(READ_ONLY_KEY);
+        serverName = (String) properties.get(SERVER_NAME_KEY);
+        String configSubstitutionsPrefix = (String) properties.remove(PREFIX_KEY);
+
+        configFile = (String) properties.get(CONFIG_FILE_KEY);
+        configFile = System.getProperty(CONFIG_FILE_PROPERTY, configFile);
+        configSubstitutionsFileName = (String) properties.get(CONFIG_SUBSTITUTIONS_FILE_KEY);
+        resolvedPropertiesFile = System.getProperty(SUBSTITUTIONS_FILE_PROPERTY, configSubstitutionsFileName);
+        configSubstitutionsFile = resolvedPropertiesFile == null? null: serverInfo.resolveServer(resolvedPropertiesFile);
+        localConfigSubstitutions = loadConfigSubstitutions(configSubstitutionsFile);
+        prefix = System.getProperty(SUBSTITUTION_PREFIX_PREFIX, configSubstitutionsPrefix);
+        Map<String, Object> configSubstitutions = loadAllConfigSubstitutions(localConfigSubstitutions, prefix);
+        expressionParser = new JexlExpressionParser(configSubstitutions);
+
+        load();
+        if (!readOnly) {
+            timer = new Timer(true);
+        }
+    }
+
+    @Deactivate
+    public synchronized void deactivate() throws Exception {
+        boolean doSave = false;
+        synchronized (this) {
+            if (timer != null) {
+                timer.cancel();
+                if (currentTask != null) {
+                    currentTask.cancel();
+                    doSave = true;
+                }
+            }
+        }
+        if (doSave) {
+            save();
+        }
+        log.debug("Stopped LocalAttributeManager with data on {} configurations", serverOverride.getConfigurations().size());
+        serverOverride = new ServerOverride();
+    }
+
+    /**
+     * DS modified method.  This is called back every time the config admin Configuration is updated, but asynchronously.
+     *
+     * @param properties DS properties (which include configuration properties)
+     * @throws IOException
+     */
+    @Modified
+    public void modified(Map<String, Object> properties) throws IOException {
+        activate(properties);
+//        readOnly = (Boolean) properties.get(READ_ONLY_KEY);
+//        serverName = (String) properties.get(SERVER_NAME_KEY);
+//        String configSubstitutionsPrefix = (String) properties.remove(PREFIX_KEY);
+//        String servicePid = (String) properties.get(Constants.SERVICE_PID);
+//        this.configuration = configurationAdmin.getConfiguration(servicePid);
+//
+//        Dictionary<Object, Object> d = getConfigurationProperties();
+//        String overrides = (String) d.get(OVERRIDES_KEY);
+//        localConfigSubstitutions = loadConfigSubstitutions(d);
+//        prefix = System.getProperty(SUBSTITUTION_PREFIX_PREFIX, configSubstitutionsPrefix);
+//        Map<String, Object> configSubstitutions = loadAllConfigSubstitutions(localConfigSubstitutions, prefix);
+//        expressionParser.setVariables(configSubstitutions);
+//
+//        load(overrides);
     }
 
     public boolean isReadOnly() {
         return readOnly;
     }
 
-
     public String getConfigFile() {
         return configFile;
     }
@@ -181,11 +281,71 @@ public class LocalAttributeManager imple
                     }
                     if (!(name instanceof AbstractName)) {
                         message.append(sep).append("a full AbstractName ");
+                        sep = "and ";
+                    }
+                    message.append("configuration=").append(configName);
+                    message.append(" gbeanName=").append(name);
+                    throw new InvalidConfigException(message.toString());
+                }
+                GBeanInfo gbeanInfo = infoFactory.getGBeanInfo(gbean.getGBeanInfo(), bundle);
+                AbstractName abstractName = (AbstractName) name;
+                GBeanData gBeanData = new GBeanData(abstractName, gbeanInfo);
+                gbeanDatas.add(gBeanData);
+            }
+        }
+
+        // set the attributes
+        for (Iterator<GBeanData> iterator = gbeanDatas.iterator(); iterator.hasNext();) {
+            GBeanData data = iterator.next();
+            boolean load = setAttributes(data, configuration, configName, bundle);
+            if (!load) {
+                iterator.remove();
+            }
+        }
+        return gbeanDatas;
+    }
+/*
+    public synchronized Collection<GBeanData> applyOverrides(Artifact configName, Collection<GBeanData> untypedGbeanDatas, Map<String, Bundle> bundleMap) throws InvalidConfigException {
+        // clone the datas since we will be modifying this collection
+        Collection<GBeanData> gbeanDatas = new ArrayList<GBeanData>(untypedGbeanDatas);
+
+        ConfigurationOverride configuration = serverOverride.getConfiguration(configName);
+        if (configuration == null) {
+            return gbeanDatas;
+        }
+
+        // index the incoming datas
+        Map<Object, GBeanData> datasByName = new HashMap<Object, GBeanData>();
+        for (GBeanData gbeanData : gbeanDatas) {
+            datasByName.put(gbeanData.getAbstractName(), gbeanData);
+            datasByName.put(gbeanData.getAbstractName().getName().get("name"), gbeanData);
+        }
+
+        // add the new GBeans
+        for (Object o : configuration.getGBeans().entrySet()) {
+            Map.Entry entry = (Map.Entry) o;
+            Object name = entry.getKey();
+            GBeanOverride gbean = (GBeanOverride) entry.getValue();
+            if (!datasByName.containsKey(name) && gbean.isLoad()) {
+                if (gbean.getGBeanInfo() == null || !(name instanceof AbstractName) || gbean.getBundleSymbolicName() == null) {
+                    String sep = "";
+                    StringBuilder message = new StringBuilder("New GBeans must be specified with ");
+                    if (gbean.getGBeanInfo() == null) {
+                        message.append("a GBeanInfo ");
+                        sep = "and ";
+                    }
+                    if (!(name instanceof AbstractName)) {
+                        message.append(sep).append("a full AbstractName ");
+                        sep = "and ";
+                    }
+                    if (gbean.getBundleSymbolicName() == null) {
+                        message.append(sep).append("a bundleSymbolicName ");
                     }
                     message.append("configuration=").append(configName);
                     message.append(" gbeanName=").append(name);
                     throw new InvalidConfigException(message.toString());
                 }
+                Bundle bundle = bundleMap.get(gbean.getBundleSymbolicName());
                 GBeanInfo gbeanInfo = infoFactory.getGBeanInfo(gbean.getGBeanInfo(), bundle);
                 AbstractName abstractName = (AbstractName) name;
                 GBeanData gBeanData = new GBeanData(abstractName, gbeanInfo);
@@ -194,8 +354,10 @@ public class LocalAttributeManager imple
         }
 
         // set the attributes
-        for (Iterator iterator = gbeanDatas.iterator(); iterator.hasNext();) {
-            GBeanData data = (GBeanData) iterator.next();
+        for (Iterator<GBeanData> iterator = gbeanDatas.iterator(); iterator.hasNext();) {
+            GBeanData data = iterator.next();
+            String bundleSymbolicName = data.getGBeanInfo().getBundleSymbolicName();
+            Bundle bundle = bundleMap.get(bundleSymbolicName);
             boolean load = setAttributes(data, configuration, configName, bundle);
             if (!load) {
                 iterator.remove();
@@ -203,6 +365,7 @@ public class LocalAttributeManager imple
         }
         return gbeanDatas;
     }
+*/
 
     /**
      * Set the attributes from the attribute store on a single gbean, and return whether or not to load the gbean.
@@ -230,7 +393,7 @@ public class LocalAttributeManager imple
         return gbean.applyOverrides(data, configName, gbeanName, bundle);
     }
 
-    public void setModuleGBeans(Artifact moduleName, List<GbeanType> gbeans, boolean load, String condition) throws InvalidGBeanException {
+    public synchronized void setModuleGBeans(Artifact moduleName, List<GbeanType> gbeans, boolean load, String condition) throws InvalidGBeanException {
         if (readOnly) {
             return;
         }
@@ -243,9 +406,9 @@ public class LocalAttributeManager imple
         }
         configuration.setLoad(load);
         configuration.setCondition(condition);
-        
+
         log.debug("Added gbeans for module: {}  load: {}",  moduleName, load);
-        
+
         attributeChanged();
     }
 
@@ -257,16 +420,33 @@ public class LocalAttributeManager imple
         return expressionParser.parse(in);
     }
 
+    @Override
+    public String getServerName() {
+        return serverName;
+    }
+
     public void addConfigSubstitutions(java.util.Properties properties) {
         for (Object key : properties.keySet()) {
             String keyStr = (String) key;
             localConfigSubstitutions.put(keyStr, properties.getProperty(keyStr));
-        }        
+        }
         Map<String, Object> configSubstutions = loadAllConfigSubstitutions(localConfigSubstitutions, prefix);
         storeConfigSubstitutions(configSubstitutionsFile, localConfigSubstitutions);
         expressionParser = new JexlExpressionParser(configSubstutions);
     }
 
+
+    public synchronized void addConfigSubstitutions(Map<String, String> properties) {
+        localConfigSubstitutions.putAll(properties);
+        Map<String, Object> configSubstitutions = loadAllConfigSubstitutions(localConfigSubstitutions, prefix);
+        //TODO which is correct?
+        storeConfigSubstitutions(configSubstitutionsFile, localConfigSubstitutions);
+        expressionParser = new JexlExpressionParser(configSubstitutions);
+        //or this?
+//        expressionParser = new JexlExpressionParser(configSubstitutions);
+//        attributeChanged();
+    }
+
     public synchronized void setValue(Artifact configurationName, AbstractName gbeanName, GAttributeInfo attribute, Object value, Bundle bundle) {
         if (readOnly) {
             return;
@@ -398,21 +578,21 @@ public class LocalAttributeManager imple
         if (backupFile.exists()) {
             if (!backupFile.delete()) {
                 throw new IOException("Unable to delete old backup file in order to back up current manageable attribute working file for save");
-            }
+        }
         }
 
         // rename the existing configuration file to the backup file
         if (attributeFile.exists()) {
             if (!attributeFile.renameTo(backupFile)) {
                 throw new IOException("Unable to rename " + attributeFile.getAbsolutePath() + " to " + backupFile.getAbsolutePath() + " in order to back up manageable attribute save file");
-            }
+        }
         }
 
         // rename the temp file the the configuration file
         if (!tempFile.renameTo(attributeFile)) {
             throw new IOException(
                     "EXTREMELY CRITICAL!  Unable to move manageable attributes working file to proper file name!  Configuration will revert to defaults unless this is manually corrected!  (could not rename " + tempFile.getAbsolutePath() + " to " + attributeFile.getAbsolutePath() + ")");
-        }
+    }
     }
 
     void write(Writer writer) throws XMLStreamException, JAXBException,
@@ -556,45 +736,6 @@ public class LocalAttributeManager imple
         return configInfo != null && !configInfo.getGBeans().isEmpty();
     }
 
-    //GBeanLifeCycle
-    public synchronized void doStart() throws Exception {
-        load();
-        if (!readOnly) {
-            timer = new Timer(true);
-        }
-        log.debug("Started LocalAttributeManager with data on {} configurations", serverOverride.getConfigurations().size());
-    }
-
-    public synchronized void doStop() throws Exception {
-        boolean doSave = false;
-        synchronized (this) {
-            if (timer != null) {
-                timer.cancel();
-                if (currentTask != null) {
-                    currentTask.cancel();
-                    doSave = true;
-                }
-            }
-        }
-        if (doSave) {
-            save();
-        }
-        log.debug("Stopped LocalAttributeManager with data on {} configurations", serverOverride.getConfigurations().size());
-        serverOverride = new ServerOverride();
-    }
-
-    public synchronized void doFail() {
-        synchronized (this) {
-            if (timer != null) {
-                timer.cancel();
-                if (currentTask != null) {
-                    currentTask.cancel();
-                }
-            }
-        }
-        serverOverride = new ServerOverride();
-    }
-
     private synchronized void ensureParentDirectory() throws IOException {
         if (attributeFile == null) {
             attributeFile = serverInfo.resolveServer(configFile);
@@ -623,14 +764,14 @@ public class LocalAttributeManager imple
             currentTask = new TimerTask() {
 
                 public void run() {
-                    try {
+        try {
                         LocalAttributeManager.this.save();
-                    } catch (IOException e) {
+        } catch (IOException e) {
                         log.error("IOException occurred while saving attributes", e);
                     } catch (Throwable t) {
                         log.error("Error occurred during execution of attributeChanged TimerTask", t);
-                    }
-                }
+        }
+    }
             };
             timer.schedule(currentTask, SAVE_BUFFER_MS);
         }
@@ -663,10 +804,10 @@ public class LocalAttributeManager imple
                         properties.load(in);
                     } finally {
                         in.close();
-                    }
+            }
                 } catch (Exception e) {
                     log.error("Caught exception {} trying to read properties file {}", e, configSubstitutionsFile.getAbsolutePath());
-                }
+        }
             }
         }
         return properties;
@@ -677,7 +818,7 @@ public class LocalAttributeManager imple
             try {
                 FileOutputStream out = new FileOutputStream(configSubstitutionsFile);
                 try {
-                    out.write(INSTRUCTION);                    
+                    out.write(INSTRUCTION);
                     properties.save(out);
                 } finally {
                     out.close();
@@ -703,24 +844,4 @@ public class LocalAttributeManager imple
         }
     }
 
-    public static final GBeanInfo GBEAN_INFO;
-
-    static {
-        GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(LocalAttributeManager.class, "AttributeStore");
-        infoFactory.addReference("ServerInfo", ServerInfo.class, "GBean");
-        infoFactory.addAttribute("configFile", String.class, true);
-        infoFactory.addAttribute("readOnly", boolean.class, true);
-        infoFactory.addAttribute("substitutionsFile", String.class, true);
-        infoFactory.addAttribute("substitutionPrefix", String.class, true);
-        infoFactory.addInterface(ManageableAttributeStore.class);
-        infoFactory.addInterface(PersistentConfigurationList.class);
-
-        infoFactory.setConstructor(new String[]{"configFile", "substitutionsFile", "substitutionPrefix", "readOnly", "ServerInfo"});
-
-        GBEAN_INFO = infoFactory.getBeanInfo();
-    }
-
-    public static GBeanInfo getGBeanInfo() {
-        return GBEAN_INFO;
-    }
 }

Added: geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/LocalPluginAttributeStoreGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/LocalPluginAttributeStoreGBean.java?rev=1221390&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/LocalPluginAttributeStoreGBean.java (added)
+++ geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/LocalPluginAttributeStoreGBean.java Tue Dec 20 18:04:59 2011
@@ -0,0 +1,121 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+package org.apache.geronimo.system.configuration;
+
+import java.io.IOException;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.GAttributeInfo;
+import org.apache.geronimo.gbean.GBeanData;
+import org.apache.geronimo.gbean.GReferenceInfo;
+import org.apache.geronimo.gbean.ReferencePatterns;
+import org.apache.geronimo.gbean.annotation.GBean;
+import org.apache.geronimo.gbean.annotation.ParamSpecial;
+import org.apache.geronimo.gbean.annotation.SpecialAttributeType;
+import org.apache.geronimo.gbean.wrapper.AbstractServiceWrapper;
+import org.apache.geronimo.kernel.InvalidGBeanException;
+import org.apache.geronimo.kernel.config.InvalidConfigException;
+import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.system.plugin.model.GbeanType;
+import org.osgi.framework.Bundle;
+
+/**
+ * @version $Rev:$ $Date:$
+ */
+@GBean(j2eeType = "AttributeStore")
+public class LocalPluginAttributeStoreGBean extends AbstractServiceWrapper<LocalPluginAttributeStore> implements LocalPluginAttributeStore {
+    public LocalPluginAttributeStoreGBean(@ParamSpecial(type = SpecialAttributeType.bundle)final Bundle bundle) {
+        super(bundle, LocalPluginAttributeStore.class);
+    }
+
+    @Override
+    public String getConfigFile() {
+        return get().getConfigFile();
+    }
+
+    @Override
+    public String getConfigSubstitutionsFile() {
+        return get().getConfigSubstitutionsFile();
+    }
+
+    @Override
+    public String getConfigSubstitutionsPrefix() {
+        return get().getConfigSubstitutionsPrefix();
+    }
+
+    @Override
+    public void setModuleGBeans(Artifact moduleName, List<GbeanType> gbeans, boolean load, String condition) throws InvalidGBeanException {
+        get().setModuleGBeans(moduleName, gbeans, load, condition);
+    }
+
+    @Override
+    public void addConfigSubstitutions(Map<String, String> properties) {
+        get().addConfigSubstitutions(properties);
+    }
+
+    @Override
+    public boolean isModuleInstalled(Artifact artifact) {
+        return get().isModuleInstalled(artifact);
+    }
+
+    @Override
+    public String substitute(String in) {
+        return get().substitute(in);
+    }
+
+    @Override
+    public String getServerName() {
+        return get().getServerName();
+    }
+
+    @Override
+    public Collection<GBeanData> applyOverrides(Artifact configurationName, Collection<GBeanData> datas, Bundle bundle) throws InvalidConfigException {
+        return get().applyOverrides(configurationName, datas, bundle);
+    }
+
+    @Override
+    public void setValue(Artifact configurationName, AbstractName gbeanName, GAttributeInfo attribute, Object value, Bundle bundle) {
+        get().setValue(configurationName, gbeanName, attribute, value, bundle);
+    }
+
+    @Override
+    public void setReferencePatterns(Artifact configurationName, AbstractName gbean, GReferenceInfo reference, ReferencePatterns patterns) {
+        get().setReferencePatterns(configurationName, gbean, reference, patterns);
+    }
+
+    @Override
+    public void setShouldLoad(Artifact configurationName, AbstractName gbean, boolean load) {
+        get().setShouldLoad(configurationName, gbean, load);
+    }
+
+    @Override
+    public void addGBean(Artifact configurationName, GBeanData gbeanData, Bundle bundle) {
+        get().addGBean(configurationName, gbeanData, bundle);
+    }
+
+    @Override
+    public void save() throws IOException {
+        get().save();
+    }
+}

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

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

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

Modified: geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/PluginAttributeStore.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/PluginAttributeStore.java?rev=1221390&r1=1221389&r2=1221390&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/PluginAttributeStore.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/PluginAttributeStore.java Tue Dec 20 18:04:59 2011
@@ -17,11 +17,11 @@
 package org.apache.geronimo.system.configuration;
 
 import java.util.List;
-import java.util.Properties;
+import java.util.Map;
 
+import org.apache.geronimo.kernel.InvalidGBeanException;
 import org.apache.geronimo.kernel.config.ManageableAttributeStore;
 import org.apache.geronimo.kernel.repository.Artifact;
-import org.apache.geronimo.kernel.InvalidGBeanException;
 import org.apache.geronimo.system.plugin.model.GbeanType;
 
 /**
@@ -38,9 +38,11 @@ public interface PluginAttributeStore ex
      */
     public void setModuleGBeans(Artifact moduleName, List<GbeanType> gbeans, boolean load, String condition) throws InvalidGBeanException;
 
-    void addConfigSubstitutions(Properties properties);
+    void addConfigSubstitutions(Map<String, String> properties);
 
     boolean isModuleInstalled(Artifact artifact);
 
     String substitute(final String in);
+
+    String getServerName();
 }



Mime
View raw message