[teiid-commits] teiid SVN: r2084 - in trunk: build/kits/jboss-container/deploy/teiid and 16 other directories.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Tue Apr 27 18:25:06 EDT 2010


Author: rareddy
Date: 2010-04-27 18:25:00 -0400 (Tue, 27 Apr 2010)
New Revision: 2084

Added:
   trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/AdminObjectBuilder.java
   trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/ExtendedPropertyInfo.java
   trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/AutoConnectionFactoryDeployer.java
   trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/AutoConnectionFactoryDeploymentGroup.java
   trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/AutoConnectionFactoryParserDeployer.java
   trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/ConnectionFactoryMetadataGroup.java
   trunk/jboss-integration/src/main/java/org/teiid/templates/connector/ConnectorDeploymentTemplate.java
   trunk/jboss-integration/src/main/java/org/teiid/templates/connector/ConnectorTemplateInfo.java
   trunk/jboss-integration/src/main/java/org/teiid/templates/connector/RaXmlPropertyConverter.java
   trunk/jboss-integration/src/main/java/org/teiid/templates/connector/XaJdbcConnectorTemplate.java
   trunk/jboss-integration/src/main/java/org/teiid/templates/connector/XaJdbcConnectorTemplateInfo.java
   trunk/runtime/src/main/java/org/teiid/deployers/VDBStatusChecker.java
Removed:
   trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/ExtendedComponentType.java
   trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/ConnectorManagerGroup.java
   trunk/jboss-integration/src/main/java/org/teiid/templates/connector/ConnectorTypeTemplate.java
   trunk/jboss-integration/src/main/java/org/teiid/templates/connector/ConnectorTypeTemplateInfo.java
Modified:
   trunk/adminshell/src/main/java/org/teiid/adminshell/AdminShell.java
   trunk/build/kits/jboss-container/deploy/teiid/teiid-connector-templates-jboss-beans.xml
   trunk/build/kits/jboss-container/deployers/teiid.deployer/teiid-deployer-jboss-beans.xml
   trunk/client/src/main/java/org/teiid/adminapi/Admin.java
   trunk/client/src/main/java/org/teiid/adminapi/ConnectionFactory.java
   trunk/client/src/main/java/org/teiid/adminapi/impl/ConnectionFactoryMetaData.java
   trunk/common-core/src/main/java/com/metamatrix/common/util/PropertiesUtils.java
   trunk/connector-api/src/main/java/org/teiid/connector/api/Connection.java
   trunk/connector-api/src/main/java/org/teiid/connector/basic/BasicManagedConnection.java
   trunk/connector-api/src/main/java/org/teiid/connector/basic/BasicManagedConnectionFactory.java
   trunk/connector-api/src/main/java/org/teiid/connector/basic/WrappedConnection.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCConnector.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCManagedConnectionFactory.java
   trunk/connectors/connector-jdbc/src/main/rar/META-INF/ra.xml
   trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorManager.java
   trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorWorkItem.java
   trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java
   trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/ConnectionFactoryDeployer.java
   trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
   trunk/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties
   trunk/runtime/src/main/resources/org/teiid/runtime/i18n.properties
   trunk/test-integration/db/src/test/java/org/teiid/adminapi/jboss/TestConnectorBindings.java
Log:
TEIID-1067, TEIID-1068: Providing a single connection for JDBC based connector

Modified: trunk/adminshell/src/main/java/org/teiid/adminshell/AdminShell.java
===================================================================
--- trunk/adminshell/src/main/java/org/teiid/adminshell/AdminShell.java	2010-04-27 17:56:40 UTC (rev 2083)
+++ trunk/adminshell/src/main/java/org/teiid/adminshell/AdminShell.java	2010-04-27 22:25:00 UTC (rev 2084)
@@ -49,7 +49,6 @@
 import org.teiid.adminapi.Transaction;
 import org.teiid.adminapi.VDB;
 import org.teiid.adminapi.WorkerPoolStatistics;
-import org.teiid.adminapi.Admin.DataSourceType;
 import org.teiid.adminshell.Help.Doc;
 
 import com.metamatrix.common.util.ReaderInputStream;
@@ -171,12 +170,6 @@
 		getAdmin().deleteConnector(name);
 	}
 
-	@Doc(text = "Delete a DataSource")
-	public static void deleteDataSource(
-			@Doc(text = "deployed name") String deploymentName) throws AdminException {
-		getAdmin().deleteDataSource(deploymentName);
-	}
-
 	@Doc(text = "Delete a VDB")
 	public static void deleteVDB(
 			@Doc(text = "vdb name") String vdbName, 
@@ -209,29 +202,17 @@
 		return getAdmin().getConnectionFactory(deployedName);
 	}
 
-	@Doc(text = "Get the ConnectionPoolStatistics for the given ConnectionFactory")
-	public static ConnectionPoolStatistics getConnectionFactoryStats(
-			@Doc(text = "deployed name") String deployedName) throws AdminException {
-		return getAdmin().getConnectionFactoryStats(deployedName);
-	}
-
 	@Doc(text = "Get all connector name Strings")
 	public static Set<String> getConnectorNames() throws AdminException {
-		return getAdmin().getConnectorNames();
+		return getAdmin().getConnectorTemplateNames();
 	}
 
 	@Doc(text = "Get all PropertyDefinition instances for the given connector")
 	public static Collection<PropertyDefinition> getConnectorPropertyDefinitions(
 			@Doc(text = "connector name") String connectorName) throws AdminException {
-		return getAdmin().getConnectorPropertyDefinitions(connectorName);
+		return getAdmin().getConnectorTemplatePropertyDefinitions(connectorName);
 	}
 
-	@Doc(text = "Get all ProperyDefinition instances for a DataSource")
-	public static Collection<PropertyDefinition> getDataSourcePropertyDefinitions()
-			throws AdminException {
-		return getAdmin().getDataSourcePropertyDefinitions();
-	}
-
 	@Doc(text = "Get the ProcessObject instances for the given identifier")
 	public static Collection<ProcessObject> getProcesses(
 			@Doc(text = "identifier") String processIdentifier)
