Package org.jboss.resource.metadata.mcf

Examples of org.jboss.resource.metadata.mcf.XADataSourceDeploymentMetaData


            KnownComponentTypes.DataSourceTypes.LocalTx.getType().getType(),
            KnownComponentTypes.DataSourceTypes.LocalTx.getType().getSubtype());
      }
      else if("xa-datasource".equals(cfType))
      {
         mcf = new XADataSourceDeploymentMetaData();
         mof.setInstanceClassFactory(XADataSourceDeploymentMetaData.class, new XADSInstanceClassFactory(mof));
         cfMO = mof.initManagedObject(mcf,
            KnownComponentTypes.DataSourceTypes.XA.getType().getType(),
            KnownComponentTypes.DataSourceTypes.XA.getType().getSubtype());
      }
View Full Code Here


         raa.setResourceAdapter(resourceAdapter);
      }

      if (dmd instanceof XADataSourceDeploymentMetaData)
      {
         XADataSourceDeploymentMetaData xdsdm = (XADataSourceDeploymentMetaData)dmd;

         if (getXAResourceRecoveryRegistry() != null && !xdsdm.isNoRecover())
         {
            // If we have an XAResourceRecoveryRegistry and the deployment is XA
            // lets register it for XA Resource Recovery using the "recover" definitions
            // from the -ds.xml file. Fallback to the standard definitions for
            // user name, password. Keep a seperate reference to the security-domain

            SecurityMetaData recoverSecurityDomainMD = xdsdm.getRecoverSecurityMetaData();
            if (recoverSecurityDomainMD != null)
               recoverSecurityDomain = recoverSecurityDomainMD.getDomain();

            SecurityMetaData securityDomainMD = xdsdm.getSecurityMetaData();
            if (securityDomainMD != null)
               securityDomain = securityDomainMD.getDomain();

            recoverUserName = xdsdm.getRecoverUserName();
            recoverPassword = xdsdm.getRecoverPassWord();

            if (recoverUserName == null)
            {
               for (XAConnectionPropertyMetaData xcpmd : xdsdm.getXADataSourceProperties())
               {
                  if (xcpmd.getName().equals("User"))
                     recoverUserName = xcpmd.getValue();
               }
            }

            if (recoverPassword == null)
            {
               for (XAConnectionPropertyMetaData xcpmd : xdsdm.getXADataSourceProperties())
               {
                  if (xcpmd.getName().equals("Password"))
                     recoverPassword = xcpmd.getValue();
               }
            }

            if (recoverUserName == null)
               recoverUserName = xdsdm.getUserName();

            if (recoverPassword == null)
               recoverPassword = xdsdm.getPassWord();

            if (log.isDebugEnabled())
               log.debug("Registered for XA Resource Recovery: " + xdsdm.getJndiName());

            if (log.isDebugEnabled())
            {
               if (recoverUserName != null)
               {
View Full Code Here

   {
      enableTrace("org.jboss.managed.plugins.factory");
      ManagedObjectFactory mof = ManagedObjectFactory.getInstance();
      XADSInstanceClassFactory icf = new XADSInstanceClassFactory();
      mof.setInstanceClassFactory(XADataSourceDeploymentMetaData.class, icf);
      XADataSourceDeploymentMetaData xads = new XADataSourceDeploymentMetaData();
      ManagedObject mo = mof.initManagedObject(xads, "XADataSourceDeploymentMetaData", null);
      // Validate the expected property names
      Set<String> expectedPropertyNames = new TreeSet<String>();
      expectedPropertyNames.addAll(Arrays.asList(ManagedConnectionFactoryDeploymentMetaData_NAMES));
      expectedPropertyNames.addAll(Arrays.asList(DataSourceDeploymentMetaData_NAMES));
      expectedPropertyNames.addAll(Arrays.asList(XADataSourceDeploymentMetaData_NAMES));
      Set<String> propertyNames = mo.getPropertyNames();
      TreeSet<String> sortedPropertyNames = new TreeSet<String>(propertyNames);
      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);
      }
      // Validate the xa-datasource-properties type
      ManagedProperty connectionProperties = mo.getProperty("xa-datasource-properties");
      MetaType cpType = connectionProperties.getMetaType();
      assertTrue("xa-datasource-properties.type="+cpType, cpType instanceof CompositeMetaType);
      Object cpValue = connectionProperties.getValue();
      assertTrue("xa-datasource-properties.value="+cpValue, cpValue instanceof CompositeValue);
      CompositeValue cvalue = (CompositeValue) cpValue;
      // Now update the values
      MapCompositeValueSupport map = (MapCompositeValueSupport) cvalue;
      map.put("key1", SimpleValueSupport.wrap("value1"));
      map.put("key2", SimpleValueSupport.wrap("value2"));
      connectionProperties.setValue(map);
      // Check the underlying values
      List<XAConnectionPropertyMetaData> xaProps = xads.getXADataSourceProperties();
      assertEquals(2, xaProps.size());
      DataSourceConnectionPropertyMetaData key1 = null;
      DataSourceConnectionPropertyMetaData key2 = null;
      for(XAConnectionPropertyMetaData dspmd : xaProps)
      {
         if(dspmd.getName().equals("key1"))
            key1 = dspmd;
         else if(dspmd.getName().equals("key2"))
            key2 = dspmd;
      }
      assertNotNull(key1);
      assertEquals("value1", key1.getValue());
      assertNotNull(key2);
      assertEquals("value2", key2.getValue());
      // Test a simple property
      ManagedProperty jndiName = mo.getProperty("jndi-name");
      jndiName.setValue(SimpleValueSupport.wrap("java:ClusteredDS"));
      String jndiNameTest = xads.getJndiName();
      assertEquals("java:ClusteredDS", jndiNameTest);
   }
View Full Code Here

   public void testXADSInstanceClassFactory()
      throws Exception
   {
      XADSInstanceClassFactory icf = new XADSInstanceClassFactory();
      XADataSourceDeploymentMetaData xads = new XADataSourceDeploymentMetaData();
      ManagedPropertyImpl property = new ManagedPropertyImpl("xa-datasource-properties");
      icf.getValue(null, property, null, xads);
      InstanceClassFactory icfref = icf;
      Serializable x = xads;
      icfref.getValue(null, property, null, x);
View Full Code Here

   {
      enableTrace("org.jboss.managed.plugins.factory");
      ManagedObjectFactory mof = ManagedObjectFactory.getInstance();
      XADSInstanceClassFactory icf = new XADSInstanceClassFactory();
      mof.setInstanceClassFactory(XADataSourceDeploymentMetaData.class, icf);
      XADataSourceDeploymentMetaData xads = new XADataSourceDeploymentMetaData();
      ManagedObject mo = mof.initManagedObject(xads, "XADataSourceDeploymentMetaData", null);
      // Validate the expected property names
      Set<String> expectedPropertyNames = new TreeSet<String>();
      expectedPropertyNames.addAll(Arrays.asList(ManagedConnectionFactoryDeploymentMetaData_NAMES));
      expectedPropertyNames.addAll(Arrays.asList(DataSourceDeploymentMetaData_NAMES));
      expectedPropertyNames.addAll(Arrays.asList(XADataSourceDeploymentMetaData_NAMES));
      Set<String> propertyNames = mo.getPropertyNames();
      TreeSet<String> sortedPropertyNames = new TreeSet<String>(propertyNames);
      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);
      }
      // Validate the xa-datasource-properties type
      ManagedProperty connectionProperties = mo.getProperty("xa-datasource-properties");
      MetaType cpType = connectionProperties.getMetaType();
      assertTrue("xa-datasource-properties.type="+cpType, cpType instanceof CompositeMetaType);
      Object cpValue = connectionProperties.getValue();
      assertTrue("xa-datasource-properties.value="+cpValue, cpValue instanceof CompositeValue);
      CompositeValue cvalue = (CompositeValue) cpValue;
      // Now update the values
      MapCompositeValueSupport map = (MapCompositeValueSupport) cvalue;
      map.put("key1", SimpleValueSupport.wrap("value1"));
      map.put("key2", SimpleValueSupport.wrap("value2"));
      connectionProperties.setValue(map);
      // Check the underlying values
      List<XAConnectionPropertyMetaData> xaProps = xads.getXADataSourceProperties();
      assertEquals(2, xaProps.size());
      DataSourceConnectionPropertyMetaData key1 = null;
      DataSourceConnectionPropertyMetaData key2 = null;
      for(XAConnectionPropertyMetaData dspmd : xaProps)
      {
         if(dspmd.getName().equals("key1"))
            key1 = dspmd;
         else if(dspmd.getName().equals("key2"))
            key2 = dspmd;
      }
      assertNotNull(key1);
      assertEquals("value1", key1.getValue());
      assertNotNull(key2);
      assertEquals("value2", key2.getValue());
      // Test a simple property
      ManagedProperty jndiName = mo.getProperty("jndi-name");
      jndiName.setValue(SimpleValueSupport.wrap("java:ClusteredDS"));
      String jndiNameTest = xads.getJndiName();
      assertEquals("java:ClusteredDS", jndiNameTest);
   }
View Full Code Here

   public void testXADSInstanceClassFactory()
      throws Exception
   {
      XADSInstanceClassFactory icf = new XADSInstanceClassFactory();
      XADataSourceDeploymentMetaData xads = new XADataSourceDeploymentMetaData();
      ManagedPropertyImpl property = new ManagedPropertyImpl("xa-datasource-properties");
      icf.getValue(null, property, null, xads);
      InstanceClassFactory icfref = icf;
      Serializable x = xads;
      icfref.getValue(null, property, null, x);
View Full Code Here

            KnownComponentTypes.DataSourceTypes.LocalTx.getType().getType(),
            KnownComponentTypes.DataSourceTypes.LocalTx.getType().getSubtype());
      }
      else if("xa-datasource".equals(cfType))
      {
         mcf = new XADataSourceDeploymentMetaData();
         mof.setInstanceClassFactory(XADataSourceDeploymentMetaData.class, new XADSInstanceClassFactory(mof));
         cfMO = mof.initManagedObject(mcf,
            KnownComponentTypes.DataSourceTypes.XA.getType().getType(),
            KnownComponentTypes.DataSourceTypes.XA.getType().getSubtype());
      }
