[teiid-commits] teiid SVN: r3422 - in branches/as7: build and 26 other directories.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Mon Aug 22 10:36:08 EDT 2011


Author: rareddy
Date: 2011-08-22 10:36:06 -0400 (Mon, 22 Aug 2011)
New Revision: 3422

Added:
   branches/as7/jboss-integration/src/main/java/org/teiid/jboss/AuthorizationValidatorService.java
   branches/as7/jboss-integration/src/main/java/org/teiid/jboss/ObjectSerializer.java
   branches/as7/jboss-integration/src/main/java/org/teiid/jboss/ObjectsSerializerService.java
   branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineRemove.java
   branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidBootServicesAdd.java
   branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidModelDescription.java
   branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBDependencyProcessor.java
   branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBDeployer.java
   branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBParserDeployer.java
   branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBRepositoryService.java
   branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBService.java
   branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBStructure.java
Removed:
   branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineDescription.java
   branches/as7/runtime/src/main/java/org/teiid/deployers/ObjectSerializer.java
   branches/as7/runtime/src/main/java/org/teiid/deployers/VDBDependencyProcessor.java
   branches/as7/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java
   branches/as7/runtime/src/main/java/org/teiid/deployers/VDBParserDeployer.java
   branches/as7/runtime/src/main/java/org/teiid/deployers/VDBService.java
   branches/as7/runtime/src/main/java/org/teiid/deployers/VDBStructure.java
Modified:
   branches/as7/build/assembly/adminshell/adminshell-dist.xml
   branches/as7/build/assembly/jboss-as7/dist.xml
   branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/api/main/module.xml
   branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/client/main/module.xml
   branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/common-core/main/module.xml
   branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/main/module.xml
   branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/file/main/module.xml
   branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/jdbc/main/module.xml
   branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/ldap/main/module.xml
   branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/loopback/main/module.xml
   branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/olap/main/module.xml
   branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/salesforce/api/main/module.xml
   branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/salesforce/main/module.xml
   branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/ws/main/module.xml
   branches/as7/build/kits/jboss-as7/standalone/configuration/standalone-teiid.xml
   branches/as7/build/pom.xml
   branches/as7/engine/src/main/java/org/teiid/dqp/internal/datamgr/TranslatorRepository.java
   branches/as7/engine/src/main/java/org/teiid/dqp/internal/process/DQPConfiguration.java
   branches/as7/jboss-integration/src/main/java/org/teiid/jboss/Configuration.java
   branches/as7/jboss-integration/src/main/java/org/teiid/jboss/Element.java
   branches/as7/jboss-integration/src/main/java/org/teiid/jboss/JBossLifeCycleListener.java
   branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineAdd.java
   branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineOperationHandler.java
   branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidExtension.java
   branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidServiceNames.java
   branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidSubsystemParser.java
   branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorAdd.java
   branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorRemove.java
   branches/as7/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
   branches/as7/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties
   branches/as7/jboss-integration/src/main/resources/schema/jboss-teiid.xsd
   branches/as7/jboss-integration/src/test/java/org/teiid/jboss/TestTeiidConfiguration.java
   branches/as7/jboss-integration/src/test/resources/teiid-sample-config.xml
   branches/as7/pom.xml
   branches/as7/runtime/src/main/java/org/teiid/deployers/TranslatorUtil.java
   branches/as7/runtime/src/main/resources/org/teiid/runtime/i18n.properties
   branches/as7/runtime/src/test/java/org/teiid/deployers/TestObjectSerializer.java
Log:
TEIID-1720: 1) More service changes, more for vdb deployment. machine unstable; savepoint

Modified: branches/as7/build/assembly/adminshell/adminshell-dist.xml
===================================================================
--- branches/as7/build/assembly/adminshell/adminshell-dist.xml	2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/build/assembly/adminshell/adminshell-dist.xml	2011-08-22 14:36:06 UTC (rev 3422)
@@ -7,7 +7,7 @@
   </formats>
   
   <includeBaseDirectory>true</includeBaseDirectory>
-  <baseDirectory>teiid-adminshell-${version}</baseDirectory>
+  <baseDirectory>teiid-adminshell-${project.version}</baseDirectory>
 
   <moduleSets>
     <moduleSet>
@@ -60,7 +60,7 @@
     <fileSet>
       <directory>target</directory>
       <includes>
-        <include>teiid-${version}-client.jar</include>
+        <include>teiid-${project.version}-client.jar</include>
       </includes>
       <outputDirectory>lib</outputDirectory>
       <fileMode>0644</fileMode>      
@@ -70,7 +70,7 @@
   
   <files>
         <file>
-            <source>target/teiid-${version}-docs/admin-guide/en-US/pdf/teiid_admin_guide.pdf</source>
+            <source>target/teiid-${project.version}-docs/admin-guide/en-US/pdf/teiid_admin_guide.pdf</source>
             <fileMode>0644</fileMode>
         </file>
     </files>

Modified: branches/as7/build/assembly/jboss-as7/dist.xml
===================================================================
--- branches/as7/build/assembly/jboss-as7/dist.xml	2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/build/assembly/jboss-as7/dist.xml	2011-08-22 14:36:06 UTC (rev 3422)
@@ -8,7 +8,7 @@
   </formats>
   
   <includeBaseDirectory>false</includeBaseDirectory>
-  <baseDirectory>teiid-${version}</baseDirectory>
+  <baseDirectory>teiid-${project.version}</baseDirectory>
 
   <fileSets>
           
@@ -59,32 +59,32 @@
   
     <files>
         <file>
-            <source>target/teiid-${version}-docs/admin-guide/en-US/pdf/teiid_admin_guide.pdf</source>
+            <source>target/teiid-${project.version}-docs/admin-guide/en-US/pdf/teiid_admin_guide.pdf</source>
             <outputDirectory>docs/teiid</outputDirectory>
             <fileMode>0644</fileMode>
         </file>
         <file>
-            <source>target/teiid-${version}-docs/reference/en-US/pdf/teiid_reference.pdf</source>
+            <source>target/teiid-${project.version}-docs/reference/en-US/pdf/teiid_reference.pdf</source>
             <outputDirectory>docs/teiid</outputDirectory>
             <fileMode>0644</fileMode>
         </file>
         <file>
-            <source>target/teiid-${version}-docs/quick-start-example/en-US/pdf/teiid_quick_start_example.pdf</source>
+            <source>target/teiid-${project.version}-docs/quick-start-example/en-US/pdf/teiid_quick_start_example.pdf</source>
             <outputDirectory>docs/teiid</outputDirectory>
             <fileMode>0644</fileMode>
         </file>
         <file>
-            <source>target/teiid-${version}-docs/developer-guide/en-US/pdf/teiid_developer_guide.pdf</source>
+            <source>target/teiid-${project.version}-docs/developer-guide/en-US/pdf/teiid_developer_guide.pdf</source>
             <outputDirectory>docs/teiid</outputDirectory>
             <fileMode>0644</fileMode>
         </file>
         <file>
-            <source>target/teiid-${version}-docs/client-developers-guide/en-US/pdf/teiid_client_developers_guide.pdf</source>
+            <source>target/teiid-${project.version}-docs/client-developers-guide/en-US/pdf/teiid_client_developers_guide.pdf</source>
             <outputDirectory>docs/teiid</outputDirectory>
             <fileMode>0644</fileMode>
         </file>
         <file>
-            <source>target/teiid-${version}-docs/caching-guide/en-US/pdf/teiid_caching_guide.pdf</source>
+            <source>target/teiid-${project.version}-docs/caching-guide/en-US/pdf/teiid_caching_guide.pdf</source>
             <outputDirectory>docs/teiid</outputDirectory>
             <fileMode>0644</fileMode>
         </file>        

Modified: branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/api/main/module.xml
===================================================================
--- branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/api/main/module.xml	2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/api/main/module.xml	2011-08-22 14:36:06 UTC (rev 3422)
@@ -1,30 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-  ~ JBoss, Home of Professional Open Source.
-  ~ Copyright 2010, Red Hat, Inc., 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.
-  -->
-  
 <module xmlns="urn:jboss:module:1.0" name="org.jboss.teiid.api">
     <resources>
-        <resource-root path="teiid-api-${version}.jar" />
+        <resource-root path="teiid-api-${project.version}.jar" />
         <!-- Insert resources here -->
     </resources>
 

Modified: branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/client/main/module.xml
===================================================================
--- branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/client/main/module.xml	2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/client/main/module.xml	2011-08-22 14:36:06 UTC (rev 3422)
@@ -1,31 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-  ~ JBoss, Home of Professional Open Source.
-  ~ Copyright 2010, Red Hat, Inc., 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.
-  -->
-  
 <module xmlns="urn:jboss:module:1.0" name="org.jboss.teiid.client">
     <resources>
-        <resource-root path="teiid-client-${version}.jar" />
-        <resource-root path="teiid-hibernate-dialect-${version}.jar"/>
+        <resource-root path="teiid-client-${project.version}.jar" />
+        <resource-root path="teiid-hibernate-dialect-${project.version}.jar"/>
         <!-- Insert resources here -->
     </resources>
 

Modified: branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/common-core/main/module.xml
===================================================================
--- branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/common-core/main/module.xml	2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/common-core/main/module.xml	2011-08-22 14:36:06 UTC (rev 3422)
@@ -1,30 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-  ~ JBoss, Home of Professional Open Source.
-  ~ Copyright 2010, Red Hat, Inc., 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.
-  -->
-  
 <module xmlns="urn:jboss:module:1.0" name="org.jboss.teiid.common-core">
     <resources>
-        <resource-root path="teiid-common-core-${version}.jar" />
+        <resource-root path="teiid-common-core-${project.version}.jar" />
         <!-- Insert resources here -->
     </resources>
 

Modified: branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/main/module.xml
===================================================================
--- branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/main/module.xml	2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/main/module.xml	2011-08-22 14:36:06 UTC (rev 3422)
@@ -1,39 +1,15 @@
 <?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-  ~ JBoss, Home of Professional Open Source.
-  ~ Copyright 2010, Red Hat, Inc., 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.
-  -->
-  
 <module xmlns="urn:jboss:module:1.0" name="org.jboss.teiid">
     <resources>
-        <resource-root path="teiid-engine-${version}.jar" />
+        <resource-root path="teiid-engine-${project.version}.jar" />
         <!-- 
-        <resource-root path="teiid-cache-jbosscache-${version}.jar" />
+        <resource-root path="teiid-cache-jbosscache-${project.version}.jar" />
          -->
-        <resource-root path="teiid-jboss-integration-${version}.jar" />
-        <resource-root path="teiid-metadata-${version}.jar" />
-        <resource-root path="teiid-runtime-${version}.jar" />
-        <resource-root path="teiid-engine-${version}.jar" />
-        <resource-root path="saxon-9.1.0.8.jar" />
-        <resource-root path="saxon-9.1.0.8-dom.jar" />
+        <resource-root path="teiid-jboss-integration-${project.version}.jar" />
+        <resource-root path="teiid-metadata-${project.version}.jar" />
+        <resource-root path="teiid-runtime-${project.version}.jar" />
+        <resource-root path="teiid-engine-${project.version}.jar" />
+        <resource-root path="saxonhe-9.2.1.5.jar" />
         <resource-root path="json-simple-1.1.jar" />        
         <!-- Insert resources here -->
     </resources>

Modified: branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/file/main/module.xml
===================================================================
--- branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/file/main/module.xml	2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/file/main/module.xml	2011-08-22 14:36:06 UTC (rev 3422)
@@ -1,27 +1,4 @@
 <?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-  ~ JBoss, Home of Professional Open Source.
-  ~ Copyright 2010, Red Hat, Inc., 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.
-  -->
-  
 <module xmlns="urn:jboss:module:1.0" name="org.jboss.teiid.translator.file">
     <resources>
         <resource-root path="translator-file-${project.version}.jar" />

Modified: branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/jdbc/main/module.xml
===================================================================
--- branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/jdbc/main/module.xml	2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/jdbc/main/module.xml	2011-08-22 14:36:06 UTC (rev 3422)
@@ -1,27 +1,4 @@
 <?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-  ~ JBoss, Home of Professional Open Source.
-  ~ Copyright 2010, Red Hat, Inc., 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.
-  -->
-  
 <module xmlns="urn:jboss:module:1.0" name="org.jboss.teiid.translator.jdbc">
     <resources>
         <resource-root path="translator-jdbc-${project.version}.jar" />
@@ -31,6 +8,7 @@
 
     <dependencies>
         <module name="javax.resource.api"/>
+        <module name="javax.api"/>
         <module name="org.apache.commons.logging" />
         <module name="org.apache.log4j"/>
         <module name="org.jboss.teiid.common-core" />

Modified: branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/ldap/main/module.xml
===================================================================
--- branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/ldap/main/module.xml	2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/ldap/main/module.xml	2011-08-22 14:36:06 UTC (rev 3422)
@@ -1,27 +1,4 @@
 <?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-  ~ JBoss, Home of Professional Open Source.
-  ~ Copyright 2010, Red Hat, Inc., 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.
-  -->
-  
 <module xmlns="urn:jboss:module:1.0" name="org.jboss.teiid.translator.file">
     <resources>
         <resource-root path="translator-file-${project.version}.jar" />

Modified: branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/loopback/main/module.xml
===================================================================
--- branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/loopback/main/module.xml	2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/loopback/main/module.xml	2011-08-22 14:36:06 UTC (rev 3422)
@@ -1,27 +1,4 @@
 <?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-  ~ JBoss, Home of Professional Open Source.
-  ~ Copyright 2010, Red Hat, Inc., 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.
-  -->
-  
 <module xmlns="urn:jboss:module:1.0" name="org.jboss.teiid.translator.loopback">
     <resources>
         <resource-root path="translator-loopback-${project.version}.jar" />

Modified: branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/olap/main/module.xml
===================================================================
--- branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/olap/main/module.xml	2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/olap/main/module.xml	2011-08-22 14:36:06 UTC (rev 3422)
@@ -1,27 +1,4 @@
 <?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-  ~ JBoss, Home of Professional Open Source.
-  ~ Copyright 2010, Red Hat, Inc., 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.
-  -->
-  
 <module xmlns="urn:jboss:module:1.0" name="org.jboss.teiid.translator.file">
     <resources>
         <resource-root path="translator-loopback-${project.version}.jar" />

Modified: branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/salesforce/api/main/module.xml
===================================================================
--- branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/salesforce/api/main/module.xml	2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/salesforce/api/main/module.xml	2011-08-22 14:36:06 UTC (rev 3422)
@@ -1,27 +1,4 @@
 <?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-  ~ JBoss, Home of Professional Open Source.
-  ~ Copyright 2010, Red Hat, Inc., 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.
-  -->
-  
 <module xmlns="urn:jboss:module:1.0" name="org.jboss.teiid.transalator.salesforce.api">
     <resources>
         <resource-root path="salesforce-api-${project.version}.jar" />

Modified: branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/salesforce/main/module.xml
===================================================================
--- branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/salesforce/main/module.xml	2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/salesforce/main/module.xml	2011-08-22 14:36:06 UTC (rev 3422)
@@ -1,27 +1,4 @@
 <?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-  ~ JBoss, Home of Professional Open Source.
-  ~ Copyright 2010, Red Hat, Inc., 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.
-  -->
-  
 <module xmlns="urn:jboss:module:1.0" name="org.jboss.teiid.translator.salesforce">
     <resources>
         <resource-root path="translator-salesforce-${project.version}.jar" />

Modified: branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/ws/main/module.xml
===================================================================
--- branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/ws/main/module.xml	2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/ws/main/module.xml	2011-08-22 14:36:06 UTC (rev 3422)
@@ -1,30 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-  ~ JBoss, Home of Professional Open Source.
-  ~ Copyright 2010, Red Hat, Inc., 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.
-  -->
-  
 <module xmlns="urn:jboss:module:1.0" name="org.jboss.teiid.translator.ws">
     <resources>
-        <resource-root path="translator-ws-${project.version}.jar" />
+        <resource-root path="translator-ws-${project.name}.jar" />
         <!-- Insert resources here -->
     </resources>
 
@@ -35,4 +12,4 @@
         <module name="org.jboss.teiid.common-core" />
         <module name="org.jboss.teiid.api" />
     </dependencies>
-</module>
\ No newline at end of file
+</module>

Modified: branches/as7/build/kits/jboss-as7/standalone/configuration/standalone-teiid.xml
===================================================================
--- branches/as7/build/kits/jboss-as7/standalone/configuration/standalone-teiid.xml	2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/build/kits/jboss-as7/standalone/configuration/standalone-teiid.xml	2011-08-22 14:36:06 UTC (rev 3422)
@@ -257,7 +257,7 @@
             </security-domains>
         </subsystem>
         <subsystem xmlns="urn:jboss:domain:teiid:1.0">
-            <query-engine>
+            <query-engine name = "default">
                 <async-thread-group>teiid-async</async-thread-group>
                 <event-distributor-name>teiid/event-distributor</event-distributor-name>
                 <security-domain>teiid-security</security-domain>
@@ -268,6 +268,7 @@
                     <socket-binding>teiid-odbc</socket-binding>
                 </odbc>
             </query-engine>
+            <translator name="oracle" module="org.jboss.teiid.translator.jdbc"/>
         </subsystem>       
         <subsystem xmlns="urn:jboss:domain:threads:1.0">
             <queueless-thread-pool name="teiid-async">

Modified: branches/as7/build/pom.xml
===================================================================
--- branches/as7/build/pom.xml	2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/build/pom.xml	2011-08-22 14:36:06 UTC (rev 3422)
@@ -12,7 +12,7 @@
         <dependency>
             <groupId>org.jboss.teiid</groupId>
             <artifactId>teiid-client-jdk15</artifactId>
-            <version>${version}</version>
+            <version>${project.version}</version>
         </dependency>
         <dependency>
             <groupId>net.sf.retrotranslator</groupId>
@@ -119,9 +119,9 @@
                             <mainClass>net.sf.retrotranslator.transformer.Retrotranslator</mainClass>
                             <arguments>                     
                                 <argument>-srcjar</argument>
-                                <argument>${pom.basedir}/target/teiid-${pom.version}-client.jar</argument>
+                                <argument>${pom.basedir}/target/teiid-${project.version}-client.jar</argument>
                                 <argument>-destjar</argument>
-                                <argument>${pom.basedir}/target/teiid-${pom.version}-client-jdk15.jar</argument>            
+                                <argument>${pom.basedir}/target/teiid-${project.version}-client-jdk15.jar</argument>            
                                 <argument>-embed</argument>
                                 <argument>org.teiid.retroruntime</argument>                    
                             </arguments>

Modified: branches/as7/engine/src/main/java/org/teiid/dqp/internal/datamgr/TranslatorRepository.java
===================================================================
--- branches/as7/engine/src/main/java/org/teiid/dqp/internal/datamgr/TranslatorRepository.java	2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/engine/src/main/java/org/teiid/dqp/internal/datamgr/TranslatorRepository.java	2011-08-22 14:36:06 UTC (rev 3422)
@@ -28,7 +28,6 @@
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
-import org.teiid.adminapi.Translator;
 import org.teiid.adminapi.impl.VDBTranslatorMetaData;
 
 
@@ -41,8 +40,8 @@
 		this.translatorRepo.put(name, factory);
 	}	
 	
