geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jboy...@apache.org
Subject cvs commit: incubator-geronimo/modules/system/src/java/org/apache/geronimo/system/configuration LocalConfigStore.java
Date Thu, 03 Jun 2004 07:24:21 GMT
jboynes     2004/06/03 00:24:21

  Modified:    modules/common/src/java/org/apache/geronimo/common/propertyeditor
                        PropertyEditors.java
               modules/connector/src/java/org/apache/geronimo/connector/deployment
                        RAR_1_0ConfigBuilder.java RAR_1_5ConfigBuilder.java
               modules/deployment/src/java/org/apache/geronimo/deployment/service
                        GBeanBuilder.java
               modules/j2ee/src/java/org/apache/geronimo/j2ee/deployment
                        EARConfigBuilder.java
               modules/jetty/src/java/org/apache/geronimo/jetty/deployment
                        JettyModuleBuilder.java
               modules/kernel/src/java/org/apache/geronimo/gbean/jmx
                        GBeanMBeanOperation.java
               modules/kernel/src/java/org/apache/geronimo/kernel/config
                        Run.java
               modules/system/src/java/org/apache/geronimo/system/configuration
                        LocalConfigStore.java
  Log:
  Fix to allow removal of TCL set in GBean invoker
  
  Revision  Changes    Path
  1.10      +4 -23     incubator-geronimo/modules/common/src/java/org/apache/geronimo/common/propertyeditor/PropertyEditors.java
  
  Index: PropertyEditors.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/common/src/java/org/apache/geronimo/common/propertyeditor/PropertyEditors.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- PropertyEditors.java	21 Mar 2004 22:24:38 -0000	1.9
  +++ PropertyEditors.java	3 Jun 2004 07:24:15 -0000	1.10
  @@ -76,7 +76,7 @@
        * @param typeName    The class name of the object to be edited.
        * @return            An editor for the given type or null if none was found.
        */
  -    public static PropertyEditor findEditor(final String typeName)
  +    public static PropertyEditor findEditor(final String typeName, ClassLoader classLoader)
           throws ClassNotFoundException
       {
           if (typeName == null) {
  @@ -85,11 +85,11 @@
   
           Class type = null;
           try {
  -            type = ClassLoading.loadClass(typeName);
  +            type = ClassLoading.loadClass(typeName, classLoader);
           }
           catch (ClassNotFoundException e) {
               // look for a nested class
  -            type = ClassLoading.loadClass(typeName + "$PropertyEditor");
  +            type = ClassLoading.loadClass(typeName + "$PropertyEditor", classLoader);
           }
   
           return findEditor(type);
  @@ -108,25 +108,6 @@
           PropertyEditor editor = findEditor(type);
           if (editor == null) {
               throw new PropertyEditorException("No property editor for type: " + type);
  -        }
  -
  -        return editor;
  -    }
  -
  -    /**
  -     * Get a value editor for a given target type.
  -     *
  -     * @param typeName    The class name of the object to be edited.
  -     * @return            An editor for the given type.
  -     *
  -     * @throws PropertyEditorException   No editor was found.
  -     */
  -    public static PropertyEditor getEditor(final String typeName)
  -        throws ClassNotFoundException
  -    {
  -        PropertyEditor editor = findEditor(typeName);
  -        if (editor == null) {
  -            throw new PropertyEditorException("No property editor for type: " + typeName);
           }
   
           return editor;
  
  
  
  1.10      +5 -5      incubator-geronimo/modules/connector/src/java/org/apache/geronimo/connector/deployment/RAR_1_0ConfigBuilder.java
  
  Index: RAR_1_0ConfigBuilder.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/connector/src/java/org/apache/geronimo/connector/deployment/RAR_1_0ConfigBuilder.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- RAR_1_0ConfigBuilder.java	2 Jun 2004 05:33:02 -0000	1.9
  +++ RAR_1_0ConfigBuilder.java	3 Jun 2004 07:24:15 -0000	1.10
  @@ -109,7 +109,7 @@
                       throw new DeploymentException("Could not construct ManagedConnectionFactory
object name", e);
                   }
                   GBeanInfoFactory managedConnectionFactoryInfoFactory = new GBeanInfoFactory(ManagedConnectionFactoryWrapper.class,
ManagedConnectionFactoryWrapper.getGBeanInfo());
  -                GBeanMBean managedConnectionFactoryGBean = setUpDynamicGBean(managedConnectionFactoryInfoFactory,
resourceAdapter.getConfigPropertyArray(), connectionfactoryInstance.getConfigPropertySettingArray());
  +                GBeanMBean managedConnectionFactoryGBean = setUpDynamicGBean(managedConnectionFactoryInfoFactory,
resourceAdapter.getConfigPropertyArray(), connectionfactoryInstance.getConfigPropertySettingArray(),
cl);
                   try {
                       managedConnectionFactoryGBean.setAttribute("ManagedConnectionFactoryClass",
cl.loadClass(resourceAdapter.getManagedconnectionfactoryClass().getStringValue()));
                       managedConnectionFactoryGBean.setAttribute("ConnectionFactoryInterface",
cl.loadClass(resourceAdapter.getConnectionfactoryInterface().getStringValue()));
  @@ -137,12 +137,12 @@
       }
   
   
  -    private GBeanMBean setUpDynamicGBean(GBeanInfoFactory infoFactory, ConfigPropertyType[]
configProperties, GerConfigPropertySettingType[] configPropertySettings) throws DeploymentException
{
  +    private GBeanMBean setUpDynamicGBean(GBeanInfoFactory infoFactory, ConfigPropertyType[]
configProperties, GerConfigPropertySettingType[] configPropertySettings, ClassLoader cl) throws
DeploymentException {
           addDynamicAttributes(infoFactory, configProperties);
           GBeanInfo gbeanInfo = infoFactory.getBeanInfo();
           GBeanMBean gbean;
           try {
  -            gbean = new GBeanMBean(gbeanInfo);
  +            gbean = new GBeanMBean(gbeanInfo, cl);
           } catch (InvalidConfigurationException e) {
               throw new DeploymentException("Unable to create GMBean", e);
           }
  @@ -162,7 +162,7 @@
               ConfigPropertyType configProperty = configProperties[i];
               Object value;
               try {
  -                PropertyEditor editor = PropertyEditors.findEditor(configProperty.getConfigPropertyType().getStringValue());
  +                PropertyEditor editor = PropertyEditors.findEditor(configProperty.getConfigPropertyType().getStringValue(),
gBean.getClassLoader());
                   String valueString = null;
                   if (editor != null) {
                       //look for explicit value setting
  
  
  
  1.15      +8 -8      incubator-geronimo/modules/connector/src/java/org/apache/geronimo/connector/deployment/RAR_1_5ConfigBuilder.java
  
  Index: RAR_1_5ConfigBuilder.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/connector/src/java/org/apache/geronimo/connector/deployment/RAR_1_5ConfigBuilder.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- RAR_1_5ConfigBuilder.java	2 Jun 2004 05:33:02 -0000	1.14
  +++ RAR_1_5ConfigBuilder.java	3 Jun 2004 07:24:16 -0000	1.15
  @@ -110,7 +110,7 @@
               String resourceAdapterClassName = resourceadapterClass.getStringValue();
               resourceAdapterObjectName = null;
               GBeanInfoFactory resourceAdapterInfoFactory = new GBeanInfoFactory(ResourceAdapterWrapper.class,
ResourceAdapterWrapper.getGBeanInfo());
  -            GBeanMBean resourceAdapterGBean = setUpDynamicGBean(resourceAdapterInfoFactory,
resourceadapter.getConfigPropertyArray(), geronimoResourceAdapter.getResourceadapterInstance().getConfigPropertySettingArray());
  +            GBeanMBean resourceAdapterGBean = setUpDynamicGBean(resourceAdapterInfoFactory,
resourceadapter.getConfigPropertyArray(), geronimoResourceAdapter.getResourceadapterInstance().getConfigPropertySettingArray(),
cl);
               try {
                   resourceAdapterGBean.setAttribute("ResourceAdapterClass", cl.loadClass(resourceAdapterClassName));
               } catch (Exception e) {
  @@ -160,7 +160,7 @@
                       throw new DeploymentException("Could not construct ManagedConnectionFactory
object name", e);
                   }
                   GBeanInfoFactory managedConnectionFactoryInfoFactory = new GBeanInfoFactory(ManagedConnectionFactoryWrapper.class,
ManagedConnectionFactoryWrapper.getGBeanInfo());
  -                GBeanMBean managedConnectionFactoryGBean = setUpDynamicGBean(managedConnectionFactoryInfoFactory,
connectionDefinition.getConfigPropertyArray(), connectionfactoryInstance.getConfigPropertySettingArray());
  +                GBeanMBean managedConnectionFactoryGBean = setUpDynamicGBean(managedConnectionFactoryInfoFactory,
connectionDefinition.getConfigPropertyArray(), connectionfactoryInstance.getConfigPropertySettingArray(),
cl);
                   try {
                       managedConnectionFactoryGBean.setAttribute("ManagedConnectionFactoryClass",
cl.loadClass(connectionDefinition.getManagedconnectionfactoryClass().getStringValue()));
                       managedConnectionFactoryGBean.setAttribute("ConnectionFactoryInterface",
cl.loadClass(connectionDefinition.getConnectionfactoryInterface().getStringValue()));
  @@ -173,7 +173,7 @@
                       }
                       managedConnectionFactoryGBean.setReferencePatterns("ConnectionManagerFactory",
Collections.singleton(connectionManagerObjectName));
                       if (connectionfactoryInstance.getCredentialInterface() != null &&
PasswordCredential.class.getName().equals(connectionfactoryInstance.getCredentialInterface().getStringValue()))
{
  -                        GBeanMBean realmGBean = new GBeanMBean(PasswordCredentialRealm.getGBeanInfo());
  +                        GBeanMBean realmGBean = new GBeanMBean(PasswordCredentialRealm.getGBeanInfo(),
cl);
                           realmGBean.setAttribute("RealmName", BASE_PASSWORD_CREDENTIAL_LOGIN_MODULE_NAME
+ connectionfactoryInstance.getName());
                           context.addGBean(ObjectName.getInstance(BASE_PASSWORD_CREDENTIAL_LOGIN_MODULE_NAME
+ connectionfactoryInstance.getName()), realmGBean);
                           managedConnectionFactoryGBean.setReferencePatterns("ManagedConnectionFactoryListener",
Collections.singleton(ObjectName.getInstance(BASE_PASSWORD_CREDENTIAL_LOGIN_MODULE_NAME +
connectionfactoryInstance.getName())));
  @@ -200,7 +200,7 @@
               for (int j = 0; j < gerAdminObject.getAdminobjectInstanceArray().length;
j++) {
                   GerAdminobjectInstanceType gerAdminobjectInstance = gerAdminObject.getAdminobjectInstanceArray()[j];
                   GBeanInfoFactory adminObjectInfoFactory = new GBeanInfoFactory(AdminObjectWrapper.class,
AdminObjectWrapper.getGBeanInfo());
  -                GBeanMBean adminObjectGBean = setUpDynamicGBean(adminObjectInfoFactory,
adminobject.getConfigPropertyArray(), gerAdminobjectInstance.getConfigPropertySettingArray());
  +                GBeanMBean adminObjectGBean = setUpDynamicGBean(adminObjectInfoFactory,
adminobject.getConfigPropertyArray(), gerAdminobjectInstance.getConfigPropertySettingArray(),
cl);
                   try {
                       ObjectName adminObjectObjectName = ObjectName.getInstance(JMXReferenceFactory.BASE_ADMIN_OBJECT_NAME
+ gerAdminobjectInstance.getAdminobjectName());
                       adminObjectGBean.setAttribute("AdminObjectInterface", cl.loadClass(adminobject.getAdminobjectInterface().getStringValue()));
  @@ -217,12 +217,12 @@
       }
   
   
  -    private GBeanMBean setUpDynamicGBean(GBeanInfoFactory infoFactory, ConfigPropertyType[]
configProperties, GerConfigPropertySettingType[] configPropertySettings) throws DeploymentException
{
  +    private GBeanMBean setUpDynamicGBean(GBeanInfoFactory infoFactory, ConfigPropertyType[]
configProperties, GerConfigPropertySettingType[] configPropertySettings, ClassLoader cl) throws
DeploymentException {
           addDynamicAttributes(infoFactory, configProperties);
           GBeanInfo gbeanInfo = infoFactory.getBeanInfo();
           GBeanMBean gbean;
           try {
  -            gbean = new GBeanMBean(gbeanInfo);
  +            gbean = new GBeanMBean(gbeanInfo, cl);
           } catch (InvalidConfigurationException e) {
               throw new DeploymentException("Unable to create GMBean", e);
           }
  @@ -242,7 +242,7 @@
               ConfigPropertyType configProperty = configProperties[i];
               Object value;
               try {
  -                PropertyEditor editor = PropertyEditors.findEditor(configProperty.getConfigPropertyType().getStringValue());
  +                PropertyEditor editor = PropertyEditors.findEditor(configProperty.getConfigPropertyType().getStringValue(),
gBean.getClassLoader());
                   String valueString = null;
                   if (editor != null) {
                       //look for explicit value setting
  
  
  
  1.6       +2 -2      incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/service/GBeanBuilder.java
  
  Index: GBeanBuilder.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/service/GBeanBuilder.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- GBeanBuilder.java	26 May 2004 03:22:21 -0000	1.5
  +++ GBeanBuilder.java	3 Jun 2004 07:24:17 -0000	1.6
  @@ -53,7 +53,7 @@
       public void setAttribute(String name, String type, String text) throws DeploymentException
{
           try {
               // @todo we should not need all of common just for this
  -            PropertyEditor editor = PropertyEditors.findEditor(type);
  +            PropertyEditor editor = PropertyEditors.findEditor(type, gbean.getClassLoader());
               if (editor == null) {
                   throw new DeploymentException("Unable to find PropertyEditor for " + type);
               }
  
  
  
  1.4       +2 -2      incubator-geronimo/modules/j2ee/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java
  
  Index: EARConfigBuilder.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/j2ee/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- EARConfigBuilder.java	2 Jun 2004 05:33:02 -0000	1.3
  +++ EARConfigBuilder.java	3 Jun 2004 07:24:18 -0000	1.4
  @@ -194,7 +194,7 @@
   
               // Create the J2EEApplication managed object
               if (application != null) {
  -                GBeanMBean gbean = new GBeanMBean(J2EEApplicationImpl.GBEAN_INFO);
  +                GBeanMBean gbean = new GBeanMBean(J2EEApplicationImpl.GBEAN_INFO, cl);
                   try {
                       gbean.setAttribute("deploymentDescriptor", application.toString());
                   } catch (Exception e) {
  
  
  
  1.6       +2 -2      incubator-geronimo/modules/jetty/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
  
  Index: JettyModuleBuilder.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/jetty/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- JettyModuleBuilder.java	1 Jun 2004 16:06:50 -0000	1.5
  +++ JettyModuleBuilder.java	3 Jun 2004 07:24:19 -0000	1.6
  @@ -224,7 +224,7 @@
           UserTransaction userTransaction = new UserTransactionImpl();
           ReadOnlyContext compContext = buildComponentContext(earContext, webModule, webApp,
jettyWebApp, userTransaction, cl);
   
  -        GBeanMBean gbean = new GBeanMBean(JettyWebApplicationContext.GBEAN_INFO);
  +        GBeanMBean gbean = new GBeanMBean(JettyWebApplicationContext.GBEAN_INFO, cl);
           try {
               URI warRoot = null;
               if (!webModule.getURI().equals(URI.create("/"))) {
  
  
  
  1.12      +1 -5      incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/gbean/jmx/GBeanMBeanOperation.java
  
  Index: GBeanMBeanOperation.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/gbean/jmx/GBeanMBeanOperation.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- GBeanMBeanOperation.java	2 Jun 2004 20:10:08 -0000	1.11
  +++ GBeanMBeanOperation.java	3 Jun 2004 07:24:19 -0000	1.12
  @@ -137,16 +137,12 @@
               throw new IllegalStateException("Operations can not be called while offline");
           }
   
  -        ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
           try {
  -            Thread.currentThread().setContextClassLoader(gmbean.getClassLoader());
               return methodInvoker.invoke(gmbean.getTarget(), arguments);
           } catch (Exception e) {
               throw new ReflectionException(e);
           } catch (Throwable throwable) {
               throw new ReflectionException(new InvocationTargetException(throwable));
  -        } finally {
  -            Thread.currentThread().setContextClassLoader(oldClassLoader);
           }
       }
   }
  
  
  
  1.7       +2 -2      incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/config/Run.java
  
  Index: Run.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/config/Run.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Run.java	27 May 2004 01:06:00 -0000	1.6
  +++ Run.java	3 Jun 2004 07:24:20 -0000	1.7
  @@ -61,7 +61,7 @@
           try {
               kernel.boot();
   
  -            GBeanMBean config = new GBeanMBean(Configuration.GBEAN_INFO);
  +            GBeanMBean config = new GBeanMBean(Configuration.GBEAN_INFO, cl);
               ObjectInputStream ois = new ObjectInputStream(cl.getResourceAsStream("META-INF/config.ser"));
               try {
                   Configuration.loadGMBeanState(config, ois);
  
  
  
  1.6       +2 -3      incubator-geronimo/modules/system/src/java/org/apache/geronimo/system/configuration/LocalConfigStore.java
  
  Index: LocalConfigStore.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/system/src/java/org/apache/geronimo/system/configuration/LocalConfigStore.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- LocalConfigStore.java	2 Jun 2004 19:50:41 -0000	1.5
  +++ LocalConfigStore.java	3 Jun 2004 07:24:21 -0000	1.6
  @@ -204,10 +204,9 @@
           FileInputStream fis = new FileInputStream(new File(configRoot, "META-INF/config.ser"));
           try {
               ObjectInputStream ois = new ObjectInputStream(new BufferedInputStream(fis));
  -            GBeanInfo gbeanInfo = Configuration.GBEAN_INFO;
               GBeanMBean config;
               try {
  -                config = new GBeanMBean(gbeanInfo);
  +                config = new GBeanMBean(Configuration.GBEAN_INFO);
               } catch (InvalidConfigurationException e) {
                   throw new InvalidConfigException("Unable to instantiate Configuration GBeanMBean",
e);
               }
  
  
  

Mime
View raw message