View Full Code Here

/*     */   public MetaValue getValue(BeanInfo beanInfo, ManagedProperty property, Serializable object)
/*     */   {
/*  78 */     if ("xa-datasource-properties".equals(property.getName()))
/*     */     {
/*  80 */       MetaValue metaValue = null;
/*  81 */       XADataSourceDeploymentMetaData ds = (XADataSourceDeploymentMetaData)object;
/*  82 */       List list = ds.getXADataSourceProperties();
/*  83 */       if (list != null)
/*     */       {
/*  85 */         Map map = new HashMap();
/*  86 */         for (XAConnectionPropertyMetaData prop : list)
/*     */         {
View Full Code Here

/*     */     else
/*     */     {
/*     */       ManagedObject cfMO;
/* 105 */       if ("xa-datasource".equals(cfType))
/*     */       {
/* 107 */         ManagedConnectionFactoryDeploymentMetaData mcf = new XADataSourceDeploymentMetaData();
/* 108 */         mof.setBuilder(mcf.getClass(), new XADataSourceDeploymentMetaDataBuilder());
/* 109 */         cfMO = mof.initManagedObject(mcf, KnownComponentTypes.DataSourceTypes.XA.getType().getType(), KnownComponentTypes.DataSourceTypes.XA.getType().getSubtype());
/*     */       }
/*     */       else
/*     */       {
/*     */         ManagedObject cfMO;
/* 113 */         if ("tx-connection-factory".equals(cfType))
/*     */         {
/* 115 */           rootElementName = "connection-factories";
/* 116 */           ManagedConnectionFactoryDeploymentMetaData mcf = new TxConnectionFactoryDeploymentMetaData();
/* 117 */           mof.setBuilder(mcf.getClass(), new XADataSourceDeploymentMetaDataBuilder());
/*     */
/* 119 */           cfMO = mof.initManagedObject(mcf, "ConnectionFactory", "XA");
/*     */         }
/*     */         else
/*     */         {
/*     */           ManagedObject cfMO;
/* 123 */           if ("no-tx-connection-factory".equals(cfType))
/*     */           {
/* 125 */             rootElementName = "connection-factories";
/* 126 */             ManagedConnectionFactoryDeploymentMetaData mcf = new NoTxConnectionFactoryDeploymentMetaData();
/* 127 */             mof.setBuilder(mcf.getClass(), new XADataSourceDeploymentMetaDataBuilder());
/*     */
/* 129 */             cfMO = mof.initManagedObject(mcf, "ConnectionFactory", "NoTx");
/*     */           }
/*     */           else
/*     */           {
/*     */             ManagedObject cfMO;
/* 133 */             if ("no-tx-datasource".equals(cfType))
/*     */             {
/* 135 */               ManagedConnectionFactoryDeploymentMetaData mcf = new NoTxDataSourceDeploymentMetaData();
/* 136 */               mof.setBuilder(mcf.getClass(), new XADataSourceDeploymentMetaDataBuilder());
/* 137 */               cfMO = mof.initManagedObject(mcf, KnownComponentTypes.DataSourceTypes.NoTx.getType().getType(), KnownComponentTypes.DataSourceTypes.NoTx.getType().getSubtype());
/*     */             }
/*     */             else
/*     */             {
/* 142 */               throw new IllegalStateException("Unexpected value connection factory type: " + cfType);
View Full Code Here

TOP

Related Classes of org.jboss.resource.metadata.mcf.XADataSourceDeploymentMetaData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.