@@ -359,7 +340,7 @@
 	@Doc(text = "Checks if a Connector exists")
 	public static boolean hasConnector(
 			@Doc(text = "type name") String typeName) throws AdminException {
-	    Collection<String> types = getAdmin().getConnectorNames();
+	    Collection<String> types = getAdmin().getConnectorTemplateNames();
 
 	    for (String type:types) {
 	        if (type.equals(typeName)) {
@@ -394,22 +375,6 @@
 	    return false;
 	}
 
-	@Doc(text = "Export a Connector RAR to file")
-	public static void exportConnector(
-			@Doc(text = "connector name") String name, 
-			@Doc(text = "file name") String fileName) throws AdminException, IOException {
-	    InputStream contents = getAdmin().exportConnector(name);
-	    writeFile(name, fileName, contents);
-	}
-
-	@Doc(text = "Export a ConnectionFactory to an XML file")
-	public static void exportConnectionFactory(
-			@Doc(text = "deployed name") String deployedName, 
-			@Doc(text = "file name") String fileName) throws AdminException, IOException{
-	    Reader contents = getAdmin().exportConnectionFactory(deployedName);
-	    writeFile(deployedName, fileName, contents);
-	}
-
 	private static void writeFile(String deployedName, String fileName,
 			Reader contents) throws IOException, AdminProcessingException {
 		if (contents == null) {
@@ -464,22 +429,6 @@
 		}
 	}
 
-	@Doc(text = "Add a DataSource")
-	public static void addDataSource(
-			@Doc(text = "deployed name") String deploymentName, 
-			DataSourceType type,
-			Properties properties) throws AdminException {
-		getAdmin().addDataSource(deploymentName, type, properties);
-	}
-
-	@Doc(text = "Export the DataSource XML to file")
-	public static void exportDataSource(
-			@Doc(text = "deployed name") String deployedName,
-			@Doc(text = "file name") String fileName) throws AdminException, IOException {
-		Reader contents = getAdmin().exportDataSource(deployedName);
-		writeFile(deployedName, fileName, contents);
-	}
-	
 	@Doc(text = "Get the current Admin connection")
 	public static Admin getAdmin() {
 		if (internalAdmin == null) {

Modified: trunk/build/kits/jboss-container/deploy/teiid/teiid-connector-templates-jboss-beans.xml
===================================================================
--- trunk/build/kits/jboss-container/deploy/teiid/teiid-connector-templates-jboss-beans.xml	2010-04-27 17:56:40 UTC (rev 2083)
+++ trunk/build/kits/jboss-container/deploy/teiid/teiid-connector-templates-jboss-beans.xml	2010-04-27 22:25:00 UTC (rev 2084)
@@ -1,130 +1,124 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <deployment xmlns="urn:jboss:bean-deployer:2.0">
-
-    <!-- This file defines the connector templates for Teiid based connectors -->  
-   <bean name="export-template" class="org.jboss.resource.deployers.management.DsDataSourceTemplate">
-      <property name="info"><inject bean="export-templateinfo"/></property>
-   </bean>
-   <bean name="export-templateinfo" class="org.teiid.templates.connector.ExportConnectorTypeTemplateInfo">
-      <constructor factoryMethod="createTemplateInfo">
-         <factory bean="DSDeploymentTemplateInfoFactory"/>
-         <parameter class="java.lang.Class">org.teiid.templates.connector.ExportConnectorTypeTemplateInfo</parameter>
-         <parameter class="java.lang.Class">org.jboss.resource.metadata.mcf.NoTxConnectionFactoryDeploymentMetaData</parameter>
-         <parameter class="java.lang.String">export-template</parameter>
-         <parameter class="java.lang.String">Teiid Export Template</parameter>
-      </constructor>
-   </bean>     
     
-   <bean name="connector-jdbc-${project.version}" class="org.teiid.templates.connector.ConnectorTypeTemplate">
-      <property name="info"><inject bean="connector-jdbc-templateinfo"/></property>
-      <property name="targetTemplate"><inject bean="NoTxConnectionFactoryTemplate"/></property>
-   </bean>
-   <bean name="connector-jdbc-templateinfo" class="org.teiid.templates.connector.ConnectorTypeTemplateInfo">
+   <bean name="connector-jdbc-xa-${project.version}" class="org.teiid.templates.connector.XaJdbcConnectorTemplate">
+      <property name="info"><inject bean="connector-jdbc-xa-templateinfo"/></property>
+   </bean>   
+   
+   <bean name="connector-jdbc-xa-templateinfo" class="org.teiid.templates.connector.XaJdbcConnectorTemplateInfo">
       <constructor factoryMethod="createTemplateInfo">
          <factory bean="DSDeploymentTemplateInfoFactory"/>
-         <parameter class="java.lang.Class">org.teiid.templates.connector.ConnectorTypeTemplateInfo</parameter>
-         <parameter class="java.lang.Class">org.jboss.resource.metadata.mcf.NoTxConnectionFactoryDeploymentMetaData</parameter>
-         <parameter class="java.lang.String">connector-jdbc-${project.version}.rar</parameter>
-         <parameter class="java.lang.String">Teiid JDBC Connector</parameter>
+         <parameter class="java.lang.Class">org.teiid.templates.connector.XaJdbcConnectorTemplateInfo</parameter>
+         <parameter class="java.lang.Class">org.jboss.resource.metadata.mcf.XADataSourceDeploymentMetaData</parameter>
+         <parameter class="java.lang.String">connector-jdbc-xa-${project.version}</parameter>
+         <parameter class="java.lang.String">Teiid JDBC XA Connector</parameter>         
       </constructor>
+      <property name="rarName">connector-jdbc-${project.version}.rar</property>
    </bean> 
    
-   <bean name="connector-ldap-${project.version}" class="org.teiid.templates.connector.ConnectorTypeTemplate">
+   <bean name="connector-ldap-${project.version}" class="org.teiid.templates.connector.ConnectorDeploymentTemplate">
       <property name="info"><inject bean="connector-ldap-templateinfo"/></property>
       <property name="targetTemplate"><inject bean="NoTxConnectionFactoryTemplate"/></property>
    </bean>
-   <bean name="connector-ldap-templateinfo" class="org.teiid.templates.connector.ConnectorTypeTemplateInfo">
+   <bean name="connector-ldap-templateinfo" class="org.teiid.templates.connector.ConnectorTemplateInfo">
       <constructor factoryMethod="createTemplateInfo">
          <factory bean="DSDeploymentTemplateInfoFactory"/>
-         <parameter class="java.lang.Class">org.teiid.templates.connector.ConnectorTypeTemplateInfo</parameter>
+         <parameter class="java.lang.Class">org.teiid.templates.connector.ConnectorTemplateInfo</parameter>
          <parameter class="java.lang.Class">org.jboss.resource.metadata.mcf.NoTxConnectionFactoryDeploymentMetaData</parameter>
-         <parameter class="java.lang.String">connector-ldap-${project.version}.rar</parameter>
+         <parameter class="java.lang.String">connector-ldap-${project.version}</parameter>
          <parameter class="java.lang.String">Teiid LDAP Connector</parameter>
       </constructor>
+      <property name="rarName">connector-ldap-${project.version}.rar</property>
    </bean>    
    
-   <bean name="connector-loopback-${project.version}" class="org.teiid.templates.connector.ConnectorTypeTemplate">
+   <bean name="connector-loopback-${project.version}" class="org.teiid.templates.connector.ConnectorDeploymentTemplate">
       <property name="info"><inject bean="connector-loopback-templateinfo"/></property>
       <property name="targetTemplate"><inject bean="NoTxConnectionFactoryTemplate"/></property>
    </bean>
-   <bean name="connector-loopback-templateinfo" class="org.teiid.templates.connector.ConnectorTypeTemplateInfo">
+   <bean name="connector-loopback-templateinfo" class="org.teiid.templates.connector.ConnectorTemplateInfo">
       <constructor factoryMethod="createTemplateInfo">
          <factory bean="DSDeploymentTemplateInfoFactory"/>
-         <parameter class="java.lang.Class">org.teiid.templates.connector.ConnectorTypeTemplateInfo</parameter>
+         <parameter class="java.lang.Class">org.teiid.templates.connector.ConnectorTemplateInfo</parameter>
          <parameter class="java.lang.Class">org.jboss.resource.metadata.mcf.NoTxConnectionFactoryDeploymentMetaData</parameter>
-         <parameter class="java.lang.String">connector-loopback-${project.version}.rar</parameter>
-         <parameter class="java.lang.String">Teiid Loopback Connector</parameter>
+         <parameter class="java.lang.String">connector-loopback-${project.version}</parameter>
+         <parameter class="java.lang.String">Teiid Loopback Connector</parameter>         
       </constructor>
+      <property name="rarName">connector-loopback-${project.version}.rar</property>
    </bean>    
    
-   <bean name="connector-salesforce-${project.version}" class="org.teiid.templates.connector.ConnectorTypeTemplate">
+   <bean name="connector-salesforce-${project.version}" class="org.teiid.templates.connector.ConnectorDeploymentTemplate">
       <property name="info"><inject bean="connector-salesforce-templateinfo"/></property>
       <property name="targetTemplate"><inject bean="NoTxConnectionFactoryTemplate"/></property>
    </bean>
-   <bean name="connector-salesforce-templateinfo" class="org.teiid.templates.connector.ConnectorTypeTemplateInfo">
+   <bean name="connector-salesforce-templateinfo" class="org.teiid.templates.connector.ConnectorTemplateInfo">
       <constructor factoryMethod="createTemplateInfo">
          <factory bean="DSDeploymentTemplateInfoFactory"/>
-         <parameter class="java.lang.Class">org.teiid.templates.connector.ConnectorTypeTemplateInfo</parameter>
+         <parameter class="java.lang.Class">org.teiid.templates.connector.ConnectorTemplateInfo</parameter>
          <parameter class="java.lang.Class">org.jboss.resource.metadata.mcf.NoTxConnectionFactoryDeploymentMetaData</parameter>
-         <parameter class="java.lang.String">connector-salesforce-${project.version}.rar</parameter>
+         <parameter class="java.lang.String">connector-salesforce-${project.version}</parameter>
          <parameter class="java.lang.String">Teiid Salesforce Connector</parameter>
       </constructor>
+      <property name="rarName">connector-salesforce-${project.version}.rar</property>
    </bean>    
    
-   <bean name="connector-text-${project.version}" class="org.teiid.templates.connector.ConnectorTypeTemplate">
+   <bean name="connector-text-${project.version}" class="org.teiid.templates.connector.ConnectorDeploymentTemplate">
       <property name="info"><inject bean="connector-text-templateinfo"/></property>
       <property name="targetTemplate"><inject bean="NoTxConnectionFactoryTemplate"/></property>
    </bean>
-   <bean name="connector-text-templateinfo" class="org.teiid.templates.connector.ConnectorTypeTemplateInfo">
+   <bean name="connector-text-templateinfo" class="org.teiid.templates.connector.ConnectorTemplateInfo">
       <constructor factoryMethod="createTemplateInfo">
          <factory bean="DSDeploymentTemplateInfoFactory"/>
-         <parameter class="java.lang.Class">org.teiid.templates.connector.ConnectorTypeTemplateInfo</parameter>
+         <parameter class="java.lang.Class">org.teiid.templates.connector.ConnectorTemplateInfo</parameter>
          <parameter class="java.lang.Class">org.jboss.resource.metadata.mcf.NoTxConnectionFactoryDeploymentMetaData</parameter>
-         <parameter class="java.lang.String">connector-text-${project.version}.rar</parameter>
+         <parameter class="java.lang.String">connector-text-${project.version}</parameter>
          <parameter class="java.lang.String">Teiid Text Connector</parameter>
       </constructor>
+      <property name="rarName">connector-text-${project.version}.rar</property>
    </bean>    
    
-   <bean name="connector-xmlsource-file-${project.version}" class="org.teiid.templates.connector.ConnectorTypeTemplate">
+   <bean name="connector-xmlsource-file-${project.version}" class="org.teiid.templates.connector.ConnectorDeploymentTemplate">
       <property name="info"><inject bean="connector-xmlsource-file-templateinfo"/></property>
       <property name="targetTemplate"><inject bean="NoTxConnectionFactoryTemplate"/></property>
    </bean>
-   <bean name="connector-xmlsource-file-templateinfo" class="org.teiid.templates.connector.ConnectorTypeTemplateInfo">
+   <bean name="connector-xmlsource-file-templateinfo" class="org.teiid.templates.connector.ConnectorTemplateInfo">
       <constructor factoryMethod="createTemplateInfo">
          <factory bean="DSDeploymentTemplateInfoFactory"/>
-         <parameter class="java.lang.Class">org.teiid.templates.connector.ConnectorTypeTemplateInfo</parameter>
+         <parameter class="java.lang.Class">org.teiid.templates.connector.ConnectorTemplateInfo</parameter>
          <parameter class="java.lang.Class">org.jboss.resource.metadata.mcf.NoTxConnectionFactoryDeploymentMetaData</parameter>
-         <parameter class="java.lang.String">connector-xmlsource-file-${project.version}.rar</parameter>
+         <parameter class="java.lang.String">connector-xmlsource-file-${project.version}</parameter>
          <parameter class="java.lang.String">Teiid XML File Connector</parameter>
       </constructor>
+      <property name="rarName">connector-xmlsource-file-${project.version}.rar</property>
    </bean>    
    
-   <bean name="connector-xmlsource-soap-${project.version}" class="org.teiid.templates.connector.ConnectorTypeTemplate">
+   <bean name="connector-xmlsource-soap-${project.version}" class="org.teiid.templates.connector.ConnectorDeploymentTemplate">
       <property name="info"><inject bean="connector-xmlsource-soap-templateinfo"/></property>
       <property name="targetTemplate"><inject bean="NoTxConnectionFactoryTemplate"/></property>
    </bean>
-   <bean name="connector-xmlsource-soap-templateinfo" class="org.teiid.templates.connector.ConnectorTypeTemplateInfo">
+   <bean name="connector-xmlsource-soap-templateinfo" class="org.teiid.templates.connector.ConnectorTemplateInfo">
       <constructor factoryMethod="createTemplateInfo">
          <factory bean="DSDeploymentTemplateInfoFactory"/>
-         <parameter class="java.lang.Class">org.teiid.templates.connector.ConnectorTypeTemplateInfo</parameter>
+         <parameter class="java.lang.Class">org.teiid.templates.connector.ConnectorTemplateInfo</parameter>
          <parameter class="java.lang.Class">org.jboss.resource.metadata.mcf.NoTxConnectionFactoryDeploymentMetaData</parameter>
-         <parameter class="java.lang.String">connector-xmlsource-soap-${project.version}.rar</parameter>
+         <parameter class="java.lang.String">connector-xmlsource-soap-${project.version}</parameter>
          <parameter class="java.lang.String">Teiid XML SOAP Connector</parameter>
       </constructor>
+      <property name="rarName">connector-xmlsource-soap-${project.version}.rar</property>
    </bean> 
    
-   <bean name="connector-xml-http-${project.version}" class="org.teiid.templates.connector.ConnectorTypeTemplate">
+   <bean name="connector-xml-http-${project.version}" class="org.teiid.templates.connector.ConnectorDeploymentTemplate">
       <property name="info"><inject bean="connector-xml-http-templateinfo"/></property>
       <property name="targetTemplate"><inject bean="NoTxConnectionFactoryTemplate"/></property>
    </bean>
-   <bean name="connector-xml-http-templateinfo" class="org.teiid.templates.connector.ConnectorTypeTemplateInfo">
+   <bean name="connector-xml-http-templateinfo" class="org.teiid.templates.connector.ConnectorTemplateInfo">
       <constructor factoryMethod="createTemplateInfo">
          <factory bean="DSDeploymentTemplateInfoFactory"/>
-         <parameter class="java.lang.Class">org.teiid.templates.connector.ConnectorTypeTemplateInfo</parameter>
+         <parameter class="java.lang.Class">org.teiid.templates.connector.ConnectorTemplateInfo</parameter>
          <parameter class="java.lang.Class">org.jboss.resource.metadata.mcf.NoTxConnectionFactoryDeploymentMetaData</parameter>
-         <parameter class="java.lang.String">connector-xml-http-${project.version}.rar</parameter>
+         <parameter class="java.lang.String">connector-xml-http-${project.version}</parameter>
          <parameter class="java.lang.String">Teiid XML HTTP Connector</parameter>
       </constructor>
+      <property name="rarName">connector-xml-http-${project.version}.rar</property>
    </bean>   
    
 </deployment>

Modified: trunk/build/kits/jboss-container/deployers/teiid.deployer/teiid-deployer-jboss-beans.xml
===================================================================
--- trunk/build/kits/jboss-container/deployers/teiid.deployer/teiid-deployer-jboss-beans.xml	2010-04-27 17:56:40 UTC (rev 2083)
+++ trunk/build/kits/jboss-container/deployers/teiid.deployer/teiid-deployer-jboss-beans.xml	2010-04-27 22:25:00 UTC (rev 2084)
@@ -55,11 +55,23 @@
     </bean>      
              
     <bean name="ConnectionFactoryDeployer" class="org.teiid.jboss.deployers.ConnectionFactoryDeployer">
-        <property name="securityHelper"><inject bean="SecurityHelper"/></property>
         <property name="connectorManagerRepository"><inject bean="ConnectorManagerRepository"/></property>
+        <property name="VDBStatusChecker"><inject bean="VDBStatusChecker"/></property>
         <property name="managedObjectFactory"><inject bean="ManagedObjectFactory"/></property>
+    </bean>
+        
+    <bean name="AutoConnectionFactoryDeployer" class="org.teiid.jboss.deployers.AutoConnectionFactoryDeployer">
+        <property name="connectorManagerRepository"><inject bean="ConnectorManagerRepository"/></property>
+        <property name="VDBStatusChecker"><inject bean="VDBStatusChecker"/></property>
+        <property name="managedObjectFactory"><inject bean="ManagedObjectFactory"/></property>
+    </bean>
+    
+    <bean name="VDBStatusChecker" class="org.teiid.deployers.VDBStatusChecker">
         <property name="VDBRepository"><inject bean="VDBRepository"/></property>
     </bean>
+     
+    <bean name="AutoConnectionFactoryParserDeployer" class="org.teiid.jboss.deployers.AutoConnectionFactoryParserDeployer">
+    </bean>        
     
     <!-- Persistence class for the VDB deployment file -->
    <bean name="VDBMetadataComponentMapper" class="org.teiid.jboss.deployers.VDBMetadataComponentMapper">

Modified: trunk/client/src/main/java/org/teiid/adminapi/Admin.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/Admin.java	2010-04-27 17:56:40 UTC (rev 2083)
+++ trunk/client/src/main/java/org/teiid/adminapi/Admin.java	2010-04-27 22:25:00 UTC (rev 2084)
@@ -23,14 +23,12 @@
 package org.teiid.adminapi;
 
 import java.io.InputStream;
-import java.io.Reader;
 import java.util.Collection;
 import java.util.Properties;
 import java.util.Set;
 
 public interface Admin {
 
-	public enum DataSourceType {XA, LOCAL};
 	public enum Cache {CODE_TABLE_CACHE,PREPARED_PLAN_CACHE, QUERY_SERVICE_RESULT_SET_CACHE};
     
     /**
@@ -72,15 +70,6 @@
     void deleteConnector(String name) throws AdminException;
     
     /**
-     * Export Connector RAR file
-     *
-     * @param name  of the Connector
-     * @return InputStream of contents of the rar file
-     * @throws AdminException 
-     */
-    InputStream exportConnector(String name) throws AdminException;    
-
-    /**
      * Deploy a {@link ConnectionFactory} to Configuration
      *
      * @param deployedName  Connection Factory name that will be added to Configuration
@@ -100,16 +89,6 @@
     void deleteConnectionFactory(String deployedName) throws AdminException;
     
     /**
-     * Export a {@link ConnectionFactory} to character Array in XML format
-     *
-     * @param deployedName the unique identifier for a {@link ConnectionFactory}.
-     * @return Reader in XML format
-     * @throws AdminException
-     *             
-     */
-    Reader exportConnectionFactory(String deployedName) throws AdminException;    
-
-    /**
      * Deploy a {@link VDB} file.
      * @param name  Name of the VDB file to save under
      * @param VDB 	VDB.
@@ -146,12 +125,12 @@
     void setRuntimeProperty(String propertyName, String propertyValue) throws AdminException;
     
     /**
-     * Get the Connectors  available in the configuration.
+     * Get the Connector Template  available in the configuration.
      *
-     * @return Set of connector names.
+     * @return Set of connector template names.
      * @throws AdminException 
      */
-    Set<String> getConnectorNames() throws AdminException;
+    Set<String> getConnectorTemplateNames() throws AdminException;
 
     /**
      * Get the VDBs that currently deployed in the system
@@ -205,17 +184,7 @@
      */
     WorkerPoolStatistics getWorkManagerStats(String identifier) throws AdminException;
     
-    
-    /**
-     * Get the Connection Pool Stats that correspond to the specified identifier pattern.
-     * If the {@link ConnectionPoolStatistics ConnectionPool} represents an XA connection, there
-     * will be 2 {@link ConnectionPoolStatistics ConnectionPool}s.  
-     *
-     * @param deployedName - an identifier that corresponds to the connection factory Name
-     * @return {@link ConnectionPoolStatistics}
-     * @throws AdminException 
-     */
-    ConnectionPoolStatistics getConnectionFactoryStats(String deployedName) throws AdminException;
+
         
 
     /**
@@ -249,11 +218,11 @@
 
     /**
      * Get all of the available configuration Properties for the specified connector
-     * @param connectorName - Name of the connector
+     * @param templateName - Name of the connector
      * @return
      * @throws AdminException
      */
-    Collection<PropertyDefinition> getConnectorPropertyDefinitions(String connectorName) throws AdminException;
+    Collection<PropertyDefinition> getConnectorTemplatePropertyDefinitions(String templateName) throws AdminException;
     
     
     /**
@@ -327,37 +296,6 @@
     void terminateTransaction(String transactionId) throws AdminException;
     
     /**
-     * Adds JDBC XA Data Source in the container.
-     * @param deploymentName - name of the source
-     * @param type - type of data source
-     * @param properties - properties
-     * @throws AdminException
-     */
-    void addDataSource(String deploymentName, DataSourceType type, Properties properties) throws AdminException;
-    
-    /**
-     * Delete data source. 
-     * @param deployedName
-     * @throws AdminException
-     */
-    void deleteDataSource(String deployedName) throws AdminException;
-    
-    /**
-     * Export the data source in "-ds.xml" file format. 
-     * @param deployedName
-     * @return
-     * @throws AdminException
-     */
-    Reader exportDataSource(String deployedName) throws AdminException;
-    
-    /**
-     * Get the property definitions for creating the JDBC data source.
-     * @return
-     * @throws AdminException
-     */
-    Collection<PropertyDefinition> getDataSourcePropertyDefinitions() throws AdminException;
-    
-    /**
      * Closes the admin connection
      */
     void close();

Modified: trunk/client/src/main/java/org/teiid/adminapi/ConnectionFactory.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/ConnectionFactory.java	2010-04-27 17:56:40 UTC (rev 2083)
+++ trunk/client/src/main/java/org/teiid/adminapi/ConnectionFactory.java	2010-04-27 22:25:00 UTC (rev 2084)
@@ -39,4 +39,10 @@
      * @return
      */
     String getJNDIName();
+    
+    /**
+     * Get the template name for the Connection Factory
+     * @return
+     */
+    String getTemplateName();
 }

Modified: trunk/client/src/main/java/org/teiid/adminapi/impl/ConnectionFactoryMetaData.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/ConnectionFactoryMetaData.java	2010-04-27 17:56:40 UTC (rev 2083)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/ConnectionFactoryMetaData.java	2010-04-27 22:25:00 UTC (rev 2084)
@@ -21,20 +21,25 @@
  */
 package org.teiid.adminapi.impl;
 
+import java.util.List;
+
 import org.jboss.managed.api.annotation.ManagementComponent;
 import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementObjectID;
 import org.jboss.managed.api.annotation.ManagementProperty;
 import org.teiid.adminapi.ConnectionFactory;
 
- at ManagementObject(componentType=@ManagementComponent(type="teiid",subtype="connector"))
+ at ManagementObject(componentType=@ManagementComponent(type="teiid",subtype="connection-factory"))
 public class ConnectionFactoryMetaData extends AdminObjectImpl implements ConnectionFactory {
 
+	private static final String TEMPLATE_NAME = "template-name"; //$NON-NLS-1$
 	private static final long serialVersionUID = -4865836616882247016L;
 	private transient Object type;
 	private String rarFileName;
 	private String jndiName;
 
 	@ManagementProperty(description="Connector Binding Name")
+	@ManagementObjectID(type="cf-name")
 	public String getName() {
 		return super.getName();
 	}    
@@ -67,6 +72,22 @@
 		return this.type;
 	}
 	
+	@Override
+	@ManagementProperty(description="Template name for this connector")
+	public String getTemplateName() {
+		return getPropertyValue(TEMPLATE_NAME);
+	}
+
+	public void setTemplateName(String templateName) {
+		addProperty(TEMPLATE_NAME, templateName);
+	}
+	
+	@Override
+	@ManagementProperty(description = "Connection Factory Properties", managed=true)
+	public List<PropertyMetadata> getJAXBProperties(){
+		return super.getJAXBProperties();
+	}
+	
 	public String toString() {
 		return getName();
 	}

Modified: trunk/common-core/src/main/java/com/metamatrix/common/util/PropertiesUtils.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/util/PropertiesUtils.java	2010-04-27 17:56:40 UTC (rev 2083)
+++ trunk/common-core/src/main/java/com/metamatrix/common/util/PropertiesUtils.java	2010-04-27 22:25:00 UTC (rev 2084)
@@ -970,6 +970,37 @@
 	        }
 	    }
 	}
+    
+    public static void setBeanProperty(Object bean, String name, Object value) {
+    	if (value == null) {
+    		return;
+    	}
+    	name = name.toLowerCase();
+	    final Method[] methods = bean.getClass().getMethods();
+	    for (int i = 0; i < methods.length; i++) {
+	        final Method method = methods[i];
+	        final String methodName = method.getName();
+	        // If setter ...
+	        if ( methodName.startsWith("set") && method.getParameterTypes().length == 1 ) { //$NON-NLS-1$
+	            // Get the property name
+	            final String propertyName = methodName.substring(3);    // remove the "set"
+	            String shortName = propertyName.toLowerCase();
+	            if (!shortName.equals(name)) {
+	            	continue;
+	            }
+                final Class<?> argType = method.getParameterTypes()[0];
+                try {
+                	Object[] params = new Object[] {value};
+                	if (!argType.isAssignableFrom(value.getClass())) {
+                		params = new Object[] {StringUtil.valueOf(value.toString(), argType)};
+                	}
+                    method.invoke(bean, params);
+                } catch (Throwable e) {
+                	throw new InvalidPropertyException(propertyName, value.toString(), argType, e);
+                }
+	        }
+	    }
+	}    
 
 	private static Properties lowerCaseAllPropNames(final Properties connectionProps) {
 	    final Properties lcProps = new Properties();

Modified: trunk/connector-api/src/main/java/org/teiid/connector/api/Connection.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/api/Connection.java	2010-04-27 17:56:40 UTC (rev 2083)
+++ trunk/connector-api/src/main/java/org/teiid/connector/api/Connection.java	2010-04-27 22:25:00 UTC (rev 2084)
@@ -56,13 +56,13 @@
      * Release the connection.  This will be called when system has completed 
      * using the connection for an execution.
      */
-    void close();
+    void close() throws ConnectorException;
     
     /**
      * Called to determine whether the connection is open
      * @return true if open, false if there is a source error.
      */    
-    boolean isAlive();
+    boolean isAlive() throws ConnectorException;
          
     /**
      * Get the local transaction for the connector.

Modified: trunk/connector-api/src/main/java/org/teiid/connector/basic/BasicManagedConnection.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/basic/BasicManagedConnection.java	2010-04-27 17:56:40 UTC (rev 2083)
+++ trunk/connector-api/src/main/java/org/teiid/connector/basic/BasicManagedConnection.java	2010-04-27 22:25:00 UTC (rev 2084)
@@ -24,6 +24,8 @@
 import java.io.PrintWriter;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
 
 import javax.resource.ResourceException;
 import javax.resource.spi.ConnectionEvent;
@@ -35,16 +37,22 @@
 import javax.security.auth.Subject;
 import javax.transaction.xa.XAResource;
 
+import org.teiid.connector.api.Connection;
 import org.teiid.connector.api.ConnectionContext;
+import org.teiid.connector.api.Connector;
 import org.teiid.connector.api.ConnectorException;
 
 public class BasicManagedConnection implements ManagedConnection {
 	protected PrintWriter log;
 	protected final Collection<ConnectionEventListener> listeners = new ArrayList<ConnectionEventListener>();
-	protected WrappedConnection conn;
 	private BasicManagedConnectionFactory mcf;
+	private Connection physicalConnection;
+	private final Set<WrappedConnection> handles = new HashSet<WrappedConnection>();
+	private Connector cf;
 	
-	public BasicManagedConnection(BasicManagedConnectionFactory mcf) {
+	public BasicManagedConnection(Connector connectionFactory, BasicManagedConnectionFactory mcf) throws ResourceException  {
+		this.cf = connectionFactory;
+		this.physicalConnection = this.cf.getConnection();
 		this.mcf = mcf;
 	}
 
@@ -53,15 +61,19 @@
 		if (!(handle instanceof WrappedConnection)) {
 			throw new ConnectorException("Wrong connection supplied to assosiate");
 		}
-		this.conn = (WrappedConnection)handle;
-		this.conn.setManagedConnection(this);
+		((WrappedConnection)handle).setManagedConnection(this);
+		synchronized (this.handles) {
+			this.handles.add((WrappedConnection)handle);
+		}
 	}
 
 	@Override
 	public void cleanup() throws ResourceException {
-		if (this.conn != null) {
-			this.conn.close();
-			this.conn = null;
+		synchronized (this.handles) {
+			for (WrappedConnection wc:this.handles) {
+				wc.setManagedConnection(null);
+			}
+			handles.clear();
 		}
 		ConnectionContext.setSubject(null);
 	}
@@ -69,6 +81,9 @@
 	@Override
 	public void destroy() throws ResourceException {
 		cleanup();
+		
+		this.physicalConnection.close();
+		this.physicalConnection = null;
 	}
 	
 	@Override
@@ -81,21 +96,26 @@
 		if(!(arg1 instanceof ConnectionRequestInfoWrapper)) {
 			throw new ConnectorException("Un recognized Connection Request Info object received");
 		}
-		ConnectionRequestInfoWrapper criw = (ConnectionRequestInfoWrapper)arg1;
 		ConnectionContext.setSubject(arg0);
-		this.conn = new WrappedConnection(criw.actualConnector.getConnection(), mcf);
-		this.conn.setManagedConnection(this);
-		return this.conn;
+		if (this.physicalConnection == null) {
+			this.physicalConnection = this.cf.getConnection();
+		}
+		
+		WrappedConnection wc = new WrappedConnection(this, mcf); 
+		synchronized(this.handles) {
+			this.handles.add(wc);
+		}
+		return wc; 
 	}
 
 	@Override
 	public LocalTransaction getLocalTransaction() throws ResourceException {
-		return this.conn.getLocalTransaction();
+		return this.physicalConnection.getLocalTransaction();
 	}
 
 	@Override
 	public XAResource getXAResource() throws ResourceException {
-		return this.conn.getXAResource();
+		return this.physicalConnection.getXAResource();
 	}
 	
 	@Override
@@ -123,9 +143,14 @@
 	}
 
 	// called by the wrapped connection to notify the close of the connection.
-	void connectionClosed() {
+	void connectionClosed(WrappedConnection wc) throws ConnectorException {
+		
+		synchronized (this.handles) {
+			handles.remove(wc);
+		}
+		
 		ConnectionEvent ce = new ConnectionEvent(this, ConnectionEvent.CONNECTION_CLOSED);
-		ce.setConnectionHandle(this.conn);
+		ce.setConnectionHandle(wc);
 		
 		ArrayList<ConnectionEventListener> copy = null;
 		synchronized (this.listeners) {
@@ -135,9 +160,23 @@
 		for(ConnectionEventListener l: copy) {
 			l.connectionClosed(ce);
 		}
+		
+		// check if connector is a facade for another; in which case release it to the pool
+		if (this.mcf.getSourceJNDIName() != null) {
+			synchronized(this.physicalConnection) {
+				this.physicalConnection.close();
+				this.physicalConnection = null;
+			}
+		}
 	}
 	
-	public boolean isValid() {
-		return this.conn.isAlive();
+	public boolean isValid() throws ConnectorException {
+		return this.physicalConnection.isAlive();
 	}
+	
+   Connection getConnection() throws ConnectorException {
+      if (this.physicalConnection == null)
+         throw new ConnectorException("Connection has been destroyed!!!");
+      return this.physicalConnection;
+   }	
 }

Modified: trunk/connector-api/src/main/java/org/teiid/connector/basic/BasicManagedConnectionFactory.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/basic/BasicManagedConnectionFactory.java	2010-04-27 17:56:40 UTC (rev 2083)
+++ trunk/connector-api/src/main/java/org/teiid/connector/basic/BasicManagedConnectionFactory.java	2010-04-27 22:25:00 UTC (rev 2084)
@@ -63,6 +63,7 @@
 	private boolean exceptionOnMaxRows = false;
 	private int maxResultRows = -1;
 	private boolean xaCapable;
+	private String sourceJNDIName;
 	
 	private String overrideCapabilitiesFile;
 	
@@ -71,11 +72,6 @@
 	
 	@Override
 	public Object createConnectionFactory() throws ResourceException {
-		return new ResourceException("Resource Adapter does not currently support running in a non-managed environment.");
-	}
-
-	@Override
-	public Object createConnectionFactory(ConnectionManager arg0) throws ResourceException {
 		try {
 			Object o = ReflectionHelper.create(this.connectorClass, null, Thread.currentThread().getContextClassLoader());
 			if(!(o instanceof Connector)) {
@@ -83,15 +79,21 @@
 			}
 			Connector connector = (Connector)o;
 			connector.initialize(this);
-			return new WrappedConnector(connector, arg0, this);
+			return connector;
 		} catch (MetaMatrixCoreException e) {
 			throw new ResourceException(e);
 		} 
 	}
 
 	@Override
+	public Object createConnectionFactory(ConnectionManager arg0) throws ResourceException {
+		return new WrappedConnector((Connector)createConnectionFactory(), arg0, this);
+	}
+
+	@Override
 	public ManagedConnection createManagedConnection(Subject arg0, ConnectionRequestInfo arg1) throws ResourceException {
-		return new BasicManagedConnection(this);
+		ConnectionRequestInfoWrapper criw = (ConnectionRequestInfoWrapper)arg1;
+		return new BasicManagedConnection(criw.actualConnector, this);
 	}
 
 	@Override
@@ -178,6 +180,14 @@
 	public TypeFacility getTypeFacility() {
 		return TYPE_FACILITY;
 	}
+	
+	public void setSourceJNDIName(String arg0) {
+		this.sourceJNDIName = arg0;
+	}
+	
+	public String getSourceJNDIName() {
+		return sourceJNDIName;
+	}	
 
 	@Override
 	public Properties getOverrideCapabilities() throws ConnectorException {

Modified: trunk/connector-api/src/main/java/org/teiid/connector/basic/WrappedConnection.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/basic/WrappedConnection.java	2010-04-27 17:56:40 UTC (rev 2083)
+++ trunk/connector-api/src/main/java/org/teiid/connector/basic/WrappedConnection.java	2010-04-27 22:25:00 UTC (rev 2084)
@@ -41,23 +41,21 @@
 
 public class WrappedConnection implements Connection, MetadataProvider {
 
-	private Connection conn;
 	private ConnectorEnvironment env;
 	private ConnectorCapabilities caps;
 	private BasicManagedConnection mc;
 	boolean closed = false;
 	
-	public WrappedConnection(Connection conn, ConnectorEnvironment env) {
-		this.conn = conn;
+	public WrappedConnection(BasicManagedConnection mc, ConnectorEnvironment env) {
+		this.mc = mc;
 		this.env = env;
 	}
 	
 	@Override
-	public void close() {
+	public void close() throws ConnectorException {
 		if (!this.closed && this.mc != null) {
 			this.closed = true;
-			this.conn.close();
-			this.mc.connectionClosed();
+			this.mc.connectionClosed(this);
 			this.mc = null;
 		}
 	}
@@ -65,13 +63,13 @@
 	@Override
 	public Execution createExecution(Command command, ExecutionContext executionContext, RuntimeMetadata metadata)
 			throws ConnectorException {
-		return conn.createExecution(command, executionContext, metadata);
+		return this.mc.getConnection().createExecution(command, executionContext, metadata);
 	}
 
 	@Override
 	public ConnectorCapabilities getCapabilities() throws ConnectorException {
 		if (this.caps == null) {
-			this.caps = conn.getCapabilities();
+			this.caps = this.mc.getConnection().getCapabilities();
 			if (caps != null && this.env.getOverrideCapabilities() != null) {
 				caps = (ConnectorCapabilities) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class[] {ConnectorCapabilities.class}, new CapabilitesOverloader(caps, this.env.getOverrideCapabilities()));
 			}
@@ -81,23 +79,23 @@
 
 	@Override
 	public LocalTransaction getLocalTransaction() throws ConnectorException {
-		return conn.getLocalTransaction();
+		return this.mc.getConnection().getLocalTransaction();
 	}
 
 	@Override
-	public boolean isAlive() {
-		return conn.isAlive();
+	public boolean isAlive() throws ConnectorException {
+		return this.mc.getConnection().isAlive();
 	}
 
 	@Override
 	public XAResource getXAResource() throws ConnectorException {
-		return conn.getXAResource();
+		return this.mc.getConnection().getXAResource();
 	}
 	
 	@Override
 	public void getConnectorMetadata(MetadataFactory metadataFactory) throws ConnectorException {
-		if (this.conn instanceof MetadataProvider) {
-			((MetadataProvider) this.conn).getConnectorMetadata(metadataFactory);
+		if (this.mc.getConnection() instanceof MetadataProvider) {
+			((MetadataProvider) this.mc.getConnection()).getConnectorMetadata(metadataFactory);
 		} else {
 			throw new ConnectorException(DataPlugin.Util.getString("WrappedConnection.no_metadata"));	//$NON-NLS-1$
 		}

Modified: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCConnector.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCConnector.java	2010-04-27 17:56:40 UTC (rev 2083)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCConnector.java	2010-04-27 22:25:00 UTC (rev 2084)
@@ -35,8 +35,6 @@
 import org.teiid.connector.api.ConnectorLogger;
 import org.teiid.connector.basic.BasicConnector;
 
-import com.metamatrix.core.util.StringUtil;
-
 /**
  * JDBC implementation of Connector interface.
  */
@@ -56,15 +54,6 @@
 		
 		logger.logInfo(JDBCPlugin.Util.getString("JDBCConnector.JDBCConnector_initialized._1")); //$NON-NLS-1$
 		
-        
-        // Get the JNDI name for the underlying JDBC source
-        String dataSourceName = this.config.getSourceJNDIName();
-        
-        // Verify required items
-        if (!StringUtil.isValid(dataSourceName)) {
-            throw new ConnectorException(JDBCPlugin.Util.getString("JDBCSourceConnectionFactory.Missing_JDBC_jndi_1")); //$NON-NLS-1$
-        }
-        
         capabilities = config.getTranslator().getConnectorCapabilities();
         
         logger.logInfo(JDBCPlugin.Util.getString("JDBCConnector.JDBCConnector_started._4")); //$NON-NLS-1$

Modified: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCManagedConnectionFactory.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCManagedConnectionFactory.java	2010-04-27 17:56:40 UTC (rev 2083)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCManagedConnectionFactory.java	2010-04-27 22:25:00 UTC (rev 2084)
@@ -40,6 +40,7 @@
 	private boolean trimStrings=false;
 	private boolean useCommentsInSourceQuery = false;
 	private int fetchSize = -1;
+	private String connectionFactoryClass;
 		
 	// derived
 	private Translator sqlTranslator;
@@ -73,6 +74,7 @@
 		return this.sqlTranslator;
 	}	
 
+	@Override
 	public String getSourceJNDIName() {
 		return sourceJNDIName;
 	}
@@ -97,6 +99,7 @@
 		this.extensionTranslationClassName = arg0;
 	}
 	