-	public Translator getTranslatorMetaData(String name) {
-		Translator factory = this.translatorRepo.get(name);
+	public VDBTranslatorMetaData getTranslatorMetaData(String name) {
+		VDBTranslatorMetaData factory = this.translatorRepo.get(name);
 		return factory;
 	}
 	

Modified: branches/as7/engine/src/main/java/org/teiid/dqp/internal/process/DQPConfiguration.java
===================================================================
--- branches/as7/engine/src/main/java/org/teiid/dqp/internal/process/DQPConfiguration.java	2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/engine/src/main/java/org/teiid/dqp/internal/process/DQPConfiguration.java	2011-08-22 14:36:06 UTC (rev 3422)
@@ -42,8 +42,6 @@
 	private int timeSliceInMilli = DEFAULT_PROCESSOR_TIMESLICE;
 	private int maxRowsFetchSize = DEFAULT_FETCH_SIZE;
 	private int lobChunkSizeInKB = 100;
-	private boolean useDataRoles = true;
-	private boolean allowCreateTemporaryTablesByDefault = true;
 	private int queryThresholdInSecs = DEFAULT_QUERY_THRESHOLD;
 	private boolean exceptionOnMaxSourceRows = true;
 	private int maxSourceRows = -1;
@@ -55,7 +53,6 @@
     private boolean detectingChangeEvents = true;
     
     private transient AuthorizationValidator authorizationValidator;
-	private boolean allowFunctionCallsByDefault;
 
 	public int getMaxActivePlans() {
 		return maxActivePlans;

Added: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/AuthorizationValidatorService.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/AuthorizationValidatorService.java	                        (rev 0)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/AuthorizationValidatorService.java	2011-08-22 14:36:06 UTC (rev 3422)
@@ -0,0 +1,50 @@
+/*
+ * 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;
+
+import org.jboss.msc.service.Service;
+import org.jboss.msc.service.StartContext;
+import org.jboss.msc.service.StartException;
+import org.jboss.msc.service.StopContext;
+import org.teiid.dqp.internal.process.AuthorizationValidator;
+
+public class AuthorizationValidatorService implements Service<AuthorizationValidator> {
+	private AuthorizationValidator validator;
+	
+	public AuthorizationValidatorService(AuthorizationValidator value){
+		this.validator = value;
+	}
+	
+	@Override
+	public void start(StartContext context) throws StartException {
+	}
+
+	@Override
+	public void stop(StopContext context) {
+	}
+
+	@Override
+	public AuthorizationValidator getValue() throws IllegalStateException, IllegalArgumentException {
+		return validator;
+	}
+
+}


Property changes on: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/AuthorizationValidatorService.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/Configuration.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/Configuration.java	2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/Configuration.java	2011-08-22 14:36:06 UTC (rev 3422)
@@ -100,6 +100,8 @@
 	public static final String TRANSLATOR_NAME = "name";//$NON-NLS-1$
 	public static final String TRANSLATOR_MODULE = "module";//$NON-NLS-1$
 	
+	public static final String ENGINE_NAME = "name";//$NON-NLS-1$
+	
 	public static final String DESC = ".describe"; //$NON-NLS-1$
 	static void addAttribute(ModelNode node, String name, String type, String description, ModelType dataType, boolean required, String defaultValue) {
 		node.get(type, name, TYPE).set(dataType);

Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/Element.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/Element.java	2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/Element.java	2011-08-22 14:36:06 UTC (rev 3422)
@@ -32,6 +32,7 @@
     QUERY_ENGINE_ELEMENT(QUERY_ENGINE),
     	
 	// Query-ENGINE
+    ENGINE_NAME_ATTRIBUTE(ENGINE_NAME),
     ASYNC_THREAD_GROUP_ELEMENT(ASYNC_THREAD_GROUP),
 	MAX_THREADS_ELEMENT(MAX_THREADS),
 	MAX_ACTIVE_PLANS_ELEMENT(MAX_ACTIVE_PLANS),
@@ -96,8 +97,13 @@
 	TRUST_FILE_ELEMENT(TRUST_FILE),
 	TRUST_PASSWD_ELEMENT(TRUST_PASSWD),
 	AUTH_MODE_ELEMENT(AUTH_MODE),
-	SSL_ELEMENT(SSL);    
+	SSL_ELEMENT(SSL),    
     
+    // Translator
+    TRANSLATOR_ELEMENT(TRANSLATOR),
+    TRANSLATOR_NAME_ATTRIBUTE(TRANSLATOR_NAME),
+    TRANSLATOR_MODULE_ATTRIBUTE(TRANSLATOR_MODULE);
+    
     private final String name;
 
     Element(final String name) {

Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/JBossLifeCycleListener.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/JBossLifeCycleListener.java	2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/JBossLifeCycleListener.java	2011-08-22 14:36:06 UTC (rev 3422)
@@ -28,7 +28,7 @@
 import org.jboss.msc.service.ServiceContainer.TerminateListener;
 import org.teiid.deployers.ContainerLifeCycleListener;
 
-class JBossLifeCycleListener implements TerminateListener, ContainerLifeCycleListener{
+class JBossLifeCycleListener implements TerminateListener, ContainerLifeCycleListener {
 
 	private boolean shutdownInProgress = false;
 	private List<ContainerLifeCycleListener.LifeCycleEventListener> listeners = Collections.synchronizedList(new ArrayList<ContainerLifeCycleListener.LifeCycleEventListener>());

Copied: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/ObjectSerializer.java (from rev 3382, branches/as7/runtime/src/main/java/org/teiid/deployers/ObjectSerializer.java)
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/ObjectSerializer.java	                        (rev 0)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/ObjectSerializer.java	2011-08-22 14:36:06 UTC (rev 3422)
@@ -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.jboss;
+
+import java.io.*;
+
+import org.jboss.logging.Logger;
+import org.teiid.core.util.FileUtils;
+import org.teiid.logging.LogConstants;
+import org.teiid.logging.LogManager;
+import org.teiid.runtime.RuntimePlugin;
+
+
+public class ObjectSerializer {
+	
+	private static final Logger log = Logger.getLogger(ObjectSerializer.class);
+
+	private static final String ATTACHMENT_SUFFIX = ".ser"; //$NON-NLS-1$
+
+	private String storagePath;
+	
+	public ObjectSerializer(String path) {
+		this.storagePath = path;
+	}
+	
+	public <T> T loadAttachment(File attachmentsStore, Class<T> expected) throws IOException, ClassNotFoundException {
+		if (log.isTraceEnabled()) {
+			log.trace("loadAttachment, attachmentsStore=" + attachmentsStore); //$NON-NLS-1$
+		}
+
+		ObjectInputStream ois = null;
+		try {
+			ois = new ObjectInputStream(new FileInputStream(attachmentsStore));
+			return expected.cast(ois.readObject());
+		} finally {
+			if (ois != null) {
+				ois.close();
+			}
+		}
+	}
+
+	public void saveAttachment(File attachmentsStore, Object attachment) throws IOException {
+		if (log.isTraceEnabled()) {
+			log.trace("saveAttachment, attachmentsStore=" + attachmentsStore + ", attachment=" + attachment); //$NON-NLS-1$ //$NON-NLS-2$
+		}
+		
+		ObjectOutputStream oos = null;
+		try {
+			oos = new ObjectOutputStream(new FileOutputStream(attachmentsStore));
+			oos.writeObject(attachment);
+		} finally {
+			if (oos != null) {
+				oos.close();
+			}
+		}
+	}
+	
+	public boolean isStale(File cacheFile, long timeAfter) {
+		return (cacheFile.exists() && timeAfter > cacheFile.lastModified());
+	}
+	
+	public void removeAttachments(String fileName) {
+		String dirName = baseDirectory(fileName);
+		FileUtils.removeDirectoryAndChildren(new File(dirName));
+	}
+
+	public File getAttachmentPath(String fileName, String baseName) {
+		
+		String dirName = baseDirectory(fileName);
+
+		final String vfsPath = baseName + ATTACHMENT_SUFFIX;
+		File f = new File(dirName, vfsPath);
+		if (!f.getParentFile().exists()) {
+			f.getParentFile().mkdirs();
+		}
+		return f;
+	}
+
+	private String baseDirectory(String fileName) {
+		String dirName = this.storagePath + File.separator + fileName + File.separator;
+		return dirName;
+	}
+	
+	public <T> T loadSafe(File cacheFile, Class<T> clazz) {
+		try {
+			if (cacheFile.exists()) {
+				return clazz.cast(loadAttachment(cacheFile, clazz));
+			}
+			return null;
+		} catch (Exception e) {
+			LogManager.logWarning(LogConstants.CTX_RUNTIME, e, RuntimePlugin.Util.getString("invalid_metadata_file", cacheFile.getAbsolutePath())); //$NON-NLS-1$
+		}
+		cacheFile.delete();
+		return null;
+	}	
+}

Added: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/ObjectsSerializerService.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/ObjectsSerializerService.java	                        (rev 0)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/ObjectsSerializerService.java	2011-08-22 14:36:06 UTC (rev 3422)
@@ -0,0 +1,54 @@
+/*
+ * 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;
+
+import org.jboss.msc.service.Service;
+import org.jboss.msc.service.StartContext;
+import org.jboss.msc.service.StartException;
+import org.jboss.msc.service.StopContext;
+import org.jboss.msc.value.InjectedValue;
+
+public class ObjectsSerializerService implements Service<ObjectSerializer> {
+	private InjectedValue<String> pathInjector = new InjectedValue<String>();
+	private ObjectSerializer serializer;
+	
+	public ObjectsSerializerService(){
+	}
+	
+	@Override
+	public void start(StartContext context) throws StartException {
+		this.serializer = new ObjectSerializer(pathInjector.getValue());
+	}
+
+	@Override
+	public void stop(StopContext context) {
+	}
+
+	@Override
+	public ObjectSerializer getValue() throws IllegalStateException, IllegalArgumentException {
+		return serializer;
+	}
+	
+	public InjectedValue<String> getPathInjector() {
+		return pathInjector;
+	}
+}


Property changes on: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/ObjectsSerializerService.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineAdd.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineAdd.java	2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineAdd.java	2011-08-22 14:36:06 UTC (rev 3422)
@@ -21,9 +21,11 @@
  */
 package org.teiid.jboss;
 
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.*;
+
 import java.util.List;
-import java.util.ServiceLoader;
-import java.util.concurrent.Executor;
+import java.util.Locale;
+import java.util.ResourceBundle;
 
 import javax.resource.spi.XATerminator;
 import javax.resource.spi.work.WorkManager;
@@ -33,56 +35,46 @@
 import org.jboss.as.controller.OperationContext;
 import org.jboss.as.controller.OperationFailedException;
 import org.jboss.as.controller.ServiceVerificationHandler;
+import org.jboss.as.controller.descriptions.DescriptionProvider;
 import org.jboss.as.naming.ManagedReferenceFactory;
 import org.jboss.as.naming.ManagedReferenceInjector;
 import org.jboss.as.naming.NamingStore;
 import org.jboss.as.naming.service.BinderService;
 import org.jboss.as.network.SocketBinding;
 import org.jboss.as.security.plugins.SecurityDomainContext;
-import org.jboss.as.server.AbstractDeploymentChainStep;
-import org.jboss.as.server.DeploymentProcessorTarget;
-import org.jboss.as.server.deployment.Phase;
-import org.jboss.as.server.services.path.RelativePathService;
 import org.jboss.dmr.ModelNode;
-import org.jboss.modules.Module;
-import org.jboss.modules.ModuleIdentifier;
-import org.jboss.modules.ModuleLoadException;
 import org.jboss.msc.inject.ConcurrentMapInjector;
-import org.jboss.msc.service.AbstractServiceListener;
-import org.jboss.msc.service.ServiceBuilder;
-import org.jboss.msc.service.ServiceContainer;
-import org.jboss.msc.service.ServiceController;
-import org.jboss.msc.service.ServiceName;
-import org.jboss.msc.service.ServiceTarget;
+import org.jboss.msc.service.*;
 import org.jboss.msc.value.InjectedValue;
-import org.teiid.PolicyDecider;
-import org.teiid.cache.CacheConfiguration;
-import org.teiid.cache.CacheFactory;
-import org.teiid.cache.DefaultCacheFactory;
-import org.teiid.deployers.ObjectSerializer;
 import org.teiid.deployers.SystemVDBDeployer;
-import org.teiid.deployers.VDBDependencyProcessor;
-import org.teiid.deployers.VDBDeployer;
-import org.teiid.deployers.VDBParserDeployer;
 import org.teiid.deployers.VDBRepository;
-import org.teiid.deployers.VDBStructure;
 import org.teiid.dqp.internal.datamgr.TranslatorRepository;
 import org.teiid.dqp.internal.process.AuthorizationValidator;
-import org.teiid.dqp.internal.process.DataRolePolicyDecider;
-import org.teiid.dqp.internal.process.DefaultAuthorizationValidator;
 import org.teiid.jboss.deployers.RuntimeEngineDeployer;
 import org.teiid.logging.LogConstants;
 import org.teiid.logging.LogManager;
-import org.teiid.query.function.SystemFunctionManager;
 import org.teiid.services.BufferServiceImpl;
 import org.teiid.transport.ClientServiceRegistry;
 import org.teiid.transport.LocalServerConnection;
 import org.teiid.transport.SSLConfiguration;
 import org.teiid.transport.SocketConfiguration;
 
-class QueryEngineAdd extends AbstractBoottimeAddStepHandler {
+class QueryEngineAdd extends AbstractBoottimeAddStepHandler implements DescriptionProvider {
 
 	@Override
+	public ModelNode getModelDescription(Locale locale) {
+		final ResourceBundle bundle = IntegrationPlugin.getResourceBundle(locale);
+		
+        final ModelNode node = new ModelNode();
+        node.get(OPERATION_NAME).set(ADD);
+        node.get(DESCRIPTION).set("engine.add"); //$NON-NLS-1$
+        
+        ModelNode engine = node.get(REQUEST_PROPERTIES, Configuration.QUERY_ENGINE);
+        TeiidModelDescription.getQueryEngineDescription(engine, ATTRIBUTES, bundle);
+        return node;
+	}
+	
+	@Override
 	protected void populateModel(ModelNode operation, ModelNode model) {
 		final ModelNode queryEngineNode = operation.require(Configuration.QUERY_ENGINE);
 		model.set(Configuration.QUERY_ENGINE).set(queryEngineNode.clone());
@@ -95,58 +87,8 @@
     	final ModelNode queryEngineNode = operation.require(Configuration.QUERY_ENGINE);
     	ServiceTarget target = context.getServiceTarget();
     	
-    	final VDBRepository vdbRepo = buildVDBRepository(queryEngineNode);
     	final JBossLifeCycleListener shutdownListener = new JBossLifeCycleListener();
-    	
-    	SystemVDBDeployer systemVDB = new SystemVDBDeployer();
-    	systemVDB.setVDBRepository(vdbRepo);
-    	SystemVDBService systemVDBService = new SystemVDBService(systemVDB);
-    	newControllers.add(target.addService(TeiidServiceNames.SYSTEM_VDB, systemVDBService).install());
-    	
-    	//FIXME *******************
-    	final ObjectSerializer serializer = new ObjectSerializer("/tmp");
-    	//FIXME *******************
-    	
-    	final TranslatorRepository translatorRepo = new TranslatorRepository();
-    	TranslatorRepositoryService translatorService = new TranslatorRepositoryService(translatorRepo);
-    	newControllers.add(target.addService(TeiidServiceNames.TRANSLATOR_REPO, translatorService).install());
-
-    	newControllers.add(RelativePathService.addService(TeiidServiceNames.BUFFER_DIR, "teiid-buffer", "jboss.server.temp.dir", target)); //$NON-NLS-1$ //$NON-NLS-2$
-    	
-    	// TODO: remove verbose service by moving the buffer service from runtime project
-    	final BufferServiceImpl bufferManager = buildBufferManager(queryEngineNode.get(Configuration.BUFFER_SERVICE));
-    	BufferManagerService bufferService = new BufferManagerService(bufferManager);
-    	ServiceBuilder<BufferServiceImpl> bufferServiceBuilder = target.addService(TeiidServiceNames.BUFFER_MGR, bufferService);
-    	bufferServiceBuilder.addDependency(TeiidServiceNames.BUFFER_DIR, String.class, bufferService.pathInjector);
-    	newControllers.add(bufferServiceBuilder.install());
-
-    	PolicyDecider policyDecider;
-    	if (queryEngineNode.hasDefined(Configuration.POLICY_DECIDER_MODULE)) {
-    		policyDecider = buildService(PolicyDecider.class, queryEngineNode.get(Configuration.POLICY_DECIDER_MODULE).asString());    		
-    	}
-    	else {
-    		DataRolePolicyDecider drpd = new DataRolePolicyDecider();
-    		drpd.setAllowCreateTemporaryTablesByDefault(true);
-    		drpd.setAllowFunctionCallsByDefault(true);
-    		policyDecider = drpd;
-    	}
-    	
-    	AuthorizationValidator authValidator;
-    	if (queryEngineNode.hasDefined(Configuration.AUTHORIZATION_VALIDATOR_MODULE)) {
-    		authValidator = buildService(AuthorizationValidator.class, queryEngineNode.get(Configuration.AUTHORIZATION_VALIDATOR_MODULE).asString());
-    		authValidator.setEnabled(true);
-    	}
-    	else {
-    		DefaultAuthorizationValidator dap = new DefaultAuthorizationValidator();
-    		dap.setPolicyDecider(policyDecider);
-    		dap.setEnabled(true);
-    		authValidator = dap;
-    	}    	
-
-    	CacheFactory cacheFactory = getCacheFactory(queryEngineNode.get(Configuration.CACHE_FACORY));
-    	CacheConfiguration resultsetCache = buildCacheConfig(queryEngineNode.get(Configuration.RESULTSET_CACHE));
-    	CacheConfiguration preparePlanCache = buildCacheConfig(queryEngineNode.get(Configuration.PREPAREDPLAN_CACHE));
-    	
+       	
     	SocketConfiguration jdbc = null;
     	if (queryEngineNode.hasDefined(Configuration.JDBC)) {
     		jdbc = buildSocketConfiguration(queryEngineNode.get(Configuration.JDBC));
@@ -157,33 +99,25 @@
     		odbc = buildSocketConfiguration(queryEngineNode.get(Configuration.ODBC));
     	}
     	
-    	String asyncExecutor = "teiid-async"; //$NON-NLS-1$
-    	if (queryEngineNode.hasDefined(Configuration.ASYNC_THREAD_GROUP)) {
-    		asyncExecutor = queryEngineNode.get(Configuration.ASYNC_THREAD_GROUP).asString();
-    	}	                	
-    	
     	// now build the engine
     	final RuntimeEngineDeployer engine = buildQueryEngine(queryEngineNode);
     	engine.setJdbcSocketConfiguration(jdbc);
     	engine.setOdbcSocketConfiguration(odbc);
-    	engine.setVDBRepository(vdbRepo);
-    	engine.setCacheFactory(cacheFactory);
-    	engine.setResultsetCacheConfig(resultsetCache);
-    	engine.setPreparedPlanCacheConfig(preparePlanCache);
     	engine.setSecurityHelper(new JBossSecurityHelper());
-    	engine.setTranslatorRepository(translatorRepo);
-    	engine.setAuthorizationValidator(authValidator);
     	engine.setContainerLifeCycleListener(shutdownListener);
+    	// TODO: none of the caching is configured..
     	
         
-        ServiceBuilder<ClientServiceRegistry> serviceBuilder = target.addService(TeiidServiceNames.ENGINE, engine);
+        ServiceBuilder<ClientServiceRegistry> serviceBuilder = target.addService(TeiidServiceNames.engineServiceName(engine.getName()), engine);
         
         serviceBuilder.addDependency(ServiceName.JBOSS.append("connector", "workmanager"), WorkManager.class, engine.workManagerInjector); //$NON-NLS-1$ //$NON-NLS-2$
         serviceBuilder.addDependency(ServiceName.JBOSS.append("txn", "XATerminator"), XATerminator.class, engine.xaTerminatorInjector); //$NON-NLS-1$ //$NON-NLS-2$
         serviceBuilder.addDependency(ServiceName.JBOSS.append("txn", "TransactionManager"), TransactionManager.class, engine.txnManagerInjector); //$NON-NLS-1$ //$NON-NLS-2$
-        serviceBuilder.addDependency(ServiceName.JBOSS.append("thread", "executor", asyncExecutor), Executor.class, engine.threadPoolInjector); //$NON-NLS-1$ //$NON-NLS-2$
         serviceBuilder.addDependency(TeiidServiceNames.BUFFER_MGR, BufferServiceImpl.class, engine.bufferServiceInjector);
         serviceBuilder.addDependency(TeiidServiceNames.SYSTEM_VDB, SystemVDBDeployer.class,  new InjectedValue<SystemVDBDeployer>());
+        serviceBuilder.addDependency(TeiidServiceNames.TRANSLATOR_REPO, TranslatorRepository.class, engine.translatorRepositoryInjector);
+        serviceBuilder.addDependency(TeiidServiceNames.VDB_REPO, VDBRepository.class, engine.vdbRepositoryInjector);
+        serviceBuilder.addDependency(TeiidServiceNames.AUTHORIZATION_VALIDATOR, AuthorizationValidator.class, engine.authorizationValidatorInjector);
         
         if (jdbc != null) {
         	serviceBuilder.addDependency(ServiceName.JBOSS.append("binding", jdbc.getSocketBinding()), SocketBinding.class, engine.jdbcSocketBindingInjector); //$NON-NLS-1$
@@ -198,7 +132,7 @@
         BinderService binder = new BinderService(LocalServerConnection.TEIID_RUNTIME);
         ServiceBuilder<ManagedReferenceFactory> namingBuilder = target.addService(javaContext.append(LocalServerConnection.TEIID_RUNTIME), binder);
         namingBuilder.addDependency(javaContext, NamingStore.class, binder.getNamingStoreInjector());
-        namingBuilder.addDependency(TeiidServiceNames.ENGINE, RuntimeEngineDeployer.class, new ManagedReferenceInjector<RuntimeEngineDeployer>(binder.getManagedObjectInjector()));
+        namingBuilder.addDependency(TeiidServiceNames.engineServiceName(engine.getName()), RuntimeEngineDeployer.class, new ManagedReferenceInjector<RuntimeEngineDeployer>(binder.getManagedObjectInjector()));
         namingBuilder.setInitialMode(ServiceController.Mode.ON_DEMAND);
         newControllers.add(namingBuilder.install());
         
@@ -215,49 +149,18 @@
 		        }
 	        }
         }
-        
-        serviceBuilder.addListener(new AbstractServiceListener<Object>() {
-            @Override
-            public void transition(ServiceController<?> serviceController, ServiceController.Transition transition) {
-            	
-            	if (transition.equals(ServiceController.Transition.START_INITIATING_to_STARTING)) {
-            		vdbRepo.start();
-            		bufferManager.start();            		
-            	}
-            	
-            	if (transition.equals(ServiceController.Transition.STOPPING_to_DOWN)) {
-            		bufferManager.stop();
-            	}
-            }
-            
-            @Override
-            public void serviceRemoveRequested(ServiceController<?> serviceController) {
-                serviceController.removeListener(this);
-            }                     
-        });
                   
         serviceBuilder.setInitialMode(ServiceController.Mode.ACTIVE);
         ServiceController<ClientServiceRegistry> controller = serviceBuilder.install(); 
         newControllers.add(controller);
         ServiceContainer container =  controller.getServiceContainer();
         container.addTerminateListener(shutdownListener);    	
-    	
-        context.addStep(new AbstractDeploymentChainStep() {
-			@Override
-			public void execute(DeploymentProcessorTarget processorTarget) {
-				processorTarget.addDeploymentProcessor(Phase.STRUCTURE, Phase.STRUCTURE_WAR_DEPLOYMENT_INIT|0x0001,new VDBStructure());
-				processorTarget.addDeploymentProcessor(Phase.PARSE, Phase.PARSE_WEB_DEPLOYMENT|0x0001, new VDBParserDeployer(vdbRepo, serializer));
-				processorTarget.addDeploymentProcessor(Phase.DEPENDENCIES, Phase.DEPENDENCIES_WAR_MODULE|0x0001, new VDBDependencyProcessor());
-				processorTarget.addDeploymentProcessor(Phase.INSTALL, Phase.INSTALL_WAR_DEPLOYMENT|0x0001, new VDBDeployer(vdbRepo, engine.threadPoolInjector, translatorRepo, serializer, shutdownListener));            			
-			}
-        	
-        }, OperationContext.Stage.RUNTIME);
     }
 
 	
 	private RuntimeEngineDeployer buildQueryEngine(ModelNode node) {
-		RuntimeEngineDeployer engine = new RuntimeEngineDeployer();
-		
+		RuntimeEngineDeployer engine = new RuntimeEngineDeployer(node.require(Configuration.ENGINE_NAME).asString());
+    	
     	if (node.hasDefined(Configuration.MAX_THREADS)) {
     		engine.setMaxThreads(node.get(Configuration.MAX_THREADS).asInt());
     	}
@@ -303,113 +206,8 @@
     	
 		return engine;
 	}
-
-
-    private VDBRepository buildVDBRepository(ModelNode node) {
-    	SystemFunctionManager systemFunctionManager = new SystemFunctionManager();
-    	if (node.hasDefined(Configuration.ALLOW_ENV_FUNCTION)) {
-    		systemFunctionManager.setAllowEnvFunction(node.get(Configuration.ALLOW_ENV_FUNCTION).asBoolean());
-    	}
-    	else {
-    		systemFunctionManager.setAllowEnvFunction(false);
-    	}
-    	
-    	VDBRepository vdbRepository = new VDBRepository();
-    	vdbRepository.setSystemFunctionManager(systemFunctionManager);	
-    	return vdbRepository;               	
-    }
+        
     
-    private BufferServiceImpl  buildBufferManager(ModelNode node) {
-    	BufferServiceImpl bufferManger = new BufferServiceImpl();
-    	
-    	if (node == null) {
-    		return bufferManger;
-    	}
-    	
-    	if (node.hasDefined(Configuration.USE_DISK)) {
-    		bufferManger.setUseDisk(node.get(Configuration.USE_DISK).asBoolean());
-    	}	                	
-    	if (node.hasDefined(Configuration.PROCESSOR_BATCH_SIZE)) {
-    		bufferManger.setProcessorBatchSize(node.get(Configuration.PROCESSOR_BATCH_SIZE).asInt());
-    	}	
-    	if (node.hasDefined(Configuration.CONNECTOR_BATCH_SIZE)) {
-    		bufferManger.setConnectorBatchSize(node.get(Configuration.CONNECTOR_BATCH_SIZE).asInt());
-    	}	
-    	if (node.hasDefined(Configuration.MAX_PROCESSING_KB)) {
-    		bufferManger.setMaxProcessingKb(node.get(Configuration.MAX_PROCESSING_KB).asInt());
-    	}
-    	if (node.hasDefined(Configuration.MAX_RESERVED_KB)) {
-    		bufferManger.setMaxReserveKb(node.get(Configuration.MAX_RESERVED_KB).asInt());
-    	}
-    	if (node.hasDefined(Configuration.MAX_FILE_SIZE)) {
-    		bufferManger.setMaxFileSize(node.get(Configuration.MAX_FILE_SIZE).asLong());
-    	}
-    	if (node.hasDefined(Configuration.MAX_BUFFER_SPACE)) {
-    		bufferManger.setMaxBufferSpace(node.get(Configuration.MAX_BUFFER_SPACE).asLong());
-    	}
-    	if (node.hasDefined(Configuration.MAX_OPEN_FILES)) {
-    		bufferManger.setMaxOpenFiles(node.get(Configuration.MAX_OPEN_FILES).asInt());
-    	}	                	
-    	return bufferManger;
-    }
-    
-    private <T> T buildService(Class<T> type, String moduleName) throws OperationFailedException {
-        final ModuleIdentifier moduleId;
-        final Module module;
-        try {
-            moduleId = ModuleIdentifier.create(moduleName);
-            module = Module.getCallerModuleLoader().loadModule(moduleId);
-        } catch (ModuleLoadException e) {
-            throw new OperationFailedException(e, new ModelNode().set(IntegrationPlugin.Util.getString("failed_load_module", moduleName))); //$NON-NLS-1$
-        }
-        ServiceLoader<T> services = module.loadService(type);
-        return services.iterator().next();
-    }
-    
-    private CacheFactory getCacheFactory(ModelNode node) {
-    	CacheFactory cacheFactory = new DefaultCacheFactory();	
-    	/*
-    	if (node.hasDefined(Configuration.CLASS)) {
-    		String className = node.get(Configuration.CLASS).asString();
-    	}
-    	
-    	if (node.hasDefined(Configuration.ENABLED)) {
-    		cacheFactory.setEnabled(node.get(Configuration.ENABLED).asBoolean());
-    	}
-    	else {
-    		cacheFactory.setEnabled(true);
-    	}
-    	if (node.hasDefined(Configuration.CACHE_SERVICE_JNDI_NAME)) {
-    		cacheFactory.setCacheManager(node.get(Configuration.CACHE_SERVICE_JNDI_NAME).asString());
-    	}	                	
-    	if (node.hasDefined(Configuration.RESULTSET_CACHE_NAME)) {
-    		cacheFactory.setResultsetCacheName(node.get(Configuration.RESULTSET_CACHE_NAME).asString());
-    	}
-    	*/		                	
-    	return cacheFactory;
-    }
-    
-    private CacheConfiguration buildCacheConfig(ModelNode node) {
-    	CacheConfiguration cacheConfig = new CacheConfiguration();
-    	
-    	if (node.hasDefined(Configuration.MAX_ENTRIES)) {
-    		cacheConfig.setMaxEntries(node.get(Configuration.MAX_ENTRIES).asInt());
-    	}
-    	if (node.hasDefined(Configuration.MAX_AGE_IN_SECS)) {
-    		cacheConfig.setMaxAgeInSeconds(node.get(Configuration.MAX_AGE_IN_SECS).asInt());
-    	}
-    	if (node.hasDefined(Configuration.MAX_STALENESS)) {
-    		cacheConfig.setMaxStaleness(node.get(Configuration.MAX_STALENESS).asInt());
-    	}
-    	if (node.hasDefined(Configuration.CACHE_TYPE)) {
-    		cacheConfig.setType(node.get(Configuration.CACHE_TYPE).asString());
-    	}
-    	if (node.hasDefined(Configuration.CACHE_LOCATION)) {
-    		cacheConfig.setLocation(node.get(Configuration.CACHE_LOCATION).asString());
-    	}	   	                	
-    	return cacheConfig;
-	}	                
-    
 	private SocketConfiguration buildSocketConfiguration(ModelNode node) {
 		SocketConfiguration socket = new SocketConfiguration();
 		

Deleted: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineDescription.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineDescription.java	2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineDescription.java	2011-08-22 14:36:06 UTC (rev 3422)
@@ -1,181 +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;
-
-import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.*;
-import static org.teiid.jboss.Configuration.*;
-
-import java.util.Locale;
-import java.util.ResourceBundle;
-
-import org.jboss.as.controller.descriptions.DescriptionProvider;
-import org.jboss.dmr.ModelNode;
-import org.jboss.dmr.ModelType;
-
-class QueryEngineDescription implements DescriptionProvider {
-	
-	
-	@Override
-	public ModelNode getModelDescription(Locale locale) {
-		final ResourceBundle bundle = IntegrationPlugin.getResourceBundle(locale);
-		
-        final ModelNode node = new ModelNode();
-        node.get(OPERATION_NAME).set(ADD);
-        node.get(DESCRIPTION).set("susbsystem.add"); //$NON-NLS-1$
-        
-        getQueryEngineDescription(node.get(CHILDREN, Configuration.QUERY_ENGINE), REQUEST_PROPERTIES, bundle);
-        return node;
-	}
-		
-	static void getQueryEngineDescription(ModelNode node, String type, ResourceBundle bundle) {
-		addAttribute(node, Configuration.ASYNC_THREAD_GROUP, type, bundle.getString(Configuration.ASYNC_THREAD_GROUP+DESC), ModelType.STRING, false, "teiid-async"); //$NON-NLS-1$
-		addAttribute(node, Configuration.MAX_THREADS, type, bundle.getString(Configuration.MAX_THREADS+DESC), ModelType.INT, false, "64"); //$NON-NLS-1$
-		addAttribute(node, Configuration.MAX_ACTIVE_PLANS, type, bundle.getString(Configuration.MAX_ACTIVE_PLANS+DESC), ModelType.INT, false, "20"); //$NON-NLS-1$
-		addAttribute(node, Configuration.USER_REQUEST_SOURCE_CONCURRENCY, type, bundle.getString(Configuration.USER_REQUEST_SOURCE_CONCURRENCY+DESC), ModelType.INT, false, "0"); //$NON-NLS-1$
-		addAttribute(node, Configuration.TIME_SLICE_IN_MILLI, type, bundle.getString(Configuration.TIME_SLICE_IN_MILLI+DESC), ModelType.INT, false, "2000"); //$NON-NLS-1$		
-		addAttribute(node, Configuration.MAX_ROWS_FETCH_SIZE, type, bundle.getString(Configuration.MAX_ROWS_FETCH_SIZE+DESC), ModelType.INT, false, "20480"); //$NON-NLS-1$
-		addAttribute(node, Configuration.LOB_CHUNK_SIZE_IN_KB, type, bundle.getString(Configuration.LOB_CHUNK_SIZE_IN_KB+DESC), ModelType.INT, false, "100"); //$NON-NLS-1$
-		addAttribute(node, Configuration.QUERY_THRESHOLD_IN_SECS, type, bundle.getString(Configuration.QUERY_THRESHOLD_IN_SECS+DESC), ModelType.INT, false, "600"); //$NON-NLS-1$		
-		addAttribute(node, Configuration.MAX_SOURCE_ROWS, type, bundle.getString(Configuration.MAX_SOURCE_ROWS+DESC), ModelType.INT, false, "-1"); //$NON-NLS-1$
-		addAttribute(node, Configuration.EXCEPTION_ON_MAX_SOURCE_ROWS, type, bundle.getString(Configuration.EXCEPTION_ON_MAX_SOURCE_ROWS+DESC), ModelType.BOOLEAN, false, "true"); //$NON-NLS-1$
-		addAttribute(node, Configuration.MAX_ODBC_LOB_SIZE_ALLOWED, type, bundle.getString(Configuration.MAX_ODBC_LOB_SIZE_ALLOWED+DESC), ModelType.INT, false, "5242880"); //$NON-NLS-1$
-		addAttribute(node, Configuration.EVENT_DISTRIBUTOR_NAME, type, bundle.getString(Configuration.EVENT_DISTRIBUTOR_NAME+DESC), ModelType.STRING, false, "teiid/event-distributor"); //$NON-NLS-1$
-		addAttribute(node, Configuration.DETECTING_CHANGE_EVENTS, type, bundle.getString(Configuration.DETECTING_CHANGE_EVENTS+DESC), ModelType.BOOLEAN, false, "true"); //$NON-NLS-1$
-		
-		//session stuff
-		addAttribute(node, Configuration.SECURITY_DOMAIN, type, bundle.getString(Configuration.SECURITY_DOMAIN+DESC), ModelType.STRING, false, null);
-		addAttribute(node, Configuration.MAX_SESSIONS_ALLOWED, type, bundle.getString(Configuration.MAX_SESSIONS_ALLOWED+DESC), ModelType.INT, false, "5000"); //$NON-NLS-1$
-		addAttribute(node, Configuration.SESSION_EXPIRATION_TIME_LIMIT, type, bundle.getString(Configuration.SESSION_EXPIRATION_TIME_LIMIT+DESC), ModelType.INT, false, "0"); //$NON-NLS-1$
-		
-		addAttribute(node, Configuration.ALLOW_ENV_FUNCTION, type, bundle.getString(Configuration.ALLOW_ENV_FUNCTION+DESC), ModelType.BOOLEAN, false, "false"); //$NON-NLS-1$
-		
-		//Buffer Manager stuff
-		ModelNode bufferNode = node.get(CHILDREN, Configuration.BUFFER_SERVICE);
-		bufferNode.get(TYPE).set(ModelType.OBJECT);
-		bufferNode.get(DESCRIPTION).set(bundle.getString(Configuration.BUFFER_SERVICE+DESC));
-		bufferNode.get(REQUIRED).set(false);
-		bufferNode.get(MAX_OCCURS).set(1);
-		bufferNode.get(MIN_OCCURS).set(1);
-		getBufferDescription(bufferNode, type, bundle);
-		
-		// result-set-cache
-		ModelNode rsCacheNode = node.get(CHILDREN, Configuration.RESULTSET_CACHE);
-		rsCacheNode.get(TYPE).set(ModelType.OBJECT);
-		rsCacheNode.get(DESCRIPTION).set(bundle.getString(Configuration.RESULTSET_CACHE+DESC));
-		rsCacheNode.get(REQUIRED).set(false);
-		rsCacheNode.get(MAX_OCCURS).set(1);
-		rsCacheNode.get(MIN_OCCURS).set(1);
-		getResultsetCacheDescription(rsCacheNode, type, bundle);
-		
-		// preparedplan-set-cache
-		ModelNode preparedPlanCacheNode = node.get(CHILDREN, Configuration.PREPAREDPLAN_CACHE);
-		preparedPlanCacheNode.get(TYPE).set(ModelType.OBJECT);
-		preparedPlanCacheNode.get(DESCRIPTION).set(bundle.getString(Configuration.PREPAREDPLAN_CACHE+DESC));
-		preparedPlanCacheNode.get(REQUIRED).set(false);
-		preparedPlanCacheNode.get(MAX_OCCURS).set(1);
-		preparedPlanCacheNode.get(MIN_OCCURS).set(1);
-		getResultsetCacheDescription(preparedPlanCacheNode, type, bundle);
-		
-		//distributed-cache
-		ModelNode distributedCacheNode = node.get(CHILDREN, Configuration.CACHE_FACORY);
-		distributedCacheNode.get(TYPE).set(ModelType.OBJECT);
-		distributedCacheNode.get(DESCRIPTION).set(bundle.getString(Configuration.CACHE_FACORY+DESC));
-		distributedCacheNode.get(REQUIRED).set(false);
-		distributedCacheNode.get(MAX_OCCURS).set(1);
-		distributedCacheNode.get(MIN_OCCURS).set(1);
-		getDistributedCacheDescription(preparedPlanCacheNode, type, bundle);
-		
-		//jdbc
-		ModelNode jdbcSocketNode = node.get(CHILDREN, Configuration.JDBC);
-		jdbcSocketNode.get(TYPE).set(ModelType.OBJECT);
-		jdbcSocketNode.get(DESCRIPTION).set(bundle.getString(Configuration.JDBC+DESC));
-		jdbcSocketNode.get(REQUIRED).set(false);
-		jdbcSocketNode.get(MAX_OCCURS).set(1);
-		jdbcSocketNode.get(MIN_OCCURS).set(1);	
-		getSocketConfig(jdbcSocketNode, type, bundle);
-		
-		//odbc
-		ModelNode odbcSocketNode = node.get(CHILDREN, Configuration.ODBC);
-		odbcSocketNode.get(TYPE).set(ModelType.OBJECT);
-		odbcSocketNode.get(DESCRIPTION).set(bundle.getString(Configuration.ODBC+DESC));
-		odbcSocketNode.get(REQUIRED).set(false);
-		odbcSocketNode.get(MAX_OCCURS).set(1);
-		odbcSocketNode.get(MIN_OCCURS).set(1);	
-		getSocketConfig(odbcSocketNode, type, bundle);			
-	}
-	
-	private static void getDistributedCacheDescription(ModelNode node, String type, ResourceBundle bundle) {
-		addAttribute(node, Configuration.CACHE_SERVICE_JNDI_NAME, type, bundle.getString(Configuration.CACHE_SERVICE_JNDI_NAME+DESC), ModelType.STRING, false, "java:TeiidCacheManager"); //$NON-NLS-1$
-		addAttribute(node, Configuration.RESULTSET_CACHE_NAME, type, bundle.getString(Configuration.RESULTSET_CACHE_NAME+DESC), ModelType.STRING, false, "teiid-resultset-cache"); //$NON-NLS-1$
-	}
-	
-	private static void getBufferDescription(ModelNode node, String type, ResourceBundle bundle) {
-		addAttribute(node, Configuration.USE_DISK, type, bundle.getString(Configuration.USE_DISK+DESC), ModelType.BOOLEAN, false, "true"); //$NON-NLS-1$
-		addAttribute(node, Configuration.PROCESSOR_BATCH_SIZE, type, bundle.getString(Configuration.PROCESSOR_BATCH_SIZE+DESC), ModelType.INT, false, "512"); //$NON-NLS-1$
-		addAttribute(node, Configuration.CONNECTOR_BATCH_SIZE, type, bundle.getString(Configuration.CONNECTOR_BATCH_SIZE+DESC), ModelType.INT, false, "1024"); //$NON-NLS-1$
-		addAttribute(node, Configuration.MAX_PROCESSING_KB, type, bundle.getString(Configuration.MAX_PROCESSING_KB+DESC), ModelType.INT, false, "-1"); //$NON-NLS-1$
-		addAttribute(node, Configuration.MAX_RESERVED_KB, type, bundle.getString(Configuration.MAX_RESERVED_KB+DESC), ModelType.INT, false, "-1"); //$NON-NLS-1$
-		addAttribute(node, Configuration.MAX_FILE_SIZE, type, bundle.getString(Configuration.MAX_FILE_SIZE+DESC), ModelType.LONG, false, "2048"); //$NON-NLS-1$
-		addAttribute(node, Configuration.MAX_BUFFER_SPACE, type, bundle.getString(Configuration.MAX_BUFFER_SPACE+DESC), ModelType.LONG, false, "51200"); //$NON-NLS-1$
-		addAttribute(node, Configuration.MAX_OPEN_FILES, type, bundle.getString(Configuration.MAX_OPEN_FILES+DESC), ModelType.INT, false, "64"); //$NON-NLS-1$
-	}	
-
-	static void getResultsetCacheDescription(ModelNode node, String type, ResourceBundle bundle) {
-		addAttribute(node, Configuration.MAX_ENTRIES, type, bundle.getString(Configuration.MAX_ENTRIES+DESC), ModelType.INT, false, "1024"); //$NON-NLS-1$
-		addAttribute(node, Configuration.MAX_AGE_IN_SECS, type, bundle.getString(Configuration.MAX_AGE_IN_SECS+DESC), ModelType.INT, false, "7200");//$NON-NLS-1$
-		addAttribute(node, Configuration.MAX_STALENESS, type, bundle.getString(Configuration.MAX_STALENESS+DESC), ModelType.INT, false, "60");//$NON-NLS-1$
-		addAttribute(node, Configuration.CACHE_TYPE, type, bundle.getString(Configuration.CACHE_TYPE+DESC), ModelType.STRING, false, "EXPIRATION"); //$NON-NLS-1$
-		addAttribute(node, Configuration.CACHE_LOCATION, type, bundle.getString(Configuration.CACHE_LOCATION+DESC), ModelType.STRING, false, "resultset");	//$NON-NLS-1$	
-	}
-	
-	static void getPreparedPalnCacheDescription(ModelNode node, String type, ResourceBundle bundle) {
-		addAttribute(node, Configuration.MAX_ENTRIES, type, bundle.getString(Configuration.MAX_ENTRIES+DESC), ModelType.INT, false, "512"); //$NON-NLS-1$
-		addAttribute(node, Configuration.MAX_AGE_IN_SECS, type, bundle.getString(Configuration.MAX_AGE_IN_SECS+DESC), ModelType.INT, false, "28800");//$NON-NLS-1$
-		addAttribute(node, Configuration.MAX_STALENESS, type, bundle.getString(Configuration.MAX_STALENESS+DESC), ModelType.INT, false, "0");//$NON-NLS-1$
-		addAttribute(node, Configuration.CACHE_TYPE, type, bundle.getString(Configuration.CACHE_TYPE+DESC), ModelType.STRING, false, "LRU"); //$NON-NLS-1$
-		addAttribute(node, Configuration.CACHE_LOCATION, type, bundle.getString(Configuration.CACHE_LOCATION+DESC), ModelType.STRING, false, "preparedplan");	//$NON-NLS-1$	
-	}
-	
-	static void getSocketConfig(ModelNode node, String type, ResourceBundle bundle) {
-		addAttribute(node, Configuration.SOCKET_ENABLED, type, bundle.getString(Configuration.SOCKET_ENABLED+DESC), ModelType.BOOLEAN, false, "true"); //$NON-NLS-1$
-		addAttribute(node, Configuration.MAX_SOCKET_THREAD_SIZE, type, bundle.getString(Configuration.MAX_SOCKET_THREAD_SIZE+DESC), ModelType.INT, false, "0"); //$NON-NLS-1$
-		addAttribute(node, Configuration.IN_BUFFER_SIZE, type, bundle.getString(Configuration.IN_BUFFER_SIZE+DESC), ModelType.INT, false, "0"); //$NON-NLS-1$
-		addAttribute(node, Configuration.OUT_BUFFER_SIZE, type, bundle.getString(Configuration.OUT_BUFFER_SIZE+DESC), ModelType.INT, false, "0"); //$NON-NLS-1$
-		addAttribute(node, Configuration.SOCKET_BINDING, type, bundle.getString(Configuration.SOCKET_BINDING+DESC), ModelType.INT, true, null);
-		
-		ModelNode sslNode = node.get(CHILDREN, Configuration.SSL);
-		sslNode.get(TYPE).set(ModelType.OBJECT);
-		sslNode.get(DESCRIPTION).set(bundle.getString(Configuration.SSL+DESC));
-		sslNode.get(REQUIRED).set(false);
-		sslNode.get(MAX_OCCURS).set(1);
-		sslNode.get(MIN_OCCURS).set(0);
-		addAttribute(node, Configuration.SSL_MODE, type, bundle.getString(Configuration.SSL_MODE+DESC), ModelType.STRING, false, "login");	//$NON-NLS-1$
-		addAttribute(node, Configuration.KEY_STORE_FILE, type, bundle.getString(Configuration.KEY_STORE_FILE+DESC), ModelType.STRING, false, null);	
-		addAttribute(node, Configuration.KEY_STORE_PASSWD, type, bundle.getString(Configuration.KEY_STORE_PASSWD+DESC), ModelType.STRING, false, null);
-		addAttribute(node, Configuration.KEY_STORE_TYPE, type, bundle.getString(Configuration.KEY_STORE_TYPE+DESC), ModelType.STRING, false, "JKS"); //$NON-NLS-1$
-		addAttribute(node, Configuration.SSL_PROTOCOL, type, bundle.getString(Configuration.SSL_PROTOCOL+DESC), ModelType.BOOLEAN, false, "SSLv3");	//$NON-NLS-1$
-		addAttribute(node, Configuration.KEY_MANAGEMENT_ALG, type, bundle.getString(Configuration.KEY_MANAGEMENT_ALG+DESC), ModelType.STRING, false, "false");	//$NON-NLS-1$
-		addAttribute(node, Configuration.TRUST_FILE, type, bundle.getString(Configuration.TRUST_FILE+DESC), ModelType.STRING, false, null);	
-		addAttribute(node, Configuration.TRUST_PASSWD, type, bundle.getString(Configuration.TRUST_PASSWD+DESC), ModelType.STRING, false, null);	
-		addAttribute(node, Configuration.AUTH_MODE, type, bundle.getString(Configuration.AUTH_MODE+DESC), ModelType.STRING, false, "anonymous");	//$NON-NLS-1$
-	}
-}

Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineOperationHandler.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineOperationHandler.java	2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineOperationHandler.java	2011-08-22 14:36:06 UTC (rev 3422)
@@ -22,6 +22,7 @@
 package org.teiid.jboss;
 
 import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.*;
+import static org.teiid.jboss.Configuration.addAttribute;
 
 import java.util.Collection;
 import java.util.List;
@@ -56,7 +57,7 @@
     protected void performRuntime(final OperationContext context, final ModelNode operation, final ModelNode model,
             final ServiceVerificationHandler verificationHandler, final List<ServiceController<?>> newControllers) throws OperationFailedException {
 		
-        ServiceController<?> sc = context.getServiceRegistry(false).getRequiredService(TeiidServiceNames.ENGINE);
+        ServiceController<?> sc = context.getServiceRegistry(false).getRequiredService(TeiidServiceNames.engineServiceName(operation.require(Configuration.ENGINE_NAME).asString()));
         RuntimeEngineDeployer engine = RuntimeEngineDeployer.class.cast(sc.getValue());
         executeOperation(engine, operation, model);
     }
@@ -68,6 +69,7 @@
         final ModelNode operation = new ModelNode();
         operation.get(OPERATION_NAME).set(this.operationName);
         operation.get(DESCRIPTION).set(bundle.getString(getBundleOperationName()+DESCRIBE));
+        addAttribute(operation, Configuration.ENGINE_NAME, REQUEST_PROPERTIES, bundle.getString(Configuration.ENGINE_NAME+Configuration.DESC), ModelType.STRING, true, null);
         describeParameters(operation, bundle);
         return operation;
     }	

Added: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineRemove.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineRemove.java	                        (rev 0)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineRemove.java	2011-08-22 14:36:06 UTC (rev 3422)
@@ -0,0 +1,73 @@
+/*
+ * 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;
+
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.DESCRIPTION;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OPERATION_NAME;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.REMOVE;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.REQUEST_PROPERTIES;
+import static org.teiid.jboss.Configuration.addAttribute;
+
+import java.util.List;
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+import org.jboss.as.controller.AbstractAddStepHandler;
+import org.jboss.as.controller.OperationContext;
+import org.jboss.as.controller.OperationFailedException;
+import org.jboss.as.controller.ServiceVerificationHandler;
+import org.jboss.as.controller.descriptions.DescriptionProvider;
+import org.jboss.dmr.ModelNode;
+import org.jboss.dmr.ModelType;
+import org.jboss.msc.service.ServiceController;
+import org.jboss.msc.service.ServiceRegistry;
+
+public class QueryEngineRemove extends AbstractAddStepHandler implements DescriptionProvider {
+
+	@Override
+	public ModelNode getModelDescription(Locale locale) {
+        final ResourceBundle bundle = IntegrationPlugin.getResourceBundle(locale);
+        final ModelNode operation = new ModelNode();
+        operation.get(OPERATION_NAME).set(REMOVE);
+        operation.get(DESCRIPTION).set(bundle.getString("engine.remove")); //$NON-NLS-1$    
+        addAttribute(operation, Configuration.ENGINE_NAME, REQUEST_PROPERTIES, bundle.getString(Configuration.ENGINE_NAME+Configuration.DESC), ModelType.STRING, true, null);
+        return operation;
+	}
+	
+	@Override
+	protected void populateModel(final ModelNode operation, final ModelNode model) throws OperationFailedException {
+		final String name = model.require(Configuration.ENGINE_NAME).asString();
+		model.get(Configuration.ENGINE_NAME).set(name);
+	}
+	
+	@Override
+    protected void performRuntime(final OperationContext context, final ModelNode operation, final ModelNode model,
+            final ServiceVerificationHandler verificationHandler, final List<ServiceController<?>> newControllers) throws OperationFailedException {
+		
+		final String engineName = model.require(Configuration.ENGINE_NAME).asString();
+        final ServiceRegistry registry = context.getServiceRegistry(true);
+        final ServiceController<?> controller = registry.getService(TeiidServiceNames.translatorServiceName(engineName));
+        if (controller != null) {
+            controller.setMode(ServiceController.Mode.REMOVE);
+        }
+	}
+}


Property changes on: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineRemove.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidBootServicesAdd.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidBootServicesAdd.java	                        (rev 0)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidBootServicesAdd.java	2011-08-22 14:36:06 UTC (rev 3422)
@@ -0,0 +1,368 @@
+/*
+ * 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;
+
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.*;
+import static org.teiid.jboss.Configuration.DESC;
+import static org.teiid.jboss.Configuration.addAttribute;
+
+import java.util.List;
+import java.util.Locale;
+import java.util.ResourceBundle;
+import java.util.ServiceLoader;
+import java.util.concurrent.Executor;
+
+import org.jboss.as.controller.*;
+import org.jboss.as.controller.descriptions.DescriptionProvider;
+import org.jboss.as.server.AbstractDeploymentChainStep;
+import org.jboss.as.server.DeploymentProcessorTarget;
+import org.jboss.as.server.deployment.Phase;
+import org.jboss.as.server.services.path.RelativePathService;
+import org.jboss.dmr.ModelNode;
+import org.jboss.dmr.ModelType;
+import org.jboss.modules.Module;
+import org.jboss.modules.ModuleIdentifier;
+import org.jboss.modules.ModuleLoadException;
+import org.jboss.msc.service.*;
+import org.jboss.msc.value.InjectedValue;
+import org.teiid.PolicyDecider;
+import org.teiid.cache.CacheConfiguration;
+import org.teiid.cache.CacheFactory;
+import org.teiid.cache.DefaultCacheFactory;
+import org.teiid.deployers.*;
+import org.teiid.dqp.internal.datamgr.TranslatorRepository;
+import org.teiid.dqp.internal.process.AuthorizationValidator;
+import org.teiid.dqp.internal.process.DataRolePolicyDecider;
+import org.teiid.dqp.internal.process.DefaultAuthorizationValidator;
+import org.teiid.query.function.SystemFunctionManager;
+import org.teiid.services.BufferServiceImpl;
+
+public class TeiidBootServicesAdd extends AbstractAddStepHandler implements DescriptionProvider {
+
+	@Override
+	public ModelNode getModelDescription(Locale locale) {
+        final ResourceBundle bundle = IntegrationPlugin.getResourceBundle(locale);
+        final ModelNode node = new ModelNode();
+        node.get(OPERATION_NAME).set(ADD);
+        node.get(DESCRIPTION).set(bundle.getString("teiid-boot.add")); //$NON-NLS-1$
+        
+        addAttribute(node, Configuration.ALLOW_ENV_FUNCTION, REQUEST_PROPERTIES, bundle.getString(Configuration.ALLOW_ENV_FUNCTION+DESC), ModelType.BOOLEAN, false, "false"); //$NON-NLS-1$
+        addAttribute(node, Configuration.ASYNC_THREAD_GROUP, REQUEST_PROPERTIES, bundle.getString(Configuration.ASYNC_THREAD_GROUP+DESC), ModelType.STRING, false, "teiid-async-threads"); //$NON-NLS-1$
+
+        addAttribute(node, Configuration.AUTHORIZATION_VALIDATOR_MODULE, REQUEST_PROPERTIES, bundle.getString(Configuration.AUTHORIZATION_VALIDATOR_MODULE+DESC), ModelType.BOOLEAN, false, "false"); //$NON-NLS-1$
+        addAttribute(node, Configuration.POLICY_DECIDER_MODULE, REQUEST_PROPERTIES, bundle.getString(Configuration.POLICY_DECIDER_MODULE+DESC), ModelType.STRING, false, "teiid-async-threads"); //$NON-NLS-1$
+        
+		ModelNode bufferNode = node.get(CHILDREN, Configuration.BUFFER_SERVICE);
+		bufferNode.get(TYPE).set(ModelType.OBJECT);
+		bufferNode.get(DESCRIPTION).set(bundle.getString(Configuration.BUFFER_SERVICE+DESC));
+		bufferNode.get(REQUIRED).set(false);
+		getBufferManagerDesciption(bufferNode, ATTRIBUTES, bundle);		
+        
+		// result-set-cache
+		ModelNode rsCacheNode = node.get(CHILDREN, Configuration.RESULTSET_CACHE);
+		rsCacheNode.get(TYPE).set(ModelType.OBJECT);
+		rsCacheNode.get(DESCRIPTION).set(bundle.getString(Configuration.RESULTSET_CACHE+DESC));
+		rsCacheNode.get(REQUIRED).set(false);
+		getResultsetCacheDescription(rsCacheNode, ATTRIBUTES, bundle);
+		
+		// preparedplan-set-cache
+		ModelNode preparedPlanCacheNode = node.get(CHILDREN, Configuration.PREPAREDPLAN_CACHE);
+		preparedPlanCacheNode.get(TYPE).set(ModelType.OBJECT);
+		preparedPlanCacheNode.get(DESCRIPTION).set(bundle.getString(Configuration.PREPAREDPLAN_CACHE+DESC));
+		preparedPlanCacheNode.get(REQUIRED).set(false);
+		getResultsetCacheDescription(preparedPlanCacheNode, ATTRIBUTES, bundle);
+		
+		//distributed-cache
+		ModelNode distributedCacheNode = node.get(CHILDREN, Configuration.CACHE_FACORY);
+		distributedCacheNode.get(TYPE).set(ModelType.OBJECT);
+		distributedCacheNode.get(DESCRIPTION).set(bundle.getString(Configuration.CACHE_FACORY+DESC));
+		distributedCacheNode.get(REQUIRED).set(false);
+		getDistributedCacheDescription(preparedPlanCacheNode, ATTRIBUTES, bundle);
+		
+        return node;
+	}
+
+	@Override
+	protected void populateModel(ModelNode operation, ModelNode model)	throws OperationFailedException {
+		if (operation.hasDefined(Configuration.ALLOW_ENV_FUNCTION)) {
+			model.get(Configuration.ALLOW_ENV_FUNCTION).set(operation.get(Configuration.ALLOW_ENV_FUNCTION).asString());
+		}
+		if (operation.hasDefined(Configuration.ASYNC_THREAD_GROUP)) {
+			model.get(Configuration.ASYNC_THREAD_GROUP).set(operation.get(Configuration.ASYNC_THREAD_GROUP).asString());
+		}
+		populateBufferManager(operation, model);
+		
+	}
+	
+	@Override
+    protected void performRuntime(final OperationContext context, final ModelNode operation, final ModelNode model,
+            final ServiceVerificationHandler verificationHandler, final List<ServiceController<?>> newControllers) throws OperationFailedException {
+		ServiceTarget target = context.getServiceTarget();
+		
+		// translator repository
+    	final TranslatorRepository translatorRepo = new TranslatorRepository();
+    	TranslatorRepositoryService translatorService = new TranslatorRepositoryService(translatorRepo);
+    	ServiceController<TranslatorRepository> service = target.addService(TeiidServiceNames.TRANSLATOR_REPO, translatorService).install();
+    	newControllers.add(service);
+    	ServiceContainer serviceContainer = service.getServiceContainer();
+    	
+    	// system function tree
+    	SystemFunctionManager systemFunctionManager = new SystemFunctionManager();
+    	if (operation.hasDefined(Configuration.ALLOW_ENV_FUNCTION)) {
+    		systemFunctionManager.setAllowEnvFunction(operation.get(Configuration.ALLOW_ENV_FUNCTION).asBoolean());
+    	}
+    	else {
+    		systemFunctionManager.setAllowEnvFunction(false);
+    	}    	
+    	
+    	// VDB repository
+    	final VDBRepository vdbRepository = new VDBRepository();
+    	vdbRepository.setSystemFunctionManager(systemFunctionManager);
+    	VDBRepositoryService vdbRepositoryService = new VDBRepositoryService(vdbRepository);
+    	newControllers.add(target.addService(TeiidServiceNames.VDB_REPO, vdbRepositoryService).install());
+		
+    	// System VDB Service
+    	SystemVDBDeployer systemVDB = new SystemVDBDeployer();
+    	systemVDB.setVDBRepository(vdbRepository);
+    	SystemVDBService systemVDBService = new SystemVDBService(systemVDB);
+    	newControllers.add(target.addService(TeiidServiceNames.SYSTEM_VDB, systemVDBService).install());
+    	
+    	newControllers.add(RelativePathService.addService(TeiidServiceNames.DATA_DIR, "teiid-data", "jboss.server.data.dir", target)); //$NON-NLS-1$ //$NON-NLS-2$
+    	final ObjectsSerializerService serializer = new ObjectsSerializerService();
+    	newControllers.add(target.addService(TeiidServiceNames.OBJECT_SERIALIZER, serializer).install());
+
+    	// TODO: remove verbose service by moving the buffer service from runtime project
+    	newControllers.add(RelativePathService.addService(TeiidServiceNames.BUFFER_DIR, "teiid-buffer", "jboss.server.temp.dir", target)); //$NON-NLS-1$ //$NON-NLS-2$
+    	final BufferServiceImpl bufferManager = buildBufferManager(operation.get(Configuration.BUFFER_SERVICE));
+    	BufferManagerService bufferService = new BufferManagerService(bufferManager);
+    	ServiceBuilder<BufferServiceImpl> bufferServiceBuilder = target.addService(TeiidServiceNames.BUFFER_MGR, bufferService);
+    	bufferServiceBuilder.addDependency(TeiidServiceNames.BUFFER_DIR, String.class, bufferService.pathInjector);
+    	newControllers.add(bufferServiceBuilder.install());
+    	
+    	PolicyDecider policyDecider;
+    	if (operation.hasDefined(Configuration.POLICY_DECIDER_MODULE)) {
+    		policyDecider = buildService(PolicyDecider.class, operation.get(Configuration.POLICY_DECIDER_MODULE).asString());    		
+    	}
+    	else {
+    		DataRolePolicyDecider drpd = new DataRolePolicyDecider();
+    		drpd.setAllowCreateTemporaryTablesByDefault(true);
+    		drpd.setAllowFunctionCallsByDefault(true);
+    		policyDecider = drpd;
+    	}
+    	
+    	AuthorizationValidator authValidator;
+    	if (operation.hasDefined(Configuration.AUTHORIZATION_VALIDATOR_MODULE)) {
+    		authValidator = buildService(AuthorizationValidator.class, operation.get(Configuration.AUTHORIZATION_VALIDATOR_MODULE).asString());
+    		authValidator.setEnabled(true);
+    	}
+    	else {
+    		DefaultAuthorizationValidator dap = new DefaultAuthorizationValidator();
+    		dap.setPolicyDecider(policyDecider);
+    		dap.setEnabled(true);
+    		authValidator = dap;
+    	}
+    	target.addService(TeiidServiceNames.AUTHORIZATION_VALIDATOR, new AuthorizationValidatorService(authValidator));
+    	
+    	CacheFactory cacheFactory = getCacheFactory(operation.get(Configuration.CACHE_FACORY));
+    	CacheConfiguration resultsetCache = buildCacheConfig(operation.get(Configuration.RESULTSET_CACHE));
+    	CacheConfiguration preparePlanCache = buildCacheConfig(operation.get(Configuration.PREPAREDPLAN_CACHE));
+    	
+    	
+    	final JBossLifeCycleListener shutdownListener = new JBossLifeCycleListener();
+    	serviceContainer.addTerminateListener(shutdownListener);
+
+        serviceBuilder.addDependency(ServiceName.JBOSS.append("thread", "executor", asyncExecutor), Executor.class, engine.threadPoolInjector); //$NON-NLS-1$ //$NON-NLS-2$
+
+    	// Register VDB deployer
+        context.addStep(new AbstractDeploymentChainStep() {
+			@Override
+			public void execute(DeploymentProcessorTarget processorTarget) {
+				processorTarget.addDeploymentProcessor(Phase.STRUCTURE, Phase.STRUCTURE_WAR_DEPLOYMENT_INIT|0x0001,new VDBStructure());
+				processorTarget.addDeploymentProcessor(Phase.PARSE, Phase.PARSE_WEB_DEPLOYMENT|0x0001, new VDBParserDeployer(vdbRepository, serializer));
+				processorTarget.addDeploymentProcessor(Phase.DEPENDENCIES, Phase.DEPENDENCIES_WAR_MODULE|0x0001, new VDBDependencyProcessor());
+				processorTarget.addDeploymentProcessor(Phase.INSTALL, Phase.INSTALL_WAR_DEPLOYMENT|0x0001, new VDBDeployer(translatorRepo, asyncThreadPoolName));            			
+			}
+        	
+        }, OperationContext.Stage.RUNTIME);    	
+	}
+	
+    private <T> T buildService(Class<T> type, String moduleName) throws OperationFailedException {
+        final ModuleIdentifier moduleId;
+        final Module module;
+        try {
+            moduleId = ModuleIdentifier.create(moduleName);
+            module = Module.getCallerModuleLoader().loadModule(moduleId);
+        } catch (ModuleLoadException e) {
+            throw new OperationFailedException(e, new ModelNode().set(IntegrationPlugin.Util.getString("failed_load_module", moduleName))); //$NON-NLS-1$
+        }
+        ServiceLoader<T> services = module.loadService(type);
+        return services.iterator().next();
+    }
+	
+	
+	static void getBufferManagerDesciption(ModelNode node, String type, ResourceBundle bundle) {
+		addAttribute(node, Configuration.USE_DISK, type, bundle.getString(Configuration.USE_DISK+DESC), ModelType.BOOLEAN, false, "true"); //$NON-NLS-1$
+		addAttribute(node, Configuration.PROCESSOR_BATCH_SIZE, type, bundle.getString(Configuration.PROCESSOR_BATCH_SIZE+DESC), ModelType.INT, false, "512"); //$NON-NLS-1$
+		addAttribute(node, Configuration.CONNECTOR_BATCH_SIZE, type, bundle.getString(Configuration.CONNECTOR_BATCH_SIZE+DESC), ModelType.INT, false, "1024"); //$NON-NLS-1$
+		addAttribute(node, Configuration.MAX_PROCESSING_KB, type, bundle.getString(Configuration.MAX_PROCESSING_KB+DESC), ModelType.INT, false, "-1"); //$NON-NLS-1$
+		addAttribute(node, Configuration.MAX_RESERVED_KB, type, bundle.getString(Configuration.MAX_RESERVED_KB+DESC), ModelType.INT, false, "-1"); //$NON-NLS-1$
+		addAttribute(node, Configuration.MAX_FILE_SIZE, type, bundle.getString(Configuration.MAX_FILE_SIZE+DESC), ModelType.LONG, false, "2048"); //$NON-NLS-1$
+		addAttribute(node, Configuration.MAX_BUFFER_SPACE, type, bundle.getString(Configuration.MAX_BUFFER_SPACE+DESC), ModelType.LONG, false, "51200"); //$NON-NLS-1$
+		addAttribute(node, Configuration.MAX_OPEN_FILES, type, bundle.getString(Configuration.MAX_OPEN_FILES+DESC), ModelType.INT, false, "64"); //$NON-NLS-1$
+	}	
+	
+    private BufferServiceImpl  buildBufferManager(ModelNode node) {
+    	BufferServiceImpl bufferManger = new BufferServiceImpl();
+    	
+    	if (node == null) {
+    		return bufferManger;
+    	}
+    	
+    	if (node.hasDefined(Configuration.USE_DISK)) {
+    		bufferManger.setUseDisk(node.get(Configuration.USE_DISK).asBoolean());
+    	}	                	
+    	if (node.hasDefined(Configuration.PROCESSOR_BATCH_SIZE)) {
+    		bufferManger.setProcessorBatchSize(node.get(Configuration.PROCESSOR_BATCH_SIZE).asInt());
+    	}	
+    	if (node.hasDefined(Configuration.CONNECTOR_BATCH_SIZE)) {
+    		bufferManger.setConnectorBatchSize(node.get(Configuration.CONNECTOR_BATCH_SIZE).asInt());
+    	}	
+    	if (node.hasDefined(Configuration.MAX_PROCESSING_KB)) {
+    		bufferManger.setMaxProcessingKb(node.get(Configuration.MAX_PROCESSING_KB).asInt());
+    	}
+    	if (node.hasDefined(Configuration.MAX_RESERVED_KB)) {
+    		bufferManger.setMaxReserveKb(node.get(Configuration.MAX_RESERVED_KB).asInt());
+    	}
+    	if (node.hasDefined(Configuration.MAX_FILE_SIZE)) {
+    		bufferManger.setMaxFileSize(node.get(Configuration.MAX_FILE_SIZE).asLong());
+    	}
+    	if (node.hasDefined(Configuration.MAX_BUFFER_SPACE)) {
+    		bufferManger.setMaxBufferSpace(node.get(Configuration.MAX_BUFFER_SPACE).asLong());
+    	}
+    	if (node.hasDefined(Configuration.MAX_OPEN_FILES)) {
+    		bufferManger.setMaxOpenFiles(node.get(Configuration.MAX_OPEN_FILES).asInt());
+    	}	                	
+    	return bufferManger;
+    }	
+    
+    private void populateBufferManager(ModelNode operation, ModelNode model) {
+    	
+    	ModelNode childNode = operation.get(CHILDREN, Configuration.BUFFER_SERVICE);
+    	if (!childNode.isDefined()) {
+    		return;
+    	}
+		if (operation.hasDefined(Configuration.USE_DISK)) {
+			model.get(Configuration.USE_DISK).set(operation.get(Configuration.USE_DISK).asString());
+		}
+
+		if (operation.hasDefined(Configuration.PROCESSOR_BATCH_SIZE)) {
+			model.get(Configuration.PROCESSOR_BATCH_SIZE).set(operation.get(Configuration.PROCESSOR_BATCH_SIZE).asString());
+		}
+		if (operation.hasDefined(Configuration.CONNECTOR_BATCH_SIZE)) {
+			model.get(Configuration.CONNECTOR_BATCH_SIZE).set(operation.get(Configuration.CONNECTOR_BATCH_SIZE).asString());
+		}
+		if (operation.hasDefined(Configuration.MAX_PROCESSING_KB)) {
+			model.get(Configuration.MAX_PROCESSING_KB).set(operation.get(Configuration.MAX_PROCESSING_KB).asString());
+		}
+		if (operation.hasDefined(Configuration.MAX_RESERVED_KB)) {
+			model.get(Configuration.MAX_RESERVED_KB).set(operation.get(Configuration.MAX_RESERVED_KB).asString());
+		}
+		if (operation.hasDefined(Configuration.MAX_FILE_SIZE)) {
+			model.get(Configuration.MAX_FILE_SIZE).set(operation.get(Configuration.MAX_FILE_SIZE).asString());
+		}
+		if (operation.hasDefined(Configuration.MAX_BUFFER_SPACE)) {
+			model.get(Configuration.MAX_BUFFER_SPACE).set(operation.get(Configuration.MAX_BUFFER_SPACE).asString());
+		}
+		if (operation.hasDefined(Configuration.MAX_BUFFER_SPACE)) {
+			model.get(Configuration.MAX_BUFFER_SPACE).set(operation.get(Configuration.MAX_BUFFER_SPACE).asString());
+		}
+		if (operation.hasDefined(Configuration.MAX_OPEN_FILES)) {
+			model.get(Configuration.MAX_OPEN_FILES).set(operation.get(Configuration.MAX_OPEN_FILES).asString());
+		}
+    }
+    
+	private static void getDistributedCacheDescription(ModelNode node, String type, ResourceBundle bundle) {
+		addAttribute(node, Configuration.CACHE_SERVICE_JNDI_NAME, type, bundle.getString(Configuration.CACHE_SERVICE_JNDI_NAME+DESC), ModelType.STRING, false, "java:TeiidCacheManager"); //$NON-NLS-1$
+		addAttribute(node, Configuration.RESULTSET_CACHE_NAME, type, bundle.getString(Configuration.RESULTSET_CACHE_NAME+DESC), ModelType.STRING, false, "teiid-resultset-cache"); //$NON-NLS-1$
+	}
+	
+	private static void getResultsetCacheDescription(ModelNode node, String type, ResourceBundle bundle) {
+		addAttribute(node, Configuration.MAX_ENTRIES, type, bundle.getString(Configuration.MAX_ENTRIES+DESC), ModelType.INT, false, "1024"); //$NON-NLS-1$
+		addAttribute(node, Configuration.MAX_AGE_IN_SECS, type, bundle.getString(Configuration.MAX_AGE_IN_SECS+DESC), ModelType.INT, false, "7200");//$NON-NLS-1$
+		addAttribute(node, Configuration.MAX_STALENESS, type, bundle.getString(Configuration.MAX_STALENESS+DESC), ModelType.INT, false, "60");//$NON-NLS-1$
+		addAttribute(node, Configuration.CACHE_TYPE, type, bundle.getString(Configuration.CACHE_TYPE+DESC), ModelType.STRING, false, "EXPIRATION"); //$NON-NLS-1$
+		addAttribute(node, Configuration.CACHE_LOCATION, type, bundle.getString(Configuration.CACHE_LOCATION+DESC), ModelType.STRING, false, "resultset");	//$NON-NLS-1$	
+	}
+	
+	private static void getPreparedPalnCacheDescription(ModelNode node, String type, ResourceBundle bundle) {
+		addAttribute(node, Configuration.MAX_ENTRIES, type, bundle.getString(Configuration.MAX_ENTRIES+DESC), ModelType.INT, false, "512"); //$NON-NLS-1$
+		addAttribute(node, Configuration.MAX_AGE_IN_SECS, type, bundle.getString(Configuration.MAX_AGE_IN_SECS+DESC), ModelType.INT, false, "28800");//$NON-NLS-1$
+		addAttribute(node, Configuration.MAX_STALENESS, type, bundle.getString(Configuration.MAX_STALENESS+DESC), ModelType.INT, false, "0");//$NON-NLS-1$
+		addAttribute(node, Configuration.CACHE_TYPE, type, bundle.getString(Configuration.CACHE_TYPE+DESC), ModelType.STRING, false, "LRU"); //$NON-NLS-1$
+		addAttribute(node, Configuration.CACHE_LOCATION, type, bundle.getString(Configuration.CACHE_LOCATION+DESC), ModelType.STRING, false, "preparedplan");	//$NON-NLS-1$	
+	}
+    private CacheFactory getCacheFactory(ModelNode node) {
+    	CacheFactory cacheFactory = new DefaultCacheFactory();	
+    	/*
+    	if (node.hasDefined(Configuration.CLASS)) {
+    		String className = node.get(Configuration.CLASS).asString();
+    	}
+    	
+    	if (node.hasDefined(Configuration.ENABLED)) {
+    		cacheFactory.setEnabled(node.get(Configuration.ENABLED).asBoolean());
+    	}
+    	else {
+    		cacheFactory.setEnabled(true);
+    	}
+    	if (node.hasDefined(Configuration.CACHE_SERVICE_JNDI_NAME)) {
+    		cacheFactory.setCacheManager(node.get(Configuration.CACHE_SERVICE_JNDI_NAME).asString());
+    	}	                	
+    	if (node.hasDefined(Configuration.RESULTSET_CACHE_NAME)) {
+    		cacheFactory.setResultsetCacheName(node.get(Configuration.RESULTSET_CACHE_NAME).asString());
+    	}
+    	*/		                	
+    	return cacheFactory;
+    }
+    
+    private CacheConfiguration buildCacheConfig(ModelNode node) {
+    	CacheConfiguration cacheConfig = new CacheConfiguration();
+    	
+    	if (node.hasDefined(Configuration.MAX_ENTRIES)) {
+    		cacheConfig.setMaxEntries(node.get(Configuration.MAX_ENTRIES).asInt());
+    	}
+    	if (node.hasDefined(Configuration.MAX_AGE_IN_SECS)) {
+    		cacheConfig.setMaxAgeInSeconds(node.get(Configuration.MAX_AGE_IN_SECS).asInt());
+    	}
+    	if (node.hasDefined(Configuration.MAX_STALENESS)) {
+    		cacheConfig.setMaxStaleness(node.get(Configuration.MAX_STALENESS).asInt());
+    	}
+    	if (node.hasDefined(Configuration.CACHE_TYPE)) {
+    		cacheConfig.setType(node.get(Configuration.CACHE_TYPE).asString());
+    	}
+    	if (node.hasDefined(Configuration.CACHE_LOCATION)) {
+    		cacheConfig.setLocation(node.get(Configuration.CACHE_LOCATION).asString());
+    	}	   	                	
+    	return cacheConfig;
+	}	                
+    
+}


