[jboss-cvs] JBossAS SVN: r82069 - in branches/Branch_5_0/connector/src: tests/org/jboss/tests/jca/managed and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Dec 5 02:15:32 EST 2008


Author: emuckenhuber
Date: 2008-12-05 02:15:32 -0500 (Fri, 05 Dec 2008)
New Revision: 82069

Added:
   branches/Branch_5_0/connector/src/main/org/jboss/resource/deployers/management/AbstractConnectionFactoryICF.java
   branches/Branch_5_0/connector/src/main/org/jboss/resource/deployers/management/AbstractNonXADataSourceICF.java
Modified:
   branches/Branch_5_0/connector/src/main/org/jboss/resource/deployers/management/InstanceClassFactoryUtils.java
   branches/Branch_5_0/connector/src/main/org/jboss/resource/deployers/management/LocalDSInstanceClassFactory.java
   branches/Branch_5_0/connector/src/main/org/jboss/resource/deployers/management/NoTxCFInstanceClassFactory.java
   branches/Branch_5_0/connector/src/main/org/jboss/resource/deployers/management/NoTxInstanceClassFactory.java
   branches/Branch_5_0/connector/src/main/org/jboss/resource/deployers/management/TxInstanceClassFactory.java
   branches/Branch_5_0/connector/src/main/org/jboss/resource/deployers/management/XAConnectionFactoryProperty.java
   branches/Branch_5_0/connector/src/main/org/jboss/resource/deployers/management/XADSInstanceClassFactory.java
   branches/Branch_5_0/connector/src/tests/org/jboss/tests/jca/managed/ManagedObjectTestCase.java
   branches/Branch_5_0/connector/src/tests/org/jboss/tests/jca/managed/icf/XADSInstanceClassFactory.java
Log:
port JBAS-6218 to branch