+	@Override
 	public void setSourceJNDIName(String arg0) {
 		this.sourceJNDIName = arg0;
 	}
@@ -116,4 +119,12 @@
 	public int getFetchSize() {
 		return this.fetchSize;
 	}	
+	
+	public String getConnectionFactoryClass() {
+		return connectionFactoryClass;
+	}
+
+	public void setConnectionFactoryClass(String connectionFactoryClass) {
+		this.connectionFactoryClass = connectionFactoryClass;
+	}	
 }

Modified: trunk/connectors/connector-jdbc/src/main/rar/META-INF/ra.xml
===================================================================
--- trunk/connectors/connector-jdbc/src/main/rar/META-INF/ra.xml	2010-04-27 17:56:40 UTC (rev 2083)
+++ trunk/connectors/connector-jdbc/src/main/rar/META-INF/ra.xml	2010-04-27 22:25:00 UTC (rev 2084)
@@ -41,14 +41,22 @@
             <managedconnectionfactory-class>org.teiid.connector.jdbc.JDBCManagedConnectionFactory</managedconnectionfactory-class>
 
             <config-property>
-               <description>{$display:"Connector Class",$advanced:"true"}</description>
+                <!-- This property is for the auto creation of the Connector from DS -->
+               <description>{$display:"Connection Factory Class",$required:"true"}</description>
+               <config-property-name>ConnectionFactoryClass</config-property-name>
+               <config-property-type>java.lang.String</config-property-type>
+               <config-property-value>org.teiid.connector.jdbc.JDBCManagedConnectionFactory</config-property-value>
+            </config-property>
+            
+            <config-property>
+               <description>{$display:"Connector Class"}</description>
                <config-property-name>ConnectorClass</config-property-name>
                <config-property-type>java.lang.String</config-property-type>
                <config-property-value>org.teiid.connector.jdbc.JDBCConnector</config-property-value>
             </config-property>
 
             <config-property>
-               <description>{$display:"Connector Capabilities",$description:"The class to use to provide the Connector Capabilities",$advanced:"true"}</description>
+               <description>{$display:"Connector Capabilities",$description:"The class to use to provide the Connector Capabilities"}</description>
                <config-property-name>CapabilitiesClass</config-property-name>
                <config-property-type>java.lang.String</config-property-type>
             </config-property>
@@ -61,7 +69,7 @@
             </config-property>
             
             <config-property>
-               <description>{$display:"Is XA Capable",$description:"True, if this connector supports XA Transactions",$advanced:"true"}</description>
+               <description>{$display:"Is XA Capable",$description:"True, if this connector supports XA Transactions"}</description>
                <config-property-name>XaCapable</config-property-name>
                <config-property-type>java.lang.Boolean</config-property-type>
                <config-property-value>false</config-property-value>
@@ -104,20 +112,13 @@
             </config-property>
             
             <config-property>
-               <description>{$display:"Extension SQL Translation Class",$required:"true",$advanced:"true",$allowed:["org.teiid.connector.jdbc.translator.Translator","org.teiid.connector.jdbc.oracle.OracleSQLTranslator","org.teiid.connector.jdbc.db2.DB2SQLTranslator", "org.teiid.connector.jdbc.sqlserver.SqlServerSQLTranslator", "org.teiid.connector.jdbc.mysql.MySQLTranslator","org.teiid.connector.jdbc.mysql.MySQL5Translator", "org.teiid.connector.jdbc.postgresql.PostgreSQLTranslator", "org.teiid.connector.jdbc.derby.DerbySQLTranslator", "org.teiid.connector.jdbc.access.AccessSQLTranslator","org.teiid.connector.jdbc.h2.H2Translator","org.teiid.connector.jdbc.h2.H2Translator"]}</description>
+               <description>{$display:"Extension SQL Translation Class",$required:"true",$allowed:["org.teiid.connector.jdbc.translator.Translator","org.teiid.connector.jdbc.oracle.OracleSQLTranslator","org.teiid.connector.jdbc.db2.DB2SQLTranslator", "org.teiid.connector.jdbc.sqlserver.SqlServerSQLTranslator", "org.teiid.connector.jdbc.mysql.MySQLTranslator","org.teiid.connector.jdbc.mysql.MySQL5Translator", "org.teiid.connector.jdbc.postgresql.PostgreSQLTranslator", "org.teiid.connector.jdbc.derby.DerbySQLTranslator", "org.teiid.connector.jdbc.access.AccessSQLTranslator","org.teiid.connector.jdbc.h2.H2Translator","org.teiid.connector.jdbc.h2.H2Translator"]}</description>
                <config-property-name>ExtensionTranslationClassName</config-property-name>
                <config-property-type>java.lang.String</config-property-type>
                <config-property-value>org.teiid.connector.jdbc.translator.Translator</config-property-value>
             </config-property>
 
             <config-property>
-               <description>{$display:"Source Connection JNDI Name",$required:"true"}</description>
-               <description>JNDI Name of the physical resource.</description>
-               <config-property-name>SourceJNDIName</config-property-name>
-               <config-property-type>java.lang.String</config-property-type>
-            </config-property>
-
-            <config-property>
                <description>{$display:"Trim string flag",$description:"Right Trim fixed character types returned as Strings - note that the native type must be char or nchar and the source must support the rtrim function.",$advanced:"true"}</description>
                <config-property-name>TrimStrings</config-property-name>
                <config-property-type>java.lang.Boolean</config-property-type>

Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorManager.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorManager.java	2010-04-27 17:56:40 UTC (rev 2083)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorManager.java	2010-04-27 22:25:00 UTC (rev 2084)
@@ -34,9 +34,6 @@
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
 
-import org.jboss.managed.api.annotation.ManagementComponent;
-import org.jboss.managed.api.annotation.ManagementObject;
-import org.jboss.managed.api.annotation.ManagementProperties;
 import org.teiid.connector.api.Connection;
 import org.teiid.connector.api.Connector;
 import org.teiid.connector.api.ConnectorCapabilities;
@@ -70,11 +67,13 @@
  * The <code>ConnectorManager</code> manages a {@link org.teiid.connector.basic.BasicConnector Connector}
  * and its associated workers' state.
  */
- at ManagementObject(isRuntime=true, componentType=@ManagementComponent(type="teiid",subtype="connectormanager"), properties=ManagementProperties.EXPLICIT)
 public class ConnectorManager  {
 	
 	public static final int DEFAULT_MAX_THREADS = 20;
 	private String connectorName;
+	
+	// stateful connector supplied to the cm; does not do the lookup
+	private Connector statefulConnector;	
 	    
     //services acquired in start
     private BufferService bufferService;
@@ -93,8 +92,12 @@
     public ConnectorManager(String name) {
     	this(name, DEFAULT_MAX_THREADS);
     }
-	
+
     public ConnectorManager(String name, int maxThreads) {
+    	this(name, null, maxThreads);
+    }
+    
+    public ConnectorManager(String name, Connector connector, int maxThreads) {
     	if (name == null) {
     		throw new IllegalArgumentException("Connector name can not be null"); //$NON-NLS-1$
     	}
@@ -103,6 +106,7 @@
     	}
     	this.maxConnections = maxThreads;
     	this.connectorName = name;
+    	this.statefulConnector = connector;
     }
     
     public synchronized void acquireConnectionLock(ConnectorWorkItem item) throws BlockedException {
@@ -234,16 +238,6 @@
     }
 
     /**
-     * Returns a list of QueueStats objects that represent the queues in
-     * this service.
-     * If there are no queues, an empty Collection is returned.
-     */
-   /* @ManagementProperty(description="Get Runtime workmanager statistics", use={ViewUse.STATISTIC}, readOnly=true)
-    public WorkerPoolStatisticsMetadata getWorkManagerStatistics() {
-        return workManager.getStats();
-    }*/
-
-    /**
      * Add begin point to transaction monitoring table.
      * @param qr Request that contains the MetaMatrix command information in the transaction.
      */