Property changes on: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidBootServicesAdd.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidExtension.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidExtension.java	2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidExtension.java	2011-08-22 14:36:06 UTC (rev 3422)
@@ -38,43 +38,47 @@
 import org.jboss.as.controller.registry.AttributeAccess.Storage;
 import org.jboss.dmr.ModelNode;
 import org.jboss.dmr.ModelType;
+import org.teiid.logging.Log4jListener;
+import org.teiid.logging.LogManager;
 
 public class TeiidExtension implements Extension {
 	
-	private static final String ACTIVE_SESSION_COUNT = "active-session-count";
-	private static final String RUNTIME_VERSION = "runtime-version";
-	private static final String REQUESTS_PER_SESSION = "requests-per-session";
-	private static final String ACTIVE_SESSIONS = "active-sessions";
-	private static final String REQUESTS_PER_VDB = "requests-per-vdb";
-	private static final String LONG_RUNNING_QUERIES = "long-running-queries";
-	private static final String TERMINATE_SESSION = "terminate-session";
-	private static final String CANCEL_QUERY = "cancel-query";
-	private static final String CACHE_TYPES = "cache-types";
-	private static final String CLEAR_CACHE = "clear-cache";
-	private static final String CACHE_STATISTICS = "cache-statistics";
-	private static final String WORKERPOOL_STATISTICS = "workerpool-statistics";
-	private static final String ACTIVE_TRANSACTIONS = "active-transactions";
-	private static final String TERMINATE_TRANSACTION = "terminate-transaction";
-	private static final String MERGE_VDBS = "merge-vdbs";
-	private static final String EXECUTE_QUERY = "execute-query";
-	private static final String GETVDBS = "getVDBs";
-	private static final String GETVDB = "getVDB";
+	private static final String ACTIVE_SESSION_COUNT = "active-session-count"; //$NON-NLS-1$
+	private static final String RUNTIME_VERSION = "runtime-version"; //$NON-NLS-1$
+	private static final String REQUESTS_PER_SESSION = "requests-per-session"; //$NON-NLS-1$
+	private static final String ACTIVE_SESSIONS = "active-sessions"; //$NON-NLS-1$
+	private static final String REQUESTS_PER_VDB = "requests-per-vdb"; //$NON-NLS-1$
+	private static final String LONG_RUNNING_QUERIES = "long-running-queries"; //$NON-NLS-1$
+	private static final String TERMINATE_SESSION = "terminate-session";//$NON-NLS-1$
+	private static final String CANCEL_QUERY = "cancel-query";//$NON-NLS-1$
+	private static final String CACHE_TYPES = "cache-types";//$NON-NLS-1$
+	private static final String CLEAR_CACHE = "clear-cache";//$NON-NLS-1$
+	private static final String CACHE_STATISTICS = "cache-statistics";//$NON-NLS-1$
+	private static final String WORKERPOOL_STATISTICS = "workerpool-statistics";//$NON-NLS-1$
+	private static final String ACTIVE_TRANSACTIONS = "active-transactions";//$NON-NLS-1$
+	private static final String TERMINATE_TRANSACTION = "terminate-transaction";//$NON-NLS-1$
+	private static final String MERGE_VDBS = "merge-vdbs";//$NON-NLS-1$
+	private static final String EXECUTE_QUERY = "execute-query";//$NON-NLS-1$
+	private static final String GETVDBS = "getVDBs";//$NON-NLS-1$
+	private static final String GETVDB = "getVDB";//$NON-NLS-1$
 	
-	public static final String SUBSYSTEM_NAME = "teiid"; //$NON-NLS-1$
+	public static final String TEIID_SUBSYSTEM = "teiid"; //$NON-NLS-1$
 	private static TeiidSubsystemParser parser = new TeiidSubsystemParser();
-	private static QueryEngineDescription ENGINE_DESC = new QueryEngineDescription();
 	private static QueryEngineAdd ENGINE_ADD = new QueryEngineAdd();
+	private static QueryEngineRemove ENGINE_REMOVE = new QueryEngineRemove();
 	private static TranslatorAdd TRANSLATOR_ADD = new TranslatorAdd();
 	private static TranslatorRemove TRANSLATOR_REMOVE = new TranslatorRemove();
 	
 	@Override
 	public void initialize(ExtensionContext context) {
-		final SubsystemRegistration registration = context.registerSubsystem(SUBSYSTEM_NAME);
+		final SubsystemRegistration registration = context.registerSubsystem(TEIID_SUBSYSTEM);
 		
+		LogManager.setLogListener(new Log4jListener());
+		
 		registration.registerXMLElementWriter(parser);
-		
-		final ManagementResourceRegistration subsystem = registration.registerSubsystemModel(new DescriptionProvider() {
-			
+
+		// Main Teiid system, with children query engine and translators.
+		final ManagementResourceRegistration teiidSubsystem = registration.registerSubsystemModel(new DescriptionProvider() {
 			@Override
 			public ModelNode getModelDescription(Locale locale) {
 				final ResourceBundle bundle = IntegrationPlugin.getResourceBundle(locale);
@@ -85,8 +89,6 @@
 		        node.get(ModelDescriptionConstants.TAIL_COMMENT_ALLOWED).set(true);
 		        node.get(ModelDescriptionConstants.NAMESPACE).set(Namespace.CURRENT.getUri());
 		        
-		        //getQueryEngineDescription(node.get(CHILDREN, Configuration.QUERY_ENGINE), ATTRIBUTES, bundle);
-
 		        node.get(CHILDREN, Configuration.QUERY_ENGINE, DESCRIPTION).set(bundle.getString(Configuration.QUERY_ENGINE)); 
 		        node.get(CHILDREN, Configuration.QUERY_ENGINE, REQUIRED).set(false);
 		        
@@ -96,10 +98,11 @@
 		        return node;
 		    }
 		});
-		subsystem.registerOperationHandler(ModelDescriptionConstants.ADD, ENGINE_ADD, ENGINE_DESC);
-		//subsystem.registerOperationHandler(ModelDescriptionConstants.DESCRIBE, describe, describe, false);
-		
-        final ManagementResourceRegistration translators = subsystem.registerSubModel(PathElement.pathElement(Configuration.TRANSLATOR), new DescriptionProvider() {
+		teiidSubsystem.registerOperationHandler(ADD, ENGINE_ADD, ENGINE_ADD, false);
+		teiidSubsystem.registerOperationHandler(REMOVE, ENGINE_REMOVE, ENGINE_REMOVE, false);     
+				
+		// Translator Subsystem
+        final ManagementResourceRegistration translatorSubsystem = teiidSubsystem.registerSubModel(PathElement.pathElement(Configuration.TRANSLATOR), new DescriptionProvider() {
 			@Override
 			public ModelNode getModelDescription(Locale locale) {
 				final ResourceBundle bundle = IntegrationPlugin.getResourceBundle(locale);
@@ -114,68 +117,83 @@
 	            return node;
 			}
 		});
-        translators.registerOperationHandler(ADD, TRANSLATOR_ADD, TRANSLATOR_ADD, false);
-        translators.registerOperationHandler(REMOVE, TRANSLATOR_REMOVE, TRANSLATOR_REMOVE, false);		
+        translatorSubsystem.registerOperationHandler(ADD, TRANSLATOR_ADD, TRANSLATOR_ADD, false);
+        translatorSubsystem.registerOperationHandler(REMOVE, TRANSLATOR_REMOVE, TRANSLATOR_REMOVE, false);
+
+        
+        // Query engine subsystem
+        final ManagementResourceRegistration engineSubsystem = teiidSubsystem.registerSubModel(PathElement.pathElement(Configuration.QUERY_ENGINE), new DescriptionProvider() {
+			@Override
+			public ModelNode getModelDescription(Locale locale) {
+				final ResourceBundle bundle = IntegrationPlugin.getResourceBundle(locale);
+				
+				final ModelNode node = new ModelNode();
+	            node.get(DESCRIPTION).set(bundle.getString(Configuration.QUERY_ENGINE));
+	            node.get(HEAD_COMMENT_ALLOWED).set(true);
+	            node.get(TAIL_COMMENT_ALLOWED).set(true);
+	            TeiidModelDescription.getQueryEngineDescription(node, ATTRIBUTES, bundle);
+	            return node;
+			}
+		});
+        engineSubsystem.registerOperationHandler(ADD, ENGINE_ADD, ENGINE_ADD, false);
+        engineSubsystem.registerOperationHandler(REMOVE, ENGINE_REMOVE, ENGINE_REMOVE, false);     
+        
 		
 		QueryEngineOperationHandler op;
-		subsystem.registerReadOnlyAttribute(RUNTIME_VERSION, new GetRuntimeVersion(RUNTIME_VERSION), Storage.RUNTIME); 
-		subsystem.registerReadOnlyAttribute(ACTIVE_SESSION_COUNT, new GetActiveSessionsCount(ACTIVE_SESSION_COUNT), Storage.RUNTIME); 
+		engineSubsystem.registerReadOnlyAttribute(RUNTIME_VERSION, new GetRuntimeVersion(RUNTIME_VERSION), Storage.RUNTIME); 
+		engineSubsystem.registerReadOnlyAttribute(ACTIVE_SESSION_COUNT, new GetActiveSessionsCount(ACTIVE_SESSION_COUNT), Storage.RUNTIME); 
 		
 		op = new GetActiveSessions(ACTIVE_SESSIONS);
-		subsystem.registerOperationHandler(ACTIVE_SESSIONS, op, op); 
+		engineSubsystem.registerOperationHandler(ACTIVE_SESSIONS, op, op); 
 		
 		op = new GetRequestsPerSession(REQUESTS_PER_SESSION);
-		subsystem.registerOperationHandler(REQUESTS_PER_SESSION, op, op);
+		engineSubsystem.registerOperationHandler(REQUESTS_PER_SESSION, op, op);
 
 		op = new GetRequestsPerVDB(REQUESTS_PER_VDB);
-		subsystem.registerOperationHandler(REQUESTS_PER_VDB, op, op);
+		engineSubsystem.registerOperationHandler(REQUESTS_PER_VDB, op, op);
 		
 		op = new GetLongRunningQueries(LONG_RUNNING_QUERIES);
-		subsystem.registerOperationHandler(LONG_RUNNING_QUERIES, op, op);		
+		engineSubsystem.registerOperationHandler(LONG_RUNNING_QUERIES, op, op);		
 		
 		op = new TerminateSession(TERMINATE_SESSION);
-		subsystem.registerOperationHandler(TERMINATE_SESSION, op, op);	
+		engineSubsystem.registerOperationHandler(TERMINATE_SESSION, op, op);	
 		
 		op = new CancelQuery(CANCEL_QUERY);
-		subsystem.registerOperationHandler(CANCEL_QUERY, op, op);		
+		engineSubsystem.registerOperationHandler(CANCEL_QUERY, op, op);		
 		
 		op = new CacheTypes(CACHE_TYPES);
-		subsystem.registerOperationHandler(CACHE_TYPES, op, op);	
+		engineSubsystem.registerOperationHandler(CACHE_TYPES, op, op);	
 		
 		op = new ClearCache(CLEAR_CACHE);
-		subsystem.registerOperationHandler(CLEAR_CACHE, op, op);	
+		engineSubsystem.registerOperationHandler(CLEAR_CACHE, op, op);	
 		
 		op = new CacheStatistics(CACHE_STATISTICS);
-		subsystem.registerOperationHandler(CACHE_STATISTICS, op, op);		
+		engineSubsystem.registerOperationHandler(CACHE_STATISTICS, op, op);		
 		
 		op = new WorkerPoolStatistics(WORKERPOOL_STATISTICS);
-		subsystem.registerOperationHandler(WORKERPOOL_STATISTICS, op, op);		
+		engineSubsystem.registerOperationHandler(WORKERPOOL_STATISTICS, op, op);		
 		
 		op = new ActiveTransactions(ACTIVE_TRANSACTIONS);
-		subsystem.registerOperationHandler(ACTIVE_TRANSACTIONS, op, op);	
+		engineSubsystem.registerOperationHandler(ACTIVE_TRANSACTIONS, op, op);	
 		
 		op = new TerminateTransaction(TERMINATE_TRANSACTION);
-		subsystem.registerOperationHandler(TERMINATE_TRANSACTION, op, op);		
+		engineSubsystem.registerOperationHandler(TERMINATE_TRANSACTION, op, op);		
 		
 		op = new MergeVDBs(MERGE_VDBS);
-		subsystem.registerOperationHandler(MERGE_VDBS, op, op);	
+		engineSubsystem.registerOperationHandler(MERGE_VDBS, op, op);	
 		
 		op = new ExecuteQuery(EXECUTE_QUERY);
-		subsystem.registerOperationHandler(EXECUTE_QUERY, op, op);	
+		engineSubsystem.registerOperationHandler(EXECUTE_QUERY, op, op);	
 		
 		op = new GetVDBs(GETVDBS);
-		subsystem.registerOperationHandler(GETVDBS, op, op);
+		engineSubsystem.registerOperationHandler(GETVDBS, op, op);
 		
 		op = new GetVDB(GETVDB);
-		subsystem.registerOperationHandler(GETVDB, op, op);		
+		engineSubsystem.registerOperationHandler(GETVDB, op, op);		
 	}
 
 	@Override
 	public void initializeParsers(ExtensionParsingContext context) {
 		context.setSubsystemXmlMapping(Namespace.CURRENT.getUri(), parser);
 	}
-	
-	
-	
-
 }

Copied: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidModelDescription.java (from rev 3394, branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineDescription.java)
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidModelDescription.java	                        (rev 0)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidModelDescription.java	2011-08-22 14:36:06 UTC (rev 3422)
@@ -0,0 +1,98 @@
+/*
+ * 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;
+
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.*;
+import static org.teiid.jboss.Configuration.DESC;
+import static org.teiid.jboss.Configuration.addAttribute;
+
+import java.util.ResourceBundle;
+
+import org.jboss.dmr.ModelNode;
+import org.jboss.dmr.ModelType;
+
+class TeiidModelDescription {
+			
+	static void getQueryEngineDescription(ModelNode node, String type, ResourceBundle bundle) {
+		addAttribute(node, Configuration.ENGINE_NAME, type, bundle.getString(Configuration.ENGINE_NAME+Configuration.DESC), ModelType.STRING, true, null);		
+		addAttribute(node, Configuration.MAX_THREADS, type, bundle.getString(Configuration.MAX_THREADS+DESC), ModelType.INT, false, "64"); //$NON-NLS-1$
+		addAttribute(node, Configuration.MAX_ACTIVE_PLANS, type, bundle.getString(Configuration.MAX_ACTIVE_PLANS+DESC), ModelType.INT, false, "20"); //$NON-NLS-1$
+		addAttribute(node, Configuration.USER_REQUEST_SOURCE_CONCURRENCY, type, bundle.getString(Configuration.USER_REQUEST_SOURCE_CONCURRENCY+DESC), ModelType.INT, false, "0"); //$NON-NLS-1$
+		addAttribute(node, Configuration.TIME_SLICE_IN_MILLI, type, bundle.getString(Configuration.TIME_SLICE_IN_MILLI+DESC), ModelType.INT, false, "2000"); //$NON-NLS-1$		
+		addAttribute(node, Configuration.MAX_ROWS_FETCH_SIZE, type, bundle.getString(Configuration.MAX_ROWS_FETCH_SIZE+DESC), ModelType.INT, false, "20480"); //$NON-NLS-1$
+		addAttribute(node, Configuration.LOB_CHUNK_SIZE_IN_KB, type, bundle.getString(Configuration.LOB_CHUNK_SIZE_IN_KB+DESC), ModelType.INT, false, "100"); //$NON-NLS-1$
+		addAttribute(node, Configuration.QUERY_THRESHOLD_IN_SECS, type, bundle.getString(Configuration.QUERY_THRESHOLD_IN_SECS+DESC), ModelType.INT, false, "600"); //$NON-NLS-1$		
+		addAttribute(node, Configuration.MAX_SOURCE_ROWS, type, bundle.getString(Configuration.MAX_SOURCE_ROWS+DESC), ModelType.INT, false, "-1"); //$NON-NLS-1$
+		addAttribute(node, Configuration.EXCEPTION_ON_MAX_SOURCE_ROWS, type, bundle.getString(Configuration.EXCEPTION_ON_MAX_SOURCE_ROWS+DESC), ModelType.BOOLEAN, false, "true"); //$NON-NLS-1$
+		addAttribute(node, Configuration.MAX_ODBC_LOB_SIZE_ALLOWED, type, bundle.getString(Configuration.MAX_ODBC_LOB_SIZE_ALLOWED+DESC), ModelType.INT, false, "5242880"); //$NON-NLS-1$
+		addAttribute(node, Configuration.EVENT_DISTRIBUTOR_NAME, type, bundle.getString(Configuration.EVENT_DISTRIBUTOR_NAME+DESC), ModelType.STRING, false, "teiid/event-distributor"); //$NON-NLS-1$
+		addAttribute(node, Configuration.DETECTING_CHANGE_EVENTS, type, bundle.getString(Configuration.DETECTING_CHANGE_EVENTS+DESC), ModelType.BOOLEAN, false, "true"); //$NON-NLS-1$
+		
+		//session stuff
+		addAttribute(node, Configuration.SECURITY_DOMAIN, type, bundle.getString(Configuration.SECURITY_DOMAIN+DESC), ModelType.STRING, false, null);
+		addAttribute(node, Configuration.MAX_SESSIONS_ALLOWED, type, bundle.getString(Configuration.MAX_SESSIONS_ALLOWED+DESC), ModelType.INT, false, "5000"); //$NON-NLS-1$
+		addAttribute(node, Configuration.SESSION_EXPIRATION_TIME_LIMIT, type, bundle.getString(Configuration.SESSION_EXPIRATION_TIME_LIMIT+DESC), ModelType.INT, false, "0"); //$NON-NLS-1$
+		
+		//jdbc
+		ModelNode jdbcSocketNode = node.get(CHILDREN, Configuration.JDBC);
+		jdbcSocketNode.get(TYPE).set(ModelType.OBJECT);
+		jdbcSocketNode.get(DESCRIPTION).set(bundle.getString(Configuration.JDBC+DESC));
+		jdbcSocketNode.get(REQUIRED).set(false);
+		jdbcSocketNode.get(MAX_OCCURS).set(1);
+		jdbcSocketNode.get(MIN_OCCURS).set(1);	
+		getSocketConfig(jdbcSocketNode, type, bundle);
+		
+		//odbc
+		ModelNode odbcSocketNode = node.get(CHILDREN, Configuration.ODBC);
+		odbcSocketNode.get(TYPE).set(ModelType.OBJECT);
+		odbcSocketNode.get(DESCRIPTION).set(bundle.getString(Configuration.ODBC+DESC));
+		odbcSocketNode.get(REQUIRED).set(false);
+		odbcSocketNode.get(MAX_OCCURS).set(1);
+		odbcSocketNode.get(MIN_OCCURS).set(1);	
+		getSocketConfig(odbcSocketNode, type, bundle);			
+	}
+	
+	
+	private static void getSocketConfig(ModelNode node, String type, ResourceBundle bundle) {
+		addAttribute(node, Configuration.SOCKET_ENABLED, type, bundle.getString(Configuration.SOCKET_ENABLED+DESC), ModelType.BOOLEAN, false, "true"); //$NON-NLS-1$
+		addAttribute(node, Configuration.MAX_SOCKET_THREAD_SIZE, type, bundle.getString(Configuration.MAX_SOCKET_THREAD_SIZE+DESC), ModelType.INT, false, "0"); //$NON-NLS-1$
+		addAttribute(node, Configuration.IN_BUFFER_SIZE, type, bundle.getString(Configuration.IN_BUFFER_SIZE+DESC), ModelType.INT, false, "0"); //$NON-NLS-1$
+		addAttribute(node, Configuration.OUT_BUFFER_SIZE, type, bundle.getString(Configuration.OUT_BUFFER_SIZE+DESC), ModelType.INT, false, "0"); //$NON-NLS-1$
+		addAttribute(node, Configuration.SOCKET_BINDING, type, bundle.getString(Configuration.SOCKET_BINDING+DESC), ModelType.INT, true, null);
+		
+		ModelNode sslNode = node.get(CHILDREN, Configuration.SSL);
+		sslNode.get(TYPE).set(ModelType.OBJECT);
+		sslNode.get(DESCRIPTION).set(bundle.getString(Configuration.SSL+DESC));
+		sslNode.get(REQUIRED).set(false);
+		sslNode.get(MAX_OCCURS).set(1);
+		sslNode.get(MIN_OCCURS).set(0);
+		addAttribute(node, Configuration.SSL_MODE, type, bundle.getString(Configuration.SSL_MODE+DESC), ModelType.STRING, false, "login");	//$NON-NLS-1$
+		addAttribute(node, Configuration.KEY_STORE_FILE, type, bundle.getString(Configuration.KEY_STORE_FILE+DESC), ModelType.STRING, false, null);	
+		addAttribute(node, Configuration.KEY_STORE_PASSWD, type, bundle.getString(Configuration.KEY_STORE_PASSWD+DESC), ModelType.STRING, false, null);
+		addAttribute(node, Configuration.KEY_STORE_TYPE, type, bundle.getString(Configuration.KEY_STORE_TYPE+DESC), ModelType.STRING, false, "JKS"); //$NON-NLS-1$
+		addAttribute(node, Configuration.SSL_PROTOCOL, type, bundle.getString(Configuration.SSL_PROTOCOL+DESC), ModelType.BOOLEAN, false, "SSLv3");	//$NON-NLS-1$
+		addAttribute(node, Configuration.KEY_MANAGEMENT_ALG, type, bundle.getString(Configuration.KEY_MANAGEMENT_ALG+DESC), ModelType.STRING, false, "false");	//$NON-NLS-1$
+		addAttribute(node, Configuration.TRUST_FILE, type, bundle.getString(Configuration.TRUST_FILE+DESC), ModelType.STRING, false, null);	
+		addAttribute(node, Configuration.TRUST_PASSWD, type, bundle.getString(Configuration.TRUST_PASSWD+DESC), ModelType.STRING, false, null);	
+		addAttribute(node, Configuration.AUTH_MODE, type, bundle.getString(Configuration.AUTH_MODE+DESC), ModelType.STRING, false, "anonymous");	//$NON-NLS-1$
+	}
+}


Property changes on: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidModelDescription.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidServiceNames.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidServiceNames.java	2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidServiceNames.java	2011-08-22 14:36:06 UTC (rev 3422)
@@ -24,14 +24,31 @@
 import org.jboss.msc.service.ServiceName;
 
 public class TeiidServiceNames {
-	public static ServiceName ENGINE = ServiceName.JBOSS.append("teiid", "query-engine");
-	public static ServiceName TRANSLATOR_REPO = ServiceName.JBOSS.append("teiid", "translator-repository");
-	static ServiceName TRANSLATOR_BASE = ServiceName.JBOSS.append("teiid", "translator");
-	public static ServiceName BUFFER_DIR = ServiceName.JBOSS.append("teiid", "buffer.dir");
-	public static ServiceName BUFFER_MGR = ServiceName.JBOSS.append("teiid", "buffer-mgr");
-	public static ServiceName SYSTEM_VDB = ServiceName.JBOSS.append("teiid", "system.vdb");
+	private static ServiceName ENGINE = ServiceName.JBOSS.append("teiid", "query-engine"); //$NON-NLS-1$ //$NON-NLS-2$
+	public static ServiceName TRANSLATOR_REPO = ServiceName.JBOSS.append("teiid", "translator-repository");//$NON-NLS-1$ //$NON-NLS-2$
+	public static ServiceName VDB_REPO = ServiceName.JBOSS.append("teiid", "vdb-repository");//$NON-NLS-1$ //$NON-NLS-2$
+	private static ServiceName TRANSLATOR_BASE = ServiceName.JBOSS.append("teiid", "translator");//$NON-NLS-1$ //$NON-NLS-2$
+	public static ServiceName BUFFER_DIR = ServiceName.JBOSS.append("teiid", "buffer.dir");//$NON-NLS-1$ //$NON-NLS-2$
+	public static ServiceName DATA_DIR = ServiceName.JBOSS.append("teiid", "data.dir");//$NON-NLS-1$ //$NON-NLS-2$
+	public static ServiceName BUFFER_MGR = ServiceName.JBOSS.append("teiid", "buffer-mgr");//$NON-NLS-1$ //$NON-NLS-2$
+	public static ServiceName SYSTEM_VDB = ServiceName.JBOSS.append("teiid", "system.vdb");//$NON-NLS-1$ //$NON-NLS-2$
+	public static ServiceName AUTHORIZATION_VALIDATOR = ServiceName.JBOSS.append("teiid", "authorization-validator");//$NON-NLS-1$ //$NON-NLS-2$
+	private static ServiceName VDB_SVC_BASE = ServiceName.JBOSS.append("teiid", "vdb"); //$NON-NLS-1$ //$NON-NLS-2$
+	public static ServiceName OBJECT_SERIALIZER = ServiceName.JBOSS.append("teiid", "object-serializer"); //$NON-NLS-1$ //$NON-NLS-2$
 	
 	public static ServiceName translatorServiceName(String name) {
 		return TRANSLATOR_BASE.append(name);
 	}
+	
+	public static ServiceName engineServiceName(String name) {
+		return ENGINE.append(name);
+	}
+	
+	public static ServiceName vdbServiceName(String vdbName, int version) {
+		return VDB_SVC_BASE.append(vdbName, ".", String.valueOf(version)); //$NON-NLS-1$
+	}
+	
+	public static ServiceName executorServiceName(String poolName) {
+		return ServiceName.JBOSS.append("thread", "executor", poolName);
+	}
 }

Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidSubsystemParser.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidSubsystemParser.java	2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidSubsystemParser.java	2011-08-22 14:36:06 UTC (rev 3422)
@@ -21,10 +21,10 @@
  */
 package org.teiid.jboss;
 
-import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.ADD;
 import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP;
 import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP_ADDR;
 import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.SUBSYSTEM;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.ADD;
 import static org.jboss.as.controller.parsing.ParseUtils.requireNoAttributes;
 
 import java.util.List;
@@ -57,6 +57,7 @@
     
     // write the elements according to the schema defined.
     private void writeQueryEngine( XMLExtendedStreamWriter writer, ModelNode node) throws XMLStreamException {
+    	writeAttribute(writer, Element.ENGINE_NAME_ATTRIBUTE, node);
     	writeElement(writer, Element.ASYNC_THREAD_GROUP_ELEMENT, node);
     	writeElement(writer, Element.MAX_THREADS_ELEMENT, node);
     	writeElement(writer, Element.MAX_ACTIVE_PLANS_ELEMENT, node);
@@ -176,18 +177,24 @@
 	        writer.writeEndElement();
     	}
     }        
+    
+    private void writeAttribute(final XMLExtendedStreamWriter writer, final Element element, final ModelNode node) throws XMLStreamException {
+    	if (has(node, element.getLocalName())) {
+	        writer.writeAttribute(element.getLocalName(), node.get(element.getLocalName()).asString());
+    	}
+    }     
 
     @Override
     public void readElement(final XMLExtendedStreamReader reader, final List<ModelNode> list) throws XMLStreamException {
         final ModelNode address = new ModelNode();
-        address.add(SUBSYSTEM, TeiidExtension.SUBSYSTEM_NAME);
+        address.add(SUBSYSTEM, TeiidExtension.TEIID_SUBSYSTEM);
         address.protect();
-            	 
-        final ModelNode subsystem = new ModelNode();
-        subsystem.get(OP).set(ADD);
-        subsystem.get(OP_ADDR).set(address);
-        list.add(subsystem);
         
+        final ModelNode bootServices = new ModelNode();
+        bootServices.get(OP).set(ADD);
+        bootServices.get(OP_ADDR).set(address);
+        list.add(bootServices);  
+        
     	// no attributes 
     	requireNoAttributes(reader);
 
@@ -198,9 +205,30 @@
                     Element element = Element.forName(reader.getLocalName());
                     switch (element) {
                         case QUERY_ENGINE_ELEMENT:
-                        	ModelNode node = parseQueryEngine(reader);
-                        	subsystem.get(Configuration.QUERY_ENGINE).set(node);
+                            ModelNode engineNode = parseQueryEngine(reader, new ModelNode());
+                            
+                            final ModelNode engineAddress = address.clone();
+                            engineAddress.add(Configuration.QUERY_ENGINE, engineNode.require(Configuration.ENGINE_NAME).asString());
+                            engineAddress.protect();
+                            engineNode.get(OP).set(ADD);
+                            engineNode.get(OP_ADDR).set(engineAddress);
+                            
+                            list.add(engineNode);  
+                            break;
+                            
+                        case TRANSLATOR_ELEMENT:
+                        	ModelNode translatorNode = parseTranslator(reader, new ModelNode());
+
+                            final ModelNode translatorAddress = address.clone();
+                            translatorAddress.add(Configuration.QUERY_ENGINE, translatorNode.require(Configuration.TRANSLATOR_NAME).asString());
+                            translatorAddress.protect();
+                            
+                            translatorNode.get(OP).set(ADD);
+                            translatorNode.get(OP_ADDR).set(translatorAddress);
+                        	
+                            list.add(translatorNode);  
                             break;                            
+                            
                         default: 
                             throw ParseUtils.unexpectedElement(reader);
                     }
@@ -211,12 +239,9 @@
                 }
             }
         }  
-        
-        
     }
     