Copied: branches/Branch_5_0/connector/src/main/org/jboss/resource/deployers/management/AbstractConnectionFactoryICF.java (from rev 82038, trunk/connector/src/main/org/jboss/resource/deployers/management/AbstractConnectionFactoryICF.java)
===================================================================
--- branches/Branch_5_0/connector/src/main/org/jboss/resource/deployers/management/AbstractConnectionFactoryICF.java	                        (rev 0)
+++ branches/Branch_5_0/connector/src/main/org/jboss/resource/deployers/management/AbstractConnectionFactoryICF.java	2008-12-05 07:15:32 UTC (rev 82069)
@@ -0,0 +1,138 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.resource.deployers.management;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.beans.info.spi.BeanInfo;
+import org.jboss.beans.info.spi.PropertyInfo;
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.managed.api.factory.ManagedObjectFactory;
+import org.jboss.managed.plugins.factory.AbstractInstanceClassFactory;
+import org.jboss.metadata.spi.MetaData;
+import org.jboss.metatype.api.types.SimpleMetaType;
+import org.jboss.metatype.api.values.MapCompositeValueSupport;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.metatype.api.values.SimpleValueSupport;
+import org.jboss.resource.metadata.mcf.ManagedConnectionFactoryDeploymentMetaData;
+import org.jboss.resource.metadata.mcf.ManagedConnectionFactoryPropertyMetaData;
+
+/**
+ * Common operations for the ManagedConnectionFactoryDeploymentMetaData.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public abstract class AbstractConnectionFactoryICF<T extends ManagedConnectionFactoryDeploymentMetaData>
+      extends AbstractInstanceClassFactory<T>
+{
+
+   public AbstractConnectionFactoryICF()
+   {
+      super();
+   }
+   
+   public AbstractConnectionFactoryICF(ManagedObjectFactory mof)
+   {
+      super(mof);
+   }
+   
+   @Override
+   public MetaValue getValue(BeanInfo beanInfo, ManagedProperty property,
+         MetaData metaData,
+         T attachment)
+   {
+      MetaValue value = null;
+      if("config-property".equals(property.getName()))
+      {
+         MapCompositeValueSupport mapValue = new MapCompositeValueSupport(SimpleMetaType.STRING);
+         List<ManagedConnectionFactoryPropertyMetaData> list = attachment.getManagedConnectionFactoryProperties();
+         if(list != null)
+         {
+            for(ManagedConnectionFactoryPropertyMetaData prop : list)
+            {
+               String name = prop.getName();               
+               MetaValue svalue = SimpleValueSupport.wrap(prop.getValue());
+               mapValue.put(name, svalue);
+               MetaValue stype = SimpleValueSupport.wrap(prop.getValue());
+               mapValue.put(name+".type", stype);
+            }
+         }
+         value = mapValue;
+      }
+      else
+      {
+         value = super.getValue(beanInfo, property, metaData, attachment);
+      }
+      return value;
+   }
+   
+   @Override
+   protected void setManagedObject(BeanInfo beanInfo,
+         PropertyInfo propertyInfo, T object,
+         ManagedObject mo)
+   {
+      if(propertyInfo.getName().equals("security-domain"))
+         InstanceClassFactoryUtils.setValue(object, mo);
+   }
+   
+   @Override
+   protected Object unwrapValue(BeanInfo beanInfo, ManagedProperty property,
+         MetaValue value)
+   {
+      Object unwrapValue = null;
+      if("config-property".equals(property.getName()))
+      {
+         if((value instanceof MapCompositeValueSupport) == false)
+         {
+            return super.unwrapValue(beanInfo, property, value);
+         }
+         
+         MapCompositeValueSupport mapValue = (MapCompositeValueSupport) value;
+         
+         List<ManagedConnectionFactoryPropertyMetaData> list = new ArrayList<ManagedConnectionFactoryPropertyMetaData>();
+         for(String name : mapValue.getMetaType().keySet())
+         {
+            ManagedConnectionFactoryPropertyMetaData prop = new ManagedConnectionFactoryPropertyMetaData();
+            prop.setName(name);
+            String svalue = (String) getMetaValueFactory().unwrap(mapValue.get(name));
+            prop.setValue(svalue);
+            String nameType = name+".type";
+            MetaValue typeValue = mapValue.get(nameType);
+            if(typeValue != null)
+            {
+               String type = (String) getMetaValueFactory().unwrap(typeValue);
+               prop.setType(type);
+            }
+            list.add(prop);
+         }
+         unwrapValue = list;
+      }
+      else
+      {
+         unwrapValue = super.unwrapValue(beanInfo, property, value);
+      }
+      return unwrapValue;
+   }
+}

Copied: branches/Branch_5_0/connector/src/main/org/jboss/resource/deployers/management/AbstractNonXADataSourceICF.java (from rev 82038, trunk/connector/src/main/org/jboss/resource/deployers/management/AbstractNonXADataSourceICF.java)
===================================================================
--- branches/Branch_5_0/connector/src/main/org/jboss/resource/deployers/management/AbstractNonXADataSourceICF.java	                        (rev 0)
+++ branches/Branch_5_0/connector/src/main/org/jboss/resource/deployers/management/AbstractNonXADataSourceICF.java	2008-12-05 07:15:32 UTC (rev 82069)
@@ -0,0 +1,117 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.resource.deployers.management;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.beans.info.spi.BeanInfo;
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.managed.api.factory.ManagedObjectFactory;
+import org.jboss.metadata.spi.MetaData;
+import org.jboss.metatype.api.types.SimpleMetaType;
+import org.jboss.metatype.api.values.MapCompositeValueSupport;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.metatype.api.values.SimpleValueSupport;
+import org.jboss.resource.metadata.mcf.DataSourceConnectionPropertyMetaData;
+import org.jboss.resource.metadata.mcf.NonXADataSourceDeploymentMetaData;
+
+/**
+ * Common operations for the NonXADataSourceDeploymentMetaData.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public abstract class AbstractNonXADataSourceICF<T extends NonXADataSourceDeploymentMetaData>
+      extends AbstractConnectionFactoryICF<T>
+{
+
+   public AbstractNonXADataSourceICF()
+   {
+      super();
+   }
+   
+   public AbstractNonXADataSourceICF(ManagedObjectFactory mof)
+   {
+      super(mof);
+   }
+   
+   @Override
+   public MetaValue getValue(BeanInfo beanInfo, ManagedProperty property,
+         MetaData metaData,
+         T attachment)
+   {
+      MetaValue value = null;
+      if("connection-properties".equals(property.getName()))
+      {
+         MapCompositeValueSupport mapValue = new MapCompositeValueSupport(SimpleMetaType.STRING);
+         List<DataSourceConnectionPropertyMetaData> list = attachment.getDataSourceConnectionProperties();
+         if(list != null)
+         {
+            for(DataSourceConnectionPropertyMetaData prop : list)
+            {
+               MetaValue wrapped = SimpleValueSupport.wrap(prop.getValue());
+               mapValue.put(prop.getName(), wrapped);
+            }
+         }
+         value = mapValue;
+      }
+      else
+      {
+         value = super.getValue(beanInfo, property, metaData, attachment);
+      }
+      return value;
+   }
+   
+   @Override
+   protected Object unwrapValue(BeanInfo beanInfo, ManagedProperty property,
+         MetaValue value)
+   {
+      Object unwrapValue = null;
+      if("connection-properties".equals(property.getName()))
+      {
+         if((value instanceof MapCompositeValueSupport) == false)
+         {
+            return super.unwrapValue(beanInfo, property, value);
+         }
+    
+         MapCompositeValueSupport mapValue = (MapCompositeValueSupport) value;
+         
+         List<DataSourceConnectionPropertyMetaData> list = new ArrayList<DataSourceConnectionPropertyMetaData>();
+         for(String name : mapValue.getMetaType().keySet())
+         {
+            DataSourceConnectionPropertyMetaData prop = new DataSourceConnectionPropertyMetaData();
+            prop.setName(name);
+            String svalue = (String) getMetaValueFactory().unwrap(mapValue.get(name));
+            prop.setValue(svalue);
+            list.add(prop);
+         }
+         unwrapValue = list;
+      }
+      else
+      {
+         unwrapValue = super.unwrapValue(beanInfo, property, value);
+      }
+      return unwrapValue;
+   }
+   
+}

Modified: branches/Branch_5_0/connector/src/main/org/jboss/resource/deployers/management/InstanceClassFactoryUtils.java
===================================================================
--- branches/Branch_5_0/connector/src/main/org/jboss/resource/deployers/management/InstanceClassFactoryUtils.java	2008-12-05 05:40:07 UTC (rev 82068)
+++ branches/Branch_5_0/connector/src/main/org/jboss/resource/deployers/management/InstanceClassFactoryUtils.java	2008-12-05 07:15:32 UTC (rev 82069)
@@ -29,7 +29,6 @@
 import org.jboss.managed.api.ManagedProperty;
 import org.jboss.metatype.api.types.SimpleMetaType;
 import org.jboss.metatype.api.values.EnumValue;
-import org.jboss.metatype.api.values.GenericValue;
 import org.jboss.metatype.api.values.MapCompositeValueSupport;
 import org.jboss.metatype.api.values.MetaValue;
 import org.jboss.metatype.api.values.MetaValueFactory;
@@ -42,7 +41,6 @@
 import org.jboss.resource.metadata.mcf.SecurityDomainApplicationManagedMetaData;
 import org.jboss.resource.metadata.mcf.SecurityDomainMetaData;
 import org.jboss.resource.metadata.mcf.SecurityMetaData;
-import org.jboss.resource.metadata.mcf.XADataSourceDeploymentMetaData;
 
 /**
  * property to meta value conversion for common properties

Modified: branches/Branch_5_0/connector/src/main/org/jboss/resource/deployers/management/LocalDSInstanceClassFactory.java
===================================================================
--- branches/Branch_5_0/connector/src/main/org/jboss/resource/deployers/management/LocalDSInstanceClassFactory.java	2008-12-05 05:40:07 UTC (rev 82068)
+++ branches/Branch_5_0/connector/src/main/org/jboss/resource/deployers/management/LocalDSInstanceClassFactory.java	2008-12-05 07:15:32 UTC (rev 82069)
@@ -21,24 +21,8 @@
  */
 package org.jboss.resource.deployers.management;
 
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jboss.beans.info.spi.BeanInfo;
-import org.jboss.beans.info.spi.PropertyInfo;
-import org.jboss.managed.api.ManagedObject;
-import org.jboss.managed.api.ManagedProperty;
 import org.jboss.managed.api.factory.ManagedObjectFactory;