@@ -284,6 +278,9 @@
      */
     Connector getConnector() throws ConnectorException {
 		try {
+			if (this.statefulConnector != null) {
+				return this.statefulConnector;
+			}
 			InitialContext ic  = new InitialContext();
 			return (Connector)ic.lookup(this.connectorName);    			
 		} catch (NamingException e) {

Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorWorkItem.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorWorkItem.java	2010-04-27 17:56:40 UTC (rev 2083)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorWorkItem.java	2010-04-27 22:25:00 UTC (rev 2084)
@@ -189,7 +189,11 @@
         } finally {
             manager.removeState(this.id);
             if (connection != null) {
-                connection.close();
+                try {
+					connection.close();
+				} catch (ConnectorException e) {
+					LogManager.logWarning(LogConstants.CTX_CONNECTOR, e.getMessage());
+				}
                 LogManager.logDetail(LogConstants.CTX_CONNECTOR, new Object[] {this.id, "Closed connection"}); //$NON-NLS-1$
             }
         } 

Modified: trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java	2010-04-27 17:56:40 UTC (rev 2083)
+++ trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java	2010-04-27 22:25:00 UTC (rev 2084)
@@ -27,8 +27,6 @@
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
-import java.io.Reader;
-import java.io.StringReader;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.ArrayList;
@@ -47,16 +45,13 @@
 import org.jboss.managed.api.ComponentType;
 import org.jboss.managed.api.DeploymentTemplateInfo;
 import org.jboss.managed.api.ManagedComponent;
-import org.jboss.managed.api.ManagedDeployment;
 import org.jboss.managed.api.ManagedObject;
 import org.jboss.managed.api.ManagedProperty;
 import org.jboss.managed.plugins.DefaultFieldsImpl;
 import org.jboss.managed.plugins.WritethroughManagedPropertyImpl;
 import org.jboss.metatype.api.types.CollectionMetaType;
-import org.jboss.metatype.api.types.MapCompositeMetaType;
 import org.jboss.metatype.api.types.SimpleMetaType;
 import org.jboss.metatype.api.values.CollectionValueSupport;
-import org.jboss.metatype.api.values.MapCompositeValueSupport;
 import org.jboss.metatype.api.values.MetaValue;
 import org.jboss.metatype.api.values.MetaValueFactory;
 import org.jboss.metatype.api.values.SimpleValueSupport;
@@ -68,7 +63,6 @@
 import org.teiid.adminapi.AdminObject;
 import org.teiid.adminapi.AdminProcessingException;
 import org.teiid.adminapi.ConnectionFactory;
-import org.teiid.adminapi.ConnectionPoolStatistics;
 import org.teiid.adminapi.Model;
 import org.teiid.adminapi.PropertyDefinition;
 import org.teiid.adminapi.Request;
@@ -78,7 +72,6 @@
 import org.teiid.adminapi.VDB;
 import org.teiid.adminapi.WorkerPoolStatistics;
 import org.teiid.adminapi.impl.ConnectionFactoryMetaData;
-import org.teiid.adminapi.impl.ConnectionPoolStatisticsMetadata;
 import org.teiid.adminapi.impl.DataPolicyMetadata;
 import org.teiid.adminapi.impl.ModelMetaData;
 import org.teiid.adminapi.impl.PropertyDefinitionMetadata;
@@ -88,31 +81,26 @@
 import org.teiid.adminapi.impl.VDBMetaData;
 import org.teiid.adminapi.impl.WorkerPoolStatisticsMetadata;
 import org.teiid.adminapi.impl.DataPolicyMetadata.PermissionMetaData;
-import org.teiid.connector.api.Connector;
 import org.teiid.jboss.IntegrationPlugin;
 import org.teiid.jboss.deployers.RuntimeEngineDeployer;
-import org.teiid.templates.connector.ExportConnectorTypeTemplateInfo;
 
-import com.metamatrix.core.util.ObjectConverterUtil;
-
 public class Admin extends TeiidAdmin {
 	private static final String CONNECTOR_PREFIX = "connector-"; //$NON-NLS-1$
 	private static final String RAR = ".rar"; //$NON-NLS-1$
 	private static final ProfileKey DEFAULT_PROFILE_KEY = new ProfileKey(ProfileKey.DEFAULT);
-	private static final String XA_DATA_SOURCE_TEMPLATE = "XADataSourceTemplate"; //$NON-NLS-1$
-	private static final String LOCAL_DATA_SOURCE_TEMPLATE = "LocalTxDataSourceTemplateInfo";  //$NON-NLS-1$	
 	private static final long serialVersionUID = 7081309086056911304L;
 	private static ComponentType VDBTYPE = new ComponentType("teiid", "vdb");//$NON-NLS-1$ //$NON-NLS-2$
 	private static ComponentType DQPTYPE = new ComponentType("teiid", "dqp");//$NON-NLS-1$ //$NON-NLS-2$
+	private static ComponentType CONNECTION_FACTORY_TYPE = new ComponentType("teiid", "connection-factory");//$NON-NLS-1$ //$NON-NLS-2$
 	private static String DQPNAME = RuntimeEngineDeployer.class.getName();
-	private static ExtendedComponentType NOTXTYPE = new ExtendedComponentType("ConnectionFactory", "NoTx", "no-tx-connection-factory");//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-	private static ExtendedComponentType TXTYPE = new ExtendedComponentType("ConnectionFactory", "Tx", "tx-connection-factory");//$NON-NLS-1$ //$NON-NLS-2$	//$NON-NLS-3$
-	private static ExtendedComponentType DS_LOCAL_TX = new ExtendedComponentType("DataSource", "LocalTx", "local-tx-datasource");//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-	private static ExtendedComponentType DS_XA_TX = new ExtendedComponentType("DataSource", "XA", "xa-datasource");//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-	private static ExtendedComponentType DS_NO_TX = new ExtendedComponentType("DataSource", "NoTx", "no-tx-datasource");//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-	private static ExtendedComponentType[] DS_TYPES = new ExtendedComponentType[] {DS_XA_TX, DS_LOCAL_TX, DS_NO_TX};
-	private static ExtendedComponentType[] CF_TYPES = new ExtendedComponentType[] {NOTXTYPE, TXTYPE};
+	private static ComponentType NOTXTYPE = new ComponentType("ConnectionFactory", "NoTx");//$NON-NLS-1$ //$NON-NLS-2$ 
+	private static ComponentType TXTYPE = new ComponentType("ConnectionFactory", "Tx");//$NON-NLS-1$ //$NON-NLS-2$
+	private static ComponentType DS_LOCAL_TX = new ComponentType("DataSource", "LocalTx");//$NON-NLS-1$ //$NON-NLS-2$
+	private static ComponentType DS_XA_TX = new ComponentType("DataSource", "XA");//$NON-NLS-1$ //$NON-NLS-2$
+	private static ComponentType DS_NO_TX = new ComponentType("DataSource", "NoTx");//$NON-NLS-1$ //$NON-NLS-2$
+	private static ComponentType[] DS_TYPES = {DS_XA_TX,DS_LOCAL_TX,TXTYPE,DS_NO_TX,NOTXTYPE};
 	
+	
 	private ManagementView view;
 	private DeploymentManager deploymentMgr;
 	
@@ -171,90 +159,44 @@
 	
 	@Override
 	public Collection<ConnectionFactory> getConnectionFactories() throws AdminException {
-		ArrayList<ConnectionFactory> bindings = new ArrayList<ConnectionFactory>();
-		findConnectorBindings(bindings, "NoTx"); //$NON-NLS-1$			
-		findConnectorBindings(bindings, "Tx"); //$NON-NLS-1$
-		return bindings;
-	}
-
-	@Override
-	public ConnectionFactory getConnectionFactory(String deployedName) throws AdminException {
-		ManagedComponent mc = getConnectorBindingComponent(deployedName);
-		if (mc != null) {
-			return buildConnectorBinding(mc);
+		ArrayList<ConnectionFactory> factories = new ArrayList<ConnectionFactory>();
+		try {
+			Set<ManagedComponent> mcSet = getView().getComponentsForType(CONNECTION_FACTORY_TYPE);
+			for (ManagedComponent mc:mcSet) {
+				factories.add(AdminObjectBuilder.buildAO(mc, ConnectionFactoryMetaData.class));
+			}
+		} catch (Exception e) {
+			throw new AdminComponentException(e);
 		}
-		return null;
+		return factories;
 	}
 
 	@Override
-	public Reader exportConnectionFactory(String deployedName) throws AdminException {
-		ManagementView view = getView();
+	public ConnectionFactory getConnectionFactory(String deployedName) throws AdminException {
 		try {
-			for (ExtendedComponentType type:CF_TYPES) {
-				ManagedComponent mc = view.getComponent(deployedName, type);
-				if (mc != null) {
-					return exportJCAConnection(deployedName, mc, type);
-				}				
-			}	
-			throw new AdminProcessingException(IntegrationPlugin.Util.getString("connectionfactory_not_found", deployedName)); //$NON-NLS-1$
-		} catch (Exception e) {
-			throw new AdminComponentException(e);			
-		}
-	}
-		
-	private Reader exportJCAConnection(String deployedName, ManagedComponent mc, ExtendedComponentType type) throws AdminException {		
-		try {
-			DeploymentTemplateInfo info = getView().getTemplate("export-template"); //$NON-NLS-1$
-			if(info == null) {
-				throw new AdminProcessingException(IntegrationPlugin.Util.getString("connector_type_not_found", "export-template")); //$NON-NLS-1$ //$NON-NLS-2$
+			ManagedComponent mc = getConnectionFactoryComponent(deployedName);
+			if (mc != null) {
+				return AdminObjectBuilder.buildAO(mc, ConnectionFactoryMetaData.class);
 			}
-			
-			for (ManagedProperty infoProperty:info.getProperties().values()) {
-				if (infoProperty != null) {
-					ManagedProperty mp = mc.getProperty(infoProperty.getName());
-					if (mp != null) {
-						infoProperty.setValue(mp.getValue());
-					}
-				}
-			}			
-			
-			ManagedProperty dsType = info.getProperties().get("dsType"); //$NON-NLS-1$
-			dsType.setValue(ManagedUtil.wrap(SimpleMetaType.STRING, type.getDsType()));
-			
-			File dsXml = File.createTempFile(deployedName, "-ds.xml"); //$NON-NLS-1$
-			ExportConnectorTypeTemplateInfo.writeTemplate(dsXml, info);
-			Reader r  = new StringReader(ObjectConverterUtil.convertFileToString(dsXml));
-			dsXml.delete();
-			return r;
-		} catch (NoSuchDeploymentException e) {
-			throw new AdminComponentException(e);
-		} catch (IOException e) {
-			throw new AdminComponentException(e);
+			return null;
 		} catch(Exception e) {
-			throw new AdminComponentException(e);
+			throw new AdminProcessingException(e.getMessage(), e);
 		}
 	}
-	
-	@Override
-	public Reader exportDataSource(String deployedName) throws AdminException {
+
+	private ManagedComponent getConnectionFactoryComponent(String deployedName)
+			throws Exception {
 		if (deployedName.startsWith("java:")) { //$NON-NLS-1$
 			deployedName = deployedName.substring(5);
 		}
-		try {
-			ManagedComponent mc = null;
-			ManagementView view = getView();
-			for (ExtendedComponentType type:DS_TYPES) {
-				mc = view.getComponent(deployedName, type);
-				if (mc != null) {
-					return exportJCAConnection(deployedName, mc, type);
-				}
-			}
-			throw new AdminProcessingException(IntegrationPlugin.Util.getString("datasource_not_found", deployedName)); //$NON-NLS-1$
-		} catch (Exception e) {
-			throw new AdminComponentException(e);
+		
+		if (!deployedName.startsWith("teiid-cf/")) { //$NON-NLS-1$
+			deployedName = "teiid-cf/"+deployedName; //$NON-NLS-1$
 		}
+		ManagedComponent mc = view.getComponent(deployedName, CONNECTION_FACTORY_TYPE);
+		return mc;
 	}
-
+	
 	private InputStream exportDeployment(String url) throws AdminComponentException {
 		try {
 			URL contentURL = new URL(url);
@@ -264,112 +206,96 @@
 		} catch (IOException e) {
 			throw new AdminComponentException(e);
 		}
-	}
+	}	
 	
-	private ManagedComponent getConnectorBindingComponent(String deployedName) throws AdminProcessingException {
+	private ManagedComponent getManagedConnectionFactoryComponent(String deployedName) throws AdminProcessingException {
 		try {
 			if (deployedName.startsWith("java:")) { //$NON-NLS-1$
 				deployedName = deployedName.substring(5);
 			}
-			ManagementView view = getView();
-			for (ExtendedComponentType type:CF_TYPES) {
+			for (ComponentType type:DS_TYPES) {
 				ManagedComponent mc = view.getComponent(deployedName, type);
 				if (mc != null) {
-					if (isConnectorBinding(mc)) {
-						return mc;	
-					}
-				}				
-			}	
+					return mc;
+				}
+			}
 		} catch(Exception e) {
 			throw new AdminProcessingException(e.getMessage(), e);
 		}
 		return null;
-	}
+	}	
 	
-	private ConnectionFactory buildConnectorBinding(ManagedComponent mc) {
-		ConnectionFactoryMetaData connector = new ConnectionFactoryMetaData();
-		connector.setName(mc.getName());
-		connector.setComponentType(mc.getType());
-		connector.addProperty("deployer-name", mc.getDeployment().getName());//$NON-NLS-1$	
-		
-		for (String key:mc.getProperties().keySet()) {
-			ManagedProperty property = mc.getProperty(key);
-			MetaValue value = property.getValue();
-			
-			//TODO: All properties need to be added
-			if (value != null) {
-				if(value.getMetaType().isSimple()) {
-					connector.addProperty(key, ManagedUtil.stringValue(value));
-				}
-				else if (key.equals("config-property")) { //$NON-NLS-1$	
-					MapCompositeValueSupport v1 = (MapCompositeValueSupport)value;
-					MapCompositeMetaType metaType = v1.getMetaType();
-					for (String configProperty:metaType.keySet()) {
-						if (!configProperty.endsWith(".type")) { //$NON-NLS-1$	
-							connector.addProperty(configProperty, ManagedUtil.stringValue(v1.get(configProperty)));
-						}
-					}
-				}
-				else {
-					//log.info(key+" property is not added to connector properties");
-				}
-			}
-		}
-		return connector;
-	}
+//	private ConnectionFactory buildConnectionFactory(ManagedComponent mc) {
+//		
+//		ConnectionFactoryMetaData connector = new ConnectionFactoryMetaData();
+//		connector.setName(mc.getName());
+//		connector.setComponentType(mc.getType());
+//		connector.setJNDIName(ManagedUtil.getSimpleValue(mc, "jndi-name", String.class)); //$NON-NLS-1$
+//		connector.setRARFileName(ManagedUtil.getSimpleValue(mc, "rar-name", String.class)); //$NON-NLS-1$
+//		
+//		connector.addProperty("deployer-name", mc.getDeployment().getName());//$NON-NLS-1$	
+//		
+//		for (String key:mc.getProperties().keySet()) {
+//			ManagedProperty property = mc.getProperty(key);
+//			MetaValue value = property.getValue();
+//			
+//			//TODO: All properties need to be added
+//			if (value != null) {
+//				if(value.getMetaType().isSimple()) {
+//					connector.addProperty(key, ManagedUtil.stringValue(value));
+//				}
+//				else if (key.equals("config-property")) { //$NON-NLS-1$	
+//					MapCompositeValueSupport v1 = (MapCompositeValueSupport)value;
+//					MapCompositeMetaType metaType = v1.getMetaType();
+//					for (String configProperty:metaType.keySet()) {
+//						if (!configProperty.endsWith(".type")) { //$NON-NLS-1$	
+//							connector.addProperty(configProperty, ManagedUtil.stringValue(v1.get(configProperty)));
+//						}
+//					}
+//				}
+//				else {
+//					//log.info(key+" property is not added to connector properties");
+//				}
+//			}
+//		}
+//		return connector;
+//	}
 	
-	private boolean isConnectorBinding(ManagedComponent mc) {
-	    String connectionDefinition = ManagedUtil.getSimpleValue(mc, "connection-definition", String.class); //$NON-NLS-1$	
-	    return Connector.class.getName().equals(connectionDefinition);
-	}
+
 	
-	private void findConnectorBindings(ArrayList<ConnectionFactory> bindings, String subType) throws AdminException {
-		try {
-			ComponentType type = new ComponentType("ConnectionFactory", subType); //$NON-NLS-1$	
-			Set<ManagedComponent> jcaConnectors = getView().getComponentsForType(type);
-			
-			for(ManagedComponent mc:jcaConnectors) {
-			    ManagedProperty mp = mc.getProperty("connection-definition"); //$NON-NLS-1$	
-				SimpleValueSupport v = (SimpleValueSupport)mp.getValue();
-				if (v.getValue().equals(Connector.class.getName())){
-					bindings.add(buildConnectorBinding(mc));
-			    }
-			}
-		}catch(Exception e) {
-			throw new AdminComponentException(e);
-		}
-	}
-	
 	@Override
 	public ConnectionFactory addConnectionFactory(String deploymentName, String typeName, Properties properties) throws AdminException {
-		if (getConnectionFactory(deploymentName) != null) {
+		if (getManagedConnectionFactoryComponent(deploymentName) != null) {
 			throw new AdminProcessingException(IntegrationPlugin.Util.getString("connector_binding_exists",deploymentName)); //$NON-NLS-1$;
-		}
-		properties.setProperty("connection-definition", Connector.class.getName()); //$NON-NLS-1$	
+		}			
 		addConnectionfactory(deploymentName, typeName, properties);
-		
 		return getConnectionFactory(deploymentName);
 	}
 	
 	@Override
 	public void setConnectionFactoryProperty(String deployedName, String propertyName, String propertyValue) throws AdminException{
-		ManagedComponent mc = getConnectorBindingComponent(deployedName);
-		if (mc == null) {
-			throw new AdminProcessingException(IntegrationPlugin.Util.getString("connector_binding_exists",deployedName)); //$NON-NLS-1$;
-		}
-		if (mc.getProperty(propertyName) != null) {
-			mc.getProperty(propertyName).setValue(SimpleValueSupport.wrap(propertyValue));
-		}
-		else {
-			Map<String, String> configProps = new HashMap<String, String>();
-			configProps.put(propertyName, propertyValue);
-			configProps.put(propertyValue+".type", "java.lang.String"); //$NON-NLS-1$	//$NON-NLS-2$	
-			MetaValue metaValue = ManagedUtil.compositeValueMap(configProps);
-			mc.getProperty("config-property").setValue(metaValue); //$NON-NLS-1$	
-		}
 		try {
-			getView().updateComponent(mc);
-			getView().load();
+			ManagementView localView = getView();
+			ManagedComponent mc = getManagedConnectionFactoryComponent(deployedName);
+			if (mc == null) {
+				throw new AdminProcessingException(IntegrationPlugin.Util.getString("connector_binding_exists",deployedName)); //$NON-NLS-1$;
+			}
+			if (mc.getProperty(propertyName) != null) {
+				mc.getProperty(propertyName).setValue(SimpleValueSupport.wrap(propertyValue));
+			}
+			else {
+				// since this is not in the regular properties list; must be teiid specific property
+				// handle this by template properties
+				ConnectionFactory cf = getConnectionFactory(deployedName);
+				DeploymentTemplateInfo template = localView.getTemplate(cf.getTemplateName());
+				if (template instanceof ExtendedPropertyInfo) {
+					ExtendedPropertyInfo extendedTemplate = (ExtendedPropertyInfo)template;
+					extendedTemplate.updateProperty(propertyName, propertyValue, mc);
+				}
+			}
+
+			localView.updateComponent(mc);
+			localView.load();
 		} catch (Exception e) {
 			throw new AdminComponentException(e);
 		}
@@ -377,7 +303,7 @@
 		
 	@Override
 	public void deleteConnectionFactory(String deployedName) throws AdminException {
-		ManagedComponent mc = getConnectorBindingComponent(deployedName);
+		ManagedComponent mc = getManagedConnectionFactoryComponent(deployedName);
 		if (mc != null) {
 			ManagedUtil.removeArchive(getDeploymentManager(),mc.getDeployment().getName());
 		}
@@ -386,15 +312,8 @@
 	@Override
 	public void startConnectionFactory(String deployedName) throws AdminException {
 		try {
-			ConnectionFactory factory = getConnectionFactory(deployedName);
-			if (factory == null) {
-				throw new AdminProcessingException(IntegrationPlugin.Util.getString("failed_to_connector_deployer")); //$NON-NLS-1$
-			}
-			String deployerName = factory.getPropertyValue("deployer-name"); //$NON-NLS-1$
-			if (deployerName == null) {
-				throw new AdminProcessingException(IntegrationPlugin.Util.getString("failed_to_connector_deployer")); //$NON-NLS-1$
-			}
-			ManagedUtil.execute(getDeploymentManager().start(deployerName), IntegrationPlugin.Util.getString("failed_to_start_connector", factory.getName())); //$NON-NLS-1$
+			String deploymentName = getDeploymentName(deployedName);
+			ManagedUtil.execute(getDeploymentManager().start(deploymentName), IntegrationPlugin.Util.getString("failed_to_start_connector", deployedName)); //$NON-NLS-1$
 		} catch (Exception e) {
 			ManagedUtil.handleException(e);
 		}
@@ -403,18 +322,23 @@
 	@Override
 	public void stopConnectionFactory(String deployedName) throws AdminException {
 		try {
-			ConnectionFactory factory = getConnectionFactory(deployedName);
-			if (factory == null) {
-				throw new AdminProcessingException(IntegrationPlugin.Util.getString("failed_to_connector_deployer")); //$NON-NLS-1$
-			}			
-			String deployerName = factory.getPropertyValue("deployer-name");//$NON-NLS-1$
-			if (deployerName == null) {
-				throw new AdminProcessingException(IntegrationPlugin.Util.getString("failed_to_connector_deployer")); //$NON-NLS-1$
-			}			
-			ManagedUtil.execute(getDeploymentManager().stop(deployerName), IntegrationPlugin.Util.getString("failed_to_stop_connector", factory.getName())); //$NON-NLS-1$
+			String deploymentName = getDeploymentName(deployedName);			
+			ManagedUtil.execute(getDeploymentManager().stop(deploymentName), IntegrationPlugin.Util.getString("failed_to_stop_connector", deployedName)); //$NON-NLS-1$
 		} catch (Exception e) {
 			ManagedUtil.handleException(e);
 		}
+	}
+
+	private String getDeploymentName(String deployedName) throws AdminProcessingException {
+		ManagedComponent mc = getManagedConnectionFactoryComponent(deployedName);
+		if (mc == null) {
+			throw new AdminProcessingException(IntegrationPlugin.Util.getString("failed_to_find_connector", deployedName)); //$NON-NLS-1$
+		}
+		String deploymentName = mc.getDeployment().getName();
+		if (deploymentName == null) {
+			throw new AdminProcessingException(IntegrationPlugin.Util.getString("failed_to_find_connector")); //$NON-NLS-1$
+		}
+		return deploymentName;
 	}	
 	
 	@Override
@@ -438,20 +362,15 @@
 	
 	
 	@Override
-	public Set<String> getConnectorNames() throws AdminException{
-		try {
-			Set<ManagedDeployment> rarFiles = getView().getDeploymentsForType("rar");//$NON-NLS-1$ 
-			HashSet<String> matched = new HashSet<String>();
-			for(ManagedDeployment md:rarFiles) {
-				String name = md.getSimpleName();
-				if (name.startsWith(CONNECTOR_PREFIX) && name.endsWith(RAR)) {
-					matched.add(md.getSimpleName());
-				}
+	public Set<String> getConnectorTemplateNames() throws AdminException{
+		Set<String> names = getView().getTemplateNames();
+		HashSet<String> matched = new HashSet<String>();
+		for(String name:names) {
+			if (name.startsWith(CONNECTOR_PREFIX)) {
+				matched.add(name);
 			}
-			return matched;
-		} catch(Exception e) {
-			throw new AdminComponentException(e.getMessage(), e);
 		}
+		return matched;
 	}
 	
     boolean matches(String regEx, String value) {
@@ -764,19 +683,6 @@
 	}
 	
 	@Override
-	public InputStream exportConnector(String connectorName) throws AdminException {
-		if (!connectorName.startsWith(CONNECTOR_PREFIX) || !connectorName.endsWith(RAR)) {
-			throw new AdminProcessingException(IntegrationPlugin.Util.getString("bad_connector_type_name")); //$NON-NLS-1$
-		}
-		
-		String deployerName = getRarDeployerName(connectorName);
-		if (deployerName == null) {
-			throw new AdminProcessingException(IntegrationPlugin.Util.getString("connector_not_found", connectorName)); //$NON-NLS-1$
-		}
-		return exportDeployment(deployerName);
-	}
-	
-	@Override
 	public Collection<String> getCacheTypes() throws AdminException {
 		try {
 			Collection<String> requestList = new ArrayList<String>();
@@ -839,41 +745,22 @@
 		}
 	}	
 	
-	@Override
-	public ConnectionPoolStatistics getConnectionFactoryStats(String deployedName) throws AdminException {
-		ManagedComponent mc = getConnectorBindingComponent(deployedName);
-		if (mc != null) {
-			return buildConnectorConnectionPool(mc);
-		}
-		return null;
-	}
-
-	private ConnectionPoolStatistics buildConnectorConnectionPool(ManagedComponent mc) {
-		ConnectionPoolStatisticsMetadata stats = new ConnectionPoolStatisticsMetadata();
-		stats.setName(mc.getName());
-		stats.setAvailableConnectionCount(ManagedUtil.getSimpleValue(mc, "availableConnectionCount", Long.class));//$NON-NLS-1$
-		stats.setConnectionCount(ManagedUtil.getSimpleValue(mc, "connectionCount", Integer.class));//$NON-NLS-1$
-		stats.setConnectionCreatedCount(ManagedUtil.getSimpleValue(mc, "connectionCreatedCount", Integer.class));//$NON-NLS-1$
-		stats.setConnectionDestroyedCount(ManagedUtil.getSimpleValue(mc, "connectionDestroyedCount", Integer.class));//$NON-NLS-1$
-		stats.setInUseConnectionCount(ManagedUtil.getSimpleValue(mc, "inUseConnectionCount", Long.class));//$NON-NLS-1$
-		stats.setMaxConnectionsInUseCount(ManagedUtil.getSimpleValue(mc, "maxConnectionsInUseCount", Long.class));//$NON-NLS-1$
-		stats.setMaxSize(ManagedUtil.getSimpleValue(mc, "maxSize", Integer.class));//$NON-NLS-1$
-		stats.setMinSize(ManagedUtil.getSimpleValue(mc, "minSize", Integer.class));//$NON-NLS-1$
-		return stats;
-	}	
 	
 	@Override
-	public Collection<PropertyDefinition> getConnectorPropertyDefinitions(String typeName) throws AdminException {
+	public Collection<PropertyDefinition> getConnectorTemplatePropertyDefinitions(String templateName) throws AdminException {
 		try {
-			DeploymentTemplateInfo info = getView().getTemplate(typeName);
+			DeploymentTemplateInfo info = getView().getTemplate(templateName);
 			if(info == null) {
-				throw new AdminProcessingException(IntegrationPlugin.Util.getString("connector_type_not_found", typeName)); //$NON-NLS-1$
+				throw new AdminProcessingException(IntegrationPlugin.Util.getString("connector_type_not_found", templateName)); //$NON-NLS-1$
 			}
 			
 			ArrayList<PropertyDefinition> props = new ArrayList<PropertyDefinition>();
 			Map<String, ManagedProperty> propertyMap = info.getProperties();
 			
 			for (ManagedProperty mp:propertyMap.values()) {
+					if (!includeInTemplate(mp)) {
+						continue;
+					}
 					PropertyDefinitionMetadata p = new PropertyDefinitionMetadata();
 					p.setName(mp.getName());
 					p.setDescription(mp.getDescription());
@@ -916,26 +803,26 @@
 		}
 	}	
 	
-	@Override
-    public void addDataSource(String deploymentName, DataSourceType type, Properties properties) throws AdminException {
-		if (type == DataSourceType.XA) { 
-			addConnectionfactory(deploymentName, XA_DATA_SOURCE_TEMPLATE, properties);
+    private boolean includeInTemplate(ManagedProperty mp) {
+    	Boolean teiidProperty = mp.getField("teiid-property", Boolean.class);//$NON-NLS-1$
+		if ( teiidProperty != null && teiidProperty.booleanValue()) {
+			return true;
 		}
-		else if (type == DataSourceType.LOCAL) {
-			addConnectionfactory(deploymentName, LOCAL_DATA_SOURCE_TEMPLATE, properties);
+		if (mp.isMandatory() && mp.getDefaultValue() == null) {
+			return true;
 		}
+		return false;
 	}
-	
-    private void addConnectionfactory(String deploymentName, String typeName, Properties properties) throws AdminException {	
+
+	private void addConnectionfactory(String deploymentName, String typeName, Properties properties) throws AdminException {	
 		try {
 			DeploymentTemplateInfo info = getView().getTemplate(typeName);
 			if(info == null) {
 				throw new AdminProcessingException(IntegrationPlugin.Util.getString("connector_type_not_found", typeName)); //$NON-NLS-1$
 			}
-		
-			//config-properties list
-			Map<String, String> configProps = new HashMap<String, String>();
 			
+//			Map<String, String> configProps = new HashMap<String, String>();
+			
 			// template properties specific to the template
 			Map<String, ManagedProperty> propertyMap = info.getProperties();
 			
@@ -949,16 +836,16 @@
 						mp.setValue(SimpleValueSupport.wrap(value));
 					}
 				}
-				else {
-					configProps.put(key, properties.getProperty(key));
-					configProps.put(key+".type", "java.lang.String");//$NON-NLS-1$ //$NON-NLS-2$
-				}
+//				else {
+//					configProps.put(key, properties.getProperty(key));
+//					configProps.put(key+".type", "java.lang.String");//$NON-NLS-1$ //$NON-NLS-2$
+//				}
 			}
 			
-			if (configProps.size() > 0) {
-				MetaValue metaValue = ManagedUtil.compositeValueMap(configProps);
-				info.getProperties().get("config-property").setValue(metaValue);//$NON-NLS-1$				
-			}
+//			if (configProps.size() > 0) {
+//				MetaValue metaValue = ManagedUtil.compositeValueMap(configProps);
+//				info.getProperties().get("config-property").setValue(metaValue);//$NON-NLS-1$				
+//			}
 			
 			getView().applyTemplate(deploymentName, info);
 	
@@ -969,43 +856,23 @@
 		}    	
     }
     
-	@Override
-    public void deleteDataSource(String deployedName) throws AdminException {
-		try {
-			ManagementView view = getView();
-			for (ExtendedComponentType type:DS_TYPES) {
-				ManagedComponent mc = view.getComponent(deployedName, type);
-				if (mc != null) {
-					ManagedUtil.removeArchive(getDeploymentManager(),mc.getDeployment().getName());
-					break;
-				}
-			}			
-		} catch (Exception e) {
-			throw new AdminComponentException(e.getMessage(), e);
-		}
-    }
-    
-	@Override
-    public Collection<PropertyDefinition> getDataSourcePropertyDefinitions() throws AdminException {
-		return getConnectorPropertyDefinitions(XA_DATA_SOURCE_TEMPLATE);
-	}
-	
 	private static final String connectorTemplate = 
 		"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"+ //$NON-NLS-1$
         "<deployment xmlns=\"urn:jboss:bean-deployer:2.0\">\n" + //$NON-NLS-1$
 		"<!-- This is Teiid connector type template - DO NOT DELETE -->\n"+ //$NON-NLS-1$
-		"<bean name=\"${name}\" class=\"org.teiid.templates.connector.ConnectorTypeTemplate\">\n" + //$NON-NLS-1$
+		"<bean name=\"${name}\" class=\"org.teiid.templates.connector.ConnectorDeploymentTemplate\">\n" + //$NON-NLS-1$
 		"    <property name=\"info\"><inject bean=\"${name}-templateinfo\"/></property>\n" + //$NON-NLS-1$
         "    <property name=\"targetTemplate\"><inject bean=\"NoTxConnectionFactoryTemplate\"/></property>\n" + //$NON-NLS-1$
         "</bean>\n" + //$NON-NLS-1$
-        "<bean name=\"${name}-templateinfo\" class=\"org.teiid.templates.connector.ConnectorTypeTemplateInfo\">\n" + //$NON-NLS-1$
+        "<bean name=\"${name}-templateinfo\" class=\"org.teiid.templates.connector.ConnectorTemplateInfo\">\n" + //$NON-NLS-1$
         "  <constructor factoryMethod=\"createTemplateInfo\">\n" + //$NON-NLS-1$
         "  <factory bean=\"DSDeploymentTemplateInfoFactory\"/>\n" + //$NON-NLS-1$
-        "    <parameter class=\"java.lang.Class\">org.teiid.templates.connector.ConnectorTypeTemplateInfo</parameter>\n" + //$NON-NLS-1$
+        "    <parameter class=\"java.lang.Class\">org.teiid.templates.connector.ConnectorTemplateInfo</parameter>\n" + //$NON-NLS-1$
         "    <parameter class=\"java.lang.Class\">org.jboss.resource.metadata.mcf.NoTxConnectionFactoryDeploymentMetaData</parameter>\n" + //$NON-NLS-1$
-        "    <parameter class=\"java.lang.String\">${name}.rar</parameter>\n" + //$NON-NLS-1$
+        "    <parameter class=\"java.lang.String\">${name}</parameter>\n" + //$NON-NLS-1$
         "    <parameter class=\"java.lang.String\">${name}</parameter>\n"+ //$NON-NLS-1$
         "  </constructor>\n" + //$NON-NLS-1$
+        "  <property name=\"rarName\">${name}.rar</property>" + //$NON-NLS-1$
         "</bean>\n"+ //$NON-NLS-1$
         "</deployment>"; //$NON-NLS-1$
 	

Added: trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/AdminObjectBuilder.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/AdminObjectBuilder.java	                        (rev 0)
+++ trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/AdminObjectBuilder.java	2010-04-27 22:25:00 UTC (rev 2084)
@@ -0,0 +1,82 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * 
+ * This library 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 library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.adminapi.jboss;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.managed.api.ManagedCommon;
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.metatype.api.types.MetaType;
+import org.jboss.metatype.api.values.MapCompositeValueSupport;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.metatype.api.values.MetaValueFactory;
+import org.jboss.metatype.api.values.SimpleValue;
+import org.teiid.jboss.IntegrationPlugin;
+
+import com.metamatrix.common.util.PropertiesUtils;
+import com.metamatrix.core.MetaMatrixRuntimeException;
+
+
+public class AdminObjectBuilder {
+
+	public static <T> T buildAO(ManagedCommon mc, Class<T> clazz) {
+		
+		try {
+			Object t = clazz.newInstance();
+			
+			Map<String, ManagedProperty> managedProperties = mc.getProperties(); 
+			for (ManagedProperty mp: managedProperties.values()) {
+				MetaValue value = mp.getValue();
+				if (value != null) {
+					MetaType type = value.getMetaType();
+					if (type.isSimple()) {
+						PropertiesUtils.setBeanProperty(t, mp.getName(), ((SimpleValue)value).getValue());
+					}
+					else if (type.isProperties()) {
+						
+					}
+					else if (type.isComposite()) {
+						if (value instanceof MapCompositeValueSupport) {
+							MapCompositeValueSupport map = (MapCompositeValueSupport)value;
+						}
+					}
+					else if (type.isCollection()) {
+						List list = new ArrayList();
+						List<ManagedObject> managedObjects = (List<ManagedObject>)MetaValueFactory.getInstance().unwrap(value);
+						for (ManagedObject mo:managedObjects) {
+							list.add(buildAO(mo, mo.getAttachment().getClass()));							
+						}
+						PropertiesUtils.setBeanProperty(t, mp.getName(), list);
+					}
+				}
+			}
+			return clazz.cast(t);
+		} catch (InstantiationException e) {
+			throw new MetaMatrixRuntimeException(e, IntegrationPlugin.Util.getString("class_not_found", clazz.getName())); //$NON-NLS-1$
+		} catch (IllegalAccessException e) {
+			throw new MetaMatrixRuntimeException(e, IntegrationPlugin.Util.getString("class_not_found", clazz.getName())); //$NON-NLS-1$
+		}
+	}
+}


Property changes on: trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/AdminObjectBuilder.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Deleted: trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/ExtendedComponentType.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/ExtendedComponentType.java	2010-04-27 17:56:40 UTC (rev 2083)
+++ trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/ExtendedComponentType.java	2010-04-27 22:25:00 UTC (rev 2084)
@@ -1,39 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library 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 library 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 library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.adminapi.jboss;
-
-import org.jboss.managed.api.ComponentType;
-
-public class ExtendedComponentType extends ComponentType {
-	private static final long serialVersionUID = 5526223504408812809L;
-	
-	private String dsType;
-	
-	public ExtendedComponentType(String type, String subtype, String dsType) {
-		super(type, subtype);
-		this.dsType = dsType;
-	}
-	
-	public String getDsType() {
-		return this.dsType;
-	}
-}

Added: trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/ExtendedPropertyInfo.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/ExtendedPropertyInfo.java	                        (rev 0)
+++ trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/ExtendedPropertyInfo.java	2010-04-27 22:25:00 UTC (rev 2084)
@@ -0,0 +1,28 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * 
+ * This library 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 library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.adminapi.jboss;
+
+import org.jboss.managed.api.ManagedComponent;
+
+public interface ExtendedPropertyInfo {
+	void updateProperty(String name, String value, ManagedComponent mc);
+}


Property changes on: trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/ExtendedPropertyInfo.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/AutoConnectionFactoryDeployer.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/AutoConnectionFactoryDeployer.java	                        (rev 0)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/AutoConnectionFactoryDeployer.java	2010-04-27 22:25:00 UTC (rev 2084)
@@ -0,0 +1,195 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * 
+ * This library 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 library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.jboss.deployers;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+import javax.resource.ResourceException;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
+import org.jboss.deployers.spi.deployer.managed.ManagedObjectCreator;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.api.factory.ManagedObjectFactory;
+import org.jboss.resource.metadata.mcf.ManagedConnectionFactoryDeploymentMetaData;
+import org.jboss.resource.metadata.mcf.ManagedConnectionFactoryPropertyMetaData;
+import org.teiid.adminapi.ConnectionFactory;
+import org.teiid.adminapi.impl.ConnectionFactoryMetaData;
+import org.teiid.connector.api.Connector;
+import org.teiid.connector.api.ConnectorEnvironment;
+import org.teiid.connector.basic.BasicManagedConnectionFactory;
+import org.teiid.deployers.VDBStatusChecker;
+import org.teiid.dqp.internal.datamgr.impl.ConnectorManager;
+import org.teiid.dqp.internal.datamgr.impl.ConnectorManagerRepository;
+import org.teiid.jboss.IntegrationPlugin;
+
+import com.metamatrix.common.log.LogConstants;
+import com.metamatrix.common.log.LogManager;
+import com.metamatrix.common.util.PropertiesUtils;
+import com.metamatrix.core.MetaMatrixCoreException;
+import com.metamatrix.core.util.ReflectionHelper;
+
+/**
+ * If the data source's "-ds.xml" file contains couple of extra Teiid Connection Factory properties, this deployer
+ * creates a stateful "Connector" and creates the "ConnectorManager" using the "Connector" created. In this case the 
+ * "Connector" is not the JCA component. No lookup done for the "Connector". This way Teiid can combine the creation of
+ * data source and connection factory in one step.
+ */
+public class AutoConnectionFactoryDeployer extends AbstractSimpleRealDeployer<AutoConnectionFactoryDeploymentGroup> implements ManagedObjectCreator {
+	
+	private ConnectorManagerRepository connectorManagerRepository;
+	private VDBStatusChecker vdbChecker;
+	private ManagedObjectFactory mof;
+	
+	public AutoConnectionFactoryDeployer() {
+		super(AutoConnectionFactoryDeploymentGroup.class);
+		setRelativeOrder(3000);
+	}
+
+	@Override
+	public void deploy(DeploymentUnit unit, AutoConnectionFactoryDeploymentGroup group) throws DeploymentException {
+		List<ManagedConnectionFactoryDeploymentMetaData> deployments = group.getDeployments();
+		
+		ConnectionFactoryMetadataGroup cfGroup = new ConnectionFactoryMetadataGroup();
+		
+		for (ManagedConnectionFactoryDeploymentMetaData data : deployments) {
+			String connectorName = "java:"+data.getJndiName(); //$NON-NLS-1$
+			ConnectorManager cm = null;
+
+			// check if a Teiid connection factory needs to be created for this data source.
+			List<ManagedConnectionFactoryPropertyMetaData> props = data.getManagedConnectionFactoryProperties();
+			
+			String cfClass = getPropertyValue("ConnectionFactoryClass", props); //$NON-NLS-1$	
+			if (cfClass != null) {
+				Properties teiidProps = convertToProperties(props);
+				
+				// This indicates that a Teiid Connection factory 
+				Connector connector = buildTeiidConnector(cfClass, teiidProps, connectorName);
+				cm = new ConnectorManager(connectorName, connector, data.getMaxSize());
+				
+				cm.start();
+	
+				// Add the references to the mgr as loaded.
+	            this.connectorManagerRepository.addConnectorManager(connectorName, cm);   
+	            cfGroup.addConnectionFactory(ConnectionFactoryDeployer.buildCF(data));
+	            
+	            this.vdbChecker.connectorAdded(connectorName);
+	            LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.getString("connector_started", connectorName)); //$NON-NLS-1$
+			}
+		}
+		
+		if (!cfGroup.getConnectionFactories().isEmpty()) {
+			unit.addAttachment(ConnectionFactoryMetadataGroup.class, cfGroup);
+		}		
+	}
+	
+	private String getPropertyValue(String name, List<ManagedConnectionFactoryPropertyMetaData> props) {
+		for (ManagedConnectionFactoryPropertyMetaData prop:props) {
+			if (prop.getName().equals(name)) {
+				return prop.getValue();
+			}
+		}
+		return null;
+	}
+	
+	private Properties convertToProperties(List<ManagedConnectionFactoryPropertyMetaData> props) {
+		Properties convertedProps = new Properties();
+		for (ManagedConnectionFactoryPropertyMetaData prop:props) {
+			convertedProps.setProperty(prop.getName(), prop.getValue());
+		}
+		return convertedProps;
+	}	
+
+	private Connector buildTeiidConnector(String cfClass, Properties props, String sourceJndiName) throws DeploymentException {
+		BasicManagedConnectionFactory cf;
+		try {
+			Object o = ReflectionHelper.create(cfClass, null, Thread.currentThread().getContextClassLoader());
+			if(!(o instanceof ConnectorEnvironment)) {
+				throw new DeploymentException(IntegrationPlugin.Util.getString("invalid_class", cfClass));//$NON-NLS-1$	
+			}
+			cf = (BasicManagedConnectionFactory)o;
+			
+			PropertiesUtils.setBeanProperties(cf, props, null);
+			cf.setSourceJNDIName(sourceJndiName);
+			
+			return (Connector)cf.createConnectionFactory();
+			
+		} catch (MetaMatrixCoreException e) {
+			throw new DeploymentException(e);
+		} catch (ResourceException e) {
+			throw new DeploymentException(e);
+		}
+	}
+    
+	public void setConnectorManagerRepository(ConnectorManagerRepository repo) {
+		this.connectorManagerRepository = repo;
+	}
+
+	/*
+	 * undeploy covered by the other deployer already.
+	@Override
+	public void undeploy(DeploymentUnit unit, AutoConnectionFactoryDeploymentGroup group) {
+		super.undeploy(unit, group);
+		List<ManagedConnectionFactoryDeploymentMetaData> deployments = group.getDeployments();
+
+		for (ManagedConnectionFactoryDeploymentMetaData data : deployments) {
+			String connectorName = "java:"+data.getJndiName(); //$NON-NLS-1$
+			if (this.connectorManagerRepository != null) {
+				ConnectorManager cm = this.connectorManagerRepository.removeConnectorManager(connectorName);
+				if (cm != null) {
+					cm.stop();
+					this.vdbChecker.connectorRemoved(connectorName);
+					LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.getString("connector_stopped", connectorName)); //$NON-NLS-1$				
+				}
+			}
+		}
+	}
+	*/
+	
+	@Override
+	public void build(DeploymentUnit unit, Set<String> attachmentNames, Map<String, ManagedObject> managedObjects)
+			throws DeploymentException {
+		
+		ConnectionFactoryMetadataGroup group = unit.getAttachment(ConnectionFactoryMetadataGroup.class);
+		if (group != null) {
+			for (ConnectionFactoryMetaData data : group.getConnectionFactories()) {
+				ManagedObject mo = this.mof.initManagedObject(data, ConnectionFactory.class, data.getName(), data.getName());
+				if (mo == null) {
+					throw new DeploymentException("could not create managed object"); //$NON-NLS-1$
+				}
+				managedObjects.put(mo.getName(), mo);					
+			}
+		}
+	}
+	
+	public void setVDBStatusChecker(VDBStatusChecker vdbChecker) {
+		this.vdbChecker = vdbChecker;
+	}	
+	
+	public void setManagedObjectFactory(ManagedObjectFactory mof) {
+		this.mof = mof;
+	}
+}


Property changes on: trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/AutoConnectionFactoryDeployer.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/AutoConnectionFactoryDeploymentGroup.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/AutoConnectionFactoryDeploymentGroup.java	                        (rev 0)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/AutoConnectionFactoryDeploymentGroup.java	2010-04-27 22:25:00 UTC (rev 2084)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.teiid.jboss.deployers;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElements;
+import javax.xml.bind.annotation.XmlRootElement;
+
+import org.jboss.resource.metadata.mcf.ManagedConnectionFactoryDeploymentMetaData;
+
+
+ at XmlAccessorType(XmlAccessType.NONE)
+ at XmlRootElement
+public class AutoConnectionFactoryDeploymentGroup implements Serializable {
+   private static final long serialVersionUID = -7650097438654698297L;
+
+   @XmlElements({@XmlElement(name="local-tx-datasource", type=ManagedConnectionFactoryDeploymentMetaData.class),
+                 @XmlElement(name="no-tx-datasource", type=ManagedConnectionFactoryDeploymentMetaData.class),
+                 @XmlElement(name="xa-datasource", type=ManagedConnectionFactoryDeploymentMetaData.class)})
+   List<ManagedConnectionFactoryDeploymentMetaData> deployments = new ArrayList<ManagedConnectionFactoryDeploymentMetaData>();
+   
+   public List<ManagedConnectionFactoryDeploymentMetaData> getDeployments() {
+      return Collections.unmodifiableList(deployments);
+   }   
+}


Property changes on: trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/AutoConnectionFactoryDeploymentGroup.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/AutoConnectionFactoryParserDeployer.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/AutoConnectionFactoryParserDeployer.java	                        (rev 0)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/AutoConnectionFactoryParserDeployer.java	2010-04-27 22:25:00 UTC (rev 2084)
@@ -0,0 +1,69 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.teiid.jboss.deployers;
+
+import java.io.InputStream;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.transform.sax.SAXSource;
+
+import org.jboss.deployers.vfs.spi.deployer.AbstractVFSParsingDeployer;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.util.xml.JBossEntityResolver;
+import org.jboss.virtual.VirtualFile;
+import org.xml.sax.InputSource;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.XMLReaderFactory;
+
+
+public class AutoConnectionFactoryParserDeployer extends AbstractVFSParsingDeployer<AutoConnectionFactoryDeploymentGroup> {   
+   
+   public AutoConnectionFactoryParserDeployer() {
+      super(AutoConnectionFactoryDeploymentGroup.class);
+      setIncludeDeploymentFile(true);
+      setSuffix("-ds.xml"); //$NON-NLS-1$
+   }
+   
+   @Override
+   protected AutoConnectionFactoryDeploymentGroup parse(VFSDeploymentUnit unit, VirtualFile file, AutoConnectionFactoryDeploymentGroup root) throws Exception {
+	  JAXBContext context = JAXBContext.newInstance(new Class[] {AutoConnectionFactoryDeploymentGroup.class});
+      Unmarshaller um = context.createUnmarshaller();      
+      InputStream is = file.openStream();
+
+      try{
+         InputSource input = new InputSource(is);
+         input.setSystemId(file.toURI().toString());
+         XMLReader reader = XMLReaderFactory.createXMLReader();
+         reader.setEntityResolver(new JBossEntityResolver());
+         SAXSource source = new SAXSource(reader, input);
+         JAXBElement<AutoConnectionFactoryDeploymentGroup> elem = um.unmarshal(source, AutoConnectionFactoryDeploymentGroup.class);
+         AutoConnectionFactoryDeploymentGroup deployment = elem.getValue();
+         return deployment;
+      }      
+      finally {
+         if (is != null)
+            is.close();            
+      }
+   }
+}


Property changes on: trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/AutoConnectionFactoryParserDeployer.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/ConnectionFactoryDeployer.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/ConnectionFactoryDeployer.java	2010-04-27 17:56:40 UTC (rev 2083)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/ConnectionFactoryDeployer.java	2010-04-27 22:25:00 UTC (rev 2084)
@@ -25,37 +25,43 @@
 import java.util.Map;
 import java.util.Set;
 
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-
 import org.jboss.deployers.spi.DeploymentException;
 import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
 import org.jboss.deployers.spi.deployer.managed.ManagedObjectCreator;
 import org.jboss.deployers.structure.spi.DeploymentUnit;
 import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.api.ManagedProperty;
 import org.jboss.managed.api.factory.ManagedObjectFactory;
+import org.jboss.metatype.api.types.MetaType;
+import org.jboss.metatype.api.values.CollectionValue;
+import org.jboss.metatype.api.values.GenericValue;
+import org.jboss.metatype.api.values.MapCompositeValueSupport;
+import org.jboss.metatype.api.values.MetaValue;
 import org.jboss.resource.metadata.mcf.ManagedConnectionFactoryDeploymentGroup;
 import org.jboss.resource.metadata.mcf.ManagedConnectionFactoryDeploymentMetaData;
-import org.teiid.adminapi.Model;
-import org.teiid.adminapi.VDB;
-import org.teiid.adminapi.impl.ModelMetaData;
-import org.teiid.adminapi.impl.VDBMetaData;
+import org.jboss.resource.metadata.mcf.ManagedConnectionFactoryPropertyMetaData;
+import org.teiid.adminapi.ConnectionFactory;
+import org.teiid.adminapi.impl.ConnectionFactoryMetaData;
+import org.teiid.adminapi.jboss.ManagedUtil;
 import org.teiid.connector.api.Connector;
-import org.teiid.deployers.VDBRepository;
+import org.teiid.deployers.VDBStatusChecker;
 import org.teiid.dqp.internal.datamgr.impl.ConnectorManager;
 import org.teiid.dqp.internal.datamgr.impl.ConnectorManagerRepository;
 import org.teiid.jboss.IntegrationPlugin;
-import org.teiid.security.SecurityHelper;
 
 import com.metamatrix.common.log.LogConstants;
 import com.metamatrix.common.log.LogManager;
 
+/**
+ * This is a deployer that looks for the teiid connection factories deployed with their own "-ds.xml"
+ * file, then this class creates a ConnectorManager for it. So, the access to the "Connector" is through look-up
+ * in jndi tree for Connector Manager. Connector is JCA component.
+ */
 public class ConnectionFactoryDeployer extends AbstractSimpleRealDeployer<ManagedConnectionFactoryDeploymentGroup> implements ManagedObjectCreator {
-	private ManagedObjectFactory mof;
-	private SecurityHelper securityHelper;
 	
+	private ManagedObjectFactory mof;
 	private ConnectorManagerRepository connectorManagerRepository;
-	private VDBRepository vdbRepository;
+	private VDBStatusChecker vdbChecker;
 	
 	public ConnectionFactoryDeployer() {
 		super(ManagedConnectionFactoryDeploymentGroup.class);
@@ -66,38 +72,30 @@
 	public void deploy(DeploymentUnit unit, ManagedConnectionFactoryDeploymentGroup group) throws DeploymentException {
 		List<ManagedConnectionFactoryDeploymentMetaData> deployments = group.getDeployments();
 		
-		ConnectorManagerGroup cmGroup = new ConnectorManagerGroup();
+		ConnectionFactoryMetadataGroup cfGroup = new ConnectionFactoryMetadataGroup();
 		
 		for (ManagedConnectionFactoryDeploymentMetaData data : deployments) {
 			String connectorDefinition = data.getConnectionDefinition();
+			String connectorName = "java:"+data.getJndiName(); //$NON-NLS-1$
+			
 			if (connectorDefinition.equals(Connector.class.getName())) {
-				String connectorName = "java:"+data.getJndiName(); //$NON-NLS-1$
-
-				ConnectorManager cm = createConnectorManger(connectorName, data.getMaxSize());
+				ConnectorManager cm = new ConnectorManager(connectorName, data.getMaxSize());
+				// start the connector manager
 				cm.start();
-				cmGroup.addConnectorManager(cm);
 
 				// Add the references to the mgr as loaded.
-	            this.connectorManagerRepository.addConnectorManager(connectorName, cm);      
+	            this.connectorManagerRepository.addConnectorManager(connectorName, cm);    
+	            cfGroup.addConnectionFactory(buildCF(data));
 	            
-	            connectorAdded(connectorName);
+	            this.vdbChecker.connectorAdded(connectorName);
 	            LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.getString("connector_started", connectorName)); //$NON-NLS-1$
 			}
-			else {
-				// check if data source is down
-			}
 		}
 		
-		if (!cmGroup.getConnectorManagers().isEmpty()) {
-			unit.addAttachment(ConnectorManagerGroup.class, cmGroup);
-		}
+		if (!cfGroup.getConnectionFactories().isEmpty()) {
+			unit.addAttachment(ConnectionFactoryMetadataGroup.class, cfGroup);
+		}		
 	}
-
-
-    ConnectorManager createConnectorManger(String deployedConnectorName, int maxThreads) {
-        ConnectorManager mgr = new ConnectorManager(deployedConnectorName, maxThreads);       
-        return mgr;
-    }
     
 	public void setConnectorManagerRepository(ConnectorManagerRepository repo) {
 		this.connectorManagerRepository = repo;
@@ -116,113 +114,93 @@
 					ConnectorManager cm = this.connectorManagerRepository.removeConnectorManager(connectorName);
 					if (cm != null) {
 						cm.stop();
+						this.vdbChecker.connectorRemoved(connectorName);
+						LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.getString("connector_stopped", connectorName)); //$NON-NLS-1$				
 					}
 				}
-				connectorRemoved(connectorName);
-				LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.getString("connector_stopped", connectorName)); //$NON-NLS-1$				
 			}
 		}
 	}
-
+	
 	@Override
-	public void build(DeploymentUnit unit, Set<String> attachmentNames, Map<String, ManagedObject> managedObjects)
-			throws DeploymentException {
+	public void build(DeploymentUnit unit, Set<String> outputs,Map<String, ManagedObject> managedObjects) throws DeploymentException {
+		ConnectionFactoryMetadataGroup group = unit.getAttachment(ConnectionFactoryMetadataGroup.class);
 		
-		ConnectorManagerGroup cmGroup = unit.removeAttachment(ConnectorManagerGroup.class);
-		if (cmGroup != null) {
-			for (ConnectorManager mgr:cmGroup.getConnectorManagers()) {
-				ManagedObject mo = this.mof.initManagedObject(mgr, ConnectorManager.class, mgr.getName(), mgr.getName());
-				if (mo == null) {
-					throw new DeploymentException("could not create managed object"); //$NON-NLS-1$
+		ManagedObject mcfdgMO = managedObjects.get(ManagedConnectionFactoryDeploymentGroup.class.getName());
+		if (mcfdgMO != null) {
+			ManagedProperty deployments = mcfdgMO.getProperty("deployments"); //$NON-NLS-1$
+			if (deployments.getMetaType().isCollection()) {
+				if (deployments.getValue() != null) {
+					MetaValue[] elements = ((CollectionValue)deployments.getValue()).getElements();
+					for (MetaValue element:elements) {
+						ManagedObject managed = (ManagedObject) ((GenericValue)element).getValue();
+						
+						ConnectionFactoryMetaData data = group.getConnectionFactory("teiid-cf/"+managed.getName()); //$NON-NLS-1$
+						populateConnectionFactory(data, managed);
+						if (data != null) {
+							ManagedObject mo = this.mof.initManagedObject(data, ConnectionFactory.class, data.getName(), data.getName());
+							if (mo == null) {
+								throw new DeploymentException("could not create managed object"); //$NON-NLS-1$
+							}
+							managedObjects.put(mo.getName(), mo);	
+						}
+					}
 				}
-				managedObjects.put(mo.getName(), mo);				
 			}
 		}
-	}
+	}	
 	
+
+
 	public void setManagedObjectFactory(ManagedObjectFactory mof) {
 		this.mof = mof;
-	}	
-	
-	public void setSecurityHelper(SecurityHelper securityHelper) {
-		this.securityHelper = securityHelper;
 	}
+		
+	public void setVDBStatusChecker(VDBStatusChecker vdbChecker) {
+		this.vdbChecker = vdbChecker;
+	}
 	
-	public void setVDBRepository(VDBRepository repo) {
-		this.vdbRepository = repo;
+	static ConnectionFactoryMetaData buildCF(ManagedConnectionFactoryDeploymentMetaData data) {
+		ConnectionFactoryMetaData c = new ConnectionFactoryMetaData();
+		// The name is prefixed here because, the Managed objects map overwrites this MO, with the main
+		// -ds.xml based MO, since they have same names.
+		c.setName("teiid-cf/"+data.getJndiName()); //$NON-NLS-1$
+		c.setRARFileName(data.getRarName());
+		c.setJNDIName("java:"+data.getJndiName()); //$NON-NLS-1$
+		
+		List<ManagedConnectionFactoryPropertyMetaData> props = data.getManagedConnectionFactoryProperties();
+		for (ManagedConnectionFactoryPropertyMetaData p:props) {
+			c.addProperty(p.getName(), p.getValue());
+		}
+		return c;
 	}
 	
-	public void connectorAdded(String connectorName) {
-		for (VDBMetaData vdb:this.vdbRepository.getVDBs()) {
-			if (vdb.getStatus() == VDB.Status.ACTIVE || vdb.isPreview()) {
-				continue;
-			}
+	private void populateConnectionFactory(ConnectionFactoryMetaData data, ManagedObject managed) {
+		Map<String, ManagedProperty> props = managed.getProperties();
+		
+		for (String key:props.keySet()) {
+			ManagedProperty mp = props.get(key);
 			
-			for (Model m:vdb.getModels()) {
-				ModelMetaData model = (ModelMetaData)m;
-				if (model.getErrors().isEmpty()) {
-					continue;
+			MetaValue value = mp.getValue();
+			if (value != null) {
+				MetaType type = value.getMetaType();
+				if (type.isSimple()) {
+					data.addProperty(mp.getName(), ManagedUtil.stringValue(value));
 				}
-
-				boolean inUse = false;
-				for (String sourceName:model.getSourceNames()) {
-					if (connectorName.equals(model.getSourceJndiName(sourceName))) {
-						inUse = true;
-					}
-				}
-					
-				if (inUse) {
-					model.clearErrors();
-					for (String sourceName:model.getSourceNames()) {
-						if (!connectorName.equals(model.getSourceJndiName(sourceName))) {
-							try {
-								InitialContext ic = new InitialContext();
-								ic.lookup(model.getSourceJndiName(sourceName));
-							} catch (NamingException e) {
-								String msg = IntegrationPlugin.Util.getString("jndi_not_found", vdb.getName(), vdb.getVersion(), model.getSourceJndiName(sourceName), sourceName); //$NON-NLS-1$
-								model.addError(ModelMetaData.ValidationError.Severity.ERROR.name(), msg);
-								LogManager.logInfo(LogConstants.CTX_RUNTIME, msg);
-							}								
+				else if (type.isComposite()) {
+					if (value instanceof MapCompositeValueSupport) {
+						MapCompositeValueSupport map = (MapCompositeValueSupport)value;
+						if (key.equals("config-property") || key.equals("connection-properties") || key.equals("xa-datasource-properties")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+							for (String subKey:map.getMetaType().keySet()) {
+								MetaValue subValue = map.get(subKey);
+								if (subValue.getMetaType().isSimple()) {
+									data.addProperty(subKey, ManagedUtil.stringValue(subValue));
+								}
+							}
 						}
-					}						
-				}
-			}
-
-			boolean valid = true;
-			for (Model m:vdb.getModels()) {
-				ModelMetaData model = (ModelMetaData)m;
-				if (!model.getErrors().isEmpty()) {
-					valid = false;
-					break;
-				}
-			}
-			
-			if (valid) {
-				vdb.setStatus(VDB.Status.ACTIVE);
-				LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.getString("vdb_activated",vdb.getName(), vdb.getVersion())); //$NON-NLS-1$
-			}
-			
-		}
-	}
-
-	public void connectorRemoved(String connectorName) {
-		for (VDBMetaData vdb:this.vdbRepository.getVDBs()) {
-			if (vdb.isPreview()) {
-				continue;
-			}
-			for (Model m:vdb.getModels()) {
-				ModelMetaData model = (ModelMetaData)m;
-				for (String sourceName:model.getSourceNames()) {
-					if (connectorName.equals(model.getSourceJndiName(sourceName))) {
-						vdb.setStatus(VDB.Status.INACTIVE);
-						String msg = IntegrationPlugin.Util.getString("jndi_not_found", vdb.getName(), vdb.getVersion(), model.getSourceJndiName(sourceName), sourceName); //$NON-NLS-1$
-						model.addError(ModelMetaData.ValidationError.Severity.ERROR.name(), msg);
-						LogManager.logInfo(LogConstants.CTX_RUNTIME, msg);					
-						LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.getString("vdb_inactivated",vdb.getName(), vdb.getVersion())); //$NON-NLS-1$							
 					}
 				}
 			}
 		}
-	}		
-	
+	}	
 }

Copied: trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/ConnectionFactoryMetadataGroup.java (from rev 2076, trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/ConnectorManagerGroup.java)
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/ConnectionFactoryMetadataGroup.java	                        (rev 0)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/ConnectionFactoryMetadataGroup.java	2010-04-27 22:25:00 UTC (rev 2084)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * 
+ * This library 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 library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.jboss.deployers;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.teiid.adminapi.impl.ConnectionFactoryMetaData;
+
+public class ConnectionFactoryMetadataGroup {
+	private List<ConnectionFactoryMetaData> mgrs = new ArrayList<ConnectionFactoryMetaData>();
+	
+	public void addConnectionFactory(ConnectionFactoryMetaData cm) {
+		this.mgrs.add(cm);
+	}
+	
+	public List<ConnectionFactoryMetaData> getConnectionFactories(){
+		return this.mgrs;
+	}
+	
+	public ConnectionFactoryMetaData getConnectionFactory(String name) {
+		for(ConnectionFactoryMetaData cf: this.mgrs) {
+			if (cf.getName().equals(name)) {
+				return cf;
+			}
+		}
+		return null;
+	}
+}

Deleted: trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/ConnectorManagerGroup.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/ConnectorManagerGroup.java	2010-04-27 17:56:40 UTC (rev 2083)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/ConnectorManagerGroup.java	2010-04-27 22:25:00 UTC (rev 2084)
@@ -1,40 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library 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 library 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 library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.jboss.deployers;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.teiid.dqp.internal.datamgr.impl.ConnectorManager;
-
-public class ConnectorManagerGroup {
-	private List<ConnectorManager> mgrs = new ArrayList<ConnectorManager>();
-	
-	public void addConnectorManager(ConnectorManager cm) {
-		this.mgrs.add(cm);
-	}
-	
-	public List<ConnectorManager> getConnectorManagers(){
-		return this.mgrs;
-	}
-}

Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java	2010-04-27 17:56:40 UTC (rev 2083)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java	2010-04-27 22:25:00 UTC (rev 2084)
@@ -314,7 +314,7 @@
 	}
 	
 	@Override
-	@ManagementOperation(description="Clear the caches in the system", impact=Impact.ReadOnly)
+	@ManagementOperation(description="Terminate the transaction", impact=Impact.ReadOnly)
 	public void terminateTransaction(String xid) throws AdminException {
 		this.dqpCore.terminateTransaction(xid);
 	}

Copied: trunk/jboss-integration/src/main/java/org/teiid/templates/connector/ConnectorDeploymentTemplate.java (from rev 2071, trunk/jboss-integration/src/main/java/org/teiid/templates/connector/ConnectorTypeTemplate.java)
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/templates/connector/ConnectorDeploymentTemplate.java	                        (rev 0)
+++ trunk/jboss-integration/src/main/java/org/teiid/templates/connector/ConnectorDeploymentTemplate.java	2010-04-27 22:25:00 UTC (rev 2084)
@@ -0,0 +1,176 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * 
+ * This library 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 library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.templates.connector;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.deployers.spi.management.DeploymentTemplate;
+import org.jboss.managed.api.DeploymentTemplateInfo;
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.metatype.api.values.SimpleValueSupport;
+import org.jboss.profileservice.spi.NoSuchDeploymentException;
+import org.jboss.virtual.VirtualFile;
+import org.teiid.adminapi.AdminComponentException;
+import org.teiid.adminapi.jboss.ManagedUtil;
+import org.teiid.connector.api.Connector;
+import org.teiid.jboss.IntegrationPlugin;
+
+/**
+ * The connection factory template implementation. Here the idea is "targetTemplate" is the actual template we store 
+ * the information under, which is the "connection factory" that container generates. However, we have got data 
+ * passed under Teiid owned template. Now this classe'ss JOB is to transfer the properties from the source template 
+ * into target template and write the target template.  
+ * 
+ * When the properties are written to target template, and source has a new property that is not defined in target, that
+ * property will be written as "config-property" 
+ */
+public class ConnectorDeploymentTemplate implements DeploymentTemplate {
+
+	/** The deployment template info. */
+	private DeploymentTemplateInfo info;
+	private DeploymentTemplate targetTemplate;
+  
+	/** The file suffix. */
+   private static final String FILE_SUFFIX = "-ds.xml";//$NON-NLS-1$	
+
+    
+	public String getDeploymentName(String deploymentBaseName) {
+		if (deploymentBaseName == null)
+			throw new IllegalArgumentException("Null base name.");//$NON-NLS-1$	
+		
+	    if(deploymentBaseName.endsWith(FILE_SUFFIX) == false)
+	        deploymentBaseName = deploymentBaseName + FILE_SUFFIX;
+	    
+		return deploymentBaseName;
+	}
+
+	public VirtualFile applyTemplate(DeploymentTemplateInfo sourceInfo) throws Exception {
+		try {
+			
+			DeploymentTemplateInfo targetInfo = this.targetTemplate.getInfo();
+
+			// override these properties always. 
+			targetInfo.getProperties().get("connection-definition").setValue(SimpleValueSupport.wrap(Connector.class.getName()));//$NON-NLS-1$	
+			targetInfo.getProperties().get("rar-name").setValue(SimpleValueSupport.wrap(((ConnectorTemplateInfo)getInfo()).getRarName()));//$NON-NLS-1$
+			
+			
+			//config-properties list
+			List<String> connectorPropNames = RaXmlPropertyConverter.getPropertyNames(((ConnectorTemplateInfo)getInfo()).getRarName());
+			Map<String, String> configProps = ConnectorDeploymentTemplate.propertiesAsMap(sourceInfo, connectorPropNames.toArray(new String[connectorPropNames.size()]), info.getName());		
+			configProps.put(ConnectorTemplateInfo.TEMPLATE_NAME, getInfo().getName());
+			
+			// template properties specific to the template
+			Map<String, ManagedProperty> propertyMap = targetInfo.getProperties();
+			
+			// walk through the supplied properties and assign properly to either template
+			// or config-properties.
+			for (String key:sourceInfo.getProperties().keySet()) {
+				ManagedProperty mp = propertyMap.get(key);
+								
+				if (mp != null) {
+					// property found in target, so just add as value
+					MetaValue value = sourceInfo.getProperties().get(key).getValue();
+					if (ManagedUtil.sameValue(mp.getDefaultValue(), value)) {
+						continue;
+					}		
+					
+					if (value != null) {
+						mp.setValue(value);
+					}
+				}
+				else {
+					// property not found in the target; add as "config-property"
+					mp = sourceInfo.getProperties().get(key);
+					if (ManagedUtil.sameValue(mp.getDefaultValue(), mp.getValue())) {
+						continue;
+					}	
+					
+					if (mp.getValue() != null) {
+						configProps.put(key, ManagedUtil.stringValue(mp.getValue()));
+						configProps.put(key+".type", mp.getValue().getMetaType().getClassName());//$NON-NLS-1$	
+					}
+				}
+			}
+			
+			if (configProps.size() > 0) {
+				MetaValue metaValue = ManagedUtil.compositeValueMap(configProps);
+				targetInfo.getProperties().get("config-property").setValue(metaValue);//$NON-NLS-1$					
+			}
+			return this.targetTemplate.applyTemplate(targetInfo);
+
+		} catch (NoSuchDeploymentException e) {
+			throw new AdminComponentException(e.getMessage(), e);
+		} catch(Exception e) {
+			throw new AdminComponentException(e.getMessage(), e);
+		}		
+	}
+
+	@Override
+	public DeploymentTemplateInfo getInfo() {
+		return info;
+	}
+
+	public void setInfo(DeploymentTemplateInfo info) {
+		this.info = info;
+	}
+	
+	public void setTargetTemplate(DeploymentTemplate target) {
+		this.targetTemplate = target;
+	}
+	
+	/**
+	 * Check to make sure supplied names are extracted from original list. If a mandatory property is missing fail
+	 * @param values
+	 * @param names
+	 * @param templateName
+	 * @return
+	 * @throws Exception
+	 */
+	static Map<String, String> propertiesAsMap(DeploymentTemplateInfo values, String[] names, String templateName) throws Exception {
+		Map<String, String> props = new HashMap<String, String>();
+		
+		Map<String, ManagedProperty> sourceProperties = values.getProperties();
+		
+		for (String name:names) {
+			ManagedProperty mp = sourceProperties.remove(name);
+			if (mp != null) {
+				if (mp.getValue() != null) {
+					props.put(name, ManagedUtil.stringValue(mp.getValue()));
+				}
+				else {
+					if (mp.isMandatory()) {
+						if( mp.getDefaultValue() != null) {
+							props.put(name, ManagedUtil.stringValue(mp.getDefaultValue()));
+						}
+						else {
+							throw new AdminComponentException(IntegrationPlugin.Util.getString("property_required_not_found", mp.getName(), templateName));//$NON-NLS-1$	
+						}
+					}
+				}
+			}
+		}
+		return props;
+	}	
+}


Property changes on: trunk/jboss-integration/src/main/java/org/teiid/templates/connector/ConnectorDeploymentTemplate.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Copied: trunk/jboss-integration/src/main/java/org/teiid/templates/connector/ConnectorTemplateInfo.java (from rev 2071, trunk/jboss-integration/src/main/java/org/teiid/templates/connector/ConnectorTypeTemplateInfo.java)
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/templates/connector/ConnectorTemplateInfo.java	                        (rev 0)
+++ trunk/jboss-integration/src/main/java/org/teiid/templates/connector/ConnectorTemplateInfo.java	2010-04-27 22:25:00 UTC (rev 2084)
@@ -0,0 +1,131 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * 
+ * This library 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 library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.templates.connector;
+
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.managed.api.Fields;
+import org.jboss.managed.api.ManagedComponent;
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.managed.plugins.BasicDeploymentTemplateInfo;
+import org.jboss.managed.plugins.DefaultFieldsImpl;
+import org.jboss.managed.plugins.ManagedPropertyImpl;
+import org.jboss.metatype.api.types.SimpleMetaType;
+import org.jboss.metatype.api.values.MapCompositeValueSupport;
+import org.jboss.metatype.api.values.SimpleValueSupport;
+import org.teiid.adminapi.jboss.ExtendedPropertyInfo;
+import org.teiid.connector.api.Connector;
+
+/**
+ * This class some magic in it. First off all through the configuration it extends the
+ * NoTxConnectionFactoryTemplate. Then using the JMX adds the properties defined inside a connector
+ * RAR file's ra.xml dynamically the above template. The RAR file name is supplied in the "description" 
+ * field of the configuration. Also, it uses the NoTxConnectionFactoryTemplate "applyTemplate" to write
+ * the custom properties that have been added thru JMX as "config-property" in the eventual "-ds.xml" file.
+ */
+public class ConnectorTemplateInfo extends BasicDeploymentTemplateInfo implements ExtendedPropertyInfo {
+	
+	private static final long serialVersionUID = 9066758787789280783L;
+	private String rarName;
+	static final String TEMPLATE_NAME = "template-name"; //$NON-NLS-1$
+	private static final String TEIID_PROPERTY = "teiid-property"; //$NON-NLS-1$
+	
+	
+	public ConnectorTemplateInfo(String name, String description, Map<String, ManagedProperty> properties) {
+		super(name, description, properties);
+	}
+
+	public void start() {
+		populate();
+	}
+
+	@Override
+	public ConnectorTemplateInfo copy() {
+		ConnectorTemplateInfo copy = new ConnectorTemplateInfo(getName(), getDescription(), getProperties());
+		copy.setRarName(getRarName());
+		super.copy(copy);
+		copy.populate();
+		
+		ManagedProperty mp = copy.getProperties().get("connection-definition");//$NON-NLS-1$
+		mp.setValue(SimpleValueSupport.wrap(Connector.class.getName())); 
+		
+		mp = copy.getProperties().get("rar-name");//$NON-NLS-1$	
+		mp.setValue(SimpleValueSupport.wrap(getRarName()));
+		return copy;
+	}
+	
+	private void populate() {
+		List<ManagedProperty> props = RaXmlPropertyConverter.getAsManagedProperties(getRarName());
+		for (ManagedProperty p:props) {
+			addProperty(p);
+		}
+		addProperty(buildTemplateProperty(getName()));
+	}
+	
+	public String getRarName() {
+		return rarName;
+	}
+
+	public void setRarName(String rarName) {
+		this.rarName = rarName;
+	}
+	
+	static ManagedProperty buildTemplateProperty(String name) {
+		ManagedProperty mp = buildProperty(TEMPLATE_NAME, SimpleMetaType.STRING, "Template Name", "The Name of the Teiid Connector Template", true, name);//$NON-NLS-1$ //$NON-NLS-2$
+		mp.setField(Fields.READ_ONLY, SimpleValueSupport.wrap(true));
+		return mp;
+	}	
+
+	static ManagedProperty buildProperty(String name, SimpleMetaType type, String displayName, String description, boolean mandatory, String value) {
+		DefaultFieldsImpl fields = new DefaultFieldsImpl(name);
+		fields.setDescription(description);
+		fields.setField(Fields.MAPPED_NAME,displayName);
+		fields.setMetaType(type);
+		fields.setField(Fields.MANDATORY, SimpleValueSupport.wrap(mandatory));
+		fields.setField(TEIID_PROPERTY, SimpleValueSupport.wrap(true));
+		if (value != null) {
+			fields.setField(Fields.DEFAULT_VALUE, SimpleValueSupport.wrap(value));
+		}
+		return  new ManagedPropertyImpl(fields);		
+	}	
+	
+	static void markAsTeiidProperty(ManagedProperty mp) {
+		mp.setField(TEIID_PROPERTY, SimpleValueSupport.wrap(true)); 
+	}
+	
+	@Override
+	public void updateProperty(String name, String value, ManagedComponent main) {
+		List<String> connectorNames = RaXmlPropertyConverter.getPropertyNames(getRarName());
+		if (connectorNames.contains(name)) {
+			updateManagedConnectionFactory(name, value, main);
+		}
+	}
+
+	static void updateManagedConnectionFactory(String name, String value, ManagedComponent mc) {
+		// Update the Container connection factory
+		MapCompositeValueSupport previousValues = (MapCompositeValueSupport)mc.getProperty("config-property").getValue(); //$NON-NLS-1$
+		if (previousValues != null) {
+			previousValues.put(name, SimpleValueSupport.wrap(value));
+		}
+	}
+}


Property changes on: trunk/jboss-integration/src/main/java/org/teiid/templates/connector/ConnectorTemplateInfo.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Deleted: trunk/jboss-integration/src/main/java/org/teiid/templates/connector/ConnectorTypeTemplate.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/templates/connector/ConnectorTypeTemplate.java	2010-04-27 17:56:40 UTC (rev 2083)
+++ trunk/jboss-integration/src/main/java/org/teiid/templates/connector/ConnectorTypeTemplate.java	2010-04-27 22:25:00 UTC (rev 2084)
@@ -1,146 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library 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 library 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 library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.templates.connector;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.jboss.deployers.spi.management.DeploymentTemplate;
-import org.jboss.managed.api.DeploymentTemplateInfo;
-import org.jboss.managed.api.ManagedProperty;
-import org.jboss.metatype.api.values.MetaValue;
-import org.jboss.metatype.api.values.SimpleValueSupport;
-import org.jboss.profileservice.spi.NoSuchDeploymentException;
-import org.jboss.virtual.VirtualFile;
-import org.teiid.adminapi.AdminComponentException;
-import org.teiid.adminapi.AdminProcessingException;
-import org.teiid.adminapi.jboss.ManagedUtil;
-
-/**
- * The connection factory template implementation. Here the idea is "targetTemplate" is the actual template we store 
- * the information under, which is the "connection factory" that container generates. However, we have got data 
- * passed under Teiid owned template. Now this classe'ss JOB is to transfer the properties from the source template 
- * into target template and write the target template.  
- * 
- * When the properties are written to target template, and source has a new property that is not defined in target, that
- * property will be written as "config-property" 
- */
-public class ConnectorTypeTemplate implements DeploymentTemplate {
-
-	/** The deployment template info. */
-	private DeploymentTemplateInfo info;
-	private DeploymentTemplate targetTemplate;
-  
-	/** The file suffix. */
-   private static final String FILE_SUFFIX = "-ds.xml";
-
-    
-	public String getDeploymentName(String deploymentBaseName) {
-		if (deploymentBaseName == null)
-			throw new IllegalArgumentException("Null base name.");
-		
-	    if(deploymentBaseName.endsWith(FILE_SUFFIX) == false)
-	        deploymentBaseName = deploymentBaseName + FILE_SUFFIX;
-	    
-		return deploymentBaseName;
-	}
-
-	public VirtualFile applyTemplate(DeploymentTemplateInfo sourceInfo) throws Exception {
-		try {
-			
-			ManagedProperty rar = sourceInfo.getProperties().get("rar-name");
-			String rarName = ManagedUtil.stringValue(rar.getValue());
-			if (!isValidRar(rarName)) {
-				throw new AdminProcessingException("Invalid RAR specified; please supply correct RAR file. "+rarName);
-			}
-			
-			DeploymentTemplateInfo targetInfo = this.targetTemplate.getInfo();
-
-			// override these properties always. 
-			targetInfo.getProperties().get("connection-definition").setValue(SimpleValueSupport.wrap("org.teiid.connector.api.Connector"));
-			
-			//config-properties list
-			Map<String, String> configProps = new HashMap<String, String>();
-			
-			// template properties specific to the template
-			Map<String, ManagedProperty> propertyMap = targetInfo.getProperties();
-			
-			// walk through the supplied properties and assign properly to either template
-			// or config-properties.
-			for (String key:sourceInfo.getProperties().keySet()) {
-				ManagedProperty mp = propertyMap.get(key);
-								
-				if (mp != null) {
-					// property found in target, so just add as value
-					MetaValue value = sourceInfo.getProperties().get(key).getValue();
-					if (ManagedUtil.sameValue(mp.getDefaultValue(), value)) {
-						continue;
-					}		
-					
-					if (value != null) {
-						mp.setValue(value);
-					}
-				}
-				else {
-					// property not found in the target; add as "config-property"
-					mp = sourceInfo.getProperties().get(key);
-					if (ManagedUtil.sameValue(mp.getDefaultValue(), mp.getValue())) {
-						continue;
-					}	
-					
-					if (mp.getValue() != null) {
-						configProps.put(key, ManagedUtil.stringValue(mp.getValue()));
-						configProps.put(key+".type", mp.getValue().getMetaType().getClassName());
-					}
-				}
-			}
-			
-			if (configProps.size() > 0) {
-				MetaValue metaValue = ManagedUtil.compositeValueMap(configProps);
-				targetInfo.getProperties().get("config-property").setValue(metaValue);				
-			}
-			return this.targetTemplate.applyTemplate(targetInfo);
-
-		} catch (NoSuchDeploymentException e) {
-			throw new AdminComponentException(e.getMessage(), e);
-		} catch(Exception e) {
-			throw new AdminComponentException(e.getMessage(), e);
-		}		
-	}
-
-	private boolean isValidRar(String rarName) {
-		return rarName != null;
-	}
-		
-	@Override
-	public DeploymentTemplateInfo getInfo() {
-		return info;
-	}
-
-	public void setInfo(DeploymentTemplateInfo info) {
-		this.info = info;
-	}
-	
-	public void setTargetTemplate(DeploymentTemplate target) {
-		this.targetTemplate = target;
-	}
-}

Deleted: trunk/jboss-integration/src/main/java/org/teiid/templates/connector/ConnectorTypeTemplateInfo.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/templates/connector/ConnectorTypeTemplateInfo.java	2010-04-27 17:56:40 UTC (rev 2083)
+++ trunk/jboss-integration/src/main/java/org/teiid/templates/connector/ConnectorTypeTemplateInfo.java	2010-04-27 22:25:00 UTC (rev 2084)
@@ -1,138 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library 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 library 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 library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.templates.connector;
-
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Map;
-
-import javax.management.AttributeNotFoundException;
-import javax.management.InstanceNotFoundException;
-import javax.management.MBeanException;
-import javax.management.MBeanServer;
-import javax.management.MBeanServerFactory;
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-import javax.management.ReflectionException;
-
-import org.jboss.managed.api.Fields;
-import org.jboss.managed.api.ManagedProperty;
-import org.jboss.managed.plugins.BasicDeploymentTemplateInfo;
-import org.jboss.managed.plugins.DefaultFieldsImpl;
-import org.jboss.managed.plugins.ManagedPropertyImpl;
-import org.jboss.metatype.api.types.SimpleMetaType;
-import org.jboss.metatype.api.values.MetaValue;
-import org.jboss.resource.metadata.ConfigPropertyMetaData;
-import org.jboss.resource.metadata.ConnectionDefinitionMetaData;
-import org.jboss.resource.metadata.ConnectorMetaData;
-import org.jboss.resource.metadata.DescriptionMetaData;
-import org.teiid.adminapi.jboss.ManagedUtil;
-
-/**
- * This class some magic in it. First off all through the configuration it extends the
- * NoTxConnectionFactoryTemplate. Then using the JMX adds the properties defined inside a connector
- * RAR file's ra.xml dynamically the above template. The RAR file name is supplied in the "description" 
- * field of the configuration. Also, it uses the NoTxConnectionFactoryTemplate "applyTemplate" to write
- * the custom properties that have been added thru JMX as "config-property" in the eventual "-ds.xml" file.
- */
-public class ConnectorTypeTemplateInfo extends BasicDeploymentTemplateInfo {
-
-	private static final long serialVersionUID = 9066758787789280783L;
-
-	public ConnectorTypeTemplateInfo(String arg0, String arg1, Map<String, ManagedProperty> arg2) {
-		super(arg0, arg1, arg2);
-	}
-
-	public void start() {
-		populate();
-	}
-
-	@Override
-	public ConnectorTypeTemplateInfo copy() {
-		ConnectorTypeTemplateInfo copy = new ConnectorTypeTemplateInfo(getName(), getDescription(), getProperties());
-		super.copy(copy);
-		copy.populate();
-		return copy;
-	}
-	
-	
-	private void populate() {
-		try {
-			MBeanServer server = MBeanServerFactory.findMBeanServer(null).get(0);
-			ObjectName on = new ObjectName("jboss.jca:service=RARDeployment,name='"+getName()+".rar'");
-			ConnectorMetaData obj = (ConnectorMetaData)server.getAttribute(on, "MetaData");
-			ConnectionDefinitionMetaData metadata = obj.getConnectionDefinition("org.teiid.connector.api.Connector");
-			Collection<ConfigPropertyMetaData> props = metadata.getProperties();
-			for (ConfigPropertyMetaData p:props) {
-				addConnectorProperty(p);
-			}
-		} catch (MalformedObjectNameException e) {
-			//ignore
-		} catch (AttributeNotFoundException e) {
-			//ignore
-		} catch (InstanceNotFoundException e) {
-			//ignore
-		} catch (MBeanException e) {
-			//ignore
-		} catch (ReflectionException e) {
-			//ignore
-		}		
-	}
-
-	private void addConnectorProperty(ConfigPropertyMetaData metadata) {
-		SimpleMetaType metaType = SimpleMetaType.resolve(metadata.getType());
-		
-		DefaultFieldsImpl fields = new DefaultFieldsImpl(metadata.getName());
-		DescriptionMetaData descMetadata = metadata.getDescription();
-		String description = descMetadata.getDescription();
-		if (description != null) {
-			ExtendedPropertyMetadata extended = new ExtendedPropertyMetadata(description);
-			if (extended.getDescription() != null) {
-				fields.setDescription(description);
-			}
-			
-			if (extended.getDisplayName() != null) {
-				fields.setField(Fields.MAPPED_NAME, extended.getDisplayName());
-			}
-			
-			if (extended.getAllowed() != null) {
-				HashSet<MetaValue> values = new HashSet<MetaValue>();
-				for (String value:extended.getAllowed()) {
-					values.add(ManagedUtil.wrap(SimpleMetaType.STRING, value));
-				}
-				fields.setField(Fields.LEGAL_VALUES, values);
-			}
-			fields.setField(Fields.MANDATORY, ManagedUtil.wrap(SimpleMetaType.BOOLEAN_PRIMITIVE, String.valueOf(extended.isRequired())));
-			fields.setField(Fields.READ_ONLY,  ManagedUtil.wrap(SimpleMetaType.BOOLEAN_PRIMITIVE, String.valueOf(!extended.isEditable())));
-			fields.setField("advanced",  ManagedUtil.wrap(SimpleMetaType.BOOLEAN_PRIMITIVE, String.valueOf(extended.isAdvanced())));
-			fields.setField("masked",  ManagedUtil.wrap(SimpleMetaType.BOOLEAN_PRIMITIVE, String.valueOf(extended.isMasked())));
-		}
-		
-		fields.setMetaType(metaType);		
-		if (metadata.getValue() != null && metadata.getValue().trim().length() > 0) {
-			fields.setField(Fields.DEFAULT_VALUE, ManagedUtil.wrap(metaType, metadata.getValue()));
-		}
-		
-		ManagedPropertyImpl dsTypeMP = new ManagedPropertyImpl(fields);
-		addProperty(dsTypeMP);
-	}
-}

Added: trunk/jboss-integration/src/main/java/org/teiid/templates/connector/RaXmlPropertyConverter.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/templates/connector/RaXmlPropertyConverter.java	                        (rev 0)
+++ trunk/jboss-integration/src/main/java/org/teiid/templates/connector/RaXmlPropertyConverter.java	2010-04-27 22:25:00 UTC (rev 2084)
@@ -0,0 +1,137 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * 
+ * This library 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 library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.templates.connector;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+
+import javax.management.AttributeNotFoundException;
+import javax.management.InstanceNotFoundException;
+import javax.management.MBeanException;
+import javax.management.MBeanServer;
+import javax.management.MBeanServerFactory;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import javax.management.ReflectionException;
+
+import org.jboss.managed.api.Fields;
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.managed.plugins.DefaultFieldsImpl;
+import org.jboss.managed.plugins.ManagedPropertyImpl;
+import org.jboss.metatype.api.types.SimpleMetaType;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.metatype.api.values.SimpleValueSupport;
+import org.jboss.resource.metadata.ConfigPropertyMetaData;
+import org.jboss.resource.metadata.ConnectionDefinitionMetaData;
+import org.jboss.resource.metadata.ConnectorMetaData;
+import org.jboss.resource.metadata.DescriptionMetaData;
+import org.teiid.adminapi.jboss.ManagedUtil;
+import org.teiid.connector.api.Connector;
+
+public class RaXmlPropertyConverter {
+
+	
+	public static List<String> getPropertyNames(String rarName){
+		ArrayList<String> names = new ArrayList<String>();
+		Collection<ConfigPropertyMetaData> props = getRarProperties(rarName);
+		if (props != null) {
+			for (ConfigPropertyMetaData p:props) {
+				names.add(p.getName());
+			}
+		}
+		return names;
+	}
+	
+	public static List<ManagedProperty> getAsManagedProperties(String rarName){
+		ArrayList<ManagedProperty> managedProperties = new ArrayList<ManagedProperty>();
+		Collection<ConfigPropertyMetaData> props = getRarProperties(rarName);
+		if (props != null) {
+			for (ConfigPropertyMetaData p:props) {
+				managedProperties.add(createConnectorProperty(p));
+			}
+		}
+		return managedProperties;
+	}
+	
+	
+	private static Collection<ConfigPropertyMetaData> getRarProperties(String rarName){
+		try {
+			MBeanServer server = MBeanServerFactory.findMBeanServer(null).get(0);
+			ObjectName on = new ObjectName("jboss.jca:service=RARDeployment,name='"+rarName+"'");//$NON-NLS-1$	//$NON-NLS-2$	
+			ConnectorMetaData obj = (ConnectorMetaData)server.getAttribute(on, "MetaData");//$NON-NLS-1$	
+			ConnectionDefinitionMetaData metadata = obj.getConnectionDefinition(Connector.class.getName());
+			return metadata.getProperties();
+		} catch (MalformedObjectNameException e) {
+			//ignore
+		} catch (AttributeNotFoundException e) {
+			//ignore
+		} catch (InstanceNotFoundException e) {
+			//ignore
+		} catch (MBeanException e) {
+			//ignore
+		} catch (ReflectionException e) {
+			//ignore
+		}		
+		return null;
+	}
+	
+	private static ManagedProperty createConnectorProperty(ConfigPropertyMetaData metadata) {
+		SimpleMetaType metaType = SimpleMetaType.resolve(metadata.getType());
+		
+		DefaultFieldsImpl fields = new DefaultFieldsImpl(metadata.getName());
+		DescriptionMetaData descMetadata = metadata.getDescription();
+		String description = descMetadata.getDescription();
+		if (description != null) {
+			ExtendedPropertyMetadata extended = new ExtendedPropertyMetadata(description);
+			if (extended.getDescription() != null) {
+				fields.setDescription(description);
+			}
+			
+			if (extended.getDisplayName() != null) {
+				fields.setField(Fields.MAPPED_NAME, extended.getDisplayName());
+			}
+			
+			if (extended.getAllowed() != null) {
+				HashSet<MetaValue> values = new HashSet<MetaValue>();
+				for (String value:extended.getAllowed()) {
+					values.add(ManagedUtil.wrap(SimpleMetaType.STRING, value));
+				}
+				fields.setField(Fields.LEGAL_VALUES, values);
+			}
+			fields.setField(Fields.MANDATORY, ManagedUtil.wrap(SimpleMetaType.BOOLEAN_PRIMITIVE, String.valueOf(extended.isRequired())));
+			fields.setField(Fields.READ_ONLY,  ManagedUtil.wrap(SimpleMetaType.BOOLEAN_PRIMITIVE, String.valueOf(!extended.isEditable())));
+			fields.setField("advanced",  ManagedUtil.wrap(SimpleMetaType.BOOLEAN_PRIMITIVE, String.valueOf(extended.isAdvanced())));//$NON-NLS-1$	
+			fields.setField("masked",  ManagedUtil.wrap(SimpleMetaType.BOOLEAN_PRIMITIVE, String.valueOf(extended.isMasked())));//$NON-NLS-1$
+			fields.setField("teiid-property", SimpleValueSupport.wrap(true)); //$NON-NLS-1$
+		}
+		
+		fields.setMetaType(metaType);		
+		if (metadata.getValue() != null && metadata.getValue().trim().length() > 0) {
+			fields.setField(Fields.DEFAULT_VALUE, ManagedUtil.wrap(metaType, metadata.getValue()));
+		}
+		
+		ManagedPropertyImpl dsTypeMP = new ManagedPropertyImpl(fields);
+		return dsTypeMP;
+	}	
+}


Property changes on: trunk/jboss-integration/src/main/java/org/teiid/templates/connector/RaXmlPropertyConverter.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: trunk/jboss-integration/src/main/java/org/teiid/templates/connector/XaJdbcConnectorTemplate.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/templates/connector/XaJdbcConnectorTemplate.java	                        (rev 0)
+++ trunk/jboss-integration/src/main/java/org/teiid/templates/connector/XaJdbcConnectorTemplate.java	2010-04-27 22:25:00 UTC (rev 2084)
@@ -0,0 +1,63 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * 
+ * This library 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 library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.templates.connector;
+
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.managed.api.DeploymentTemplateInfo;
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.virtual.VirtualFile;
+import org.teiid.adminapi.jboss.ManagedUtil;
+
+
+
+public class XaJdbcConnectorTemplate extends org.jboss.resource.deployers.management.DsDataSourceTemplate {
+
+	private static final long serialVersionUID = 1607932913015949359L;
+
+	@Override
+	public VirtualFile applyTemplate(DeploymentTemplateInfo values) throws Exception {
+		
+		XaJdbcConnectorTemplateInfo info = (XaJdbcConnectorTemplateInfo)getInfo();
+		
+		// combine connection factory specific properties.
+		List<String> connectorPropNames = RaXmlPropertyConverter.getPropertyNames(info.getRarName());
+		Map<String, String> props = ConnectorDeploymentTemplate.propertiesAsMap(values, connectorPropNames.toArray(new String[connectorPropNames.size()]), info.getName());
+		props.put(ConnectorTemplateInfo.TEMPLATE_NAME, getInfo().getName());
+		values.getProperties().get("config-property").setValue(ManagedUtil.compositeValueMap(props));//$NON-NLS-1$	
+		
+		// combine data source specific properties
+		props = ConnectorDeploymentTemplate.propertiesAsMap(values, XaJdbcConnectorTemplateInfo.EXTENDED_DS_PROPERTIES, info.getName());
+		
+		ManagedProperty mp = values.getProperties().remove(XaJdbcConnectorTemplateInfo.ADDITIONAL_DS_PROPS);
+		if (mp != null && mp.getValue() != null) {
+			XaJdbcConnectorTemplateInfo.parseProperties(ManagedUtil.stringValue(mp.getValue()), props);
+		}
+		
+		values.getProperties().get("xa-datasource-properties").setValue(ManagedUtil.compositeValueMap(props));//$NON-NLS-1$
+	      
+		return super.applyTemplate(values);
+	}
+	
+
+}


Property changes on: trunk/jboss-integration/src/main/java/org/teiid/templates/connector/XaJdbcConnectorTemplate.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: trunk/jboss-integration/src/main/java/org/teiid/templates/connector/XaJdbcConnectorTemplateInfo.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/templates/connector/XaJdbcConnectorTemplateInfo.java	                        (rev 0)
+++ trunk/jboss-integration/src/main/java/org/teiid/templates/connector/XaJdbcConnectorTemplateInfo.java	2010-04-27 22:25:00 UTC (rev 2084)
@@ -0,0 +1,155 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * 
+ * This library 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 library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.templates.connector;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+import org.jboss.managed.api.ManagedComponent;
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.managed.plugins.DefaultFieldsImpl;
+import org.jboss.managed.plugins.ManagedPropertyImpl;
+import org.jboss.metatype.api.types.MapCompositeMetaType;
+import org.jboss.metatype.api.types.SimpleMetaType;
+import org.jboss.metatype.api.values.MapCompositeValueSupport;
+import org.jboss.metatype.api.values.SimpleValueSupport;
+import org.jboss.resource.deployers.management.DsDataSourceTemplateInfo;
+import org.teiid.adminapi.jboss.ExtendedPropertyInfo;
+import org.teiid.adminapi.jboss.ManagedUtil;
+
+/**
+ * This template is specific to XA data source combined with Teiid's JDBC connector.
+ */
+public class XaJdbcConnectorTemplateInfo extends DsDataSourceTemplateInfo implements ExtendedPropertyInfo {
+	
+	private static final long serialVersionUID = 9066758787789280783L;
+	static final String SERVER_NAME = "ServerName";//$NON-NLS-1$	
+	static final String PORT_NUMBER = "PortNumber";//$NON-NLS-1$	
+	static final String DATABASE_NAME = "DatabaseName";//$NON-NLS-1$
+	static final String ADDITIONAL_DS_PROPS = "addtional-ds-properties";//$NON-NLS-1$
+	
+	static final String[] EXTENDED_DS_PROPERTIES = {SERVER_NAME, PORT_NUMBER,DATABASE_NAME};
+	
+	private String rarName;
+	
+	public XaJdbcConnectorTemplateInfo(String name, String description, Map<String, ManagedProperty> properties) {
+		super(name, description, properties);
+	}
+
+	public void start() {
+		populate();
+	}
+
+	@Override
+	public XaJdbcConnectorTemplateInfo copy() {
+		XaJdbcConnectorTemplateInfo copy = new XaJdbcConnectorTemplateInfo(getName(), getDescription(), getProperties());
+		copy.setRarName(getRarName());
+		super.copy(copy);
+		copy.populate();
+		return copy;
+	}
+	
+	private void populate() {
+		super.start();
+		List<ManagedProperty> props = RaXmlPropertyConverter.getAsManagedProperties(getRarName());
+		for (ManagedProperty p:props) {
+			addProperty(p);
+		}
+
+		ManagedProperty mp = this.getProperties().get("connection-definition");//$NON-NLS-1$	
+		mp.setValue(ManagedUtil.wrap(SimpleMetaType.STRING, "javax.sql.DataSource"));//$NON-NLS-1$	
+
+		mp = this.getProperties().get("dsType");//$NON-NLS-1$	
+		mp.setValue(ManagedUtil.wrap(SimpleMetaType.STRING, "xa-datasource"));//$NON-NLS-1$	
+		
+		
+		ManagedPropertyImpl dsTypeMP = buildConfigProperty();
+		addProperty(dsTypeMP);
+		
+		addProperty(ConnectorTemplateInfo.buildTemplateProperty(getName()));
+		
+		ConnectorTemplateInfo.markAsTeiidProperty(this.getProperties().get("user-name")); //$NON-NLS-1$
+		ConnectorTemplateInfo.markAsTeiidProperty(this.getProperties().get("password"));//$NON-NLS-1$
+		addProperty(ConnectorTemplateInfo.buildProperty(DATABASE_NAME, SimpleMetaType.STRING,"Database Name","Database Name", false, null));//$NON-NLS-1$ //$NON-NLS-2$
+		addProperty(ConnectorTemplateInfo.buildProperty(PORT_NUMBER, SimpleMetaType.INTEGER,"Database Port", "Database Port",false, null));//$NON-NLS-1$ //$NON-NLS-2$	
+		addProperty(ConnectorTemplateInfo.buildProperty(SERVER_NAME, SimpleMetaType.STRING,"Database Server Name", "Database Server Name", false, null));//$NON-NLS-1$ //$NON-NLS-2$
+		addProperty(ConnectorTemplateInfo.buildProperty(ADDITIONAL_DS_PROPS, SimpleMetaType.STRING,"Addtional Data Source Properties", "Addtional Data source properties. (comma separated name value pairs)", false, null));//$NON-NLS-1$ //$NON-NLS-2$
+	}
+
+	static ManagedPropertyImpl buildConfigProperty() {
+		DefaultFieldsImpl fields = new DefaultFieldsImpl("config-property");//$NON-NLS-1$	
+		fields.setDescription("The config-property type"); //$NON-NLS-1$	
+		fields.setMetaType(new MapCompositeMetaType (SimpleMetaType.STRING));
+		ManagedPropertyImpl dsTypeMP = new ManagedPropertyImpl(fields);
+		return dsTypeMP;
+	}
+	
+	
+	public String getRarName() {
+		return rarName;
+	}
+
+	public void setRarName(String rarName) {
+		this.rarName = rarName;
+	}
+
+	@Override
+	public void updateProperty(String name, String value, ManagedComponent main) {
+		List<String> connectorNames = RaXmlPropertyConverter.getPropertyNames(getRarName());
+		if (connectorNames.contains(name)) {
+			ConnectorTemplateInfo.updateManagedConnectionFactory(name, value, main);
+			//ConnectorTemplateInfo.updateConnectionFactory(name, value, cf);			
+		}
+		else if (name.equals(DATABASE_NAME)||name.equals(PORT_NUMBER)||name.equals(SERVER_NAME)||name.equals(ADDITIONAL_DS_PROPS)) {
+			Map<String, String> map = new HashMap<String, String>();
+			
+			if (name.equals(ADDITIONAL_DS_PROPS)) {
+				parseProperties(value, map);
+			}
+			else {
+				map.put(name, value);
+			}
+			
+			// update the container managed object.
+			MapCompositeValueSupport previousValues = (MapCompositeValueSupport)main.getProperty("xa-datasource-properties").getValue(); //$NON-NLS-1$
+			if (previousValues != null) {
+				for (String key:map.keySet()) {
+					previousValues.put(key, SimpleValueSupport.wrap(map.get(key)));
+				}
+			}
+		}
+	}
+	
+	static void parseProperties(String str, Map<String, String> props) {
+		str = str.trim();
+		StringTokenizer st = new StringTokenizer(str, ",");  //$NON-NLS-1$
+		while (st.hasMoreTokens()) {
+			String property = st.nextToken();
+			int index = property.indexOf('=');
+			if (index != -1 && property.length() > (index+1)) {
+				props.put(property.substring(0, index).trim(), property.substring(index+1).trim());
+			}
+		}
+	}	
+}


Property changes on: trunk/jboss-integration/src/main/java/org/teiid/templates/connector/XaJdbcConnectorTemplateInfo.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: trunk/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties
===================================================================
--- trunk/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties	2010-04-27 17:56:40 UTC (rev 2083)
+++ trunk/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties	2010-04-27 22:25:00 UTC (rev 2084)
@@ -26,7 +26,7 @@
 engine_stopped=Teiid Engine stopped {0}
 admin_connection_closed=Teiid admin connection is already closed.
 connector_binding_exists=Connection factory with name "{0}" already exists.
-failed_to_connector_deployer=Failed to find deployer name of the connector. Can not start!
+failed_to_find_connector=Failed to find connector {0}. Can not start!
 failed_to_start_connector=Failed to start Connection factory = {0}
 failed_to_stop_connector=Failed to start Connection factory = {0}
 bad_vdb_extension=The extension of the file name must be either ".vdb" for designer vdb or "xxx-vdb.xml" for dynamic VDBs
@@ -39,15 +39,15 @@
 connectionfactory_not_found=Connection factory {0} not found in the configuration.
 datasource_not_found=Datasource {0} not found in the configuration.
 connector_not_found=Connector {0} not found in the configuration.
-
 sourcename_not_found=No source name {0} found in the model: {1}.{2}.{3}
 connector_started= Teiid connector {0} started
 connector_stopped=Teiid connector {0} stopped
-vdb_activated={0}.{1} status has been changed to active
-vdb_inactivated={0}.{1} status has been changed to inactive. Check the connector mappings!
-jndi_not_found=For {0}.{1} VDB, JNDI resource "{2}" not found for Source Name "{3}"
+
 no_operation=No operation found with given name = {0}
 failed_to_remove=Failed to remove the deployment
 distibute_failed={0} distribute failed.
 deployment_start_failed={0} deployment start failed
-failed_to_convert=Failed to convert from String value to {0} type
\ No newline at end of file
+failed_to_convert=Failed to convert from String value to {0} type
+property_required_not_found="{0}" is required for the connector type "{1}", but was not supplied; There is no default value either.
+invalid_class={0} invalid type of class specified. Must be of type org.teiid.connector.api.ConnectorEnvironment
+class_not_found=Class {0} not found.
\ No newline at end of file

Added: trunk/runtime/src/main/java/org/teiid/deployers/VDBStatusChecker.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/VDBStatusChecker.java	                        (rev 0)
+++ trunk/runtime/src/main/java/org/teiid/deployers/VDBStatusChecker.java	2010-04-27 22:25:00 UTC (rev 2084)
@@ -0,0 +1,115 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * 
+ * This library 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 library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.deployers;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.teiid.adminapi.Model;
+import org.teiid.adminapi.VDB;
+import org.teiid.adminapi.impl.ModelMetaData;
+import org.teiid.adminapi.impl.VDBMetaData;
+import org.teiid.runtime.RuntimePlugin;
+
+import com.metamatrix.common.log.LogConstants;
+import com.metamatrix.common.log.LogManager;
+
+public class VDBStatusChecker {
+	private VDBRepository vdbRepository;
+	
+	public void connectorAdded(String connectorName) {
+		for (VDBMetaData vdb:this.vdbRepository.getVDBs()) {
+			if (vdb.getStatus() == VDB.Status.ACTIVE || vdb.isPreview()) {
+				continue;
+			}
+			
+			for (Model m:vdb.getModels()) {
+				ModelMetaData model = (ModelMetaData)m;
+				if (model.getErrors().isEmpty()) {
+					continue;
+				}
+
+				boolean inUse = false;
+				for (String sourceName:model.getSourceNames()) {
+					if (connectorName.equals(model.getSourceJndiName(sourceName))) {
+						inUse = true;
+					}
+				}
+					
+				if (inUse) {
+					model.clearErrors();
+					for (String sourceName:model.getSourceNames()) {
+						if (!connectorName.equals(model.getSourceJndiName(sourceName))) {
+							try {
+								InitialContext ic = new InitialContext();
+								ic.lookup(model.getSourceJndiName(sourceName));
+							} catch (NamingException e) {
+								String msg = RuntimePlugin.Util.getString("jndi_not_found", vdb.getName(), vdb.getVersion(), model.getSourceJndiName(sourceName), sourceName); //$NON-NLS-1$
+								model.addError(ModelMetaData.ValidationError.Severity.ERROR.name(), msg);
+								LogManager.logInfo(LogConstants.CTX_RUNTIME, msg);
+							}								
+						}
+					}						
+				}
+			}
+
+			boolean valid = true;
+			for (Model m:vdb.getModels()) {
+				ModelMetaData model = (ModelMetaData)m;
+				if (!model.getErrors().isEmpty()) {
+					valid = false;
+					break;
+				}
+			}
+			
+			if (valid) {
+				vdb.setStatus(VDB.Status.ACTIVE);
+				LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("vdb_activated",vdb.getName(), vdb.getVersion())); //$NON-NLS-1$
+			}
+			
+		}
+	}
+
+	public void connectorRemoved(String connectorName) {
+		for (VDBMetaData vdb:this.vdbRepository.getVDBs()) {
+			if (vdb.isPreview()) {
+				continue;
+			}
+			for (Model m:vdb.getModels()) {
+				ModelMetaData model = (ModelMetaData)m;
+				for (String sourceName:model.getSourceNames()) {
+					if (connectorName.equals(model.getSourceJndiName(sourceName))) {
+						vdb.setStatus(VDB.Status.INACTIVE);
+						String msg = RuntimePlugin.Util.getString("jndi_not_found", vdb.getName(), vdb.getVersion(), model.getSourceJndiName(sourceName), sourceName); //$NON-NLS-1$
+						model.addError(ModelMetaData.ValidationError.Severity.ERROR.name(), msg);
+						LogManager.logInfo(LogConstants.CTX_RUNTIME, msg);					
+						LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("vdb_inactivated",vdb.getName(), vdb.getVersion())); //$NON-NLS-1$							
+					}
+				}
+			}
+		}
+	}
+	
+	public void setVDBRepository(VDBRepository repo) {
+		this.vdbRepository = repo;
+	}	
+}


Property changes on: trunk/runtime/src/main/java/org/teiid/deployers/VDBStatusChecker.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: trunk/runtime/src/main/resources/org/teiid/runtime/i18n.properties
===================================================================
--- trunk/runtime/src/main/resources/org/teiid/runtime/i18n.properties	2010-04-27 17:56:40 UTC (rev 2083)
+++ trunk/runtime/src/main/resources/org/teiid/runtime/i18n.properties	2010-04-27 22:25:00 UTC (rev 2084)
@@ -294,4 +294,7 @@
 failed_to_deployed=Failed to deploy {0}
 invalid_udf_file=No "path" information found to load the FUNCTION model {0}; FUNCTION model must have path information.
 failed_matadata_load=Failed to load metadata for VDB {0}.{1}
-vdb_not_found=VDB {0}.{1} not found deployed.
\ No newline at end of file
+vdb_not_found=VDB {0}.{1} not found deployed.
+jndi_not_found=For {0}.{1} VDB, JNDI resource "{2}" not found for Source Name "{3}"
+vdb_activated={0}.{1} status has been changed to active
+vdb_inactivated={0}.{1} status has been changed to inactive. Check the connector mappings!

Modified: trunk/test-integration/db/src/test/java/org/teiid/adminapi/jboss/TestConnectorBindings.java
===================================================================
--- trunk/test-integration/db/src/test/java/org/teiid/adminapi/jboss/TestConnectorBindings.java	2010-04-27 17:56:40 UTC (rev 2083)
+++ trunk/test-integration/db/src/test/java/org/teiid/adminapi/jboss/TestConnectorBindings.java	2010-04-27 22:25:00 UTC (rev 2084)
@@ -70,7 +70,44 @@
 		admin.close();
 	}
 
-	@Test public void testConnectorBinding() throws Exception {
+	@Test public void testLoopbackConnectorBinding() throws Exception {
+		ConnectionFactory binding = admin.getConnectionFactory("loopy"); //$NON-NLS-1$
+		
+		if (binding != null) {
+			admin.deleteConnectionFactory("loopy"); //$NON-NLS-1$
+		}
+		
+		Properties p = new Properties();
+		p.setProperty("jndi-name", "loopy"); //$NON-NLS-1$ //$NON-NLS-2$
+		p.setProperty("CapabilitiesClass", "org.teiid.connector.jdbc.loopback.LoopbackCapabilities"); //$NON-NLS-1$ //$NON-NLS-2$
+
+		ConnectionFactory cf = admin.addConnectionFactory("loopy","connector-loopback-7.0.0-SNAPSHOT", p);	 //$NON-NLS-1$ //$NON-NLS-2$
+		System.out.println(cf.getProperties());
+		
+//		admin.setConnectionFactoryProperty("loopy", "CapabilitiesClass", "org.teiid.connector.BasicCapabilities");
+//		cf = admin.getConnectionFactory("loopy");
+//		System.out.println(cf.getProperties());
+	}
+	
+	@Test public void testLoopbackUpdate() throws Exception {
+		ConnectionFactory cf = admin.getConnectionFactory("loopy"); //$NON-NLS-1$
+		System.out.println(cf.getProperties());
+		
+		admin.setConnectionFactoryProperty("loopy", "CapabilitiesClass", "org.teiid.connector.LoopyCapabilities");
+		cf = admin.getConnectionFactory("loopy");
+		System.out.println(cf.getProperties());
+	}	
+	
+	@Test public void testGetConnectorFactories() throws Exception {
+		Collection<ConnectionFactory> cfs = admin.getConnectionFactories();
+		for(ConnectionFactory cf:cfs) {
+			System.out.println(cf.getName());
+		}
+		ConnectionFactory cf = admin.getConnectionFactory("products-cf"); //$NON-NLS-1$
+		System.out.println(cf.getName());
+	}
+	
+	@Test public void testDSConnectorBinding() throws Exception {
 		ConnectionFactory binding = admin.getConnectionFactory("test-mysql-cb"); //$NON-NLS-1$
 		
 		if (binding != null) {
@@ -79,33 +116,40 @@
 		
 		Properties p = new Properties();
 		p.setProperty("jndi-name", "test-mysql-cb"); //$NON-NLS-1$ //$NON-NLS-2$
-		p.setProperty("rar-name", "connector-jdbc-7.0.0-SNAPSHOT.rar"); //$NON-NLS-1$ //$NON-NLS-2$
-		p.setProperty("CapabilitiesClass", "org.teiid.connector.jdbc.derby.DerbyCapabilities"); //$NON-NLS-1$ //$NON-NLS-2$
+		p.setProperty("CapabilitiesClass", "org.teiid.connector.jdbc.mysql.MySQL5Capabilities"); //$NON-NLS-1$ //$NON-NLS-2$
 		p.setProperty("XaCapable", "true"); //$NON-NLS-1$ //$NON-NLS-2$
-		p.setProperty("SourceJNDIName", "java:DerbyDS"); //$NON-NLS-1$ //$NON-NLS-2$
-		admin.addConnectionFactory("test-mysql-cb","connector-jdbc-7.0.0-SNAPSHOT", p);	 //$NON-NLS-1$ //$NON-NLS-2$
+
+		p.setProperty("DatabaseName", "txntest");
+		p.setProperty("PortNumber", "3306");
+		p.setProperty("ServerName", "localhost");
+		p.setProperty("addtional-ds-properties", "foo=bar, t= x");
+		p.setProperty("user-name", "rareddy");
+		p.setProperty("password", "mm");
+		p.setProperty("xa-datasource-class", "com.mysql.jdbc.jdbc2.optional.MysqlXADataSource");
 		
+		admin.addConnectionFactory("test-mysql-cb","connector-jdbc-xa-7.0.0-SNAPSHOT", p);	 //$NON-NLS-1$ //$NON-NLS-2$
+
 		binding = admin.getConnectionFactory("test-mysql-cb"); //$NON-NLS-1$
 		
 		assertNotNull(binding);	
 		
-		assertEquals("java:DerbyDS", binding.getPropertyValue("SourceJNDIName")); //$NON-NLS-1$ //$NON-NLS-2$
+		assertEquals("org.teiid.connector.jdbc.mysql.MySQL5Capabilities", binding.getPropertyValue("CapabilitiesClass")); //$NON-NLS-1$ //$NON-NLS-2$
 		
 		admin.stopConnectionFactory("test-mysql-cb");
 		
 		admin.startConnectionFactory("test-mysql-cb");
 		
-		admin.setConnectionFactoryProperty("test-mysql-cb", "SourceJNDIName", "DummyDS"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+		admin.setConnectionFactoryProperty("test-mysql-cb", "XaCapable", "false"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
 		
 		binding = admin.getConnectionFactory("test-mysql-cb"); //$NON-NLS-1$
 		
-		assertEquals("DummyDS", binding.getPropertyValue("SourceJNDIName")); //$NON-NLS-1$ //$NON-NLS-2$
+		assertEquals("false", binding.getPropertyValue("XaCapable")); //$NON-NLS-1$ //$NON-NLS-2$
 		
-		admin.deleteConnectionFactory("test-mysql-cb"); //$NON-NLS-1$
+		//admin.deleteConnectionFactory("test-mysql-cb"); //$NON-NLS-1$
 		
-		binding = admin.getConnectionFactory("test-mysql-cb"); //$NON-NLS-1$
+		//binding = admin.getConnectionFactory("test-mysql-cb"); //$NON-NLS-1$
 		
-		assertNull(binding);		
+		//assertNull(binding);		
 	}
 	
 	@Test public void testVDBDeploy() throws Exception {
@@ -245,27 +289,13 @@
 	}
 	
 	@Test
-	public void testWorkmanagerStats() throws Exception {
-		WorkerPoolStatistics stats = admin.getWorkManagerStats("runtime"); //$NON-NLS-1$
-		System.out.println(stats);
-		assertNotNull(stats);
-	}
-	
-	@Test
-	public void testConnectionPool() throws Exception {
-		ConnectionPoolStatistics stats = admin.getConnectionFactoryStats("mysql-connector-binding"); //$NON-NLS-1$
-		System.out.println(stats);
-		assertNotNull(stats);
-	}
-	
-	@Test
 	public void testConnectorTypeProperties() throws Exception {
-		Collection<PropertyDefinition> defs = admin.getConnectorPropertyDefinitions("connector-jdbc-7.0.0-SNAPSHOT"); //$NON-NLS-1$
+		Collection<PropertyDefinition> defs = admin.getConnectorTemplatePropertyDefinitions("connector-jdbc-xa-7.0.0-SNAPSHOT"); //$NON-NLS-1$
 		for (PropertyDefinition pd:defs) {
-			System.out.println(pd.getName());
+			System.out.println(pd.getName()+":"+pd.getPropertyTypeClassName());
 			if (pd.getName().equals("ExtensionTranslationClassName")) { //$NON-NLS-1$
 				assertEquals("Extension SQL Translation Class", pd.getDisplayName()); //$NON-NLS-1$
-				assertEquals(true, pd.isAdvanced());
+				assertEquals(false, pd.isAdvanced());
 				assertEquals(true, pd.isRequired());
 				assertEquals(false, pd.isMasked());
 				assertEquals(true, pd.isModifiable());
@@ -288,36 +318,30 @@
 	
 	@Test
 	public void testConnectorTypes() throws Exception {
-		Set<String> defs = admin.getConnectorNames();
-		assertTrue(defs.contains("connector-salesforce-7.0.0-SNAPSHOT")); //$NON-NLS-1$
-		assertTrue(defs.contains("connector-jdbc-7.0.0-SNAPSHOT")); //$NON-NLS-1$
-		assertTrue(defs.contains("connector-text-7.0.0-SNAPSHOT")); //$NON-NLS-1$
-		assertTrue(defs.contains("connector-loopback-7.0.0-SNAPSHOT")); //$NON-NLS-1$
-		assertTrue(defs.contains("connector-ldap-7.0.0-SNAPSHOT")); //$NON-NLS-1$
+		Set<String> defs = admin.getConnectorTemplateNames();
+//		assertTrue(defs.contains("connector-salesforce-7.0.0-SNAPSHOT")); //$NON-NLS-1$
+//		assertTrue(defs.contains("connector-jdbc-7.0.0-SNAPSHOT")); //$NON-NLS-1$
+//		assertTrue(defs.contains("connector-text-7.0.0-SNAPSHOT")); //$NON-NLS-1$
+//		assertTrue(defs.contains("connector-loopback-7.0.0-SNAPSHOT")); //$NON-NLS-1$
+//		assertTrue(defs.contains("connector-ldap-7.0.0-SNAPSHOT")); //$NON-NLS-1$
 		System.out.println(defs);
 	}
+
 	
 	@Test
-	public void testPropertyDefsForDS() throws Exception {
-		Collection<PropertyDefinition> defs = admin.getDataSourcePropertyDefinitions();		
-		System.out.println(defs);
-		assertNotNull(defs);
-		assertTrue(defs.size() > 1);
-	}
-	
-	@Test
 	public void testConnectorAddDelete() throws Exception{
 		File f = new File(UnitTestUtil.getTestDataPath()+"/connector-loopback.rar"); //$NON-NLS-1$
 		FileInputStream fis = new FileInputStream(f);
 		admin.addConnector("connector-loopy.rar", fis); //$NON-NLS-1$
 		fis.close();
 		
-		Set<String> names = admin.getConnectorNames();
-		assertTrue(names.contains("connector-loopy.rar")); //$NON-NLS-1$
+		Set<String> names = admin.getConnectorTemplateNames();
+		System.out.println(names);
+		assertTrue(names.contains("connector-loopy")); //$NON-NLS-1$
 		
 		admin.deleteConnector("connector-loopy.rar"); //$NON-NLS-1$
 		
-		names = admin.getConnectorNames();
+		names = admin.getConnectorTemplateNames();
 		//assertTrue(!names.contains("connector-loopy")); //$NON-NLS-1$
 	}
 	
@@ -390,11 +414,4 @@
 		admin.removeRoleFromDataPolicy("TransactionsRevisited", 1, "policy1", "FOO");
 	}	
 	
-	@Test public void testExportConnectionFactory() throws Exception {
-		ObjectConverterUtil.write(admin.exportConnectionFactory("products-cf"), "cf.xml");
-	}	
-	
-	@Test public void testExportDataSource() throws Exception {
-		ObjectConverterUtil.write(admin.exportDataSource("CustomersDS"), "ds.xml");
-	}
 }



More information about the teiid-commits mailing list