-    private ModelNode parseQueryEngine(XMLExtendedStreamReader reader) throws XMLStreamException {
-    	ModelNode node = new ModelNode();
+    private ModelNode parseQueryEngine(XMLExtendedStreamReader reader, ModelNode node) throws XMLStreamException {
     	
     	if (reader.getAttributeCount() > 0) {
     		for(int i=0; i<reader.getAttributeCount(); i++) {
@@ -414,5 +439,28 @@
             }
         }
     	return node;
-    }    
+    }
+    
+    private ModelNode parseTranslator(XMLExtendedStreamReader reader, ModelNode node) throws XMLStreamException {
+    	if (reader.getAttributeCount() > 0) {
+    		for(int i=0; i<reader.getAttributeCount(); i++) {
+    			String attrName = reader.getAttributeLocalName(i);
+    			String attrValue = reader.getAttributeValue(i);
+    			
+    			Element element = Element.forName(attrName);
+    			switch(element) {
+    			case TRANSLATOR_NAME_ATTRIBUTE:
+    			case TRANSLATOR_MODULE_ATTRIBUTE:
+    				node.get(attrName).set(attrValue);
+    				break;
+    			default: 
+                	throw ParseUtils.unexpectedElement(reader);
+    			}
+    		}
+    	}      	
+    	while (reader.hasNext() && (reader.nextTag() != XMLStreamConstants.END_ELEMENT)) {
+    		throw ParseUtils.unexpectedElement(reader);
+    	}
+    	return node;
+    }
 }

Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorAdd.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorAdd.java	2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorAdd.java	2011-08-22 14:36:06 UTC (rev 3422)
@@ -54,8 +54,10 @@
         final ModelNode operation = new ModelNode();
         operation.get(OPERATION_NAME).set(ADD);
         operation.get(DESCRIPTION).set(bundle.getString("translator.add")); //$NON-NLS-1$