-import org.jboss.managed.plugins.factory.AbstractInstanceClassFactory;
-import org.jboss.metadata.spi.MetaData;
-import org.jboss.metatype.api.types.SimpleMetaType;
-import org.jboss.metatype.api.values.MapCompositeValueSupport;
-import org.jboss.metatype.api.values.MetaValue;
-import org.jboss.metatype.api.values.SimpleValueSupport;
-import org.jboss.resource.metadata.mcf.DataSourceConnectionPropertyMetaData;
 import org.jboss.resource.metadata.mcf.LocalDataSourceDeploymentMetaData;
-import org.jboss.resource.metadata.mcf.ManagedConnectionFactoryPropertyMetaData;
 
 /**
  * An InstanceClassFactory for LocalDataSourceDeploymentMetaData that handles
@@ -48,12 +32,14 @@
  * @version $Revision$
  */
 public class LocalDSInstanceClassFactory
-   extends AbstractInstanceClassFactory<LocalDataSourceDeploymentMetaData>
+   extends AbstractNonXADataSourceICF<LocalDataSourceDeploymentMetaData>
 {
+   
    public LocalDSInstanceClassFactory()
    {
       super();
    }
+   
    public LocalDSInstanceClassFactory(ManagedObjectFactory mof)
    {
       super(mof);
@@ -63,102 +49,5 @@
    {
       return LocalDataSourceDeploymentMetaData.class;
    }
-
-   public Class<? extends Serializable> getManagedObjectClass(
-         LocalDataSourceDeploymentMetaData attachment)
-         throws ClassNotFoundException
-   {
-      return attachment.getClass();
-   }
-
-   public MetaValue getValue(BeanInfo beanInfo, ManagedProperty property,
-         MetaData metaData,
-         LocalDataSourceDeploymentMetaData attachment)
-   {
-      MetaValue value = null;
-      if("connection-properties".equals(property.getName()))
-      {
-         MapCompositeValueSupport mapValue = new MapCompositeValueSupport(SimpleMetaType.STRING);
-         List<DataSourceConnectionPropertyMetaData> list = attachment.getDataSourceConnectionProperties();
-         if(list != null)
-         {
-            for(DataSourceConnectionPropertyMetaData prop : list)
-            {
-               MetaValue wrapped = SimpleValueSupport.wrap(prop.getValue());
-               mapValue.put(prop.getName(), wrapped);
-            }
-         }
-         value = mapValue;
-      }
-      else if("config-property".equals(property.getName()))
-      {
-         MapCompositeValueSupport mapValue = new MapCompositeValueSupport(SimpleMetaType.STRING);
-         List<ManagedConnectionFactoryPropertyMetaData> list = attachment.getManagedConnectionFactoryProperties();
-         if(list != null)
-         {
-            for(ManagedConnectionFactoryPropertyMetaData prop : list)
-            {
-               mapValue.put("name", SimpleValueSupport.wrap(prop.getName()));
-               mapValue.put("value", SimpleValueSupport.wrap(prop.getValue()));
-               mapValue.put("type", SimpleValueSupport.wrap("java.lang.String"));
-            }
-         }
-         value = mapValue;
-      }
-      else
-      {
-         value = super.getValue(beanInfo, property, metaData, attachment);
-      }
-      return value;
-   }
-
-   @Override
-   protected void setManagedObject(BeanInfo beanInfo,
-         PropertyInfo propertyInfo, LocalDataSourceDeploymentMetaData object,
-         ManagedObject mo)
-   {
-      if(propertyInfo.getName().equals("security-domain"))
-         InstanceClassFactoryUtils.setValue(object, mo);
-   }
-
-   @Override
-   protected Object unwrapValue(BeanInfo beanInfo, ManagedProperty property,
-         MetaValue value)
-   {
-      if((value instanceof MapCompositeValueSupport) == false)
-      {
-         return super.unwrapValue(beanInfo, property, value);
-      }
-
-      MapCompositeValueSupport mapValue = (MapCompositeValueSupport) value;
-      Object unwrapValue = null;
-      if("connection-properties".equals(property.getName()))
-      {
-         List<DataSourceConnectionPropertyMetaData> list = new ArrayList<DataSourceConnectionPropertyMetaData>();
-         for(String name : mapValue.getMetaType().keySet())
-         {
-            DataSourceConnectionPropertyMetaData prop = new DataSourceConnectionPropertyMetaData();
-            prop.setName(name);
-            String svalue = (String) getMetaValueFactory().unwrap(mapValue.get(name));
-            prop.setValue(svalue);
-            list.add(prop);
-         }
-         unwrapValue = list;
-      }
-      else if("config-property".equals(property.getName()))
-      {
-         List<ManagedConnectionFactoryPropertyMetaData> list = new ArrayList<ManagedConnectionFactoryPropertyMetaData>();
-         for(String name : mapValue.getMetaType().keySet())
-         {
-            ManagedConnectionFactoryPropertyMetaData prop = new ManagedConnectionFactoryPropertyMetaData();
-            prop.setName(name);
-            String svalue = (String) getMetaValueFactory().unwrap(mapValue.get(name));
-            prop.setValue(svalue);
-            prop.setType("java.lang.String");
-            list.add(prop);
-         }
-         unwrapValue = list;
-      }
-      return unwrapValue;
-   }
+   
 }

Modified: branches/Branch_5_0/connector/src/main/org/jboss/resource/deployers/management/NoTxCFInstanceClassFactory.java
===================================================================
--- branches/Branch_5_0/connector/src/main/org/jboss/resource/deployers/management/NoTxCFInstanceClassFactory.java	2008-12-05 05:40:07 UTC (rev 82068)
+++ branches/Branch_5_0/connector/src/main/org/jboss/resource/deployers/management/NoTxCFInstanceClassFactory.java	2008-12-05 07:15:32 UTC (rev 82069)
@@ -21,13 +21,7 @@
  */
 package org.jboss.resource.deployers.management;
 
-import org.jboss.beans.info.spi.BeanInfo;
-import org.jboss.managed.api.ManagedProperty;
 import org.jboss.managed.api.factory.ManagedObjectFactory;
-import org.jboss.managed.plugins.factory.AbstractInstanceClassFactory;
-import org.jboss.metadata.spi.MetaData;
-import org.jboss.metatype.api.values.MapCompositeValueSupport;
-import org.jboss.metatype.api.values.MetaValue;
 import org.jboss.resource.metadata.mcf.NoTxConnectionFactoryDeploymentMetaData;
 
 /**
@@ -38,12 +32,14 @@
  * @version $Revision$
  */
 public class NoTxCFInstanceClassFactory
-   extends AbstractInstanceClassFactory<NoTxConnectionFactoryDeploymentMetaData>
+   extends AbstractConnectionFactoryICF<NoTxConnectionFactoryDeploymentMetaData>
 {
+   
    public NoTxCFInstanceClassFactory()
    {
       super();
    }
+   
    public NoTxCFInstanceClassFactory(ManagedObjectFactory mof)
    {
       super(mof);
@@ -53,38 +49,5 @@
    {
       return NoTxConnectionFactoryDeploymentMetaData.class;
    }
-
-   public MetaValue getValue(BeanInfo beanInfo, ManagedProperty property,
-         MetaData metaData,
-         NoTxConnectionFactoryDeploymentMetaData attachment)
-   {
-      MetaValue value = null;
-      if("config-property".equals(property.getName()))
-      {
-         value = InstanceClassFactoryUtils.getConfigPropertyValue(beanInfo, property, attachment);
-      }
-      else
-      {
-         value = super.getValue(beanInfo, property, metaData, attachment);
-      }
-      return value;
-   }
-
-   @Override
-   protected Object unwrapValue(BeanInfo beanInfo, ManagedProperty property,
-         MetaValue value)
-   {
-      if((value instanceof MapCompositeValueSupport) == false)
-      {
-         return super.unwrapValue(beanInfo, property, value);
-      }
-
-      Object unwrapValue = null;
-      if("config-property".equals(property.getName()))
-      {
-         unwrapValue = InstanceClassFactoryUtils.unwrapConfigPropertyValue(beanInfo,
-               property, value, getMetaValueFactory());
-      }
-      return unwrapValue;
-   }
+   
 }

Modified: branches/Branch_5_0/connector/src/main/org/jboss/resource/deployers/management/NoTxInstanceClassFactory.java
===================================================================
--- branches/Branch_5_0/connector/src/main/org/jboss/resource/deployers/management/NoTxInstanceClassFactory.java	2008-12-05 05:40:07 UTC (rev 82068)
+++ branches/Branch_5_0/connector/src/main/org/jboss/resource/deployers/management/NoTxInstanceClassFactory.java	2008-12-05 07:15:32 UTC (rev 82069)
@@ -21,13 +21,7 @@
  */
 package org.jboss.resource.deployers.management;
 
-import org.jboss.beans.info.spi.BeanInfo;
-import org.jboss.managed.api.ManagedProperty;
 import org.jboss.managed.api.factory.ManagedObjectFactory;
-import org.jboss.managed.plugins.factory.AbstractInstanceClassFactory;
-import org.jboss.metadata.spi.MetaData;
-import org.jboss.metatype.api.values.MapCompositeValueSupport;
-import org.jboss.metatype.api.values.MetaValue;
 import org.jboss.resource.metadata.mcf.NoTxDataSourceDeploymentMetaData;
 
 /**
@@ -37,12 +31,14 @@
  * @version $Revision$
  */
 public class NoTxInstanceClassFactory
-   extends AbstractInstanceClassFactory<NoTxDataSourceDeploymentMetaData>
+   extends AbstractNonXADataSourceICF<NoTxDataSourceDeploymentMetaData>
 {
+   
    public NoTxInstanceClassFactory()
    {
       super();
    }
+   
    public NoTxInstanceClassFactory(ManagedObjectFactory mof)
    {
       super(mof);
@@ -52,38 +48,5 @@
    {
       return NoTxDataSourceDeploymentMetaData.class;
    }
-
-   public MetaValue getValue(BeanInfo beanInfo, ManagedProperty property,
-         MetaData metaData,
-         NoTxDataSourceDeploymentMetaData attachment)
-   {
-      MetaValue value = null;
-      if("config-property".equals(property.getName()))
-      {
-         value = InstanceClassFactoryUtils.getConfigPropertyValue(beanInfo, property, attachment);
-      }
-      else
-      {
-         value = super.getValue(beanInfo, property, metaData, attachment);
-      }
-      return value;
-   }
-
-   @Override
-   protected Object unwrapValue(BeanInfo beanInfo, ManagedProperty property,
-         MetaValue value)
-   {
-      if((value instanceof MapCompositeValueSupport) == false)
-      {
-         return super.unwrapValue(beanInfo, property, value);
-      }
-
-      Object unwrapValue = null;
-      if("config-property".equals(property.getName()))
-      {
-         unwrapValue = InstanceClassFactoryUtils.unwrapConfigPropertyValue(beanInfo,
-               property, value, getMetaValueFactory());
-      }
-      return unwrapValue;
-   }
+   
 }

Modified: branches/Branch_5_0/connector/src/main/org/jboss/resource/deployers/management/TxInstanceClassFactory.java
===================================================================
--- branches/Branch_5_0/connector/src/main/org/jboss/resource/deployers/management/TxInstanceClassFactory.java	2008-12-05 05:40:07 UTC (rev 82068)
+++ branches/Branch_5_0/connector/src/main/org/jboss/resource/deployers/management/TxInstanceClassFactory.java	2008-12-05 07:15:32 UTC (rev 82069)
@@ -21,13 +21,7 @@
  */
 package org.jboss.resource.deployers.management;
 
-import org.jboss.beans.info.spi.BeanInfo;
-import org.jboss.managed.api.ManagedProperty;
 import org.jboss.managed.api.factory.ManagedObjectFactory;
-import org.jboss.managed.plugins.factory.AbstractInstanceClassFactory;
-import org.jboss.metadata.spi.MetaData;
-import org.jboss.metatype.api.values.MapCompositeValueSupport;
-import org.jboss.metatype.api.values.MetaValue;
 import org.jboss.resource.metadata.mcf.TxConnectionFactoryDeploymentMetaData;
 
 /**
@@ -38,13 +32,14 @@
  * @version $Revision$
  */
 public class TxInstanceClassFactory
-   extends AbstractInstanceClassFactory<TxConnectionFactoryDeploymentMetaData>
+   extends AbstractConnectionFactoryICF<TxConnectionFactoryDeploymentMetaData>
 {
    
    public TxInstanceClassFactory()
    {
       super();
    }
+   
    public TxInstanceClassFactory(ManagedObjectFactory mof)
    {
       super(mof);
@@ -54,38 +49,5 @@
    {
       return TxConnectionFactoryDeploymentMetaData.class;
    }
-
-   public MetaValue getValue(BeanInfo beanInfo, ManagedProperty property,
-         MetaData metaData,
-         TxConnectionFactoryDeploymentMetaData attachment)
-   {
-      MetaValue value = null;
-      if("config-property".equals(property.getName()))
-      {
-         value = InstanceClassFactoryUtils.getConfigPropertyValue(beanInfo, property, attachment);
-      }
-      else
-      {
-         value = super.getValue(beanInfo, property, metaData, attachment);
-      }
-      return value;
-   }
-
-   @Override
-   protected Object unwrapValue(BeanInfo beanInfo, ManagedProperty property,
-         MetaValue value)
-   {
-      if((value instanceof MapCompositeValueSupport) == false)
-      {
-         return super.unwrapValue(beanInfo, property, value);
-      }
-
-      Object unwrapValue = null;
-      if("config-property".equals(property.getName()))
-      {
-         unwrapValue = InstanceClassFactoryUtils.unwrapConfigPropertyValue(beanInfo,
-               property, value, getMetaValueFactory());
-      }
-      return unwrapValue;
-   }
+   
 }

Modified: branches/Branch_5_0/connector/src/main/org/jboss/resource/deployers/management/XAConnectionFactoryProperty.java
===================================================================
--- branches/Branch_5_0/connector/src/main/org/jboss/resource/deployers/management/XAConnectionFactoryProperty.java	2008-12-05 05:40:07 UTC (rev 82068)
+++ branches/Branch_5_0/connector/src/main/org/jboss/resource/deployers/management/XAConnectionFactoryProperty.java	2008-12-05 07:15:32 UTC (rev 82069)
@@ -21,29 +21,22 @@
  */
 package org.jboss.resource.deployers.management;
 
-import java.lang.reflect.Type;
-import java.util.Map;
-import java.util.List;
-import java.util.ArrayList;
-import java.io.Serializable;
 import java.io.ObjectStreamException;
-import org.jboss.managed.plugins.WritethroughManagedPropertyImpl;
-import org.jboss.managed.plugins.ManagedPropertyImpl;
-import org.jboss.managed.plugins.factory.ManagedObjectFactoryBuilder;
+import java.io.Serializable;
+
+import org.jboss.beans.info.spi.BeanInfo;
+import org.jboss.beans.info.spi.PropertyInfo;
 import org.jboss.managed.api.Fields;
 import org.jboss.managed.api.ManagedObject;
 import org.jboss.managed.api.factory.ManagedObjectFactory;
+import org.jboss.managed.plugins.ManagedPropertyImpl;
+import org.jboss.managed.plugins.factory.ManagedObjectFactoryBuilder;
 import org.jboss.managed.spi.factory.InstanceClassFactory;
 import org.jboss.metatype.api.types.MapCompositeMetaType;
 import org.jboss.metatype.api.types.MetaType;
-import org.jboss.metatype.api.types.MetaTypeFactory;
 import org.jboss.metatype.api.types.SimpleMetaType;
-import org.jboss.metatype.api.values.MetaValueFactory;
 import org.jboss.metatype.api.values.MetaValue;
-import org.jboss.beans.info.spi.PropertyInfo;
-import org.jboss.beans.info.spi.BeanInfo;
-import org.jboss.resource.metadata.mcf.ManagedConnectionFactoryPropertyMetaData;
-import org.jboss.resource.metadata.mcf.XAConnectionPropertyMetaData;
+import org.jboss.metatype.api.values.MetaValueFactory;
 
 /**
  * @author <a href="mailto:alex at jboss.org">Alexey Loubyansky</a>

Modified: branches/Branch_5_0/connector/src/main/org/jboss/resource/deployers/management/XADSInstanceClassFactory.java
===================================================================
--- branches/Branch_5_0/connector/src/main/org/jboss/resource/deployers/management/XADSInstanceClassFactory.java	2008-12-05 05:40:07 UTC (rev 82068)
+++ branches/Branch_5_0/connector/src/main/org/jboss/resource/deployers/management/XADSInstanceClassFactory.java	2008-12-05 07:15:32 UTC (rev 82069)
@@ -25,10 +25,8 @@
 import java.util.List;
 
 import org.jboss.beans.info.spi.BeanInfo;
-import org.jboss.logging.Logger;
 import org.jboss.managed.api.ManagedProperty;
 import org.jboss.managed.api.factory.ManagedObjectFactory;
-import org.jboss.managed.plugins.factory.AbstractInstanceClassFactory;
 import org.jboss.metadata.spi.MetaData;
 import org.jboss.metatype.api.types.SimpleMetaType;
 import org.jboss.metatype.api.values.MapCompositeValueSupport;
@@ -45,9 +43,8 @@
  * @version $Revision$
  */
 public class XADSInstanceClassFactory
-   extends AbstractInstanceClassFactory<XADataSourceDeploymentMetaData>
+   extends AbstractConnectionFactoryICF<XADataSourceDeploymentMetaData>
 {
-   private static final Logger log = Logger.getLogger(XADSInstanceClassFactory.class);
 
    public XADSInstanceClassFactory()
    {
@@ -63,6 +60,7 @@
       return XADataSourceDeploymentMetaData.class;
    }
 
+   @Override
    public MetaValue getValue(BeanInfo beanInfo, ManagedProperty property,
          MetaData metaData,
          XADataSourceDeploymentMetaData attachment)
@@ -82,11 +80,6 @@
             metaValue = map;
          }
       }
-      else if("config-property".equals(property.getName()))
-      {
-         metaValue = InstanceClassFactoryUtils.getConfigPropertyValue(beanInfo, property, attachment);
-         return metaValue;
-      }
       else
       {
          metaValue = super.getValue(beanInfo, property, metaData, attachment);
@@ -98,15 +91,17 @@
    protected Object unwrapValue(BeanInfo beanInfo, ManagedProperty property,
          MetaValue value)
    {
-      if((value instanceof MapCompositeValueSupport) == false)
-      {
-         return super.unwrapValue(beanInfo, property, value);
-      }
 
-      MapCompositeValueSupport mapValue = (MapCompositeValueSupport) value;
       Object unwrapValue = null;
       if("xa-datasource-properties".equals(property.getName()))
       {
+         if((value instanceof MapCompositeValueSupport) == false)
+         {
+            return super.unwrapValue(beanInfo, property, value);
+         }
+         
+         MapCompositeValueSupport mapValue = (MapCompositeValueSupport) value;         
+         
          List<XAConnectionPropertyMetaData> list = new ArrayList<XAConnectionPropertyMetaData>();
          for(String name : mapValue.getMetaType().keySet())
          {
@@ -118,10 +113,9 @@
          }
          unwrapValue = list;
       }
-      else if("config-property".equals(property.getName()))
+      else
       {
-         unwrapValue = InstanceClassFactoryUtils.unwrapConfigPropertyValue(beanInfo,
-               property, value, getMetaValueFactory());
+         unwrapValue = super.unwrapValue(beanInfo, property, value);
       }
 
       return unwrapValue;

Modified: branches/Branch_5_0/connector/src/tests/org/jboss/tests/jca/managed/ManagedObjectTestCase.java
===================================================================
--- branches/Branch_5_0/connector/src/tests/org/jboss/tests/jca/managed/ManagedObjectTestCase.java	2008-12-05 05:40:07 UTC (rev 82068)
+++ branches/Branch_5_0/connector/src/tests/org/jboss/tests/jca/managed/ManagedObjectTestCase.java	2008-12-05 07:15:32 UTC (rev 82069)
@@ -21,26 +21,13 @@
  */
 package org.jboss.tests.jca.managed;
 
-import java.beans.BeanInfo;
-import java.beans.ExceptionListener;
-import java.beans.Introspector;
-import java.beans.PropertyDescriptor;
-import java.beans.XMLEncoder;
-import java.io.ByteArrayOutputStream;
-import java.net.URL;
 import java.util.Arrays;
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.TreeSet;
 
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBElement;
-import javax.xml.bind.Marshaller;
-import javax.xml.namespace.QName;
-
 import org.jboss.managed.api.DeploymentTemplateInfo;
 import org.jboss.managed.api.ManagedObject;
 import org.jboss.managed.api.ManagedProperty;
@@ -55,13 +42,11 @@
 import org.jboss.metatype.api.values.SimpleValueSupport;
 import org.jboss.resource.connectionmanager.JBossManagedConnectionPool;
 import org.jboss.resource.deployers.management.LocalDSInstanceClassFactory;
+import org.jboss.resource.deployers.management.NoTxCFInstanceClassFactory;
 import org.jboss.resource.deployers.management.TxInstanceClassFactory;
 import org.jboss.resource.deployers.management.XADSInstanceClassFactory;
-import org.jboss.resource.metadata.mcf.DBMSMetaData;
 import org.jboss.resource.metadata.mcf.DataSourceConnectionPropertyMetaData;
 import org.jboss.resource.metadata.mcf.LocalDataSourceDeploymentMetaData;
-import org.jboss.resource.metadata.mcf.ManagedConnectionFactoryDeploymentGroup;
-import org.jboss.resource.metadata.mcf.ManagedConnectionFactoryDeploymentMetaData;
 import org.jboss.resource.metadata.mcf.NoTxDataSourceDeploymentMetaData;
 import org.jboss.resource.metadata.mcf.SecurityMetaData;
 import org.jboss.resource.metadata.mcf.TxConnectionFactoryDeploymentMetaData;
@@ -90,7 +75,7 @@
       "idle-timeout-minutes",
       "prefill",
       "background-validation",
-      "background-validation-minutes",
+      "background-validation-millis",
       "validate-on-match",
       "use-strict-min",
       "statistics-formatter",
@@ -100,7 +85,9 @@
       "security-domain",
       "type-mapping",
       "metadata",
-      "no-tx-separate-pools"
+      "no-tx-separate-pools",
+      "allocation-retry",
+      "allocation-retry-wait-millis"
    };
    static final String[] ManagedConnectionFactoryDeploymentMetaData_NAMES = {
       "jndi-name",
@@ -127,7 +114,8 @@
       "metadata",
       "no-tx-separate-pools",
       "interleaving",
-      "use-try-lock"
+      "allocation-retry",
+      "allocation-retry-wait-millis"
    };
 
    static final String[] DataSourceDeploymentMetaData_NAMES = {
@@ -145,7 +133,8 @@
       "query-timeout",
       "stale-connection-checker-class-name",
       "url-delimiter",
-      "url-selector-strategy-class-name"
+      "url-selector-strategy-class-name",
+      "use-try-lock"
    };
    static final String[] DataSourceDeploymentTemplate_NAMES = DataSourceDeploymentMetaData_NAMES;
 
@@ -192,6 +181,7 @@
    {
       enableTrace("org.jboss.managed.plugins.factory");
       ManagedObjectFactory mof = ManagedObjectFactory.getInstance();
+      mof.addInstanceClassFactory(new NoTxCFInstanceClassFactory());
       ManagedObject mo = mof.createManagedObject(NoTxDataSourceDeploymentMetaData.class);
       log.info(mo.getProperties());
       // Validate the expected property names
@@ -201,7 +191,14 @@
       expectedPropertyNames.addAll(Arrays.asList(NonXADataSourceDeploymentMetaData_NAMES));
       Set<String> propertyNames = mo.getPropertyNames();
       TreeSet<String> sortedPropertyNames = new TreeSet<String>(propertyNames);
-      assertEquals(expectedPropertyNames, sortedPropertyNames);
+      if(expectedPropertyNames.equals(sortedPropertyNames) == false)
+      {
+         Set<String> missingNames = new TreeSet<String>();
+         Set<String> extraNames = new TreeSet<String>();
+         analyzeDiffs(expectedPropertyNames, sortedPropertyNames,
+               missingNames, extraNames);
+         fail("Extra properties: "+extraNames+", missing properties: "+missingNames);
+      }
    }
    public void testTxConnectionFactoryMetaData()
    {
@@ -478,99 +475,6 @@
    }
 
    /**
-    * Just a test to see what the java.beans.XMLEncoder output for the
-    * local ds metadata looks like.
-    */
-   public void testJavaBeanXml()
-      throws Exception
-   {
-      ManagedConnectionFactoryDeploymentGroup mcfs = initMCFDG();
-      
-      BeanInfo info = Introspector.getBeanInfo(mcfs.getClass());
-      for(PropertyDescriptor pd : info.getPropertyDescriptors())
-         System.out.println(pd.getName() + ", "+pd.getReadMethod());
-
-
-      ByteArrayOutputStream baos = new ByteArrayOutputStream();
-      XMLEncoder oos = new XMLEncoder(baos);
-      oos.setExceptionListener(new ExceptionListener()
-      {
-         public void exceptionThrown(Exception e)
-         {
-            e.printStackTrace();
-         }  
-      });
-      oos.writeObject(mcfs);
-      oos.close();
-
-      String s = new String(baos.toByteArray());
-      System.out.println(s);
-   }
-   /**
-    * Just a test to see what the jaxb output for the
-    * local ds metadata looks like.
-    */
-   public void testJaxbMCFXml()
-      throws Exception
-   {
-      ManagedConnectionFactoryDeploymentGroup mcfs = initMCFDG();
-   
-      JAXBContext ctx = JAXBContext.newInstance(ManagedConnectionFactoryDeploymentGroup.class);
-      Marshaller marshaller = ctx.createMarshaller();
-      marshaller.setProperty("jaxb.formatted.output", Boolean.TRUE);
-      QName mcfsName = new QName("datasources");
-      JAXBElement<ManagedConnectionFactoryDeploymentGroup> root = new
-         JAXBElement<ManagedConnectionFactoryDeploymentGroup>(mcfsName,
-               ManagedConnectionFactoryDeploymentGroup.class, mcfs);
-      marshaller.marshal(root, System.out);
-   }
-
-   private ManagedConnectionFactoryDeploymentGroup initMCFDG()
-      throws Exception
-   {
-      ManagedConnectionFactoryDeploymentGroup mcfs = new ManagedConnectionFactoryDeploymentGroup();
-      LocalDataSourceDeploymentMetaData lds = new LocalDataSourceDeploymentMetaData();
-      lds.setBackgroundValidation(true);
-      lds.setBackgroundValidationMillis(5000);
-      lds.setBlockingTimeoutMilliSeconds(5000);
-      lds.setCheckValidConnectionSQL("select something from somewhere");
-      lds.setConnectionDefinition("conn def");
-      lds.setConnectionUrl("jdbc:xyz:a=b");
-      DataSourceConnectionPropertyMetaData cp1 = new DataSourceConnectionPropertyMetaData();
-      cp1.setName("cp1-name");
-      cp1.setValue("cp1-value");
-      DataSourceConnectionPropertyMetaData cp2 = new DataSourceConnectionPropertyMetaData();
-      cp2.setName("cp2-name");
-      cp2.setValue("cp2-value");
-      DataSourceConnectionPropertyMetaData[] cps = {
-        cp1, cp2    
-      };
-      lds.setDataSourceConnectionProperties(Arrays.asList(cps));
-      lds.setDriverClass("org.jboss.jdbc.SomeDriver");
-      lds.setExceptionSorterClassName("org.jboss.jdbc.SomeExceptionSorter");
-      String[] depends = {"jboss:service=Naming", "jboss:service=Hypersonic,database=localDB"};
-      lds.setDependsNames(Arrays.asList(depends));
-      lds.setIdleTimeoutMinutes(15);
-      lds.setInterleaving(false);
-      lds.setMaxSize(100);
-      lds.setMinSize(1);
-      DBMSMetaData md = new DBMSMetaData();
-      md.setTypeMapping("Hypersonic SQL");
-      lds.setDBMSMetaData(md);
-      lds.setNewConnectionSQL("run this on a new conn");
-      lds.setPassWord("password");
-      lds.setPrefill(true);
-      lds.setPreparedStatementCacheSize(50);
-      lds.setQueryTimeout(30000);
-      lds.setUserName("user");
-
-      ManagedConnectionFactoryDeploymentMetaData[] mds = {lds};
-      mcfs.setDeployments(Arrays.asList(mds));
-      mcfs.setUrl(new URL("file:/deploy/some-ds.xml"));
-      return mcfs;
-   }
-
-   /**
     * Build the missingNames, extraNames from the input expectedPropertyNames
     * and sortedPropertyNames.
     * 

Modified: branches/Branch_5_0/connector/src/tests/org/jboss/tests/jca/managed/icf/XADSInstanceClassFactory.java
===================================================================
--- branches/Branch_5_0/connector/src/tests/org/jboss/tests/jca/managed/icf/XADSInstanceClassFactory.java	2008-12-05 05:40:07 UTC (rev 82068)
+++ branches/Branch_5_0/connector/src/tests/org/jboss/tests/jca/managed/icf/XADSInstanceClassFactory.java	2008-12-05 07:15:32 UTC (rev 82069)
@@ -23,12 +23,7 @@
 
 import java.io.Serializable;
 
-import org.jboss.beans.info.spi.BeanInfo;
-import org.jboss.logging.Logger;
-import org.jboss.managed.api.ManagedProperty;
-import org.jboss.managed.plugins.factory.AbstractInstanceClassFactory;
-import org.jboss.metadata.spi.MetaData;
-import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.resource.deployers.management.AbstractConnectionFactoryICF;
 import org.jboss.resource.metadata.mcf.XADataSourceDeploymentMetaData;
 
 /**
@@ -37,16 +32,14 @@
  * @version $Revision$
  */
 public class XADSInstanceClassFactory
-   extends AbstractInstanceClassFactory<XADataSourceDeploymentMetaData>
+   extends AbstractConnectionFactoryICF<XADataSourceDeploymentMetaData>
 {
-   private static final Logger log = Logger.getLogger(XADSInstanceClassFactory.class);
 
    public Class<? extends Serializable> getManagedObjectClass(
          XADataSourceDeploymentMetaData attachment)
          throws ClassNotFoundException
    {
-      // TODO Auto-generated method stub
-      return null;
+      return attachment.getClass();
    }
 
    public Class<XADataSourceDeploymentMetaData> getType()
@@ -54,12 +47,4 @@
       return XADataSourceDeploymentMetaData.class;
    }
 
-   public MetaValue getValue(BeanInfo beanInfo, ManagedProperty property,
-         MetaData metaData,
-         XADataSourceDeploymentMetaData attachment)
-   {
-      log.info("getValue, "+property);
-      return null;
-   }
-
 }




More information about the jboss-cvs-commits mailing list