-        addAttribute(operation, Configuration.TRANSLATOR_NAME, REQUEST_PROPERTIES, bundle.getString(Configuration.TRANSLATOR_NAME+Configuration.DESC), ModelType.STRING, true, null);
-        addAttribute(operation, Configuration.TRANSLATOR_MODULE, REQUEST_PROPERTIES, bundle.getString(Configuration.TRANSLATOR_MODULE+Configuration.DESC), ModelType.STRING, true, null);
+        
+        ModelNode translator = operation.get(REQUEST_PROPERTIES, Configuration.TRANSLATOR);
+        addAttribute(translator, Configuration.TRANSLATOR_NAME, ATTRIBUTES, bundle.getString(Configuration.TRANSLATOR_NAME+Configuration.DESC), ModelType.STRING, true, null);
+        addAttribute(translator, Configuration.TRANSLATOR_MODULE, ATTRIBUTES, bundle.getString(Configuration.TRANSLATOR_MODULE+Configuration.DESC), ModelType.STRING, true, null);
         return operation;
     }
     
@@ -64,11 +66,10 @@
         final ModelNode address = operation.require(OP_ADDR);
         final PathAddress pathAddress = PathAddress.pathAddress(address);
 
-		final String name = operation.require(Configuration.TRANSLATOR_NAME).asString();
-        final String moduleName = operation.require(Configuration.TRANSLATOR_MODULE).asString();
+        ModelNode translator = operation.require(Configuration.TRANSLATOR);
+        final String moduleName = translator.require(Configuration.TRANSLATOR_MODULE).asString();
 
         model.get(NAME).set(pathAddress.getLastElement().getValue());
-        model.get(Configuration.TRANSLATOR_NAME).set(name);
         model.get(Configuration.TRANSLATOR_MODULE).set(moduleName);
 	}
 	
@@ -76,8 +77,9 @@
     protected void performRuntime(final OperationContext context, final ModelNode operation, final ModelNode model,
             final ServiceVerificationHandler verificationHandler, final List<ServiceController<?>> newControllers) throws OperationFailedException {
 
-		final String name = operation.require(Configuration.TRANSLATOR_NAME).asString();
-        final String moduleName = operation.require(Configuration.TRANSLATOR_MODULE).asString();
+		ModelNode translator = operation.require(Configuration.TRANSLATOR);
+		final String name = translator.require(Configuration.TRANSLATOR_NAME).asString();
+        final String moduleName = translator.require(Configuration.TRANSLATOR_MODULE).asString();
 		
         final ServiceTarget target = context.getServiceTarget();
 

Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorRemove.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorRemove.java	2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorRemove.java	2011-08-22 14:36:06 UTC (rev 3422)
@@ -24,6 +24,8 @@
 import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.DESCRIPTION;
 import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OPERATION_NAME;
 import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.REMOVE;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.REQUEST_PROPERTIES;
+import static org.teiid.jboss.Configuration.addAttribute;
 
 import java.util.List;
 import java.util.Locale;
@@ -35,6 +37,7 @@
 import org.jboss.as.controller.ServiceVerificationHandler;
 import org.jboss.as.controller.descriptions.DescriptionProvider;
 import org.jboss.dmr.ModelNode;
+import org.jboss.dmr.ModelType;
 import org.jboss.msc.service.ServiceController;
 import org.jboss.msc.service.ServiceRegistry;
 
@@ -45,7 +48,8 @@
         final ResourceBundle bundle = IntegrationPlugin.getResourceBundle(locale);
         final ModelNode operation = new ModelNode();
         operation.get(OPERATION_NAME).set(REMOVE);
-        operation.get(DESCRIPTION).set(bundle.getString("translator.remove")); //$NON-NLS-1$        
+        operation.get(DESCRIPTION).set(bundle.getString("translator.remove")); //$NON-NLS-1$  
+        addAttribute(operation, Configuration.TRANSLATOR_NAME, REQUEST_PROPERTIES, bundle.getString(Configuration.TRANSLATOR_NAME+Configuration.DESC), ModelType.STRING, true, null);
         return operation;
 	}
 	

Copied: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBDependencyProcessor.java (from rev 3382, branches/as7/runtime/src/main/java/org/teiid/deployers/VDBDependencyProcessor.java)
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBDependencyProcessor.java	                        (rev 0)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBDependencyProcessor.java	2011-08-22 14:36:06 UTC (rev 3422)
@@ -0,0 +1,100 @@
+/*
+ * 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;
+
+import java.io.Closeable;
+import java.io.IOException;
+import java.util.List;
+
+import org.jboss.as.server.deployment.*;
+import org.jboss.as.server.deployment.module.*;
+import org.jboss.modules.Module;
+import org.jboss.modules.ModuleIdentifier;
+import org.jboss.modules.ModuleLoadException;
+import org.jboss.modules.ModuleLoader;
+import org.jboss.vfs.VFS;
+import org.jboss.vfs.VirtualFile;
+import org.jboss.vfs.VirtualFileFilter;
+import org.jboss.vfs.VisitorAttributes;
+import org.jboss.vfs.util.SuffixMatchFilter;
+import org.teiid.adminapi.impl.ModelMetaData;
+import org.teiid.adminapi.impl.VDBMetaData;
+import org.teiid.deployers.TeiidAttachments;
+
+public class VDBDependencyProcessor implements DeploymentUnitProcessor {
+	public static final String LIB = "/lib"; //$NON-NLS-1$
+	private static final VirtualFileFilter DEFAULT_JAR_LIB_FILTER = new SuffixMatchFilter(".jar", VisitorAttributes.DEFAULT); //$NON-NLS-1$
+	
+	@Override
+	public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
+		DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
+		if (!TeiidAttachments.isVDBDeployment(deploymentUnit)) {
+			return;
+		}
+		
+		if (!TeiidAttachments.isDynamicVDB(deploymentUnit)) {
+			final ResourceRoot deploymentResourceRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT);
+			final VirtualFile deploymentRoot = deploymentResourceRoot.getRoot();
+	        if(deploymentRoot == null) {
+	            return;
+	        }
+			
+			try {
+				final VirtualFile libDir = deploymentRoot.getChild(LIB);
+				if (libDir.exists()) {
+					final List<VirtualFile> archives = libDir.getChildren(DEFAULT_JAR_LIB_FILTER);
+					for (final VirtualFile archive : archives) {
+						try {
+							final Closeable closable = VFS.mountZip(archive, archive,TempFileProviderService.provider());
+							final ResourceRoot jarArchiveRoot = new ResourceRoot(archive.getName(), archive, new MountHandle(closable));
+							ModuleRootMarker.mark(jarArchiveRoot);
+							deploymentUnit.addToAttachmentList(Attachments.RESOURCE_ROOTS, jarArchiveRoot);
+						} catch (IOException e) {
+							throw new DeploymentUnitProcessingException("failed to process " + archive, e); //$NON-NLS-1$
+						}
+					}
+				}	
+			} catch(IOException e) {
+				throw new DeploymentUnitProcessingException(e);
+			}
+		}
+		
+		// add translators as dependent modules to this VDB.
+        try {
+			final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
+			final ModuleLoader moduleLoader = Module.getCallerModule().getModule(ModuleIdentifier.create("org.jboss.teiid")).getModuleLoader(); //$NON-NLS-1$
+			VDBMetaData vdb = deploymentUnit.getAttachment(TeiidAttachments.VDB_METADATA);
+
+			for (ModelMetaData model: vdb.getModelMetaDatas().values()) {
+				for (String source:model.getSourceNames()) {
+					moduleSpecification.addLocalDependency(new ModuleDependency(moduleLoader, ModuleIdentifier.create(model.getSourceTranslatorName(source)), false, false, false));		
+				}
+			}
+		} catch (ModuleLoadException e) {
+			throw new DeploymentUnitProcessingException(e);
+		}
+	}
+
+	@Override
+	public void undeploy(DeploymentUnit context) {
+	}
+}


Property changes on: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBDependencyProcessor.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Copied: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBDeployer.java (from rev 3382, branches/as7/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java)
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBDeployer.java	                        (rev 0)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBDeployer.java	2011-08-22 14:36:06 UTC (rev 3422)
@@ -0,0 +1,142 @@
+/*
+ * 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;
+
+import java.util.List;
+
+import org.jboss.as.server.deployment.*;
+import org.jboss.msc.service.ServiceBuilder;
+import org.jboss.msc.service.ServiceController;
+import org.jboss.msc.service.ServiceController.Mode;
+import org.jboss.msc.service.ServiceName;
+import org.jboss.vfs.VirtualFile;
+import org.teiid.adminapi.Translator;
+import org.teiid.adminapi.impl.ModelMetaData;
+import org.teiid.adminapi.impl.VDBMetaData;
+import org.teiid.adminapi.impl.VDBTranslatorMetaData;
+import org.teiid.deployers.MetadataStoreGroup;
+import org.teiid.deployers.TeiidAttachments;
+import org.teiid.deployers.UDFMetaData;
+import org.teiid.deployers.VDBRepository;
+import org.teiid.dqp.internal.datamgr.TranslatorRepository;
+import org.teiid.logging.LogConstants;
+import org.teiid.logging.LogManager;
+import org.teiid.metadata.index.IndexMetadataFactory;
+import org.teiid.runtime.RuntimePlugin;
+
+
+public class VDBDeployer implements DeploymentUnitProcessor {
+			
+	private TranslatorRepository translatorRepository;
+	private String asyncThreadPoolName;
+	
+	public VDBDeployer (TranslatorRepository translatorRepo, String poolName) {
+		this.translatorRepository = translatorRepo;
+		this.asyncThreadPoolName = poolName;
+	}
+	
+	public void deploy(final DeploymentPhaseContext context)  throws DeploymentUnitProcessingException {
+		DeploymentUnit deploymentUnit = context.getDeploymentUnit();
+		if (!TeiidAttachments.isVDBDeployment(deploymentUnit)) {
+			return;
+		}
+		VirtualFile file = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT).getRoot();
+		VDBMetaData deployment = deploymentUnit.getAttachment(TeiidAttachments.VDB_METADATA);
+		
+		// check to see if there is old vdb already deployed.
+        final ServiceController<?> controller = context.getServiceRegistry().getService(TeiidServiceNames.vdbServiceName(deployment.getName(), deployment.getVersion()));
+        if (controller != null) {
+        	LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("redeploying_vdb", deployment)); //$NON-NLS-1$
+            controller.setMode(ServiceController.Mode.REMOVE);
+        }
+		
+		boolean preview = deployment.isPreview();
+		if (!preview) {
+			List<String> errors = deployment.getValidityErrors();
+			if (errors != null && !errors.isEmpty()) {
+				throw new DeploymentUnitProcessingException(RuntimePlugin.Util.getString("validity_errors_in_vdb", deployment)); //$NON-NLS-1$
+			}
+		}
+				
+		// add required connector managers; if they are not already there
+		for (Translator t: deployment.getOverrideTranslators()) {
+			VDBTranslatorMetaData data = (VDBTranslatorMetaData)t;
+			
+			String type = data.getType();
+			Translator parent = this.translatorRepository.getTranslatorMetaData(type);
+			if ( parent == null) {
+				throw new DeploymentUnitProcessingException(RuntimePlugin.Util.getString("translator_type_not_found", file.getName())); //$NON-NLS-1$
+			}
+		}
+				
+		// check if this is a VDB with index files, if there are then build the TransformationMetadata
+		UDFMetaData udf = deploymentUnit.getAttachment(TeiidAttachments.UDF_METADATA);
+		if (udf != null) {
+			deployment.addAttchment(UDFMetaData.class, udf);
+		}
+
+		// get the metadata store of the VDB (this is build in parse stage)
+		MetadataStoreGroup store = deploymentUnit.getAttachment(TeiidAttachments.METADATA_STORE);
+		if (store != null) {
+			deployment.addAttchment(MetadataStoreGroup.class, store);
+		}
+		
+		IndexMetadataFactory indexFactory = deploymentUnit.getAttachment(TeiidAttachments.INDEX_METADATA);
+		if (indexFactory != null) {
+			deployment.addAttchment(IndexMetadataFactory.class, indexFactory);
+		}
+
+		// removethe metadata objects as attachments
+		deploymentUnit.removeAttachment(TeiidAttachments.INDEX_METADATA);
+		deploymentUnit.removeAttachment(TeiidAttachments.UDF_METADATA);
+		deploymentUnit.removeAttachment(TeiidAttachments.METADATA_STORE);
+		
+		// build a VDB service
+		VDBService vdb = new VDBService(deployment);
+		ServiceBuilder<VDBMetaData> vdbService = context.getServiceTarget().addService(TeiidServiceNames.vdbServiceName(deployment.getName(), deployment.getVersion()), vdb);
+		for (ModelMetaData model:deployment.getModelMetaDatas().values()) {
+			for (String sourceName:model.getSourceNames()) {
+				vdbService.addDependency(ServiceName.JBOSS.append("data-source", model.getSourceConnectionJndiName(sourceName)));	//$NON-NLS-1$
+			}
+		}
+		vdbService.addDependency(TeiidServiceNames.VDB_REPO, VDBRepository.class,  vdb.getVDBRepositoryInjector());
+		vdbService.addDependency(TeiidServiceNames.TRANSLATOR_REPO, TranslatorRepository.class,  vdb.getTranslatorRepositoryInjector());
+		vdbService.addDependency(TeiidServiceNames.executorServiceName(this.asyncThreadPoolName), TranslatorRepository.class,  vdb.getTranslatorRepositoryInjector());
+		vdbService.addDependency(TeiidServiceNames.OBJECT_SERIALIZER, ObjectSerializer.class, vdb.getSerializerInjector());
+		vdbService.setInitialMode(Mode.ACTIVE).install();
+	}
+
+
+	@Override
+	public void undeploy(final DeploymentUnit deploymentUnit) {
+		if (!TeiidAttachments.isVDBDeployment(deploymentUnit)) {
+			return;
+		}		
+		
+		VDBMetaData deployment = deploymentUnit.getAttachment(TeiidAttachments.VDB_METADATA);
+        final ServiceController<?> controller = deploymentUnit.getServiceRegistry().getService(TeiidServiceNames.vdbServiceName(deployment.getName(), deployment.getVersion()));
+        if (controller != null) {
+            controller.setMode(ServiceController.Mode.REMOVE);
+        }
+	}
+
+}


Property changes on: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBDeployer.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Copied: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBParserDeployer.java (from rev 3382, branches/as7/runtime/src/main/java/org/teiid/deployers/VDBParserDeployer.java)
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBParserDeployer.java	                        (rev 0)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBParserDeployer.java	2011-08-22 14:36:06 UTC (rev 3422)
@@ -0,0 +1,201 @@
+/*
+ * 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;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+
+import javax.xml.XMLConstants;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+
+import org.jboss.as.server.deployment.*;
+import org.jboss.vfs.VirtualFile;
+import org.teiid.adminapi.Model;
+import org.teiid.adminapi.impl.ModelMetaData;
+import org.teiid.adminapi.impl.VDBMetaData;
+import org.teiid.deployers.*;
+import org.teiid.logging.LogConstants;
+import org.teiid.logging.LogManager;
+import org.teiid.metadata.VdbConstants;
+import org.teiid.metadata.index.IndexMetadataFactory;
+import org.teiid.runtime.RuntimePlugin;
+import org.xml.sax.SAXException;
+
+
+/**
+ * This file loads the "vdb.xml" file inside a ".vdb" file, along with all the metadata in the .INDEX files
+ */
+public class VDBParserDeployer implements DeploymentUnitProcessor {
+	private ObjectSerializer serializer;
+	private VDBRepository vdbRepository;
+	
+	public VDBParserDeployer(VDBRepository repo, ObjectSerializer serializer) {
+		this.vdbRepository = repo;
+		this.serializer = serializer;
+	}
+	
+	public void deploy(final DeploymentPhaseContext phaseContext)  throws DeploymentUnitProcessingException {
+		DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
+		if (!TeiidAttachments.isVDBDeployment(deploymentUnit)) {
+			return;
+		}
+
+		VirtualFile file = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT).getRoot();
+
+		if (TeiidAttachments.isDynamicVDB(deploymentUnit)) {
+			parseVDBXML(file, deploymentUnit);			
+		}
+		else {
+			// scan for different files 
+			List<VirtualFile> childFiles = file.getChildren();
+			for (VirtualFile childFile:childFiles) {
+				scanVDB(childFile, deploymentUnit);
+			}
+			
+			mergeMetaData(deploymentUnit);
+		}
+	}
+	
+	private void scanVDB(VirtualFile file, DeploymentUnit deploymentUnit) throws DeploymentUnitProcessingException {
+		if (file.isDirectory()) {
+			List<VirtualFile> childFiles = file.getChildren();
+			for (VirtualFile childFile:childFiles) {
+				scanVDB(childFile, deploymentUnit);
+			}
+		}
+		else {
+			if (file.getLowerCaseName().equals(VdbConstants.DEPLOYMENT_FILE)) {
+				parseVDBXML(file, deploymentUnit);
+			}
+			else if (file.getLowerCaseName().endsWith(VdbConstants.INDEX_EXT)) {
+				IndexMetadataFactory imf = deploymentUnit.getAttachment(TeiidAttachments.INDEX_METADATA);
+				if (imf == null) {
+					imf = new IndexMetadataFactory();
+					deploymentUnit.putAttachment(TeiidAttachments.INDEX_METADATA, imf);
+				}
+				imf.addIndexFile(file);
+			}
+			else if (file.getLowerCaseName().endsWith(VdbConstants.MODEL_EXT)) {
+				UDFMetaData udf = deploymentUnit.getAttachment(TeiidAttachments.UDF_METADATA);
+				if (udf == null) {
+					udf = new UDFMetaData();
+					deploymentUnit.putAttachment(TeiidAttachments.UDF_METADATA, udf);
+				}
+				udf.addModelFile(file);				
+			}
+			
+		}
+	}
+
+	private void parseVDBXML(VirtualFile file, DeploymentUnit deploymentUnit)
+			throws DeploymentUnitProcessingException {
+		try {
+			Unmarshaller un = getUnMarsheller();
+			VDBMetaData vdb = (VDBMetaData)un.unmarshal(file.openStream());
+			deploymentUnit.putAttachment(TeiidAttachments.VDB_METADATA, vdb);
+			LogManager.logDetail(LogConstants.CTX_RUNTIME,"VDB "+file.getName()+" has been parsed.");  //$NON-NLS-1$ //$NON-NLS-2$
+		} catch (JAXBException e) {
+			throw new DeploymentUnitProcessingException(e);
+		} catch (SAXException e) {
+			throw new DeploymentUnitProcessingException(e);
+		} catch (IOException e) {
+			throw new DeploymentUnitProcessingException(e);
+		}
+	}
+	
+    public void undeploy(final DeploymentUnit context) {
+    }	
+    
+
+	static Unmarshaller getUnMarsheller() throws JAXBException, SAXException {
+		JAXBContext jc = JAXBContext.newInstance(new Class<?>[] {VDBMetaData.class});
+		SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+		Schema schema = schemaFactory.newSchema(VDBMetaData.class.getResource("/vdb-deployer.xsd")); //$NON-NLS-1$
+		Unmarshaller un = jc.createUnmarshaller();
+		un.setSchema(schema);
+		return un;
+	}
+	
+	protected VDBMetaData mergeMetaData(DeploymentUnit deploymentUnit) throws DeploymentUnitProcessingException {
+		VDBMetaData vdb = deploymentUnit.getAttachment(TeiidAttachments.VDB_METADATA);
+		UDFMetaData udf = deploymentUnit.getAttachment(TeiidAttachments.UDF_METADATA);
+		IndexMetadataFactory imf = deploymentUnit.getAttachment(TeiidAttachments.INDEX_METADATA);
+		
+		VirtualFile file = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT).getRoot();
+		if (vdb == null) {
+			LogManager.logError(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("invlaid_vdb_file",file.getName())); //$NON-NLS-1$
+			return null;
+		}
+		
+		try {
+			vdb.setUrl(file.toURL());		
+			
+			// build the metadata store
+			if (imf != null) {
+				imf.addEntriesPlusVisibilities(file, vdb);
+								
+				// add the cached store.
+				File cacheFile = VDBDeployer.buildCachedVDBFileName(this.serializer, file, vdb);
+				// check to see if the vdb has been modified when server is down; if it is then clear the old files
+				if (this.serializer.isStale(cacheFile, file.getLastModified())) {
+					this.serializer.removeAttachments(file);
+					LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB", file.getName(), "old cached metadata has been removed"); //$NON-NLS-1$ //$NON-NLS-2$				
+				}
+				MetadataStoreGroup stores = this.serializer.loadSafe(cacheFile, MetadataStoreGroup.class);
+				if (stores == null) {				
+					// start to build the new metadata 
+					stores = new MetadataStoreGroup();
+					stores.addStore(imf.getMetadataStore(vdbRepository.getSystemStore().getDatatypes()));
+				}
+				else {
+					LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB", file.getName(), "was loaded from cached metadata"); //$NON-NLS-1$ //$NON-NLS-2$
+				}
+				deploymentUnit.putAttachment(TeiidAttachments.METADATA_STORE, stores);				
+			}
+			
+			if (udf != null) {
+				// load the UDF
+				for(Model model:vdb.getModels()) {
+					if (model.getModelType().equals(Model.Type.FUNCTION)) {
+						String path = ((ModelMetaData)model).getPath();
+						if (path == null) {
+							throw new DeploymentUnitProcessingException(RuntimePlugin.Util.getString("invalid_udf_file", model.getName())); //$NON-NLS-1$
+						}
+						udf.buildFunctionModelFile(model.getName(), path);
+					}
+				}		
+			}
+		} catch(IOException e) {
+			throw new DeploymentUnitProcessingException(e); 
+		} catch (JAXBException e) {
+			throw new DeploymentUnitProcessingException(e);
+		}
+				
+		LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB", file.getName(), "has been parsed."); //$NON-NLS-1$ //$NON-NLS-2$
+		return vdb;
+	}
+}


Property changes on: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBParserDeployer.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBRepositoryService.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBRepositoryService.java	                        (rev 0)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBRepositoryService.java	2011-08-22 14:36:06 UTC (rev 3422)
@@ -0,0 +1,50 @@
+/*
+ * 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;
+
+import org.jboss.msc.service.Service;
+import org.jboss.msc.service.StartContext;
+import org.jboss.msc.service.StartException;
+import org.jboss.msc.service.StopContext;
+import org.teiid.deployers.VDBRepository;
+
+public class VDBRepositoryService implements Service<VDBRepository> {
+	private VDBRepository repo;
+	
+	public VDBRepositoryService(VDBRepository repo) {
+		this.repo = repo;
+	}
+	
+	@Override
+	public void start(StartContext context) throws StartException {
+		repo.start();
+	}
+
+	@Override
+	public void stop(StopContext context) {
+	}
+
+	@Override
+	public VDBRepository getValue() throws IllegalStateException, IllegalArgumentException {
+		return repo;
+	}
+}


Property changes on: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBRepositoryService.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Copied: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBService.java (from rev 3382, branches/as7/runtime/src/main/java/org/teiid/deployers/VDBService.java)
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBService.java	                        (rev 0)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBService.java	2011-08-22 14:36:06 UTC (rev 3422)
@@ -0,0 +1,395 @@
+package org.teiid.jboss;
+
+import java.io.File;
+import java.io.IOException;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.util.concurrent.Executor;
+
+import javax.resource.spi.work.WorkManager;
+
+import org.jboss.as.server.deployment.Attachments;
+import org.jboss.as.server.deployment.DeploymentUnitProcessingException;
+import org.jboss.msc.service.Service;
+import org.jboss.msc.service.StartContext;
+import org.jboss.msc.service.StartException;
+import org.jboss.msc.service.StopContext;
+import org.jboss.msc.value.InjectedValue;
+import org.jboss.vfs.VirtualFile;
+import org.teiid.adminapi.Model;
+import org.teiid.adminapi.Translator;
+import org.teiid.adminapi.VDB;
+import org.teiid.adminapi.impl.ModelMetaData;
+import org.teiid.adminapi.impl.SourceMappingMetadata;
+import org.teiid.adminapi.impl.VDBMetaData;
+import org.teiid.adminapi.impl.VDBTranslatorMetaData;
+import org.teiid.core.TeiidException;
+import org.teiid.deployers.*;
+import org.teiid.dqp.internal.datamgr.ConnectorManager;
+import org.teiid.dqp.internal.datamgr.ConnectorManagerRepository;
+import org.teiid.dqp.internal.datamgr.TranslatorRepository;
+import org.teiid.logging.LogConstants;
+import org.teiid.logging.LogManager;
+import org.teiid.metadata.MetadataStore;
+import org.teiid.metadata.index.IndexMetadataFactory;
+import org.teiid.query.metadata.TransformationMetadata.Resource;
+import org.teiid.runtime.RuntimePlugin;
+import org.teiid.translator.DelegatingExecutionFactory;
+import org.teiid.translator.ExecutionFactory;
+import org.teiid.translator.TranslatorException;
+
+public class VDBService implements Service<VDBMetaData> {
+	private VDBMetaData vdb;
+	private final InjectedValue<VDBRepository> vdbRepositoryInjector = new InjectedValue<VDBRepository>();
+	private final InjectedValue<TranslatorRepository> translatorRepositoryInjector = new InjectedValue<TranslatorRepository>();
+	private final InjectedValue<Executor> executorInjector = new InjectedValue<Executor>();
+	private final InjectedValue<ObjectSerializer> serializerInjector = new InjectedValue<ObjectSerializer>();
+	
+	public VDBService(VDBMetaData metadata) {
+		this.vdb = metadata;
+	}
+	
+	@Override
+	public void start(StartContext context) throws StartException {
+		ConnectorManagerRepository cmr = new ConnectorManagerRepository();
+		TranslatorRepository repo = new TranslatorRepository();
+		
+		// add required connector managers; if they are not already there
+		for (Translator t: vdb.getOverrideTranslators()) {
+			VDBTranslatorMetaData data = (VDBTranslatorMetaData)t;
+			
+			String type = data.getType();
+			Translator parent = getTranslatorRepository().getTranslatorMetaData(type);
+			
+			Set<String> keys = parent.getProperties().stringPropertyNames();
+			for (String key:keys) {
+				if (data.getPropertyValue(key) == null && parent.getPropertyValue(key) != null) {
+					data.addProperty(key, parent.getPropertyValue(key));
+				}
+			}
+			repo.addTranslatorMetadata(data.getName(), data);
+		}
+
+		createConnectorManagers(cmr, repo, vdb);
+
+		// check if this is a VDB with index files, if there are then build the TransformationMetadata
+		UDFMetaData udf = vdb.getAttachment(UDFMetaData.class);
+		MetadataStoreGroup store = vdb.getAttachment(MetadataStoreGroup.class);
+		
+		boolean asynchLoad = false;
+		boolean preview = vdb.isPreview();
+		
+		// if store is null and vdb dynamic vdb then try to get the metadata
+		if (store == null && vdb.isDynamic()) {
+			store = new MetadataStoreGroup();
+			asynchLoad = buildDynamicMetadataStore(vdb, store, cmr);
+		}
+		
+		// allow empty vdbs for enabling the preview functionality
+		if (preview && store == null) {
+			store = new MetadataStoreGroup();
+		}
+		
+		if (store == null) {
+			LogManager.logError(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("failed_matadata_load", vdb.getName(), vdb.getVersion())); //$NON-NLS-1$
+		}
+		
+		LinkedHashMap<String, Resource> visibilityMap = null;
+		IndexMetadataFactory indexFactory = vdb.getAttachment(IndexMetadataFactory.class);		
+		if (indexFactory != null) {
+			visibilityMap = indexFactory.getEntriesPlusVisibilities();
+		}
+				
+		try {
+			// add transformation metadata to the repository.
+			getVDBRepository().addVDB(vdb, store, visibilityMap, udf, cmr);
+		} catch (VirtualDatabaseException e) {
+			throw new StartException(e);
+		}
+		
+		boolean valid = true;
+		synchronized (vdb) {
+			if (indexFactory != null) {
+				try {
+					saveMetadataStore(vdb, store);
+				} catch (IOException e1) {
+					LogManager.logWarning(LogConstants.CTX_RUNTIME, e1, RuntimePlugin.Util.getString("vdb_save_failed", vdb.getName()+"."+vdb.getVersion())); //$NON-NLS-1$ //$NON-NLS-2$			
+				}
+			}
+			if (!preview) {
+				valid = validateSources(cmr, vdb);
+				
+				// Check if the VDB is fully configured.
+				if (!valid) {
+					vdb.setStatus(VDB.Status.INACTIVE);
+				} else if (!asynchLoad) {
+					//if asynch this will be set by the loading thread
+					getVDBRepository().finishDeployment(vdb.getName(), vdb.getVersion());
+					vdb.setStatus(VDB.Status.ACTIVE);
+				}
+			}
+			else {
+				vdb.setStatus(VDB.Status.ACTIVE);
+			}
+		}
+		this.vdb.removeAttachment(UDFMetaData.class);
+		this.vdb.removeAttachment(MetadataStoreGroup.class);
+		this.vdb.removeAttachment(IndexMetadataFactory.class);	
+		
+		LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("vdb_deployed",vdb, valid?"active":"inactive")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$		
+	}
+
+	@Override
+	public void stop(StopContext context) {
+		
+		getVDBRepository().removeVDB(vdb.getName(), vdb.getVersion());
+		vdb.setRemoved(true);
+		
+		deleteMetadataStore(vdb);
+
+		LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("vdb_undeployed", vdb)); //$NON-NLS-1$
+		
+	}
+
+	@Override
+	public VDBMetaData getValue() throws IllegalStateException,IllegalArgumentException {
+		return this.vdb;
+	}
+	
+	private void createConnectorManagers(ConnectorManagerRepository cmr, TranslatorRepository repo, final VDBMetaData deployment) throws StartException {
+		IdentityHashMap<Translator, ExecutionFactory<Object, Object>> map = new IdentityHashMap<Translator, ExecutionFactory<Object, Object>>();
+		
+		for (Model model:deployment.getModels()) {
+			for (String source:model.getSourceNames()) {
+				if (cmr.getConnectorManager(source) != null) {
+					continue;
+				}
+
+				String name = model.getSourceTranslatorName(source);
+				ConnectorManager cm = new ConnectorManager(name, model.getSourceConnectionJndiName(source));
+				ExecutionFactory<Object, Object> ef = getExecutionFactory(name, repo, deployment, map, new HashSet<String>());
+				cm.setExecutionFactory(ef);
+				cm.setModelName(model.getName());
+				cmr.addConnectorManager(source, cm);
+			}
+		}
+	}
+	
+	private ExecutionFactory<Object, Object> getExecutionFactory(String name, TranslatorRepository repo, VDBMetaData deployment, IdentityHashMap<Translator, ExecutionFactory<Object, Object>> map, HashSet<String> building) throws StartException {
+		if (!building.add(name)) {
+			throw new StartException(RuntimePlugin.Util.getString("recursive_delegation", deployment.getName(), deployment.getVersion(), building)); //$NON-NLS-1$
+		}
+		VDBTranslatorMetaData translator = repo.getTranslatorMetaData(name);
+		if (translator == null) {
+			translator = getTranslatorRepository().getTranslatorMetaData(name);
+		}
+		if (translator == null) {
+			throw new StartException(RuntimePlugin.Util.getString("translator_not_found", deployment.getName(), deployment.getVersion(), name)); //$NON-NLS-1$
+		}
+		try {
+		ExecutionFactory<Object, Object> ef = map.get(translator);
+		if ( ef == null) {
+			ef = TranslatorUtil.buildExecutionFactory(translator);
+			if (ef instanceof DelegatingExecutionFactory) {
+				DelegatingExecutionFactory delegator = (DelegatingExecutionFactory)ef;
+				String delegateName = delegator.getDelegateName();
+				if (delegateName != null) {
+					ExecutionFactory<Object, Object> delegate = getExecutionFactory(delegateName, repo, deployment, map, building);
+					((DelegatingExecutionFactory) ef).setDelegate(delegate);
+				}
+			}
+			map.put(translator, ef);
+		}
+		return ef;
+		} catch(TeiidException e) {
+			throw new StartException(e);
+		}
+	}
+
+	
+	private boolean validateSources(ConnectorManagerRepository cmr, VDBMetaData deployment) {
+		boolean valid = true;
+		for(Model m:deployment.getModels()) {
+			ModelMetaData model = (ModelMetaData)m;
+			List<SourceMappingMetadata> mappings = model.getSourceMappings();
+			for (SourceMappingMetadata mapping:mappings) {
+				ConnectorManager cm = cmr.getConnectorManager(mapping.getName());
+				String msg = cm.getStausMessage();
+				if (msg != null && msg.length() > 0) {
+					valid = false;
+					model.addError(ModelMetaData.ValidationError.Severity.ERROR.name(), cm.getStausMessage());
+					LogManager.logInfo(LogConstants.CTX_RUNTIME, cm.getStausMessage());
+				}
+			}
+			
+			// in the dynamic case the metadata may be still loading.
+			if (!model.getErrors().isEmpty()) {
+				valid = false;
+			}
+		}
+		return valid;
+	}
+
+    private boolean buildDynamicMetadataStore(final VDBMetaData vdb, final MetadataStoreGroup vdbStore, final ConnectorManagerRepository cmr) throws StartException {
+    	boolean asynch = false;
+    	// make sure we are configured correctly first
+		for (final ModelMetaData model:vdb.getModelMetaDatas().values()) {
+	    	if (model.getSourceNames().isEmpty()) {
+	    		throw new StartException(RuntimePlugin.Util.getString("fail_to_deploy", vdb.getName()+"-"+vdb.getVersion(), model.getName())); //$NON-NLS-1$ //$NON-NLS-2$
+	    	}
+			    	
+	    	final boolean cache = "cached".equalsIgnoreCase(vdb.getPropertyValue("UseConnectorMetadata")); //$NON-NLS-1$ //$NON-NLS-2$
+	    	final File cacheFile = buildCachedModelFileName(vdb, model.getName());
+	    	boolean loaded = false;
+	    	if (cache) {
+				MetadataStore store = getSerializer().loadSafe(cacheFile, MetadataStore.class);
+				if (store != null) {
+					vdbStore.addStore(store);
+					loaded = true;
+				}
+	    	}
+	    	
+	    	if (!loaded) {
+	    		Runnable job = new Runnable() {
+					@Override
+					public void run() {
+						Boolean loadStatus = loadMetadata(vdb, model, cache, cacheFile, vdbStore, cmr);
+						//if (loadStatus == null) {
+							//TODO: a source is up, but we failed.  should we retry or poll?
+						//} 
+						if (loadStatus == null || !loadStatus) {
+							//defer the load to the status checker if/when a source is available/redeployed
+							model.addAttchment(Runnable.class, this);
+						}	    				
+					}
+	    		};	    		
+	    		Executor executor = getExecutor();
+	    		if (executor == null) {
+	    			job.run();
+	    		}
+	    		else {
+		    		asynch = true;
+		    		executor.execute(job);
+	    		}
+	    	}
+		}
+		return asynch;
+	}	
+    
+    /**
+     * @return true if loaded, null if not loaded - but a cm is available, else false
+     */
+    private Boolean loadMetadata(VDBMetaData vdb, ModelMetaData model, boolean cache, File cacheFile, MetadataStoreGroup vdbStore, ConnectorManagerRepository cmr) {
+		String msg = RuntimePlugin.Util.getString("model_metadata_loading", vdb.getName(), vdb.getVersion(), model.getName(), SimpleDateFormat.getInstance().format(new Date())); //$NON-NLS-1$ 
+		model.addError(ModelMetaData.ValidationError.Severity.ERROR.toString(), msg); 
+		LogManager.logInfo(LogConstants.CTX_RUNTIME, msg);
+
+    	String exceptionMessage = null;
+    	Boolean loaded = false;
+    	for (String sourceName: model.getSourceNames()) {
+    		ConnectorManager cm = cmr.getConnectorManager(sourceName);
+    		String status = cm.getStausMessage();
+			if (status != null && status.length() > 0) {
+				exceptionMessage = status;
+				continue;
+			}
+			loaded = null;
+    		try {
+    			MetadataStore store = cm.getMetadata(model.getName(), getVDBRepository().getBuiltinDatatypes(), model.getProperties());
+    			if (cache) {
+    				getSerializer().saveAttachment(cacheFile, store);
+    			}
+    			vdbStore.addStore(store);
+    			loaded = true;
+    			break;
+			} catch (TranslatorException e) {
+				//TODO: we aren't effectively differentiating the type of load error - connectivity vs. metadata
+				if (exceptionMessage == null) {
+					exceptionMessage = e.getMessage();
+				}
+			} catch (IOException e) {
+				if (exceptionMessage == null) {
+					exceptionMessage = e.getMessage();
+				}				
+			}
+    	}
+    	
+    	synchronized (vdb) {
+	    	if (loaded == null || !loaded) {
+	    		vdb.setStatus(VDB.Status.INACTIVE);
+	    		String failed_msg = RuntimePlugin.Util.getString(loaded==null?"failed_to_retrive_metadata":"nosources_to_retrive_metadata", vdb.getName(), vdb.getVersion(), model.getName()); //$NON-NLS-1$ //$NON-NLS-2$ 
+		    	model.addError(ModelMetaData.ValidationError.Severity.ERROR.toString(), failed_msg); 
+		    	if (exceptionMessage != null) {
+		    		model.addError(ModelMetaData.ValidationError.Severity.ERROR.toString(), exceptionMessage);     		
+		    	}
+		    	LogManager.logWarning(LogConstants.CTX_RUNTIME, failed_msg);
+	    	} else {
+	    		LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("metadata_loaded",vdb.getName(), vdb.getVersion(), model.getName())); //$NON-NLS-1$
+	    		model.clearErrors();
+	    		if (vdb.isValid()) {
+	    			getVDBRepository().finishDeployment(vdb.getName(), vdb.getVersion());
+					vdb.setStatus(VDB.Status.ACTIVE);
+					LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("vdb_activated",vdb.getName(), vdb.getVersion())); //$NON-NLS-1$    			
+	    		}
+	    	}
+    	}
+    	
+    	return loaded;
+    }
+    
+	private void saveMetadataStore(VDBMetaData vdb, MetadataStoreGroup store) throws IOException {
+		File cacheFileName = buildCachedVDBFileName(getSerializer(), vdb);
+		if (!cacheFileName.exists()) {
+			getSerializer().saveAttachment(cacheFileName,store);
+			LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB "+vdb.getName()+" metadata has been cached to "+ cacheFileName); //$NON-NLS-1$ //$NON-NLS-2$
+		}		
+	}
+	
+	private void deleteMetadataStore(VDBMetaData vdb) {
+		if (!unit.exists() || !shutdownListener.isShutdownInProgress()) {
+			getSerializer().removeAttachments(vdb.getName()+"_"+vdb.getVersion()); //$NON-NLS-1$
+			LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB "+vdb.getName()+" metadata removed"); //$NON-NLS-1$ //$NON-NLS-2$
+		}
+	}
+	
+    
+	private File buildCachedModelFileName(VDBMetaData vdb, String modelName) {
+		return getSerializer().getAttachmentPath(vdb.getName()+"_"+vdb.getVersion(), vdb.getName()+"_"+vdb.getVersion()+"_"+modelName); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+	}    
+	
+	static File buildCachedVDBFileName(ObjectSerializer serializer, VDBMetaData vdb) {
+		return serializer.getAttachmentPath(vdb.getName()+"_"+vdb.getVersion(), vdb.getName()+"_"+vdb.getVersion()); //$NON-NLS-1$ //$NON-NLS-2$
+	} 	
+	
+	public InjectedValue<VDBRepository> getVDBRepositoryInjector(){
+		return this.vdbRepositoryInjector;
+	}
+	
+	private VDBRepository getVDBRepository() {
+		return vdbRepositoryInjector.getValue();
+	}
+	
+	public InjectedValue<TranslatorRepository> getTranslatorRepositoryInjector(){
+		return this.translatorRepositoryInjector;
+	}
+	
+	private TranslatorRepository getTranslatorRepository() {
+		return this.translatorRepositoryInjector.getValue();
+	}
+	
+	public InjectedValue<Executor> getExecutorInjector(){
+		return this.executorInjector;
+	}
+	
+	private Executor getExecutor() {
+		return this.executorInjector.getValue();
+	}
+	
+	public InjectedValue<ObjectSerializer> getSerializerInjector() {
+		return serializerInjector;
+	}
+	
+	private ObjectSerializer getSerializer() {
+		return serializerInjector.getValue();
+	}
+}


Property changes on: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBService.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Copied: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBStructure.java (from rev 3382, branches/as7/runtime/src/main/java/org/teiid/deployers/VDBStructure.java)
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBStructure.java	                        (rev 0)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBStructure.java	2011-08-22 14:36:06 UTC (rev 3422)
@@ -0,0 +1,85 @@
+/*
+ * 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;
+
+import java.io.Closeable;
+import java.io.IOException;
+
+import org.jboss.as.server.deployment.*;
+import org.jboss.as.server.deployment.module.ModuleRootMarker;
+import org.jboss.as.server.deployment.module.MountHandle;
+import org.jboss.as.server.deployment.module.ResourceRoot;
+import org.jboss.as.server.deployment.module.TempFileProviderService;
+import org.jboss.vfs.VFS;
+import org.jboss.vfs.VirtualFile;
+import org.teiid.deployers.TeiidAttachments;
+import org.teiid.metadata.VdbConstants;
+
+
+
+public class VDBStructure  implements DeploymentUnitProcessor {
+	private static final String VDB_EXTENSION = ".vdb"; //$NON-NLS-1$
+	private static final String DYNAMIC_VDB_STRUCTURE = "-vdb.xml"; //$NON-NLS-1$
+	
+	@Override
+	public void deploy(final DeploymentPhaseContext phaseContext)  throws DeploymentUnitProcessingException {
+		
+        DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
+        
+        VirtualFile file = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT).getRoot();
+        if (file == null) {
+        	return;
+        }
+        
+        if(file.getLowerCaseName().endsWith(VDB_EXTENSION)) {
+
+        	try {
+				final Closeable closable = VFS.mountZip(file, file, TempFileProviderService.provider());
+				final ResourceRoot vdbArchiveRoot = new ResourceRoot(file.getName(), file, new MountHandle(closable));
+				ModuleRootMarker.mark(vdbArchiveRoot);
+				
+				VirtualFile metainf = file.getChild("META-INF"); //$NON-NLS-1$
+				if (metainf == null) {
+					return;
+				}
+				
+				if (metainf.getChild(VdbConstants.DEPLOYMENT_FILE) == null) {
+					return;
+				}
+				// adds a TYPE attachment.
+				TeiidAttachments.setAsVDBDeployment(deploymentUnit);
+			} catch (IOException e) {
+				throw new DeploymentUnitProcessingException("failed to process " + file, e); //$NON-NLS-1$
+			}			
+        }
+        else if (file.getLowerCaseName().endsWith(DYNAMIC_VDB_STRUCTURE)) {
+	        TeiidAttachments.setAsDynamicVDBDeployment(deploymentUnit);			        	
+        }
+	}
+	
+	
+	@Override
+	public void undeploy(final DeploymentUnit context) {
+		
+	}
+
+}


Property changes on: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBStructure.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java	2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java	2011-08-22 14:36:06 UTC (rev 3422)
@@ -30,20 +30,8 @@
 import java.sql.Clob;
 import java.sql.SQLException;
 import java.sql.SQLXML;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Date;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Properties;
-import java.util.Set;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.Executor;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
+import java.util.*;
+import java.util.concurrent.*;
 
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
@@ -64,14 +52,7 @@
 import org.teiid.adminapi.AdminComponentException;
 import org.teiid.adminapi.AdminException;
 import org.teiid.adminapi.AdminProcessingException;
-import org.teiid.adminapi.impl.CacheStatisticsMetadata;
-import org.teiid.adminapi.impl.DQPManagement;
-import org.teiid.adminapi.impl.RequestMetadata;
-import org.teiid.adminapi.impl.SessionMetadata;
-import org.teiid.adminapi.impl.TransactionMetadata;
-import org.teiid.adminapi.impl.VDBMetaData;
-import org.teiid.adminapi.impl.VDBTranslatorMetaData;
-import org.teiid.adminapi.impl.WorkerPoolStatisticsMetadata;
+import org.teiid.adminapi.impl.*;
 import org.teiid.cache.CacheFactory;
 import org.teiid.client.DQP;
 import org.teiid.client.RequestMessage;
@@ -89,11 +70,7 @@
 import org.teiid.deployers.VDBLifeCycleListener;
 import org.teiid.deployers.VDBRepository;
 import org.teiid.dqp.internal.datamgr.TranslatorRepository;
-import org.teiid.dqp.internal.process.DQPConfiguration;
-import org.teiid.dqp.internal.process.DQPCore;
-import org.teiid.dqp.internal.process.DQPWorkContext;
-import org.teiid.dqp.internal.process.DataTierManagerImpl;
-import org.teiid.dqp.internal.process.TransactionServerImpl;
+import org.teiid.dqp.internal.process.*;
 import org.teiid.dqp.service.BufferService;
 import org.teiid.dqp.service.SessionService;
 import org.teiid.dqp.service.SessionServiceException;
@@ -101,30 +78,18 @@
 import org.teiid.events.EventDistributor;
 import org.teiid.events.EventDistributorFactory;
 import org.teiid.jboss.IntegrationPlugin;
-import org.teiid.logging.Log4jListener;
 import org.teiid.logging.LogConstants;
 import org.teiid.logging.LogManager;
 import org.teiid.logging.MessageLevel;
-import org.teiid.metadata.AbstractMetadataRecord;
-import org.teiid.metadata.Column;
-import org.teiid.metadata.ColumnStats;
-import org.teiid.metadata.Procedure;
-import org.teiid.metadata.Schema;
-import org.teiid.metadata.Table;
+import org.teiid.metadata.*;
 import org.teiid.metadata.Table.TriggerEvent;
-import org.teiid.metadata.TableStats;
 import org.teiid.net.TeiidURL;
 import org.teiid.query.metadata.TransformationMetadata;
 import org.teiid.query.processor.DdlPlan;
 import org.teiid.security.SecurityHelper;
 import org.teiid.services.BufferServiceImpl;
 import org.teiid.services.SessionServiceImpl;
-import org.teiid.transport.ClientServiceRegistry;
-import org.teiid.transport.ClientServiceRegistryImpl;
-import org.teiid.transport.LogonImpl;
-import org.teiid.transport.ODBCSocketListener;
-import org.teiid.transport.SocketConfiguration;
-import org.teiid.transport.SocketListener;
+import org.teiid.transport.*;
 import org.teiid.vdb.runtime.VDBKey;
 
 
@@ -156,18 +121,25 @@
 	public final InjectedValue<WorkManager> workManagerInjector = new InjectedValue<WorkManager>();
 	public final InjectedValue<XATerminator> xaTerminatorInjector = new InjectedValue<XATerminator>();
 	public final InjectedValue<TransactionManager> txnManagerInjector = new InjectedValue<TransactionManager>();
-	public final InjectedValue<Executor> threadPoolInjector = new InjectedValue<Executor>();
 	public final InjectedValue<SocketBinding> jdbcSocketBindingInjector = new InjectedValue<SocketBinding>();
 	public final InjectedValue<BufferServiceImpl> bufferServiceInjector = new InjectedValue<BufferServiceImpl>();
 	public final InjectedValue<SocketBinding> odbcSocketBindingInjector = new InjectedValue<SocketBinding>();
+	public final InjectedValue<TranslatorRepository> translatorRepositoryInjector = new InjectedValue<TranslatorRepository>();
+	public final InjectedValue<VDBRepository> vdbRepositoryInjector = new InjectedValue<VDBRepository>();
+	public final InjectedValue<AuthorizationValidator> authorizationValidatorInjector = new InjectedValue<AuthorizationValidator>();
+	
+	
 	public final ConcurrentMap<String, SecurityDomainContext> securityDomains = new ConcurrentHashMap<String, SecurityDomainContext>();
 	private LinkedList<String> securityDomainNames = new LinkedList<String>();
-
+	private String instanceName;
 	
-    public RuntimeEngineDeployer() {
-		// TODO: this does not belong here
-		LogManager.setLogListener(new Log4jListener());
+    public RuntimeEngineDeployer(String name) {
+		this.instanceName = name;
     }
+    
+    public String getName() {
+    	return this.instanceName;
+    }
 	
 	@Override
 	public <T> T getClientService(Class<T> iface)
@@ -185,6 +157,9 @@
 		setWorkManager(this.workManagerInjector.getValue());
 		setXATerminator(xaTerminatorInjector.getValue());
 		setTransactionManager(txnManagerInjector.getValue());
+		setTranslatorRepository(translatorRepositoryInjector.getValue());
+		setVDBRepository(vdbRepositoryInjector.getValue());
+		setAuthorizationValidator(authorizationValidatorInjector.getValue());
 		
 		this.sessionService = new SessionServiceImpl();
 		if (!this.securityDomainNames.isEmpty()) {
@@ -222,7 +197,7 @@
 		this.dqpCore.setMetadataRepository(this.vdbRepository.getMetadataRepository());
 		this.dqpCore.setEventDistributor(this.eventDistributor);
 		this.dqpCore.start(this);
-		this.eventDistributorProxy = (EventDistributor)Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class[] {EventDistributor.class}, new InvocationHandler() {
+		this.eventDistributorProxy = (EventDistributor)Proxy.newProxyInstance(Module.getCallerModule().getClassLoader(), new Class[] {EventDistributor.class}, new InvocationHandler() {
 			
 			@Override
 			public Object invoke(Object proxy, Method method, Object[] args)
@@ -826,7 +801,7 @@
 	}
 
 	public VDBTranslatorMetaData getTranslator(String translatorName) {
-		return (VDBTranslatorMetaData)this.translatorRepository.getTranslatorMetaData(translatorName);
+		return this.translatorRepository.getTranslatorMetaData(translatorName);
 	}
 	
 	public void setTranslatorRepository(TranslatorRepository translatorRepo) {

Modified: branches/as7/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties
===================================================================
--- branches/as7/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties	2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties	2011-08-22 14:36:06 UTC (rev 3422)
@@ -182,3 +182,10 @@
 RuntimeEngineDeployer.execute-query.timeout-in-milli.describe=timeout
 
 socket-binding.not_defined=Teiid socket binding not defined for JDBC or ODBC port.
+
+name.describe = Name of the subsystem
+engine.remove = Remove Teiid query engine
+engine.add = Add Teiid query engine
+translator.add = Add Teiid translator
+translator.remove = Remove Teiid translator
+teiid-boot.add = Teiid boot services
\ No newline at end of file

Modified: branches/as7/jboss-integration/src/main/resources/schema/jboss-teiid.xsd
===================================================================
--- branches/as7/jboss-integration/src/main/resources/schema/jboss-teiid.xsd	2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/jboss-integration/src/main/resources/schema/jboss-teiid.xsd	2011-08-22 14:36:06 UTC (rev 3422)
@@ -32,6 +32,57 @@
 
     <xs:complexType name="teiidType">
         <xs:sequence>
+            <xs:element name="allow-env-function" type="xs:boolean" minOccurs="0" maxOccurs="1" default="false">
+                <xs:annotation>
+                    <xs:documentation>Allow execution of ENV function (default false)</xs:documentation>
+                </xs:annotation>
+            </xs:element>            
+
+            <xs:element name="async-thread-group" type="xs:string" minOccurs="0" maxOccurs="1" default="teiid-async">
+                <xs:annotation>
+                    <xs:documentation>Thread group to use for Async Processing</xs:documentation>
+                </xs:annotation>
+            </xs:element>        
+            <xs:element name="buffer-service" type="buffer-service-type" maxOccurs="1" minOccurs="1">
+                <xs:annotation>
+                    <xs:documentation>Buffer manager information</xs:documentation>
+                </xs:annotation>
+            </xs:element>
+            
+            <xs:element name="authorization-validator-module" type="xs:string" minOccurs="0" maxOccurs="1">
+                <xs:annotation>
+                    <xs:documentation>An authorization validator that by default uses data role information stored in VDBs. Provide module name.</xs:documentation>
+                </xs:annotation>
+            </xs:element>
+            
+            <xs:element name="policy-decider-module" type="xs:string" minOccurs="0" maxOccurs="1">
+                <xs:annotation>
+                    <xs:documentation>A policy decider that uses data role information stored in VDBs, Provide module name.</xs:documentation>
+                </xs:annotation>
+            </xs:element>
+
+
+            <xs:element name="distributed-cache-factory" type="cache-factory-type" maxOccurs="1" minOccurs="1">
+                <xs:annotation>
+                    <xs:documentation>Cache Factory</xs:documentation>
+                </xs:annotation>
+            </xs:element>
+
+            <xs:element name="resultset-cache" type="cache-config" maxOccurs="1" minOccurs="0">
+                <xs:annotation>
+                    <xs:documentation>Configuration for result set caching.
+                        There will be 2 caches with these settings.
+                        One cache holds results that are specific to sessions.
+                        The other cache holds vdb scoped results and can
+                        be replicated.</xs:documentation>
+                </xs:annotation>
+            </xs:element>
+            <xs:element name="preparedplan-cache" type="cache-config" maxOccurs="1" minOccurs="0">
+                <xs:annotation>
+                    <xs:documentation>Configuration for prepared plan caching. (local memory only)</xs:documentation>
+                </xs:annotation>
+            </xs:element>
+        
             <xs:element name="query-engine" type="runtime-engine-type" maxOccurs="1" minOccurs="1">
                 <xs:annotation>
                     <xs:documentation>Main Teiid runtime engine configuration</xs:documentation>
@@ -136,11 +187,6 @@
     </xs:complexType>
     <xs:complexType name="runtime-engine-type">
         <xs:sequence>
-            <xs:element name="async-thread-group" type="xs:string" minOccurs="0" maxOccurs="1" default="teiid-async">
-                <xs:annotation>
-                    <xs:documentation>Thread group to use for Async Processing</xs:documentation>
-                </xs:annotation>
-            </xs:element>        
             <xs:element name="max-threads" type="xs:int" minOccurs="0" maxOccurs="1" default="64">
                 <xs:annotation>
                     <xs:documentation>Process pool maximum thread count. (default 64)</xs:documentation>
@@ -219,51 +265,6 @@
                     <xs:documentation>Max allowed time before the session is terminated by the system, 0 indicates unlimited (default 0)</xs:documentation>
                 </xs:annotation>
             </xs:element>
-            <xs:element name="allow-env-function" type="xs:boolean" minOccurs="0" maxOccurs="1" default="false">
-                <xs:annotation>
-                    <xs:documentation>Allow execution of ENV function (default false)</xs:documentation>
-                </xs:annotation>
-            </xs:element>            
-
-            <xs:element name="buffer-service" type="buffer-service-type" maxOccurs="1" minOccurs="1">
-                <xs:annotation>
-                    <xs:documentation>Buffer manager information</xs:documentation>
-                </xs:annotation>
-            </xs:element>
-            
-            <xs:element name="authorization-validator-module" type="xs:string" minOccurs="0" maxOccurs="1">
-                <xs:annotation>
-                    <xs:documentation>An authorization validator that by default uses data role information stored in VDBs. Provide module name.</xs:documentation>
-                </xs:annotation>
-            </xs:element>
-            
-            <xs:element name="policy-decider-module" type="xs:string" minOccurs="0" maxOccurs="1">
-                <xs:annotation>
-                    <xs:documentation>A policy decider that uses data role information stored in VDBs, Provide module name.</xs:documentation>
-                </xs:annotation>
-            </xs:element>
-
-
-            <xs:element name="distributed-cache-factory" type="cache-factory-type" maxOccurs="1" minOccurs="1">
-                <xs:annotation>
-                    <xs:documentation>Cache Factory</xs:documentation>
-                </xs:annotation>
-            </xs:element>
-
-            <xs:element name="resultset-cache" type="cache-config" maxOccurs="1" minOccurs="0">
-                <xs:annotation>
-                    <xs:documentation>Configuration for result set caching.
-                        There will be 2 caches with these settings.
-                        One cache holds results that are specific to sessions.
-                        The other cache holds vdb scoped results and can
-                        be replicated.</xs:documentation>
-                </xs:annotation>
-            </xs:element>
-            <xs:element name="preparedplan-cache" type="cache-config" maxOccurs="1" minOccurs="0">
-                <xs:annotation>
-                    <xs:documentation>Configuration for prepared plan caching. (local memory only)</xs:documentation>
-                </xs:annotation>
-            </xs:element>
             <xs:element name="jdbc" type="socket-config" minOccurs="0" maxOccurs="1">
                 <xs:annotation>
                     <xs:documentation>jdbc port confguration</xs:documentation>

Modified: branches/as7/jboss-integration/src/test/java/org/teiid/jboss/TestTeiidConfiguration.java
===================================================================
--- branches/as7/jboss-integration/src/test/java/org/teiid/jboss/TestTeiidConfiguration.java	2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/jboss-integration/src/test/java/org/teiid/jboss/TestTeiidConfiguration.java	2011-08-22 14:36:06 UTC (rev 3422)
@@ -369,7 +369,7 @@
     @Test
     public void testSubSystemDescription() throws IOException {
     	ModelNode node = new ModelNode();
-    	QueryEngineDescription.getQueryEngineDescription(node, ATTRIBUTES, IntegrationPlugin.getResourceBundle(null));
+    	TeiidModelDescription.getQueryEngineDescription(node, ATTRIBUTES, IntegrationPlugin.getResourceBundle(null));
     	assertEquals(ObjectConverterUtil.convertToString(new FileReader("src/test/resources/teiid-model-config.txt")), node.toString());
     }
 }

Modified: branches/as7/jboss-integration/src/test/resources/teiid-sample-config.xml
===================================================================
--- branches/as7/jboss-integration/src/test/resources/teiid-sample-config.xml	2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/jboss-integration/src/test/resources/teiid-sample-config.xml	2011-08-22 14:36:06 UTC (rev 3422)
@@ -1,6 +1,8 @@
 <subsystem xmlns="urn:jboss:domain:teiid:1.0">
+    <async-thread-group>teiid-async</async-thread-group>
+    <allow-env-function>false</allow-env-function>
+    
     <query-engine>
-        <async-thread-group>teiid-async</async-thread-group>
         <max-threads>64</max-threads>
         <max-active-plans>20</max-active-plans>
         <thread-count-for-source-concurrency>0</thread-count-for-source-concurrency>
@@ -13,11 +15,10 @@
         <max-odbc-lob-size-allowed>5242880</max-odbc-lob-size-allowed>
         <event-distributor-name>teiid/event-distributor</event-distributor-name>
         <detect-change-events>true</detect-change-events>
-
         <security-domain>teiid-security</security-domain>
         <max-sessions-allowed>5000</max-sessions-allowed>
         <sessions-expiration-timelimit>0</sessions-expiration-timelimit>
-        <allow-env-function>false</allow-env-function>
+        
 
         <buffer-service>
             <use-disk>true</use-disk>

Modified: branches/as7/pom.xml
===================================================================
--- branches/as7/pom.xml	2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/pom.xml	2011-08-22 14:36:06 UTC (rev 3422)
@@ -109,6 +109,7 @@
 			<plugin>
 				<groupId>org.apache.maven.plugins</groupId>
 				<artifactId>maven-compiler-plugin</artifactId>
+                <version>2.3.2</version>
 				<configuration>
 					<source>1.6</source>
 					<target>1.6</target>
@@ -118,6 +119,7 @@
 			</plugin>
 			<plugin>
 				<artifactId>maven-surefire-plugin</artifactId>
+                <version>2.9</version>
 				<configuration>
 					<includes>
 						<include>**/*TestCase.java</include>
@@ -162,7 +164,7 @@
 							<addDefaultImplementationEntries> true</addDefaultImplementationEntries>
 						</manifest>
 						<manifestEntries>
-							<Implementation-URL>${pom.url}</Implementation-URL>
+							<Implementation-URL>${project.url}</Implementation-URL>
 						</manifestEntries>
 					</archive>
 				</configuration>
@@ -170,6 +172,7 @@
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-source-plugin</artifactId>
+                <version>2.1.2</version>
                 <executions>
                     <execution>
                         <id>attach-sources</id>
@@ -191,6 +194,7 @@
 			<plugin>
 				<groupId>org.apache.maven.plugins</groupId>
 				<artifactId>maven-javadoc-plugin</artifactId>
+                <version>2.8</version>
 				<configuration>
 					<aggregate>true</aggregate>
 					<maxmemory>512m</maxmemory>

Deleted: branches/as7/runtime/src/main/java/org/teiid/deployers/ObjectSerializer.java
===================================================================
--- branches/as7/runtime/src/main/java/org/teiid/deployers/ObjectSerializer.java	2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/runtime/src/main/java/org/teiid/deployers/ObjectSerializer.java	2011-08-22 14:36:06 UTC (rev 3422)
@@ -1,117 +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.deployers;
-
-import java.io.*;
-
-import org.jboss.logging.Logger;
-import org.jboss.vfs.VirtualFile;
-import org.teiid.core.util.FileUtils;
-import org.teiid.logging.LogConstants;
-import org.teiid.logging.LogManager;
-import org.teiid.runtime.RuntimePlugin;
-
-
-public class ObjectSerializer {
-	
-	private static final Logger log = Logger.getLogger(ObjectSerializer.class);
-
-	private static final String ATTACHMENT_SUFFIX = ".ser"; //$NON-NLS-1$
-
-	private String storagePath;
-	
-	public ObjectSerializer(String path) {
-		this.storagePath = path;
-	}
-	
-	public <T> T loadAttachment(File attachmentsStore, Class<T> expected) throws IOException, ClassNotFoundException {
-		if (log.isTraceEnabled()) {
-			log.trace("loadAttachment, attachmentsStore=" + attachmentsStore); //$NON-NLS-1$
-		}
-
-		ObjectInputStream ois = null;
-		try {
-			ois = new ObjectInputStream(new FileInputStream(attachmentsStore));
-			return expected.cast(ois.readObject());
-		} finally {
-			if (ois != null) {
-				ois.close();
-			}
-		}
-	}
-
-	public void saveAttachment(File attachmentsStore, Object attachment) throws IOException {
-		if (log.isTraceEnabled()) {
-			log.trace("saveAttachment, attachmentsStore=" + attachmentsStore + ", attachment=" + attachment); //$NON-NLS-1$ //$NON-NLS-2$
-		}
-		
-		ObjectOutputStream oos = null;
-		try {
-			oos = new ObjectOutputStream(new FileOutputStream(attachmentsStore));
-			oos.writeObject(attachment);
-		} finally {
-			if (oos != null) {
-				oos.close();
-			}
-		}
-	}
-	
-	public boolean isStale(File cacheFile, long timeAfter) {
-		return (cacheFile.exists() && timeAfter > cacheFile.lastModified());
-	}
-	
-	public void removeAttachments(VirtualFile vf) {
-		String dirName = baseDirectory(vf);
-		FileUtils.removeDirectoryAndChildren(new File(dirName));
-	}
-
-	public File getAttachmentPath(VirtualFile vf, String baseName) {
-		
-		String dirName = baseDirectory(vf);
-
-		final String vfsPath = baseName + ATTACHMENT_SUFFIX;
-		File f = new File(dirName, vfsPath);
-		if (!f.getParentFile().exists()) {
-			f.getParentFile().mkdirs();
-		}
-		return f;
-	}
-
-	private String baseDirectory(VirtualFile vf) {
-		String fileName = vf.getName();
-		String dirName = this.storagePath + File.separator + fileName + File.separator;
-		return dirName;
-	}
-	
-	public <T> T loadSafe(File cacheFile, Class<T> clazz) {
-		try {
-			if (cacheFile.exists()) {
-				return clazz.cast(loadAttachment(cacheFile, clazz));
-			}
-			return null;
-		} catch (Exception e) {
-			LogManager.logWarning(LogConstants.CTX_RUNTIME, e, RuntimePlugin.Util.getString("invalid_metadata_file", cacheFile.getAbsolutePath())); //$NON-NLS-1$
-		}
-		cacheFile.delete();
-		return null;
-	}	
-}

Modified: branches/as7/runtime/src/main/java/org/teiid/deployers/TranslatorUtil.java
===================================================================
--- branches/as7/runtime/src/main/java/org/teiid/deployers/TranslatorUtil.java	2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/runtime/src/main/java/org/teiid/deployers/TranslatorUtil.java	2011-08-22 14:36:06 UTC (rev 3422)
@@ -29,7 +29,9 @@
 import java.util.Properties;
 import java.util.TreeMap;
 
-import org.jboss.as.server.deployment.DeploymentUnitProcessingException;
+import org.jboss.modules.Module;
+import org.jboss.modules.ModuleIdentifier;
+import org.jboss.modules.ModuleLoadException;
 import org.teiid.adminapi.Translator;
 import org.teiid.adminapi.impl.VDBTranslatorMetaData;
 import org.teiid.core.TeiidException;
@@ -88,29 +90,36 @@
 		}
 	}	
 	
-	public static ExecutionFactory buildExecutionFactory(Translator data) throws DeploymentUnitProcessingException {
+	public static ExecutionFactory buildExecutionFactory(VDBTranslatorMetaData data) throws TeiidException {
 		ExecutionFactory executionFactory;
+		
+        final ModuleIdentifier moduleId;
+        final Module module;
+        try {
+            moduleId = ModuleIdentifier.create(data.getModuleName());
+            module = Module.getCallerModuleLoader().loadModule(moduleId);
+        } catch (ModuleLoadException e) {
+            throw new TeiidException(e, RuntimePlugin.Util.getString("failed_load_module", data.getModuleName(), data.getName())); //$NON-NLS-1$
+        }		
+		
 		try {
 			String executionClass = data.getPropertyValue(VDBTranslatorMetaData.EXECUTION_FACTORY_CLASS);
-			Object o = ReflectionHelper.create(executionClass, null, Thread.currentThread().getContextClassLoader());
+			Object o = ReflectionHelper.create(executionClass, null, module.getClassLoader());
 			if(!(o instanceof ExecutionFactory)) {
-				throw new DeploymentUnitProcessingException(RuntimePlugin.Util.getString("invalid_class", executionClass));//$NON-NLS-1$	
+				throw new TeiidException(RuntimePlugin.Util.getString("invalid_class", executionClass));//$NON-NLS-1$	
 			}
-			
 			executionFactory = (ExecutionFactory)o;
 			injectProperties(executionFactory, data);
 			executionFactory.start();
 			return executionFactory;
-		} catch (TeiidException e) {
-			throw new DeploymentUnitProcessingException(e);
 		} catch (InvocationTargetException e) {
-			throw new DeploymentUnitProcessingException(e);
+			throw new TeiidException(e);
 		} catch (IllegalAccessException e) {
-			throw new DeploymentUnitProcessingException(e);
+			throw new TeiidException(e);
 		}
 	}
 	
-	private static void injectProperties(ExecutionFactory ef, final Translator data) throws InvocationTargetException, IllegalAccessException, DeploymentUnitProcessingException{
+	private static void injectProperties(ExecutionFactory ef, final Translator data) throws InvocationTargetException, IllegalAccessException, TeiidException{
 		Map<Method, TranslatorProperty> props = TranslatorUtil.getTranslatorProperties(ef.getClass());
 		Map p = data.getProperties();
 		TreeMap<String, String> caseInsensitivProps = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
@@ -124,7 +133,7 @@
 				Method setterMethod = getSetter(ef.getClass(), method);
 				setterMethod.invoke(ef, convert(value, method.getReturnType()));
 			} else if (tp.required()) {
-				throw new DeploymentUnitProcessingException(RuntimePlugin.Util.getString("required_property_not_exists", tp.display())); //$NON-NLS-1$
+				throw new TeiidException(RuntimePlugin.Util.getString("required_property_not_exists", tp.display())); //$NON-NLS-1$
 			}
 		}
 		caseInsensitivProps.remove(Translator.EXECUTION_FACTORY_CLASS);
@@ -144,7 +153,7 @@
 		return result;
 	}
 	
-	public static Method getSetter(Class<?> clazz, Method method) throws SecurityException, DeploymentUnitProcessingException {
+	public static Method getSetter(Class<?> clazz, Method method) throws SecurityException, TeiidException {
 		String setter = method.getName();
 		if (method.getName().startsWith("get")) { //$NON-NLS-1$
 			setter = "set"+setter.substring(3);//$NON-NLS-1$
@@ -161,7 +170,7 @@
 			try {
 				return clazz.getMethod(method.getName(), method.getReturnType());
 			} catch (NoSuchMethodException e1) {
-				throw new DeploymentUnitProcessingException(RuntimePlugin.Util.getString("no_set_method", setter, method.getName())); //$NON-NLS-1$
+				throw new TeiidException(RuntimePlugin.Util.getString("no_set_method", setter, method.getName())); //$NON-NLS-1$
 			}
 		}
 	}

Deleted: branches/as7/runtime/src/main/java/org/teiid/deployers/VDBDependencyProcessor.java
===================================================================
--- branches/as7/runtime/src/main/java/org/teiid/deployers/VDBDependencyProcessor.java	2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/runtime/src/main/java/org/teiid/deployers/VDBDependencyProcessor.java	2011-08-22 14:36:06 UTC (rev 3422)
@@ -1,99 +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.deployers;
-
-import java.io.Closeable;
-import java.io.IOException;
-import java.util.List;
-
-import org.jboss.as.server.deployment.*;
-import org.jboss.as.server.deployment.module.*;
-import org.jboss.modules.Module;
-import org.jboss.modules.ModuleIdentifier;
-import org.jboss.modules.ModuleLoadException;
-import org.jboss.modules.ModuleLoader;
-import org.jboss.vfs.VFS;
-import org.jboss.vfs.VirtualFile;
-import org.jboss.vfs.VirtualFileFilter;
-import org.jboss.vfs.VisitorAttributes;
-import org.jboss.vfs.util.SuffixMatchFilter;
-import org.teiid.adminapi.impl.ModelMetaData;
-import org.teiid.adminapi.impl.VDBMetaData;
-
-public class VDBDependencyProcessor implements DeploymentUnitProcessor {
-	public static final String LIB = "/lib"; //$NON-NLS-1$
-	private static final VirtualFileFilter DEFAULT_JAR_LIB_FILTER = new SuffixMatchFilter(".jar", VisitorAttributes.DEFAULT); //$NON-NLS-1$
-	
-	@Override
-	public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
-		DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
-		if (!TeiidAttachments.isVDBDeployment(deploymentUnit)) {
-			return;
-		}
-		
-		if (!TeiidAttachments.isDynamicVDB(deploymentUnit)) {
-			final ResourceRoot deploymentResourceRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT);
-			final VirtualFile deploymentRoot = deploymentResourceRoot.getRoot();
-	        if(deploymentRoot == null) {
-	            return;
-	        }
-			
-			try {
-				final VirtualFile libDir = deploymentRoot.getChild(LIB);
-				if (libDir.exists()) {
-					final List<VirtualFile> archives = libDir.getChildren(DEFAULT_JAR_LIB_FILTER);
-					for (final VirtualFile archive : archives) {
-						try {
-							final Closeable closable = VFS.mountZip(archive, archive,TempFileProviderService.provider());
-							final ResourceRoot jarArchiveRoot = new ResourceRoot(archive.getName(), archive, new MountHandle(closable));
-							ModuleRootMarker.mark(jarArchiveRoot);
-							deploymentUnit.addToAttachmentList(Attachments.RESOURCE_ROOTS, jarArchiveRoot);
-						} catch (IOException e) {
-							throw new DeploymentUnitProcessingException("failed to process " + archive, e); //$NON-NLS-1$
-						}
-					}
-				}	
-			} catch(IOException e) {
-				throw new DeploymentUnitProcessingException(e);
-			}
-		}
-		
-		// add translators as dependent modules to this VDB.
-        try {
-			final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
-			final ModuleLoader moduleLoader = Module.getCallerModule().getModule(ModuleIdentifier.create("org.jboss.teiid")).getModuleLoader(); //$NON-NLS-1$
-			VDBMetaData vdb = deploymentUnit.getAttachment(TeiidAttachments.VDB_METADATA);
-
-			for (ModelMetaData model: vdb.getModelMetaDatas().values()) {
-				for (String source:model.getSourceNames()) {
-					moduleSpecification.addLocalDependency(new ModuleDependency(moduleLoader, ModuleIdentifier.create(model.getSourceTranslatorName(source)), false, false, false));		
-				}
-			}
-		} catch (ModuleLoadException e) {
-			throw new DeploymentUnitProcessingException(e);
-		}
-	}
-
-	@Override
-	public void undeploy(DeploymentUnit context) {
-	}
-}

Deleted: branches/as7/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java
===================================================================
--- branches/as7/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java	2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java	2011-08-22 14:36:06 UTC (rev 3422)
@@ -1,411 +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.deployers;
-
-import java.io.File;
-import java.io.IOException;
-import java.text.SimpleDateFormat;
-import java.util.*;
-import java.util.concurrent.Executor;
-
-import org.jboss.as.server.deployment.*;
-import org.jboss.msc.service.ServiceBuilder;
-import org.jboss.msc.service.ServiceName;
-import org.jboss.msc.value.InjectedValue;
-import org.jboss.vfs.VirtualFile;
-import org.teiid.adminapi.Model;
-import org.teiid.adminapi.Translator;
-import org.teiid.adminapi.VDB;
-import org.teiid.adminapi.impl.ModelMetaData;
-import org.teiid.adminapi.impl.SourceMappingMetadata;
-import org.teiid.adminapi.impl.VDBMetaData;
-import org.teiid.adminapi.impl.VDBTranslatorMetaData;
-import org.teiid.dqp.internal.datamgr.ConnectorManager;
-import org.teiid.dqp.internal.datamgr.ConnectorManagerRepository;
-import org.teiid.dqp.internal.datamgr.TranslatorRepository;
-import org.teiid.logging.LogConstants;
-import org.teiid.logging.LogManager;
-import org.teiid.metadata.MetadataStore;
-import org.teiid.metadata.index.IndexMetadataFactory;
-import org.teiid.query.metadata.TransformationMetadata.Resource;
-import org.teiid.runtime.RuntimePlugin;
-import org.teiid.translator.DelegatingExecutionFactory;
-import org.teiid.translator.ExecutionFactory;
-import org.teiid.translator.TranslatorException;
-
-
-public class VDBDeployer implements DeploymentUnitProcessor {
-	public ServiceName VDB_SVC_BASE = ServiceName.JBOSS.append("teiid", "vdb"); //$NON-NLS-1$ //$NON-NLS-2$
-			
-	private VDBRepository vdbRepository;
-	private TranslatorRepository translatorRepository;
-	private ObjectSerializer serializer;
-	private ContainerLifeCycleListener shutdownListener;
-	private InjectedValue<Executor> threadPoolInjector;
-	
-	public VDBDeployer (VDBRepository repo, InjectedValue<Executor> threadPoolInjector, TranslatorRepository translatorRepo, ObjectSerializer serializer, ContainerLifeCycleListener listener) {
-		this.vdbRepository = repo;
-		this.threadPoolInjector = threadPoolInjector;
-		this.translatorRepository = translatorRepo;
-		this.serializer = serializer;
-		this.shutdownListener = listener;
-	}
-	
-	public void deploy(final DeploymentPhaseContext context)  throws DeploymentUnitProcessingException {
-		DeploymentUnit deploymentUnit = context.getDeploymentUnit();
-		if (!TeiidAttachments.isVDBDeployment(deploymentUnit)) {
-			return;
-		}
-		VirtualFile file = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT).getRoot();
-		VDBMetaData deployment = deploymentUnit.getAttachment(TeiidAttachments.VDB_METADATA);
-		
-		if (this.vdbRepository.removeVDB(deployment.getName(), deployment.getVersion())) {
-			LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("redeploying_vdb", deployment)); //$NON-NLS-1$ 
-		}
-		
-		TranslatorRepository repo = new TranslatorRepository();
-		ConnectorManagerRepository cmr = new ConnectorManagerRepository();
-		
-		boolean preview = deployment.isPreview();
-		
-		if (!preview) {
-			List<String> errors = deployment.getValidityErrors();
-			if (errors != null && !errors.isEmpty()) {
-				throw new DeploymentUnitProcessingException(RuntimePlugin.Util.getString("validity_errors_in_vdb", deployment)); //$NON-NLS-1$
-			}
-		}
-		
-		// get the metadata store of the VDB (this is build in parse stage)
-		MetadataStoreGroup store = deploymentUnit.getAttachment(TeiidAttachments.METADATA_STORE);
-		
-		// add required connector managers; if they are not already there
-		for (Translator t: deployment.getOverrideTranslators()) {
-			VDBTranslatorMetaData data = (VDBTranslatorMetaData)t;
-			
-			String type = data.getType();
-			Translator parent = this.translatorRepository.getTranslatorMetaData(type);
-			if ( parent == null) {
-				throw new DeploymentUnitProcessingException(RuntimePlugin.Util.getString("translator_type_not_found", file.getName())); //$NON-NLS-1$
-			}
-			
-			Set<String> keys = parent.getProperties().stringPropertyNames();
-			for (String key:keys) {
-				if (data.getPropertyValue(key) == null && parent.getPropertyValue(key) != null) {
-					data.addProperty(key, parent.getPropertyValue(key));
-				}
-			}
-			repo.addTranslatorMetadata(data.getName(), data);
-		}
-		createConnectorManagers(cmr, repo, deployment);
-		boolean asynchLoad = false;
-		// if store is null and vdb dynamic vdb then try to get the metadata
-		if (store == null && deployment.isDynamic()) {
-			store = new MetadataStoreGroup();
-			asynchLoad = buildDynamicMetadataStore(file, deployment, store, cmr);
-		}
-		
-		// allow empty vdbs for enabling the preview functionality
-		if (preview && store == null) {
-			store = new MetadataStoreGroup();
-		}
-		
-		if (store == null) {
-			LogManager.logError(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("failed_matadata_load", deployment.getName(), deployment.getVersion())); //$NON-NLS-1$
-		}
-		
-		// check if this is a VDB with index files, if there are then build the TransformationMetadata
-		UDFMetaData udf = deploymentUnit.getAttachment(TeiidAttachments.UDF_METADATA);
-		
-		LinkedHashMap<String, Resource> visibilityMap = null;
-		IndexMetadataFactory indexFactory = deploymentUnit.getAttachment(TeiidAttachments.INDEX_METADATA);		
-		if (indexFactory != null) {
-			visibilityMap = indexFactory.getEntriesPlusVisibilities();
-		}
-				
-		// removethe metadata objects as attachments
-		deploymentUnit.removeAttachment(TeiidAttachments.INDEX_METADATA);
-		deploymentUnit.removeAttachment(TeiidAttachments.UDF_METADATA);
-		deploymentUnit.removeAttachment(TeiidAttachments.METADATA_STORE);
-		
-		try {
-			// add transformation metadata to the repository.
-			this.vdbRepository.addVDB(deployment, store, visibilityMap, udf, cmr);
-		} catch (VirtualDatabaseException e) {
-			throw new DeploymentUnitProcessingException(e);
-		}
-		
-		boolean valid = true;
-		synchronized (deployment) {
-			if (indexFactory != null) {
-				try {
-					saveMetadataStore(file, deployment, store);
-				} catch (IOException e1) {
-					LogManager.logWarning(LogConstants.CTX_RUNTIME, e1, RuntimePlugin.Util.getString("vdb_save_failed", deployment.getName()+"."+deployment.getVersion())); //$NON-NLS-1$ //$NON-NLS-2$			
-				}
-			}
-			if (!preview) {
-				valid = validateSources(cmr, deployment);
-				
-				// Check if the VDB is fully configured.
-				if (!valid) {
-					deployment.setStatus(VDB.Status.INACTIVE);
-				} else if (!asynchLoad) {
-					//if asynch this will be set by the loading thread
-					this.vdbRepository.finishDeployment(deployment.getName(), deployment.getVersion());
-					deployment.setStatus(VDB.Status.ACTIVE);
-				}
-			}
-			else {
-				deployment.setStatus(VDB.Status.ACTIVE);
-			}
-		}
-
-		// build a VDB service 
-		ServiceBuilder<VDBMetaData> vdbService = context.getServiceTarget().addService(VDB_SVC_BASE.append(deployment.getName()+"."+deployment.getVersion()), new VDBService(deployment)); //$NON-NLS-1$
-		for (ModelMetaData model:deployment.getModelMetaDatas().values()) {
-			for (String sourceName:model.getSourceNames()) {
-				vdbService.addDependency(ServiceName.JBOSS.append("data-source", model.getSourceConnectionJndiName(sourceName)));	//$NON-NLS-1$
-			}
-		}
-		
-		LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("vdb_deployed",deployment, valid?"active":"inactive")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-	}
-
-	private void createConnectorManagers(ConnectorManagerRepository cmr, TranslatorRepository repo, final VDBMetaData deployment) throws DeploymentUnitProcessingException {
-		IdentityHashMap<Translator, ExecutionFactory<Object, Object>> map = new IdentityHashMap<Translator, ExecutionFactory<Object, Object>>();
-		
-		for (Model model:deployment.getModels()) {
-			for (String source:model.getSourceNames()) {
-				if (cmr.getConnectorManager(source) != null) {
-					continue;
-				}
-
-				String name = model.getSourceTranslatorName(source);
-				ConnectorManager cm = new ConnectorManager(name, model.getSourceConnectionJndiName(source));
-				ExecutionFactory<Object, Object> ef = getExecutionFactory(name, repo, deployment, map, new HashSet<String>());
-				cm.setExecutionFactory(ef);
-				cm.setModelName(model.getName());
-				cmr.addConnectorManager(source, cm);
-			}
-		}
-	}
-	
-	private ExecutionFactory<Object, Object> getExecutionFactory(String name, TranslatorRepository repo, VDBMetaData deployment, IdentityHashMap<Translator, ExecutionFactory<Object, Object>> map, HashSet<String> building) throws DeploymentUnitProcessingException {
-		if (!building.add(name)) {
-			throw new DeploymentUnitProcessingException(RuntimePlugin.Util.getString("recursive_delegation", deployment.getName(), deployment.getVersion(), building)); //$NON-NLS-1$
-		}
-		Translator translator = repo.getTranslatorMetaData(name);
-		if (translator == null) {
-			translator = this.translatorRepository.getTranslatorMetaData(name);
-		}
-		if (translator == null) {
-			throw new DeploymentUnitProcessingException(RuntimePlugin.Util.getString("translator_not_found", deployment.getName(), deployment.getVersion(), name)); //$NON-NLS-1$
-		}
-		ExecutionFactory<Object, Object> ef = map.get(translator);
-		if ( ef == null) {
-			ef = TranslatorUtil.buildExecutionFactory(translator);
-			if (ef instanceof DelegatingExecutionFactory) {
-				DelegatingExecutionFactory delegator = (DelegatingExecutionFactory)ef;
-				String delegateName = delegator.getDelegateName();
-				if (delegateName != null) {
-					ExecutionFactory<Object, Object> delegate = getExecutionFactory(delegateName, repo, deployment, map, building);
-					((DelegatingExecutionFactory) ef).setDelegate(delegate);
-				}
-			}
-			map.put(translator, ef);
-		}
-		return ef;
-	}
-
-	private boolean validateSources(ConnectorManagerRepository cmr, VDBMetaData deployment) {
-		boolean valid = true;
-		for(Model m:deployment.getModels()) {
-			ModelMetaData model = (ModelMetaData)m;
-			List<SourceMappingMetadata> mappings = model.getSourceMappings();
-			for (SourceMappingMetadata mapping:mappings) {
-				ConnectorManager cm = cmr.getConnectorManager(mapping.getName());
-				String msg = cm.getStausMessage();
-				if (msg != null && msg.length() > 0) {
-					valid = false;
-					model.addError(ModelMetaData.ValidationError.Severity.ERROR.name(), cm.getStausMessage());
-					LogManager.logInfo(LogConstants.CTX_RUNTIME, cm.getStausMessage());
-				}
-			}
-			
-			// in the dynamic case the metadata may be still loading.
-			if (!model.getErrors().isEmpty()) {
-				valid = false;
-			}
-		}
-		return valid;
-	}
-
-	@Override
-	public void undeploy(final DeploymentUnit deploymentUnit) {
-		if (!TeiidAttachments.isVDBDeployment(deploymentUnit)) {
-			return;
-		}		
-		VDBMetaData deployment = deploymentUnit.getAttachment(TeiidAttachments.VDB_METADATA);
-		VirtualFile file = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT).getRoot();
-		
-		if (this.vdbRepository != null && deployment != null) {
-			this.vdbRepository.removeVDB(deployment.getName(), deployment.getVersion());
-			deployment.setRemoved(true);
-		}
-		
-		if (file != null) {
-			deleteMetadataStore(file);
-		}
-
-		LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("vdb_undeployed", deployment)); //$NON-NLS-1$
-	}
-
-	private void saveMetadataStore(VirtualFile unit, VDBMetaData vdb, MetadataStoreGroup store) throws IOException {
-		File cacheFileName = buildCachedVDBFileName(this.serializer, unit, vdb);
-		if (!cacheFileName.exists()) {
-			this.serializer.saveAttachment(cacheFileName,store);
-			LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB "+unit.getName()+" metadata has been cached to "+ cacheFileName); //$NON-NLS-1$ //$NON-NLS-2$
-		}		
-	}
-	
-	private void deleteMetadataStore(VirtualFile unit) {
-		if (!unit.exists() || !shutdownListener.isShutdownInProgress()) {
-			this.serializer.removeAttachments(unit);
-			LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB "+unit.getName()+" metadata removed"); //$NON-NLS-1$ //$NON-NLS-2$
-		}
-	}
-	
-    private boolean buildDynamicMetadataStore(final VirtualFile unit, final VDBMetaData vdb, final MetadataStoreGroup vdbStore, final ConnectorManagerRepository cmr) throws DeploymentUnitProcessingException {
-    	boolean asynch = false;
-    	// make sure we are configured correctly first
-		for (final ModelMetaData model:vdb.getModelMetaDatas().values()) {
-	    	if (model.getSourceNames().isEmpty()) {
-	    		throw new DeploymentUnitProcessingException(RuntimePlugin.Util.getString("fail_to_deploy", vdb.getName()+"-"+vdb.getVersion(), model.getName())); //$NON-NLS-1$ //$NON-NLS-2$
-	    	}
-			    	
-	    	final boolean cache = "cached".equalsIgnoreCase(vdb.getPropertyValue("UseConnectorMetadata")); //$NON-NLS-1$ //$NON-NLS-2$
-	    	final File cacheFile = buildCachedModelFileName(unit, vdb, model.getName());
-	    	boolean loaded = false;
-	    	if (cache) {
-				MetadataStore store = this.serializer.loadSafe(cacheFile, MetadataStore.class);
-				if (store != null) {
-					vdbStore.addStore(store);
-					loaded = true;
-				}
-	    	}
-	    	
-	    	if (!loaded) {
-	    		Runnable job = new Runnable() {
-					@Override
-					public void run() {
-						Boolean loadStatus = loadMetadata(vdb, model, cache, cacheFile, vdbStore, cmr);
-						//if (loadStatus == null) {
-							//TODO: a source is up, but we failed.  should we retry or poll?
-						//} 
-						if (loadStatus == null || !loadStatus) {
-							//defer the load to the status checker if/when a source is available/redeployed
-							model.addAttchment(Runnable.class, this);
-						}	    				
-					}
-	    		};	    		
-	    		Executor executor = this.threadPoolInjector.getValue();
-	    		if (executor == null) {
-	    			job.run();
-	    		}
-	    		else {
-		    		asynch = true;
-		    		executor.execute(job);
-	    		}
-	    	}
-		}
-		return asynch;
-	}	
-    
-    /**
-     * @return true if loaded, null if not loaded - but a cm is available, else false
-     */
-    private Boolean loadMetadata(VDBMetaData vdb, ModelMetaData model, boolean cache, File cacheFile, MetadataStoreGroup vdbStore, ConnectorManagerRepository cmr) {
-		String msg = RuntimePlugin.Util.getString("model_metadata_loading", vdb.getName(), vdb.getVersion(), model.getName(), SimpleDateFormat.getInstance().format(new Date())); //$NON-NLS-1$ 
-		model.addError(ModelMetaData.ValidationError.Severity.ERROR.toString(), msg); 
-		LogManager.logInfo(LogConstants.CTX_RUNTIME, msg);
-
-    	String exceptionMessage = null;
-    	Boolean loaded = false;
-    	for (String sourceName: model.getSourceNames()) {
-    		ConnectorManager cm = cmr.getConnectorManager(sourceName);
-    		String status = cm.getStausMessage();
-			if (status != null && status.length() > 0) {
-				exceptionMessage = status;
-				continue;
-			}
-			loaded = null;
-    		try {
-    			MetadataStore store = cm.getMetadata(model.getName(), this.vdbRepository.getBuiltinDatatypes(), model.getProperties());
-    			if (cache) {
-    				this.serializer.saveAttachment(cacheFile, store);
-    			}
-    			vdbStore.addStore(store);
-    			loaded = true;
-    			break;
-			} catch (TranslatorException e) {
-				//TODO: we aren't effectively differentiating the type of load error - connectivity vs. metadata
-				if (exceptionMessage == null) {
-					exceptionMessage = e.getMessage();
-				}
-			} catch (IOException e) {
-				if (exceptionMessage == null) {
-					exceptionMessage = e.getMessage();
-				}				
-			}
-    	}
-    	
-    	synchronized (vdb) {
-	    	if (loaded == null || !loaded) {
-	    		vdb.setStatus(VDB.Status.INACTIVE);
-	    		String failed_msg = RuntimePlugin.Util.getString(loaded==null?"failed_to_retrive_metadata":"nosources_to_retrive_metadata", vdb.getName(), vdb.getVersion(), model.getName()); //$NON-NLS-1$ //$NON-NLS-2$ 
-		    	model.addError(ModelMetaData.ValidationError.Severity.ERROR.toString(), failed_msg); 
-		    	if (exceptionMessage != null) {
-		    		model.addError(ModelMetaData.ValidationError.Severity.ERROR.toString(), exceptionMessage);     		
-		    	}
-		    	LogManager.logWarning(LogConstants.CTX_RUNTIME, failed_msg);
-	    	} else {
-	    		LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("metadata_loaded",vdb.getName(), vdb.getVersion(), model.getName())); //$NON-NLS-1$
-	    		model.clearErrors();
-	    		if (vdb.isValid()) {
-	    			this.vdbRepository.finishDeployment(vdb.getName(), vdb.getVersion());
-					vdb.setStatus(VDB.Status.ACTIVE);
-					LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("vdb_activated",vdb.getName(), vdb.getVersion())); //$NON-NLS-1$    			
-	    		}
-	    	}
-    	}
-    	
-    	return loaded;
-    }
-    
-	private File buildCachedModelFileName(VirtualFile unit, VDBMetaData vdb, String modelName) {
-		return this.serializer.getAttachmentPath(unit, vdb.getName()+"_"+vdb.getVersion()+"_"+modelName); //$NON-NLS-1$ //$NON-NLS-2$
-	}    
-	
-	static File buildCachedVDBFileName(ObjectSerializer serializer, VirtualFile unit, VDBMetaData vdb) {
-		return serializer.getAttachmentPath(unit, vdb.getName()+"_"+vdb.getVersion()); //$NON-NLS-1$
-	} 	
-}

Deleted: branches/as7/runtime/src/main/java/org/teiid/deployers/VDBParserDeployer.java
===================================================================
--- branches/as7/runtime/src/main/java/org/teiid/deployers/VDBParserDeployer.java	2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/runtime/src/main/java/org/teiid/deployers/VDBParserDeployer.java	2011-08-22 14:36:06 UTC (rev 3422)
@@ -1,200 +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.deployers;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.List;
-
-import javax.xml.XMLConstants;
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Unmarshaller;
-import javax.xml.validation.Schema;
-import javax.xml.validation.SchemaFactory;
-
-import org.jboss.as.server.deployment.*;
-import org.jboss.vfs.VirtualFile;
-import org.teiid.adminapi.Model;
-import org.teiid.adminapi.impl.ModelMetaData;
-import org.teiid.adminapi.impl.VDBMetaData;
-import org.teiid.logging.LogConstants;
-import org.teiid.logging.LogManager;
-import org.teiid.metadata.VdbConstants;
-import org.teiid.metadata.index.IndexMetadataFactory;
-import org.teiid.runtime.RuntimePlugin;
-import org.xml.sax.SAXException;
-
-
-/**
- * This file loads the "vdb.xml" file inside a ".vdb" file, along with all the metadata in the .INDEX files
- */
-public class VDBParserDeployer implements DeploymentUnitProcessor {
-	private ObjectSerializer serializer;
-	private VDBRepository vdbRepository;
-	
-	public VDBParserDeployer(VDBRepository repo, ObjectSerializer serializer) {
-		this.vdbRepository = repo;
-		this.serializer = serializer;
-	}
-	
-	public void deploy(final DeploymentPhaseContext phaseContext)  throws DeploymentUnitProcessingException {
-		DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
-		if (!TeiidAttachments.isVDBDeployment(deploymentUnit)) {
-			return;
-		}
-
-		VirtualFile file = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT).getRoot();
-
-		if (TeiidAttachments.isDynamicVDB(deploymentUnit)) {
-			parseVDBXML(file, deploymentUnit);			
-		}
-		else {
-			// scan for different files 
-			List<VirtualFile> childFiles = file.getChildren();
-			for (VirtualFile childFile:childFiles) {
-				scanVDB(childFile, deploymentUnit);
-			}
-			
-			mergeMetaData(deploymentUnit);
-		}
-	}
-	
-	private void scanVDB(VirtualFile file, DeploymentUnit deploymentUnit) throws DeploymentUnitProcessingException {
-		if (file.isDirectory()) {
-			List<VirtualFile> childFiles = file.getChildren();
-			for (VirtualFile childFile:childFiles) {
-				scanVDB(childFile, deploymentUnit);
-			}
-		}
-		else {
-			if (file.getLowerCaseName().equals(VdbConstants.DEPLOYMENT_FILE)) {
-				parseVDBXML(file, deploymentUnit);
-			}
-			else if (file.getLowerCaseName().endsWith(VdbConstants.INDEX_EXT)) {
-				IndexMetadataFactory imf = deploymentUnit.getAttachment(TeiidAttachments.INDEX_METADATA);
-				if (imf == null) {
-					imf = new IndexMetadataFactory();
-					deploymentUnit.putAttachment(TeiidAttachments.INDEX_METADATA, imf);
-				}
-				imf.addIndexFile(file);
-			}
-			else if (file.getLowerCaseName().endsWith(VdbConstants.MODEL_EXT)) {
-				UDFMetaData udf = deploymentUnit.getAttachment(TeiidAttachments.UDF_METADATA);
-				if (udf == null) {
-					udf = new UDFMetaData();
-					deploymentUnit.putAttachment(TeiidAttachments.UDF_METADATA, udf);
-				}
-				udf.addModelFile(file);				
-			}
-			
-		}
-	}
-
-	private void parseVDBXML(VirtualFile file, DeploymentUnit deploymentUnit)
-			throws DeploymentUnitProcessingException {
-		try {
-			Unmarshaller un = getUnMarsheller();
-			VDBMetaData vdb = (VDBMetaData)un.unmarshal(file.openStream());
-			deploymentUnit.putAttachment(TeiidAttachments.VDB_METADATA, vdb);
-			LogManager.logDetail(LogConstants.CTX_RUNTIME,"VDB "+file.getName()+" has been parsed.");  //$NON-NLS-1$ //$NON-NLS-2$
-		} catch (JAXBException e) {
-			throw new DeploymentUnitProcessingException(e);
-		} catch (SAXException e) {
-			throw new DeploymentUnitProcessingException(e);
-		} catch (IOException e) {
-			throw new DeploymentUnitProcessingException(e);
-		}
-	}
-	
-    public void undeploy(final DeploymentUnit context) {
-    }	
-    
-
-	static Unmarshaller getUnMarsheller() throws JAXBException, SAXException {
-		JAXBContext jc = JAXBContext.newInstance(new Class<?>[] {VDBMetaData.class});
-		SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
-		Schema schema = schemaFactory.newSchema(VDBMetaData.class.getResource("/vdb-deployer.xsd")); //$NON-NLS-1$
-		Unmarshaller un = jc.createUnmarshaller();
-		un.setSchema(schema);
-		return un;
-	}
-	
-	protected VDBMetaData mergeMetaData(DeploymentUnit deploymentUnit) throws DeploymentUnitProcessingException {
-		VDBMetaData vdb = deploymentUnit.getAttachment(TeiidAttachments.VDB_METADATA);
-		UDFMetaData udf = deploymentUnit.getAttachment(TeiidAttachments.UDF_METADATA);
-		IndexMetadataFactory imf = deploymentUnit.getAttachment(TeiidAttachments.INDEX_METADATA);
-		
-		VirtualFile file = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT).getRoot();
-		if (vdb == null) {
-			LogManager.logError(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("invlaid_vdb_file",file.getName())); //$NON-NLS-1$
-			return null;
-		}
-		
-		try {
-			vdb.setUrl(file.toURL());		
-			
-			// build the metadata store
-			if (imf != null) {
-				imf.addEntriesPlusVisibilities(file, vdb);
-								
-				// add the cached store.
-				File cacheFile = VDBDeployer.buildCachedVDBFileName(this.serializer, file, vdb);
-				// check to see if the vdb has been modified when server is down; if it is then clear the old files
-				if (this.serializer.isStale(cacheFile, file.getLastModified())) {
-					this.serializer.removeAttachments(file);
-					LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB", file.getName(), "old cached metadata has been removed"); //$NON-NLS-1$ //$NON-NLS-2$				
-				}
-				MetadataStoreGroup stores = this.serializer.loadSafe(cacheFile, MetadataStoreGroup.class);
-				if (stores == null) {				
-					// start to build the new metadata 
-					stores = new MetadataStoreGroup();
-					stores.addStore(imf.getMetadataStore(vdbRepository.getSystemStore().getDatatypes()));
-				}
-				else {
-					LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB", file.getName(), "was loaded from cached metadata"); //$NON-NLS-1$ //$NON-NLS-2$
-				}
-				deploymentUnit.putAttachment(TeiidAttachments.METADATA_STORE, stores);				
-			}
-			
-			if (udf != null) {
-				// load the UDF
-				for(Model model:vdb.getModels()) {
-					if (model.getModelType().equals(Model.Type.FUNCTION)) {
-						String path = ((ModelMetaData)model).getPath();
-						if (path == null) {
-							throw new DeploymentUnitProcessingException(RuntimePlugin.Util.getString("invalid_udf_file", model.getName())); //$NON-NLS-1$
-						}
-						udf.buildFunctionModelFile(model.getName(), path);
-					}
-				}		
-			}
-		} catch(IOException e) {
-			throw new DeploymentUnitProcessingException(e); 
-		} catch (JAXBException e) {
-			throw new DeploymentUnitProcessingException(e);
-		}
-				
-		LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB", file.getName(), "has been parsed."); //$NON-NLS-1$ //$NON-NLS-2$
-		return vdb;
-	}
-}

Deleted: branches/as7/runtime/src/main/java/org/teiid/deployers/VDBService.java
===================================================================
--- branches/as7/runtime/src/main/java/org/teiid/deployers/VDBService.java	2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/runtime/src/main/java/org/teiid/deployers/VDBService.java	2011-08-22 14:36:06 UTC (rev 3422)
@@ -1,32 +0,0 @@
-package org.teiid.deployers;
-
-import org.jboss.msc.service.Service;
-import org.jboss.msc.service.StartContext;
-import org.jboss.msc.service.StartException;
-import org.jboss.msc.service.StopContext;
-import org.teiid.adminapi.impl.VDBMetaData;
-
-public class VDBService implements Service<VDBMetaData> {
-	private VDBMetaData vdb;
-	
-	public VDBService(VDBMetaData metadata) {
-		this.vdb = metadata;
-	}
-	@Override
-	public void start(StartContext context) throws StartException {
-		// rameshTODO Auto-generated method stub
-		
-	}
-
-	@Override
-	public void stop(StopContext context) {
-		// rameshTODO Auto-generated method stub
-		
-	}
-
-	@Override
-	public VDBMetaData getValue() throws IllegalStateException,IllegalArgumentException {
-		return this.vdb;
-	}
-
-}

Deleted: branches/as7/runtime/src/main/java/org/teiid/deployers/VDBStructure.java
===================================================================
--- branches/as7/runtime/src/main/java/org/teiid/deployers/VDBStructure.java	2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/runtime/src/main/java/org/teiid/deployers/VDBStructure.java	2011-08-22 14:36:06 UTC (rev 3422)
@@ -1,84 +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.deployers;
-
-import java.io.Closeable;
-import java.io.IOException;
-
-import org.jboss.as.server.deployment.*;
-import org.jboss.as.server.deployment.module.ModuleRootMarker;
-import org.jboss.as.server.deployment.module.MountHandle;
-import org.jboss.as.server.deployment.module.ResourceRoot;
-import org.jboss.as.server.deployment.module.TempFileProviderService;
-import org.jboss.vfs.VFS;
-import org.jboss.vfs.VirtualFile;
-import org.teiid.metadata.VdbConstants;
-
-
-
-public class VDBStructure  implements DeploymentUnitProcessor {
-	private static final String VDB_EXTENSION = ".vdb"; //$NON-NLS-1$
-	private static final String DYNAMIC_VDB_STRUCTURE = "-vdb.xml"; //$NON-NLS-1$
-	
-	@Override
-	public void deploy(final DeploymentPhaseContext phaseContext)  throws DeploymentUnitProcessingException {
-		
-        DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
-        
-        VirtualFile file = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT).getRoot();
-        if (file == null) {
-        	return;
-        }
-        
-        if(file.getLowerCaseName().endsWith(VDB_EXTENSION)) {
-
-        	try {
-				final Closeable closable = VFS.mountZip(file, file, TempFileProviderService.provider());
-				final ResourceRoot vdbArchiveRoot = new ResourceRoot(file.getName(), file, new MountHandle(closable));
-				ModuleRootMarker.mark(vdbArchiveRoot);
-				
-				VirtualFile metainf = file.getChild("META-INF"); //$NON-NLS-1$
-				if (metainf == null) {
-					return;
-				}
-				
-				if (metainf.getChild(VdbConstants.DEPLOYMENT_FILE) == null) {
-					return;
-				}
-				// adds a TYPE attachment.
-				TeiidAttachments.setAsVDBDeployment(deploymentUnit);
-			} catch (IOException e) {
-				throw new DeploymentUnitProcessingException("failed to process " + file, e); //$NON-NLS-1$
-			}			
-        }
-        else if (file.getLowerCaseName().endsWith(DYNAMIC_VDB_STRUCTURE)) {
-	        TeiidAttachments.setAsDynamicVDBDeployment(deploymentUnit);			        	
-        }
-	}
-	
-	
-	@Override
-	public void undeploy(final DeploymentUnit context) {
-		
-	}
-
-}

Modified: branches/as7/runtime/src/main/resources/org/teiid/runtime/i18n.properties
===================================================================
--- branches/as7/runtime/src/main/resources/org/teiid/runtime/i18n.properties	2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/runtime/src/main/resources/org/teiid/runtime/i18n.properties	2011-08-22 14:36:06 UTC (rev 3422)
@@ -98,4 +98,5 @@
 wrong_logon_type_jaas = Wrong logon method is being used. Server is not set up for JAAS based authentication. Correct your client's 'AuthenticationType' property.
 wrong_logon_type_krb5 = Wrong logon method is being used. Server is not set up for Kerberos based authentication. Correct your client's 'AuthenticationType' property.
 krb5_login_failed=Kerberos context login failed
-no_security_domains=No security domain configured for Kerberos authentication. Can not authenticate.
\ No newline at end of file
+no_security_domains=No security domain configured for Kerberos authentication. Can not authenticate.
+failed_load_module=Failed to load module {0} for translator {1}
\ No newline at end of file

Modified: branches/as7/runtime/src/test/java/org/teiid/deployers/TestObjectSerializer.java
===================================================================
--- branches/as7/runtime/src/test/java/org/teiid/deployers/TestObjectSerializer.java	2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/runtime/src/test/java/org/teiid/deployers/TestObjectSerializer.java	2011-08-22 14:36:06 UTC (rev 3422)
@@ -28,6 +28,7 @@
 
 import org.junit.Test;
 import org.teiid.core.util.UnitTestUtil;
+import org.teiid.jboss.ObjectSerializer;
 
 
 @SuppressWarnings("nls")



More information about the teiid-commits mailing list