[teiid-commits] teiid SVN: r3503 - in branches/as7: admin/src/main/java/org/teiid/adminapi and 17 other directories.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Fri Sep 23 00:11:12 EDT 2011


Author: rareddy
Date: 2011-09-23 00:11:11 -0400 (Fri, 23 Sep 2011)
New Revision: 3503

Added:
   branches/as7/admin/src/main/java/org/teiid/adminapi/impl/VDBMetadataMapper.java
   branches/as7/admin/src/main/resources/org/
   branches/as7/admin/src/main/resources/org/teiid/
   branches/as7/admin/src/main/resources/org/teiid/adminapi/
   branches/as7/admin/src/main/resources/org/teiid/adminapi/i18n.properties
   branches/as7/admin/src/test/resources/vdb-describe.txt
Removed:
   branches/as7/client/src/main/resources/org/teiid/adminapi/i18n.properties
Modified:
   branches/as7/admin/pom.xml
   branches/as7/admin/src/main/java/org/teiid/adminapi/Admin.java
   branches/as7/admin/src/main/java/org/teiid/adminapi/AdminFactory.java
   branches/as7/admin/src/main/java/org/teiid/adminapi/impl/DQPManagement.java
   branches/as7/admin/src/main/java/org/teiid/adminapi/impl/DataPolicyMetadata.java
   branches/as7/admin/src/main/java/org/teiid/adminapi/impl/MetadataMapper.java
   branches/as7/admin/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java
   branches/as7/admin/src/main/java/org/teiid/adminapi/impl/VDBMetadataParser.java
   branches/as7/admin/src/test/java/org/teiid/adminapi/impl/TestRequestMetadata.java
   branches/as7/admin/src/test/java/org/teiid/adminapi/impl/TestSessionMetadata.java
   branches/as7/admin/src/test/java/org/teiid/adminapi/impl/TestTransactionMetadata.java
   branches/as7/admin/src/test/java/org/teiid/adminapi/impl/TestVDBMetaData.java
   branches/as7/adminshell/src/main/java/org/teiid/adminshell/AdminShell.java
   branches/as7/adminshell/src/test/java/org/teiid/adminshell/TestAdminShell.java
   branches/as7/build/assembly/jboss-as7/dist.xml
   branches/as7/build/kits/adminshell/connection.properties
   branches/as7/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
   branches/as7/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java
   branches/as7/jboss-integration/src/main/java/org/teiid/jboss/BaseOperationHandler.java
   branches/as7/jboss-integration/src/main/java/org/teiid/jboss/ObjectSerializer.java
   branches/as7/jboss-integration/src/main/java/org/teiid/jboss/OperationsConstants.java
   branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineOperationHandler.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/TeiidExtension.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/VDBService.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/test/java/org/teiid/adminapi/jboss/TestAdminObjectBuilder.java
Log:
TEIID-1720:  Admin operations except for the data source stuff were added

Modified: branches/as7/admin/pom.xml
===================================================================
--- branches/as7/admin/pom.xml	2011-09-21 04:13:59 UTC (rev 3502)
+++ branches/as7/admin/pom.xml	2011-09-23 04:11:11 UTC (rev 3503)
@@ -32,12 +32,10 @@
         <dependency>
             <groupId>org.jboss.as</groupId>
             <artifactId>jboss-as-controller-client</artifactId>   
-            <scope>provided</scope>
         </dependency> 
         <dependency>
             <groupId>org.jboss.as</groupId>
             <artifactId>jboss-as-cli</artifactId>
-            <scope>provided</scope>  
         </dependency>  
 	</dependencies>
 </project>

Modified: branches/as7/admin/src/main/java/org/teiid/adminapi/Admin.java
===================================================================
--- branches/as7/admin/src/main/java/org/teiid/adminapi/Admin.java	2011-09-21 04:13:59 UTC (rev 3502)
+++ branches/as7/admin/src/main/java/org/teiid/adminapi/Admin.java	2011-09-23 04:11:11 UTC (rev 3503)
@@ -56,23 +56,22 @@
     void changeVDBConnectionType(String vdbName, int vdbVersion, ConnectionType type) throws AdminException;
     
     /**
-     * Deploy a {@link VDB} file.
-     * @param name  Name of the VDB file to save under
-     * @param VDB 	VDB.
+     * Deploy a artifact (VDB, JAR, RAR files)
+     * @param deployName  Name of the VDB file to save under
+     * @param content
      * @throws AdminException
      *             
      * @return the {@link VDB} representing the current property values and runtime state.
      */
-    public void deployVDB(String fileName, InputStream vdb) throws AdminException;
+    public void deploy(String deployName, InputStream content) throws AdminException;
     
     
     /**
-     * Delete the VDB with the given name and version
-     * @param vdbName
-     * @param version
+     * Undeploy artifact (VDB, JAR, RAR files)
+     * @param deployedName
      * @throws AdminException
      */
-    void deleteVDB(String vdbName, int vdbVersion) throws AdminException;
+    void undeploy(String deployedName) throws AdminException;
     
     /**
      * Get the VDBs that currently deployed in the system
@@ -81,7 +80,7 @@
      * same name in the Collection but they will differ by VDB version.
      * @throws AdminException 
      */
-    Set<VDB> getVDBs() throws AdminException;
+    Set<? extends VDB> getVDBs() throws AdminException;
     
     /**
      * Get the VDB
@@ -90,7 +89,7 @@
      * @throws AdminException 
      * @return
      */
-    VDB getVDB(String vdbName, int vbdVersion) throws AdminException;
+    VDB getVDB(String vdbName, int vdbVersion) throws AdminException;
 
     /**
      * Get the translators that are available in the configuration
@@ -98,7 +97,7 @@
      * @return Collection of {@link Translator}
      * @throws AdminException 
      */
-    Collection<Translator> getTranslators() throws AdminException;
+    Collection<? extends Translator> getTranslators() throws AdminException;
     
     /**
      * Get the translator by the given the deployed name.
@@ -128,21 +127,21 @@
      * @return Collection of {@link Session}
      * @throws AdminException 
      */
-    Collection<Session> getSessions() throws AdminException;
+    Collection<? extends Session> getSessions() throws AdminException;
 
     /**
      * Get the all Requests that are currently in process
      * @return Collection of {@link Request}
      * @throws AdminException 
      */
-    Collection<Request> getRequests() throws AdminException;
+    Collection<? extends Request> getRequests() throws AdminException;
     
     /**
      * Get the Requests for the given session
      * @return Collection of {@link Request}
      * @throws AdminException 
      */
-    Collection<Request> getRequestsForSession(String sessionId) throws AdminException;
+    Collection<? extends Request> getRequestsForSession(String sessionId) throws AdminException;
     
 
     /**
@@ -151,7 +150,7 @@
      * @return
      * @throws AdminException
      */
-    Collection<PropertyDefinition> getTemplatePropertyDefinitions(String templateName) throws AdminException;
+    Collection<? extends PropertyDefinition> getTemplatePropertyDefinitions(String templateName) throws AdminException;
     
     
     /**
@@ -159,7 +158,7 @@
      * @return
      * @throws AdminException
      */
-    Collection<Transaction> getTransactions() throws AdminException;
+    Collection<? extends Transaction> getTransactions() throws AdminException;
     
     /**
      * Clear the cache or caches specified by the cacheIdentifier.

Modified: branches/as7/admin/src/main/java/org/teiid/adminapi/AdminFactory.java
===================================================================
--- branches/as7/admin/src/main/java/org/teiid/adminapi/AdminFactory.java	2011-09-21 04:13:59 UTC (rev 3502)
+++ branches/as7/admin/src/main/java/org/teiid/adminapi/AdminFactory.java	2011-09-23 04:11:11 UTC (rev 3503)
@@ -22,27 +22,37 @@
 
 package org.teiid.adminapi;
 
+import static org.jboss.as.controller.client.helpers.ClientConstants.DEPLOYMENT_REMOVE_OPERATION;
+import static org.jboss.as.controller.client.helpers.ClientConstants.DEPLOYMENT_UNDEPLOY_OPERATION;
+
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.UnknownHostException;
-import java.util.Collection;
-import java.util.List;
-import java.util.Properties;
-import java.util.Set;
+import java.util.*;
 
 import javax.security.auth.callback.*;
 import javax.security.sasl.RealmCallback;
 import javax.security.sasl.RealmChoiceCallback;
 
 import org.jboss.as.cli.Util;
+import org.jboss.as.cli.operation.OperationFormatException;
 import org.jboss.as.cli.operation.impl.DefaultOperationRequestAddress;
+import org.jboss.as.cli.operation.impl.DefaultOperationRequestBuilder;
 import org.jboss.as.controller.client.ModelControllerClient;
+import org.jboss.as.protocol.old.StreamUtils;
+import org.jboss.dmr.ModelNode;
 import org.teiid.adminapi.VDB.ConnectionType;
+import org.teiid.adminapi.impl.*;
+import org.teiid.adminapi.impl.VDBMetadataMapper.RequestMetadataMapper;
+import org.teiid.adminapi.impl.VDBMetadataMapper.SessionMetadataMapper;
+import org.teiid.adminapi.impl.VDBMetadataMapper.TransactionMetadataMapper;
+import org.teiid.core.util.ObjectConverterUtil;
 
 
 /** 
  * Singleton factory for class for creating Admin connections to the Teiid
  */
+ at SuppressWarnings("nls")
 public class AdminFactory {
 	private static AdminFactory INSTANCE = new AdminFactory();
 	
@@ -64,7 +74,7 @@
         }
 
         if(port < 0) {
-            port = 9990;
+            port = 9999;
         }
 
         try {
@@ -81,7 +91,7 @@
             } 
             System.out.println("The controller is not available at " + host + ":" + port); //$NON-NLS-1$ //$NON-NLS-2$
         } catch (UnknownHostException e) {
-        	System.out.println("Failed to resolve host '" + host + "': " + e.getLocalizedMessage()); //$NON-NLS-1$ //$NON-NLS-2$
+        	throw new AdminProcessingException("Failed to resolve host '" + host + "': " + e.getLocalizedMessage()); //$NON-NLS-1$ //$NON-NLS-2$
         }
         return null;
     }
@@ -128,177 +138,672 @@
     }    
     
     private class AdminImpl implements Admin{
+    	private ModelControllerClient connection;
+    	private boolean domainMode = false;
+    	
     	public AdminImpl (ModelControllerClient connection) {
-    		
+    		this.connection = connection;
+            List<String> nodeTypes = Util.getNodeTypes(connection, new DefaultOperationRequestAddress());
+            if (!nodeTypes.isEmpty()) {
+                domainMode = nodeTypes.contains("server-group"); //$NON-NLS-1$
+            }     		
     	}
-
+    	
 		@Override
-		public void addDataRoleMapping(String vdbName, int vdbVersion,
-				String dataRole, String mappedRoleName) throws AdminException {
-			// rameshTODO Auto-generated method stub
-			
+		public void clearCache(String cacheType) throws AdminException {
+	        final ModelNode request = buildRequest("teiid", "clear-cache", "cache-type", cacheType);//$NON-NLS-1$ //$NON-NLS-2$
+	        try {
+	            ModelNode outcome = this.connection.execute(request);
+	            if (!Util.isSuccess(outcome)) {
+	            	throw new AdminProcessingException(Util.getFailureDescription(outcome));
+	            }
+	        } catch (Exception e) {
+	        	throw new AdminProcessingException(e);
+	        }
 		}
 
 		@Override
-		public void assignToModel(String vdbName, int vdbVersion,
-				String modelName, String sourceName, String translatorName,
-				String dsName) throws AdminException {
-			// rameshTODO Auto-generated method stub
-			
+		public void clearCache(String cacheType, String vdbName, int vdbVersion) throws AdminException {
+	        final ModelNode request = buildRequest("teiid", "clear-cache", 
+	        		"cache-type", cacheType,
+	        		"vdb-name", vdbName,
+	        		"vdb-version", String.valueOf(vdbVersion));//$NON-NLS-1$ //$NON-NLS-2$
+	        try {
+	            ModelNode outcome = this.connection.execute(request);
+	            if (!Util.isSuccess(outcome)) {
+	            	throw new AdminProcessingException(Util.getFailureDescription(outcome));
+	            }
+	        } catch (Exception e) {
+	        	throw new AdminProcessingException(e);
+	        }
 		}
 
 		@Override
-		public void cancelRequest(String sessionId, long executionId)
-				throws AdminException {
-			// rameshTODO Auto-generated method stub
-			
+		public void close() {
+			if (this.connection != null) {
+				StreamUtils.safeClose(this.connection);
+				this.connection = null;
+				this.domainMode = false;
+			}
 		}
-
-		@Override
-		public void changeVDBConnectionType(String vdbName, int vdbVersion,
-				ConnectionType type) throws AdminException {
-			// rameshTODO Auto-generated method stub
-			
+		
+		private void createConnectionFactoryRequest(String deploymentName,	String templateName, Properties properties)	throws AdminException {
+			DefaultOperationRequestBuilder builder = new DefaultOperationRequestBuilder();
+			try {
+				builder.operationName("add");
+				builder.addNode("subsystem", "resource-adapters"); //$NON-NLS-1$ //$NON-NLS-2$
+				builder.addNode("resource-adapter", templateName); //$NON-NLS-1$
+				
+				builder.addProperty("archive", templateName);
+				builder.addProperty("transaction-support", properties.getProperty("transaction-support", "NoTransaction"));
+				properties.remove("transaction-support");
+				
+				
+			} catch (OperationFormatException e) {
+				throw new IllegalStateException("Failed to build operation", e); //$NON-NLS-1$
+			}
+            
+            
 		}
 
 		@Override
-		public void clearCache(String cacheType) throws AdminException {
-			// rameshTODO Auto-generated method stub
-			
+		public void createDataSource(String deploymentName,	String templateName, Properties properties)	throws AdminException {
+			DefaultOperationRequestBuilder builder = new DefaultOperationRequestBuilder();
+	        final ModelNode request;
+	        try {
+	        	//	data-source      jdbc-driver      xa-data-source resource-adapters
+	        	if (templateName.equals("data-source")) {
+		            builder.addNode("subsystem", "datasources"); //$NON-NLS-1$ //$NON-NLS-2$
+		            builder.addNode("data-source", deploymentName); //$NON-NLS-1$	        		
+	        	}
+	        	else if (templateName.equals("xa-data-source")) {
+		            builder.addNode("subsystem", "datasources"); //$NON-NLS-1$ //$NON-NLS-2$
+		            builder.addNode("xa-data-source", deploymentName); //$NON-NLS-1$	        		
+	        	}
+	        	else if (templateName.equals("resource-adapters")) {
+		            builder.addNode("subsystem", "resource-adapters"); //$NON-NLS-1$ //$NON-NLS-2$
+		            builder.addNode("resource-adapter", deploymentName); //$NON-NLS-1$
+	        	}
+	        	
+	            builder.operationName("add"); 
+	            request = builder.buildRequest();
+	            
+	            builder.addProperty("jndi-name", "java:/"+deploymentName);
+	            Enumeration keys = properties.propertyNames();
+	            while (keys.hasMoreElements()) {
+	            	String key = (String)keys.nextElement(); 
+	            	builder.addProperty(key, properties.getProperty(key));
+	            }
+	        } catch (OperationFormatException e) {
+	            throw new IllegalStateException("Failed to build operation", e); //$NON-NLS-1$
+	        }
+	        
+	        try {
+	            ModelNode outcome = this.connection.execute(request);
+	            if (!Util.isSuccess(outcome)) {
+	                throw new AdminProcessingException(Util.getFailureDescription(outcome));
+	            }
+	        } catch (Exception e) {
+	        	throw new AdminProcessingException(e);
+	        }	        
 		}
 
 		@Override
-		public void clearCache(String cacheType, String vdbName, int vdbVersion)
-				throws AdminException {
+		public void deleteDataSource(String deployedName) throws AdminException {
 			// rameshTODO Auto-generated method stub
 			
 		}
 
 		@Override
-		public void close() {
-			// rameshTODO Auto-generated method stub
-			
-		}
+		public void undeploy(String deployedName) throws AdminException {
+	        try {			
+				ModelNode request = buildUndeployRequest(deployedName);
 
-		@Override
-		public void createDataSource(String deploymentName,
-				String templateName, Properties properties)
-				throws AdminException {
-			// rameshTODO Auto-generated method stub
-			
+	            ModelNode outcome = this.connection.execute(request);
+	            if (!Util.isSuccess(outcome)) {
+	                throw new AdminProcessingException(Util.getFailureDescription(outcome));
+	            }
+	        } catch (OperationFormatException e) {
+	        	throw new AdminProcessingException(e);
+	        } catch (IOException e) {
+	        	throw new AdminProcessingException(e);
+	        }
 		}
+		
+	    public ModelNode buildUndeployRequest(String name) throws OperationFormatException {
+	        ModelNode composite = new ModelNode();
+	        composite.get("operation").set("composite");
+	        composite.get("address").setEmptyList();
+	        ModelNode steps = composite.get("steps");
 
-		@Override
-		public void deleteDataSource(String deployedName) throws AdminException {
-			// rameshTODO Auto-generated method stub
-			
-		}
+	        DefaultOperationRequestBuilder builder;
 
+	        if(this.domainMode) {
+            	final List<String> serverGroups = Util.getServerGroups(this.connection);
+
+                for (String group : serverGroups){
+                    ModelNode groupStep = Util.configureDeploymentOperation(DEPLOYMENT_UNDEPLOY_OPERATION, name, group);
+                    steps.add(groupStep);
+                }
+
+                for (String group : serverGroups) {
+                    ModelNode groupStep = Util.configureDeploymentOperation(DEPLOYMENT_REMOVE_OPERATION, name, group);
+                    steps.add(groupStep);
+                }
+	        } else if(Util.isDeployedAndEnabledInStandalone(name, this.connection)) {
+	            builder = new DefaultOperationRequestBuilder();
+	            builder.setOperationName("undeploy");
+	            builder.addNode("deployment", name);
+	            steps.add(builder.buildRequest());
+	        }
+
+	        // remove content
+            builder = new DefaultOperationRequestBuilder();
+            builder.setOperationName("remove");
+            builder.addNode("deployment", name);
+            steps.add(builder.buildRequest());
+            
+	        return composite;
+	    }
+
 		@Override
-		public void deleteVDB(String vdbName, int vdbVersion)
-				throws AdminException {
-			// rameshTODO Auto-generated method stub
-			
+		public void deploy(String deployName, InputStream vdb)	throws AdminException {
+			ModelNode request = buildDeployVDBRequest(deployName, vdb);
+	        try {
+	            ModelNode outcome = this.connection.execute(request);
+	            if (!Util.isSuccess(outcome)) {
+	                throw new AdminProcessingException(Util.getFailureDescription(outcome));
+	            }
+	        } catch (Exception e) {
+	        	throw new AdminProcessingException(e);
+	        }				
 		}
 
-		@Override
-		public void deployVDB(String fileName, InputStream vdb)
-				throws AdminException {
-			// rameshTODO Auto-generated method stub
-			
+		private ModelNode buildDeployVDBRequest(String fileName, InputStream vdb) throws AdminProcessingException {
+            try {
+				if (Util.isDeploymentInRepository(fileName, this.connection)){
+	                // replace
+					DefaultOperationRequestBuilder builder = new DefaultOperationRequestBuilder();
+	                builder = new DefaultOperationRequestBuilder();
+	                builder.setOperationName("full-replace-deployment");
+	                builder.addProperty("name", fileName);
+	                byte[] bytes = ObjectConverterUtil.convertToByteArray(vdb);
+	                builder.getModelNode().get("content").get(0).get("bytes").set(bytes);
+	                return builder.buildRequest();                
+				}
+				
+		        ModelNode composite = new ModelNode();
+		        composite.get("operation").set("composite");
+		        composite.get("address").setEmptyList();
+		        ModelNode steps = composite.get("steps");			
+				
+				DefaultOperationRequestBuilder builder = new DefaultOperationRequestBuilder();
+	            builder.setOperationName("add");
+	            builder.addNode("deployment", fileName);
+
+				byte[] bytes = ObjectConverterUtil.convertToByteArray(vdb);
+				builder.getModelNode().get("content").get(0).get("bytes").set(bytes);
+				steps.add(builder.buildRequest());
+            
+	            // deploy
+	            if (this.domainMode) {
+	            	List<String> serverGroups = Util.getServerGroups(this.connection);
+	                for (String serverGroup : serverGroups) {
+	                    steps.add(Util.configureDeploymentOperation("add", fileName, serverGroup));
+	                }
+	                for (String serverGroup : serverGroups) {
+	                    steps.add(Util.configureDeploymentOperation("deploy", fileName, serverGroup));
+	                }
+	            } else {
+	                builder = new DefaultOperationRequestBuilder();
+	                builder.setOperationName("deploy");
+	                builder.addNode("deployment", fileName);
+	                steps.add(builder.buildRequest());
+	            }     
+	            return composite;
+			} catch (OperationFormatException e) {
+				throw new AdminProcessingException(e);
+			} catch (IOException e) {
+				throw new AdminProcessingException(e);
+			}      
 		}
 
 		@Override
-		public CacheStatistics getCacheStats(String cacheType)
-				throws AdminException {
-			// rameshTODO Auto-generated method stub
-			return null;
+		public CacheStatistics getCacheStats(String cacheType) throws AdminException {
+	        final ModelNode request = buildRequest("teiid", "cache-statistics",	"cache-type", cacheType);//$NON-NLS-1$ //$NON-NLS-2$
+	        try {
+	            ModelNode outcome = this.connection.execute(request);
+	            if (Util.isSuccess(outcome)) {
+	            	if (outcome.hasDefined("result")) {
+	            		ModelNode result = outcome.get("result");
+	            		return VDBMetadataMapper.CacheStatisticsMetadataMapper.INSTANCE.unwrap(result);
+	            	}	            	
+	            	
+	            }
+	        } catch (Exception e) {
+	        	throw new AdminProcessingException(e);
+	        }
+	        return null;
 		}
 
 		@Override
 		public Collection<String> getCacheTypes() throws AdminException {
-			// rameshTODO Auto-generated method stub
-			return null;
+	        final ModelNode request = buildRequest("teiid", "cache-types");//$NON-NLS-1$ //$NON-NLS-2$
+	        try {
+	            ModelNode outcome = this.connection.execute(request);
+	            if (Util.isSuccess(outcome)) {
+	            	return Util.getList(outcome);
+	            }
+	        } catch (Exception e) {
+	        	throw new AdminProcessingException(e);
+	        }
+	        return Collections.emptyList();
 		}
 
+		private List<String> getChildNodeNames(String subsystem, String childNode) throws AdminException {
+	        final ModelNode request = buildRequest(subsystem, "read-children-names", "child-type", childNode);//$NON-NLS-1$
+	        try {
+	            ModelNode outcome = this.connection.execute(request);
+	            if (Util.isSuccess(outcome)) {
+	                return Util.getList(outcome);
+	            }
+	        } catch (IOException e) {
+	        	throw new AdminProcessingException(e);
+	        }
+	        return Collections.emptyList();	
+			
+		}
+		
+		/**
+		 * /subsystem=datasources:read-children-names(child-type=data-source)
+		 * /subsystem=resource-adapters/resource-adapter={rar-file}:read-resource
+		 * @see org.teiid.adminapi.Admin#getDataSourceNames()
+		 */
 		@Override
 		public Collection<String> getDataSourceNames() throws AdminException {
-			// rameshTODO Auto-generated method stub
-			return null;
+			Set<String> datasourceNames = new HashSet<String>();
+			datasourceNames.addAll(getChildNodeNames("datasources", "data-source"));
+			datasourceNames.addAll(getChildNodeNames("datasources", "xa-data-source"));
+
+			Set<String> resourceAdapters = getResourceAdapterNames();
+			for (String resource:resourceAdapters) {
+				
+				DefaultOperationRequestBuilder builder = new DefaultOperationRequestBuilder();
+		        try {
+		            builder.addNode("subsystem", "resource-adapters"); //$NON-NLS-1$ //$NON-NLS-2$
+		            builder.addNode("resource-adapter", resource); //$NON-NLS-1$ //$NON-NLS-2$
+		            builder.operationName("read-resource"); 
+		            ModelNode request = builder.buildRequest();
+		            
+		            ModelNode outcome = this.connection.execute(request);
+		            if (Util.isSuccess(outcome)) {
+		            	if (outcome.hasDefined("result")) {
+		            		ModelNode result = outcome.get("result");
+			            	if (result.hasDefined("connection-definitions")) {
+			            		List<ModelNode> connDefs = result.get("connection-definitions").asList();
+			            		for (ModelNode conn:connDefs) {
+			            			datasourceNames.add(conn.get("jndi-name").asString());
+			            		}
+			            	}
+		            	}
+		            }
+		        } catch (OperationFormatException e) {
+		            throw new AdminProcessingException("Failed to build operation", e); //$NON-NLS-1$
+		        } catch (IOException e) {
+		        	throw new AdminProcessingException("Failed to build operation", e); //$NON-NLS-1$
+		        }
+			}
+	        return datasourceNames;	
 		}
+		
+		/**
+		 * This will get all deplyed RAR names
+		 * /subsystem=resource-adapters:read-children-names(child-type=resource-adapter)
+		 * @return
+		 * @throws AdminException
+		 */
+		private Set<String> getResourceAdapterNames() throws AdminException {
+			Set<String> templates = new HashSet<String>();
+	        final ModelNode request = buildRequest("resource-adapters", "read-children-names", "child-type", "resource-adapter");//$NON-NLS-1$
+	        try {
+	            ModelNode outcome = this.connection.execute(request);
+	            if (Util.isSuccess(outcome)) {
+	                templates.addAll(Util.getList(outcome));
+	                return templates;
+	            }
+	        } catch (Exception e) {
+	        	throw new AdminProcessingException(e);
+	        }
+	        return Collections.emptySet();					
+		}
+		
 
 		@Override
 		public Set<String> getDataSourceTemplateNames() throws AdminException {
-			// rameshTODO Auto-generated method stub
-			return null;
+			Set<String> templates = new HashSet<String>();
+			templates.add("data-source");
+			templates.add("xa-data-source");
+			templates.addAll(getResourceAdapterNames());
+			return templates;
 		}
+		
+		@Override
+		public WorkerPoolStatistics getWorkerPoolStats() throws AdminException {
+			final ModelNode request = buildEngineRequest("workerpool-statistics");//$NON-NLS-1$
+			if (request != null) {
+		        try {
+		            ModelNode outcome = this.connection.execute(request);
+		            if (Util.isSuccess(outcome)) {
+		            	if (outcome.hasDefined("result")) {
+		            		ModelNode result = outcome.get("result");
+		            		return VDBMetadataMapper.WorkerPoolStatisticsMetadataMapper.INSTANCE.unwrap(result);
+		            	}	            	
+		            }		            
+		        } catch (Exception e) {
+		        	throw new AdminProcessingException(e);
+		        }
+			}
+	        return null;
+		}		
 
+		
 		@Override
-		public Collection<Request> getRequests() throws AdminException {
-			// rameshTODO Auto-generated method stub
-			return null;
+		public void cancelRequest(String sessionId, long executionId) throws AdminException {
+			final ModelNode request = buildEngineRequest("terminate-session", "session", sessionId, "execution-id", String.valueOf(executionId));//$NON-NLS-1$
+			if (request == null) {
+				return;
+			}
+	        try {
+	            ModelNode outcome = this.connection.execute(request);
+	            if (!Util.isSuccess(outcome)) {
+	            	throw new AdminProcessingException(Util.getFailureDescription(outcome));
+	            }
+	        } catch (Exception e) {
+	        	throw new AdminProcessingException(e);
+	        }		
 		}
-
+		
 		@Override
-		public Collection<Request> getRequestsForSession(String sessionId)
-				throws AdminException {
-			// rameshTODO Auto-generated method stub
-			return null;
+		public Collection<? extends Request> getRequests() throws AdminException {
+			final ModelNode request = buildEngineRequest("list-requests");//$NON-NLS-1$
+			if (request != null) {
+		        try {
+		            ModelNode outcome = this.connection.execute(request);
+		            if (Util.isSuccess(outcome)) {
+		                return getList(outcome, RequestMetadataMapper.INSTANCE);
+		            }
+		        } catch (Exception e) {
+		        	throw new AdminProcessingException(e);
+		        }
+			}
+	        return Collections.emptyList();
 		}
 
 		@Override
-		public Collection<Session> getSessions() throws AdminException {
-			// rameshTODO Auto-generated method stub
-			return null;
+		public Collection<? extends Request> getRequestsForSession(String sessionId) throws AdminException {
+			final ModelNode request = buildEngineRequest("requests-per-session", "session", sessionId);//$NON-NLS-1$
+			if (request != null) {
+		        try {
+		            ModelNode outcome = this.connection.execute(request);
+		            if (Util.isSuccess(outcome)) {
+		                return getList(outcome, RequestMetadataMapper.INSTANCE);
+		            }
+		        } catch (Exception e) {
+		        	throw new AdminProcessingException(e);
+		        }
+			}
+	        return Collections.emptyList();
 		}
 
 		@Override
-		public Collection<PropertyDefinition> getTemplatePropertyDefinitions(
-				String templateName) throws AdminException {
-			// rameshTODO Auto-generated method stub
-			return null;
+		public Collection<? extends Session> getSessions() throws AdminException {
+			final ModelNode request = buildEngineRequest("list-sessions");//$NON-NLS-1$
+			if (request != null) {
+		        try {
+		            ModelNode outcome = this.connection.execute(request);
+		            if (Util.isSuccess(outcome)) {
+		                return getList(outcome, SessionMetadataMapper.INSTANCE);
+		            }
+		        } catch (Exception e) {
+		        	throw new AdminProcessingException(e);
+		        }
+			}
+	        return Collections.emptyList();
 		}
 
 		@Override
-		public Collection<Transaction> getTransactions() throws AdminException {
+		public Collection<PropertyDefinition> getTemplatePropertyDefinitions(String templateName) throws AdminException {
 			// rameshTODO Auto-generated method stub
 			return null;
 		}
 
 		@Override
-		public Translator getTranslator(String deployedName)
-				throws AdminException {
-			// rameshTODO Auto-generated method stub
-			return null;
+		public Collection<? extends Transaction> getTransactions() throws AdminException {
+			final ModelNode request = buildEngineRequest("list-transactions");//$NON-NLS-1$
+			if (request != null) {
+		        try {
+		            ModelNode outcome = this.connection.execute(request);
+		            if (Util.isSuccess(outcome)) {
+		                return getList(outcome, TransactionMetadataMapper.INSTANCE);
+		            }
+		        } catch (Exception e) {
+		        	throw new AdminProcessingException(e);
+		        }
+			}
+	        return Collections.emptyList();
 		}
+		
+		@Override
+		public void terminateSession(String sessionId) throws AdminException {
+			final ModelNode request = buildEngineRequest("terminate-session", "session", sessionId);//$NON-NLS-1$
+			if (request == null) {
+				return;
+			}
+	        try {
+	            ModelNode outcome = this.connection.execute(request);
+	            if (!Util.isSuccess(outcome)) {
+	            	throw new AdminProcessingException(Util.getFailureDescription(outcome));
+	            }
+	        } catch (Exception e) {
+	        	throw new AdminProcessingException(e);
+	        }			
+		}
 
 		@Override
-		public Collection<Translator> getTranslators() throws AdminException {
-			// rameshTODO Auto-generated method stub
+		public void terminateTransaction(String transactionId) throws AdminException {
+			final ModelNode request = buildEngineRequest("terminate-transaction", "xid", transactionId);//$NON-NLS-1$
+			if (request == null) {
+				return;
+			}
+	        try {
+	            ModelNode outcome = this.connection.execute(request);
+	            if (!Util.isSuccess(outcome)) {
+	            	throw new AdminProcessingException(Util.getFailureDescription(outcome));
+	            }
+	        } catch (Exception e) {
+	        	throw new AdminProcessingException(e);
+	        }			
+		}		
+
+		@Override
+		public Translator getTranslator(String deployedName) throws AdminException {
+			final ModelNode request = buildRequest("teiid", "get-translator", "translator-name", deployedName);//$NON-NLS-1$
+			if (request == null) {
+				return null;
+			}
+	        try {
+	            ModelNode outcome = this.connection.execute(request);
+	            if (Util.isSuccess(outcome)) {
+	            	if (outcome.hasDefined("result")) {
+	            		ModelNode result = outcome.get("result");
+	            		return VDBMetadataMapper.VDBTranslatorMetaDataMapper.INSTANCE.unwrap(result);
+	            	}	            	
+	            }
+	            
+	        } catch (Exception e) {
+	        	throw new AdminProcessingException(e);
+	        }			
 			return null;
 		}
 
 		@Override
-		public VDB getVDB(String vdbName, int vbdVersion) throws AdminException {
-			// rameshTODO Auto-generated method stub
-			return null;
+		public Collection<? extends Translator> getTranslators() throws AdminException {
+	        final ModelNode request = buildRequest("teiid", "list-translators");//$NON-NLS-1$ //$NON-NLS-2$
+	        try {
+	            ModelNode outcome = this.connection.execute(request);
+	            if (Util.isSuccess(outcome)) {
+	                return getList(outcome, VDBMetadataMapper.VDBTranslatorMetaDataMapper.INSTANCE);
+	            }
+	        } catch (Exception e) {
+	        	throw new AdminProcessingException(e);
+	        }
+
+	        return Collections.emptyList();
 		}
+		
+	    private List<String> getEngines(ModelControllerClient client) {
+	        DefaultOperationRequestBuilder builder = new DefaultOperationRequestBuilder();
+	        final ModelNode request;
+	        try {
+	        	builder.addNode("subsystem", "teiid"); //$NON-NLS-1$ //$NON-NLS-2$
+	            builder.operationName("read-children-names");
+	            builder.addProperty("child-type", "query-engine");
+	            request = builder.buildRequest();
+	        } catch (OperationFormatException e) {
+	            throw new IllegalStateException("Failed to build operation", e);
+	        }
 
+	        try {
+	            ModelNode outcome = client.execute(request);
+	            if (Util.isSuccess(outcome)) {
+	                return Util.getList(outcome);
+	            }
+	        } catch (Exception e) {
+	        }
+
+	        return Collections.emptyList();
+	    }		
+		
+		private ModelNode buildEngineRequest(String operationName, String... params) {
+			ModelNode composite = new ModelNode();
+	        composite.get("operation").set("composite");
+	        composite.get("address").setEmptyList();
+	        ModelNode steps = composite.get("steps");
+	        
+			List<String> engines = getEngines(this.connection);
+			
+			for (String engine:engines) {
+				DefaultOperationRequestBuilder builder = new DefaultOperationRequestBuilder();
+		        final ModelNode request;
+		        try {
+		            builder.addNode("subsystem", "teiid"); //$NON-NLS-1$ //$NON-NLS-2$
+		            builder.addNode("query-engine", engine); //$NON-NLS-1$ //$NON-NLS-2$
+		            builder.operationName(operationName); 
+		            request = builder.buildRequest();
+		            if (params != null && params.length % 2 == 0) {
+		            	for (int i = 0; i < params.length; i+=2) {
+		            		builder.addProperty(params[i], params[i+1]);
+		            	}
+		            }
+		           steps.add(request);
+		        } catch (OperationFormatException e) {
+		            throw new IllegalStateException("Failed to build operation", e); //$NON-NLS-1$
+		        }
+			}
+			return composite;
+		}		
+
+		private ModelNode buildRequest(String subsystem, String operationName, String... params) {
+			DefaultOperationRequestBuilder builder = new DefaultOperationRequestBuilder();
+	        final ModelNode request;
+	        try {
+	            builder.addNode("subsystem", subsystem); //$NON-NLS-1$ //$NON-NLS-2$
+	            builder.operationName(operationName); 
+	            request = builder.buildRequest();
+	            if (params != null && params.length % 2 == 0) {
+	            	for (int i = 0; i < params.length; i+=2) {
+	            		builder.addProperty(params[i], params[i+1]);
+	            	}
+	            }
+	        } catch (OperationFormatException e) {
+	            throw new IllegalStateException("Failed to build operation", e); //$NON-NLS-1$
+	        }
+			return request;
+		}
+		
+	    private <T> List<T> getList(ModelNode operationResult,  MetadataMapper<T> mapper) {
+	        if(!operationResult.hasDefined("result")) //$NON-NLS-1$
+	            return Collections.emptyList();
+
+	        List<ModelNode> nodeList = operationResult.get("result").asList(); //$NON-NLS-1$
+	        if(nodeList.isEmpty())
+	            return Collections.emptyList();
+
+	        List<T> list = new ArrayList<T>(nodeList.size());
+	        for(ModelNode node : nodeList) {
+	        	Set<String> keys = node.keys();
+	        	if (!keys.isEmpty()) {
+	        		list.addAll(getList(node.get(0), mapper));
+	        	}
+	        	else {
+	        		list.add(mapper.unwrap(node));
+	        	}
+	        }
+	        return list;
+	    }		
+	    
+	    public <T> Set<T> getSet(ModelNode operationResult,  MetadataMapper<T> mapper) {
+	        if(!operationResult.hasDefined("result")) //$NON-NLS-1$
+	            return Collections.emptySet();
+
+	        List<ModelNode> nodeList = operationResult.get("result").asList(); //$NON-NLS-1$
+	        if(nodeList.isEmpty())
+	            return Collections.emptySet();
+
+	        Set<T> list = new HashSet<T>(nodeList.size());
+	        for(ModelNode node : nodeList) {
+	            list.add(mapper.unwrap(node));
+	        }
+	        return list;
+	    }	    
+
 		@Override
-		public Set<VDB> getVDBs() throws AdminException {
-			// rameshTODO Auto-generated method stub
+		public VDB getVDB(String vdbName, int vdbVersion) throws AdminException {
+			final ModelNode request = buildRequest("teiid", "get-vdb", "vdb-name", vdbName, "vdb-version", String.valueOf(vdbVersion));//$NON-NLS-1$
+			if (request == null) {
+				return null;
+			}
+	        try {
+	            ModelNode outcome = this.connection.execute(request);
+	            if (Util.isSuccess(outcome)) {
+	            	if (outcome.hasDefined("result")) {
+	            		ModelNode result = outcome.get("result");
+	            		return VDBMetadataMapper.INSTANCE.unwrap(result);
+	            	}	            	
+	            }
+	        } catch (Exception e) {
+	        	throw new AdminProcessingException(e);
+	        }			
 			return null;
 		}
 
 		@Override
-		public WorkerPoolStatistics getWorkerPoolStats() throws AdminException {
-			// rameshTODO Auto-generated method stub
-			return null;
+		public Set<? extends VDB> getVDBs() throws AdminException {
+	        final ModelNode request = buildRequest("teiid", "list-vdbs");//$NON-NLS-1$ //$NON-NLS-2$
+	        try {
+	            ModelNode outcome = this.connection.execute(request);
+	            if (Util.isSuccess(outcome)) {
+	                return getSet(outcome, VDBMetadataMapper.INSTANCE);
+	            }
+	        } catch (Exception e) {
+	        	throw new AdminProcessingException(e);
+	        }
+
+	        return Collections.emptySet();
 		}
 
 		@Override
-		public void markDataSourceAvailable(String jndiName)
-				throws AdminException {
+		public void markDataSourceAvailable(String jndiName) throws AdminException {
 			// rameshTODO Auto-generated method stub
 			
 		}
@@ -307,37 +812,113 @@
 		public void mergeVDBs(String sourceVDBName, int sourceVDBVersion,
 				String targetVDBName, int targetVDBVersion)
 				throws AdminException {
-			// rameshTODO Auto-generated method stub
-			
+			final ModelNode request = buildRequest("teiid", "merge-vdbs", 
+					"source-vdb-name", sourceVDBName, 
+					"source-vdb-name", String.valueOf(sourceVDBVersion),
+					"target-vdb-name", targetVDBName, 
+					"target-vdb-version", String.valueOf(targetVDBVersion));//$NON-NLS-1$
+	        try {
+	            ModelNode outcome = this.connection.execute(request);
+	            if (!Util.isSuccess(outcome)) {
+	                throw new AdminProcessingException(Util.getFailureDescription(outcome));
+	            }
+	        } catch (Exception e) {
+	        	throw new AdminProcessingException(e);
+	        }			
 		}
 
 		@Override
-		public void removeDataRoleMapping(String vdbName, int vdbVersion,
-				String dataRole, String mappedRoleName) throws AdminException {
-			// rameshTODO Auto-generated method stub
-			
-		}
-
+		public void addDataRoleMapping(String vdbName, int vdbVersion, String dataRole, String mappedRoleName) throws AdminException {
+	        final ModelNode request = buildRequest("teiid", "add-data-role", 
+	        		"vdb-name", vdbName,
+	        		"vdb-version", String.valueOf(vdbVersion),
+	        		"data-role", dataRole,
+	        		"mapped-role", mappedRoleName);//$NON-NLS-1$ //$NON-NLS-2$
+	        try {
+	            ModelNode outcome = this.connection.execute(request);
+	            if (!Util.isSuccess(outcome)) {
+	            	throw new AdminProcessingException(Util.getFailureDescription(outcome));
+	            }
+	        } catch (Exception e) {
+	        	throw new AdminProcessingException(e);
+	        }
+		}		
+		
 		@Override
-		public void setAnyAuthenticatedForDataRole(String vdbName,
-				int vdbVersion, String dataRole, boolean anyAuthenticated)
-				throws AdminException {
-			// rameshTODO Auto-generated method stub
-			
+		public void removeDataRoleMapping(String vdbName, int vdbVersion, String dataRole, String mappedRoleName) throws AdminException {
+	        final ModelNode request = buildRequest("teiid", "remove-data-role", 
+	        		"vdb-name", vdbName,
+	        		"vdb-version", String.valueOf(vdbVersion),
+	        		"data-role", dataRole,
+	        		"mapped-role", mappedRoleName);//$NON-NLS-1$ //$NON-NLS-2$
+	        try {
+	            ModelNode outcome = this.connection.execute(request);
+	            if (!Util.isSuccess(outcome)) {
+	            	throw new AdminProcessingException(Util.getFailureDescription(outcome));
+	            }
+	        } catch (Exception e) {
+	        	throw new AdminProcessingException(e);
+	        }		
 		}
 
 		@Override
-		public void terminateSession(String sessionId) throws AdminException {
-			// rameshTODO Auto-generated method stub
-			
+		public void setAnyAuthenticatedForDataRole(String vdbName, int vdbVersion, String dataRole, boolean anyAuthenticated) throws AdminException {
+	        ModelNode request = buildRequest("teiid", "add-anyauthenticated-role", 
+	        		"vdb-name", vdbName,
+	        		"vdb-version", String.valueOf(vdbVersion),
+	        		"data-role", dataRole); //$NON-NLS-1$ //$NON-NLS-2$
+	        
+	        if (!anyAuthenticated) {
+	        	request = buildRequest("teiid", "remove-anyauthenticated-role", 
+		        		"vdb-name", vdbName,
+		        		"vdb-version", String.valueOf(vdbVersion),
+		        		"data-role", dataRole); //$NON-NLS-1$ //$NON-NLS-2$	        	
+	        }
+	        try {
+	            ModelNode outcome = this.connection.execute(request);
+	            if (!Util.isSuccess(outcome)) {
+	            	throw new AdminProcessingException(Util.getFailureDescription(outcome));
+	            }
+	        } catch (Exception e) {
+	        	throw new AdminProcessingException(e);
+	        }			
 		}
 
 		@Override
-		public void terminateTransaction(String transactionId)
-				throws AdminException {
-			// rameshTODO Auto-generated method stub
-			
-		}
+		public void changeVDBConnectionType(String vdbName, int vdbVersion, ConnectionType type) throws AdminException {
+	        final ModelNode request = buildRequest("teiid", "change-vdb-connection-type", 
+	        		"vdb-name", vdbName,
+	        		"vdb-version", String.valueOf(vdbVersion),
+	        		"connection-type", type.name());//$NON-NLS-1$ //$NON-NLS-2$
+	        try {
+	            ModelNode outcome = this.connection.execute(request);
+	            if (!Util.isSuccess(outcome)) {
+	            	throw new AdminProcessingException(Util.getFailureDescription(outcome));
+	            }
+	        } catch (Exception e) {
+	        	throw new AdminProcessingException(e);
+	        }				
+		}		
+		
+		@Override
+		public void assignToModel(String vdbName, int vdbVersion, String modelName, String sourceName, String translatorName,
+				String dsName) throws AdminException {
+	        final ModelNode request = buildRequest("teiid", "assign-datasource", 
+	        		"vdb-name", vdbName,
+	        		"vdb-version", String.valueOf(vdbVersion),
+	        		"model-name", modelName,
+	        		"source-name", sourceName,
+	        		"translator-name", translatorName,
+	        		"ds-name", dsName);//$NON-NLS-1$ //$NON-NLS-2$
+	        try {
+	            ModelNode outcome = this.connection.execute(request);
+	            if (!Util.isSuccess(outcome)) {
+	            	throw new AdminProcessingException(Util.getFailureDescription(outcome));
+	            }
+	        } catch (Exception e) {
+	        	throw new AdminProcessingException(e);
+	        }				
+		}		
     }
     
 }

Modified: branches/as7/admin/src/main/java/org/teiid/adminapi/impl/DQPManagement.java
===================================================================
--- branches/as7/admin/src/main/java/org/teiid/adminapi/impl/DQPManagement.java	2011-09-21 04:13:59 UTC (rev 3502)
+++ branches/as7/admin/src/main/java/org/teiid/adminapi/impl/DQPManagement.java	2011-09-23 04:11:11 UTC (rev 3503)
@@ -33,15 +33,11 @@
     WorkerPoolStatisticsMetadata getWorkerPoolStatistics();
     void terminateSession(String terminateeId);
     boolean cancelRequest(String sessionId, long requestId) throws AdminException;
-    Collection<String> getCacheTypes();
-    void clearCache(String cacheType);
-    void clearCache(String cacheType, String vdbName, int version);
     Collection<SessionMetadata> getActiveSessions() throws AdminException;
     int getActiveSessionsCount() throws AdminException;
     Collection<TransactionMetadata> getTransactions();
     void terminateTransaction(String xid) throws AdminException ;
     List<RequestMetadata> getLongRunningRequests();
     List<RequestMetadata> getRequestsUsingVDB(String vdbName, int vdbVersion) throws AdminException;
-    CacheStatisticsMetadata getCacheStatistics(String cacheType);
     List<List> executeQuery(String vdbName, int version, String command, long timoutInMilli) throws AdminException;
 }

Modified: branches/as7/admin/src/main/java/org/teiid/adminapi/impl/DataPolicyMetadata.java
===================================================================
--- branches/as7/admin/src/main/java/org/teiid/adminapi/impl/DataPolicyMetadata.java	2011-09-21 04:13:59 UTC (rev 3502)
+++ branches/as7/admin/src/main/java/org/teiid/adminapi/impl/DataPolicyMetadata.java	2011-09-23 04:11:11 UTC (rev 3503)
@@ -110,6 +110,10 @@
 		this.mappedRoleNames.add(name);
 	}  	
 	
+	public void removeMappedRoleName(String name) {
+		this.mappedRoleNames.remove(name);
+	}  		
+	
 	public boolean allows(String resourceName, DataPolicy.PermissionType type) {
 		resourceName = resourceName.toLowerCase();
 		while (resourceName.length() > 0) {

Modified: branches/as7/admin/src/main/java/org/teiid/adminapi/impl/MetadataMapper.java
===================================================================
--- branches/as7/admin/src/main/java/org/teiid/adminapi/impl/MetadataMapper.java	2011-09-21 04:13:59 UTC (rev 3502)
+++ branches/as7/admin/src/main/java/org/teiid/adminapi/impl/MetadataMapper.java	2011-09-23 04:11:11 UTC (rev 3503)
@@ -21,1051 +21,10 @@
  */
 package org.teiid.adminapi.impl;
 
-import java.util.List;
-import java.util.Map;
-
 import org.jboss.dmr.ModelNode;
-import org.jboss.dmr.ModelType;
-import org.teiid.adminapi.AdminPlugin;
-import org.teiid.adminapi.DataPolicy;
-import org.teiid.adminapi.Model;
-import org.teiid.adminapi.Translator;
-import org.teiid.adminapi.Request.ProcessingState;
-import org.teiid.adminapi.Request.ThreadState;
-import org.teiid.adminapi.VDB.ConnectionType;
-import org.teiid.adminapi.VDB.Status;
-import org.teiid.adminapi.impl.DataPolicyMetadata.PermissionMetaData;
-import org.teiid.adminapi.impl.ModelMetaData.ValidationError;
- 
 
-public class MetadataMapper {
-	private static final String VDBNAME = "vdb-name"; //$NON-NLS-1$
-	private static final String CONNECTIONTYPE = "connection-type"; //$NON-NLS-1$
-	private static final String STATUS = "status"; //$NON-NLS-1$
-	private static final String VERSION = "vdb-version"; //$NON-NLS-1$
-	private static final String URL = "url"; //$NON-NLS-1$
-	private static final String MODELS = "models"; //$NON-NLS-1$
-	private static final String OVERRIDE_TRANSLATORS = "override-translators"; //$NON-NLS-1$
-	private static final String DESCRIPTION = "description"; //$NON-NLS-1$
-	private static final String PROPERTIES = "properties"; //$NON-NLS-1$
-	private static final String DYNAMIC = "dynamic"; //$NON-NLS-1$
-	private static final String DATA_POLICIES = "data-policies"; //$NON-NLS-1$
-	
-	
-	public static ModelNode wrap(VDBMetaData vdb, ModelNode node) {
-		if (vdb == null) {
-			return null;
-		}
-		node.get(ModelNodeConstants.TYPE).set(ModelType.OBJECT);
-			
-		node.get(VDBNAME).set(vdb.getName());
-		node.get(CONNECTIONTYPE).set(vdb.getConnectionType().toString());
-		node.get(STATUS).set(vdb.getStatus().toString());
-		node.get(VERSION).set(vdb.getVersion());
-		if (vdb.getUrl() != null) {
-		}
-		if (vdb.getDescription() != null) {
-			node.get(DESCRIPTION).set(vdb.getDescription());
-		}
-		node.get(DYNAMIC).set(vdb.isDynamic());
-		
-		//PROPERTIES
-		List<PropertyMetadata> properties = vdb.getJAXBProperties();
-		if (properties!= null && !properties.isEmpty()) {
-			ModelNode propsNode = node.get(CHILDREN, PROPERTIES); 
-			for (PropertyMetadata prop:properties) {
-				propsNode.add(PropertyMetaDataMapper.wrap(prop, new ModelNode()));
-			}
-		}
-		
-		// MODELS
-		Map<String, ModelMetaData> models = vdb.getModelMetaDatas();
-		if (models != null && !models.isEmpty()) {
-			ModelNode modelNodes = node.get(CHILDREN, MODELS);		
-			for(ModelMetaData model:models.values()) {
-				modelNodes.add(ModelMetadataMapper.wrap(model, new ModelNode()));
-			}
-		}
-		
-		// OVERRIDE_TRANSLATORS
-		List<Translator> translators = vdb.getOverrideTranslators();
-		if (translators != null && !translators.isEmpty()) {
-			ModelNode translatorNodes = node.get(CHILDREN, OVERRIDE_TRANSLATORS);
-			for (Translator translator:translators) {
-				translatorNodes.add(VDBTranslatorMetaDataMapper.wrap((VDBTranslatorMetaData)translator,  new ModelNode()));
-			}
-		}
-		
-		// DATA_POLICIES
-		List<DataPolicy> policies = vdb.getDataPolicies();
-		if (policies != null && !policies.isEmpty()) {
-			ModelNode dataPoliciesNodes = node.get(CHILDREN, DATA_POLICIES);
-			for (DataPolicy policy:policies) {
-				dataPoliciesNodes.add(DataPolicyMetadataMapper.wrap((DataPolicyMetadata)policy,  new ModelNode()));
-			}
-		}
-		return node;
-	}
-
-	public static VDBMetaData unwrap(ModelNode node) {
-		if (node == null)
-			return null;
-			
-		VDBMetaData vdb = new VDBMetaData();
-		if (node.has(VDBNAME)) {
-			vdb.setName(node.get(VDBNAME).asString());
-		}
-		if (node.has(CONNECTIONTYPE)) {
-			vdb.setConnectionType(node.get(CONNECTIONTYPE).asString());
-		}
-		if (node.has(STATUS)) {
-			vdb.setStatus(node.get(STATUS).asString());
-		}
-		if (node.has(VERSION)) {
-			vdb.setVersion(node.get(VERSION).asInt());
-		}
-		if (node.has(URL)) {
-			vdb.setUrl(node.get(URL).asString());
-		}
-		if(node.has(DESCRIPTION)) {
-			vdb.setDescription(node.get(DESCRIPTION).asString());
-		}
-		if (node.has(DYNAMIC)) {
-			vdb.setDynamic(node.get(DYNAMIC).asBoolean());
-		}
-
-		//PROPERTIES
-		if (node.get(CHILDREN, PROPERTIES).isDefined()) {
-			List<ModelNode> propNodes = node.get(CHILDREN, PROPERTIES).asList();
-			for (ModelNode propNode:propNodes) {
-				PropertyMetadata prop = PropertyMetaDataMapper.unwrap(propNode);
-				if (prop != null) {
-					vdb.addProperty(prop.getName(), prop.getValue());
-				}
-			}
-		}
-		
-		// MODELS
-		if (node.get(CHILDREN, MODELS).isDefined()) {
-			List<ModelNode> modelNodes = node.get(CHILDREN, MODELS).asList();
-			for(ModelNode modelNode:modelNodes) {
-				ModelMetaData model = ModelMetadataMapper.unwrap(modelNode);
-				if (model != null) {
-					vdb.addModel(model);	
-				}
-			}
-		}
-		
-		// OVERRIDE_TRANSLATORS
-		if (node.get(CHILDREN, OVERRIDE_TRANSLATORS).isDefined()) {
-			List<ModelNode> translatorNodes = node.get(CHILDREN, OVERRIDE_TRANSLATORS).asList();
-			for (ModelNode translatorNode:translatorNodes) {
-				VDBTranslatorMetaData translator = VDBTranslatorMetaDataMapper.unwrap(translatorNode);
-				if (translator != null) {
-					vdb.addOverideTranslator(translator);
-				}
-			}
-		}
-		
-		// DATA_POLICIES
-		if (node.get(CHILDREN, DATA_POLICIES).isDefined()) {
-			List<ModelNode> policiesNodes = node.get(CHILDREN, DATA_POLICIES).asList();
-			for (ModelNode policyNode:policiesNodes) {
-				DataPolicyMetadata policy = DataPolicyMetadataMapper.unwrap(policyNode);
-				if (policy != null) {
-					vdb.addDataPolicy(policy);	
-				}
-				
-			}
-		}
-		return vdb;
-	}
-	
-	public static ModelNode describe(ModelNode node) {
-		node.get(TYPE).set(ModelType.OBJECT);
-		addAttribute(node, VDBNAME, ModelType.STRING, true); 
-
-		ModelNode connectionsAllowed = new ModelNode();
-		connectionsAllowed.add(ConnectionType.NONE.toString());
-		connectionsAllowed.add(ConnectionType.ANY.toString());
-		connectionsAllowed.add(ConnectionType.BY_VERSION.toString());
-		addAttribute(node, CONNECTIONTYPE, ModelType.STRING, false).get(ALLOWED).set(connectionsAllowed);
-		
-		ModelNode statusAllowed = new ModelNode();
-		statusAllowed.add(Status.ACTIVE.toString());
-		statusAllowed.add(Status.INACTIVE.toString());
-		addAttribute(node, STATUS, ModelType.STRING, true).get(ALLOWED).set(statusAllowed);
-		
-		addAttribute(node, VERSION, ModelType.INT, true);
-		addAttribute(node, URL, ModelType.STRING, false);
-		addAttribute(node, DESCRIPTION, ModelType.STRING, false);
-		addAttribute(node, DYNAMIC, ModelType.BOOLEAN, false);
-		
-		ModelNode props = node.get(CHILDREN, PROPERTIES);
-		props.get(DESCRIPTION).set(AdminPlugin.Util.getString(PROPERTIES+DOT_DESC));
-		PropertyMetaDataMapper.describe(props);
-
-		ModelNode models = node.get(CHILDREN, MODELS);		
-		ModelMetadataMapper.describe(models);
-		models.get(DESCRIPTION).set(AdminPlugin.Util.getString(MODELS+DOT_DESC));
-		models.get(MIN_OCCURS).set(1);
-		
-		ModelNode translators = node.get(CHILDREN, OVERRIDE_TRANSLATORS);
-		translators.get(DESCRIPTION).set(AdminPlugin.Util.getString(OVERRIDE_TRANSLATORS+DOT_DESC));
-		VDBTranslatorMetaDataMapper.describe(translators);
-		
-		ModelNode dataPolicies = node.get(CHILDREN, DATA_POLICIES);
-		dataPolicies.get(DESCRIPTION).set(AdminPlugin.Util.getString(DATA_POLICIES+DOT_DESC));
-		DataPolicyMetadataMapper.describe(dataPolicies);
-		return node;
-	}
-	
-	/**
-	 * model metadata mapper
-	 */
-	public static class ModelMetadataMapper {
-		private static final String MODEL_NAME = "model-name"; //$NON-NLS-1$
-		private static final String DESCRIPTION = "description"; //$NON-NLS-1$
-		private static final String VISIBLE = "visible"; //$NON-NLS-1$
-		private static final String MODEL_TYPE = "model-type"; //$NON-NLS-1$
-		private static final String MODELPATH = "model-path"; //$NON-NLS-1$
-		private static final String PROPERTIES = "properties"; //$NON-NLS-1$
-		private static final String SOURCE_MAPPINGS = "source-mappings"; //$NON-NLS-1$
-		private static final String VALIDITY_ERRORS = "validity-errors"; //$NON-NLS-1$
-		
-		public static ModelNode wrap(ModelMetaData model, ModelNode node) {
-			if (model == null) {
-				return null;
-			}
-			node.get(TYPE).set(ModelType.OBJECT);
-			
-			node.get(MODEL_NAME).set(model.getName());
-			if (model.getDescription() != null) {
-				node.get(DESCRIPTION).set(model.getDescription());
-			}
-			node.get(VISIBLE).set(model.isVisible());
-			node.get(MODEL_TYPE).set(model.getModelType().toString());
-			if (model.getPath() != null) {
-				node.get(MODELPATH).set(model.getPath());
-			}
-
-			List<PropertyMetadata> properties = model.getJAXBProperties();
-			if (properties!= null && !properties.isEmpty()) {
-				ModelNode propsNode = node.get(CHILDREN, PROPERTIES); 
-				for (PropertyMetadata prop:properties) {
-					propsNode.add(PropertyMetaDataMapper.wrap(prop,  new ModelNode()));
-				}
-			}
-			
-			List<SourceMappingMetadata> sources = model.getSourceMappings();
-			if (sources != null && !sources.isEmpty()) {
-				ModelNode sourceMappingNode = node.get(CHILDREN, SOURCE_MAPPINGS);
-				for(SourceMappingMetadata source:sources) {
-					sourceMappingNode.add(SourceMappingMetadataMapper.wrap(source,  new ModelNode()));
-				}
-			}
-			
-			List<ValidationError> errors = model.getErrors();
-			if (errors != null && !errors.isEmpty()) {
-				ModelNode errorsNode = node.get(CHILDREN, VALIDITY_ERRORS);
-				for (ValidationError error:errors) {
-					errorsNode.add(ValidationErrorMapper.wrap(error));
-				}
-			}
-			return node;
-		}
-		
-		public static ModelMetaData unwrap(ModelNode node) {
-			if (node == null) {
-				return null;
-			}
-			
-			ModelMetaData model = new ModelMetaData();
-			if (node.has(MODEL_NAME)) {
-				model.setName(node.get(MODEL_NAME).asString());
-			}
-			if (node.has(DESCRIPTION)) {
-				model.setDescription(node.get(DESCRIPTION).asString());
-			}
-			if (node.has(VISIBLE)) {
-				model.setVisible(node.get(VISIBLE).asBoolean());
-			}
-			if(node.has(MODEL_TYPE)) {
-				model.setModelType(node.get(MODEL_TYPE).asString());
-			}
-			if(node.has(MODELPATH)) {
-				model.setPath(node.get(MODELPATH).asString());
-			}
-
-			if (node.get(CHILDREN, PROPERTIES).isDefined()) {
-				List<ModelNode> propNodes = node.get(CHILDREN, PROPERTIES).asList();
-				for (ModelNode propNode:propNodes) {
-					PropertyMetadata prop = PropertyMetaDataMapper.unwrap(propNode);
-					if (prop != null) {
-						model.addProperty(prop.getName(), prop.getValue());
-					}
-				}
-			}
-		
-			if (node.get(CHILDREN, SOURCE_MAPPINGS).isDefined()) {
-				List<ModelNode> sourceMappingNodes = node.get(CHILDREN, SOURCE_MAPPINGS).asList();
-				for (ModelNode sourceMapping:sourceMappingNodes) {
-					SourceMappingMetadata source = SourceMappingMetadataMapper.unwrap(sourceMapping);
-					if (source != null) {
-						model.addSourceMapping(source);
-					}
-				}
-			}
-			
-			if (node.get(CHILDREN, VALIDITY_ERRORS).isDefined()) {
-				List<ModelNode> errorNodes = node.get(CHILDREN, VALIDITY_ERRORS).asList();
-				for(ModelNode errorNode:errorNodes) {
-					ValidationError error = ValidationErrorMapper.unwrap(errorNode);
-					if (error != null) {
-						model.addError(error);
-					}
-				}
-			}
-			return model;
-		}
-		
-		public static ModelNode describe(ModelNode node) {
-			node.get(TYPE).set(ModelType.OBJECT);
-			
-			ModelNode modelTypes = new ModelNode();
-			modelTypes.add(Model.Type.PHYSICAL.toString());
-			modelTypes.add(Model.Type.VIRTUAL.toString());
-			modelTypes.add(Model.Type.FUNCTION.toString());
-			modelTypes.add(Model.Type.OTHER.toString());
-			addAttribute(node, MODEL_NAME, ModelType.STRING, true).get(ALLOWED).set(modelTypes);
-			
-			addAttribute(node, DESCRIPTION, ModelType.STRING, false);
-			addAttribute(node, VISIBLE, ModelType.BOOLEAN, false);
-			addAttribute(node, MODEL_TYPE, ModelType.STRING, true);
-			addAttribute(node, MODELPATH, ModelType.STRING, false);
-			
-			ModelNode props = node.get(CHILDREN, PROPERTIES);
-			props.get(DESCRIPTION).set(AdminPlugin.Util.getString(PROPERTIES+DOT_DESC));
-			PropertyMetaDataMapper.describe(props);
-
-			ModelNode source = node.get(CHILDREN, SOURCE_MAPPINGS);
-			source.get(DESCRIPTION).set(AdminPlugin.Util.getString(SOURCE_MAPPINGS+DOT_DESC));
-			SourceMappingMetadataMapper.describe(source);
-
-			ModelNode errors = node.get(CHILDREN, VALIDITY_ERRORS);
-			errors.get(DESCRIPTION).set(AdminPlugin.Util.getString(VALIDITY_ERRORS+DOT_DESC));
-			ValidationErrorMapper.describe(errors);
-			
-			return node; 
-		}
-	}	
-	
-	/**
-	 * validation error mapper
-	 */
-	public static class ValidationErrorMapper {
-		private static final String ERROR_PATH = "error-path"; //$NON-NLS-1$
-		private static final String SEVERITY = "severity"; //$NON-NLS-1$
-		private static final String MESSAGE = "message"; //$NON-NLS-1$
-		
-		public static ModelNode wrap(ValidationError error) {
-			if (error == null) {
-				return null;
-			}
-			
-			ModelNode node = new ModelNode();
-			node.get(TYPE).set(ModelType.OBJECT);
-			if (error.getPath() != null) {
-				node.get(ERROR_PATH).set(error.getPath());
-			}
-			node.get(SEVERITY).set(error.getSeverity());
-			node.get(MESSAGE).set(error.getValue());
-			
-			return node;
-		}
-		
-		public static ValidationError unwrap(ModelNode node) {
-			if (node == null) {
-				return null;
-			}
-			
-			ValidationError error = new ValidationError();
-			if (node.has(ERROR_PATH)) {
-				error.setPath(node.get(ERROR_PATH).asString());
-			}
-			if (node.has(SEVERITY)) {
-				error.setSeverity(node.get(SEVERITY).asString());
-			}
-			if(node.has(MESSAGE)) {
-				error.setValue(node.get(MESSAGE).asString());
-			}
-			return error;
-		}
-		
-		public static ModelNode describe(ModelNode node) {
-			node.get(TYPE).set(ModelType.OBJECT);
-			addAttribute(node, ERROR_PATH, ModelType.STRING, false); 
-			addAttribute(node, SEVERITY, ModelType.STRING, true);
-			addAttribute(node, MESSAGE, ModelType.STRING, true);
-			return node; 
-		}			
-	}		
-	
-	/**
-	 * Source Mapping Metadata mapper
-	 */
-	public static class SourceMappingMetadataMapper {
-		private static final String SOURCE_NAME = "source-name"; //$NON-NLS-1$
-		private static final String JNDI_NAME = "jndi-name"; //$NON-NLS-1$
-		private static final String TRANSLATOR_NAME = "translator-name"; //$NON-NLS-1$
-		
-		public static ModelNode wrap(SourceMappingMetadata source, ModelNode node) {
-			if (source == null) {
-				return null;
-			}
-			
-			node.get(TYPE).set(ModelType.OBJECT);
-			
-			node.get(SOURCE_NAME).set(source.getName());
-			node.get(JNDI_NAME).set(source.getConnectionJndiName());
-			node.get(TRANSLATOR_NAME).set(source.getTranslatorName());
-			return node;
-		}
-		
-		public static SourceMappingMetadata unwrap(ModelNode node) {
-			if (node == null) {
-				return null;
-			}
-			SourceMappingMetadata source = new SourceMappingMetadata();
-			if (node.has(SOURCE_NAME)) {
-				source.setName(node.get(SOURCE_NAME).asString());
-			}
-			if (node.has(JNDI_NAME)) {
-				source.setConnectionJndiName(node.get(JNDI_NAME).asString());
-			}
-			if (node.has(TRANSLATOR_NAME)) {
-				source.setTranslatorName(node.get(TRANSLATOR_NAME).asString());
-			}
-			return source;
-		}
-		
-		public static ModelNode describe(ModelNode node) {
-			node.get(TYPE).set(ModelType.OBJECT);
-			addAttribute(node, SOURCE_NAME, ModelType.STRING, true); 
-			addAttribute(node, JNDI_NAME, ModelType.STRING, true);
-			addAttribute(node, TRANSLATOR_NAME, ModelType.STRING, true);
-			return node; 
-		}		
-	}		
-	
-	/**
-	 * Source Mapping Metadata mapper
-	 */
-	public static class VDBTranslatorMetaDataMapper {
-		private static final String TRANSLATOR_NAME = "translator-name"; //$NON-NLS-1$
-		private static final String BASETYPE = "base-type"; //$NON-NLS-1$
-		private static final String DESCRIPTION = "description"; //$NON-NLS-1$
-		private static final String PROPERTIES = "properties"; //$NON-NLS-1$
-		private static final String MODULE_NAME = "module-name"; //$NON-NLS-1$
-		
-		public static ModelNode wrap(VDBTranslatorMetaData translator, ModelNode node) {
-			if (translator == null) {
-				return null;
-			}
-			node.get(TYPE).set(ModelType.OBJECT);
-			
-			node.get(TRANSLATOR_NAME).set(translator.getName());
-			if (translator.getType() != null) {
-				node.get(BASETYPE).set(translator.getType());
-			}
-			if (translator.getDescription() != null) {
-				node.get(DESCRIPTION).set(translator.getDescription());
-			}
-			
-			if (translator.getModuleName() != null) {
-				node.get(MODULE_NAME).set(translator.getModuleName());
-			}
-
-			List<PropertyMetadata> properties = translator.getJAXBProperties();
-			if (properties!= null && !properties.isEmpty()) {
-				ModelNode propsNode = node.get(CHILDREN, PROPERTIES); 
-				for (PropertyMetadata prop:properties) {
-					propsNode.add(PropertyMetaDataMapper.wrap(prop, new ModelNode()));
-				}
-			}
-			return node;
-		}
-		
-		public static VDBTranslatorMetaData unwrap(ModelNode node) {
-			if (node == null) {
-				return null;
-			}
-			VDBTranslatorMetaData translator = new VDBTranslatorMetaData();
-			if (node.has(TRANSLATOR_NAME)) {
-				translator.setName(node.get(TRANSLATOR_NAME).asString());
-			}
-			if (node.has(BASETYPE)) {
-				translator.setType(node.get(BASETYPE).asString());
-			}
-			if (node.has(DESCRIPTION)) {
-				translator.setDescription(node.get(DESCRIPTION).asString());
-			}
-			if (node.has(MODULE_NAME)) {
-				translator.setModuleName(node.get(MODULE_NAME).asString());
-			}
-			
-			if (node.get(CHILDREN,PROPERTIES).isDefined()) {
-				List<ModelNode> propNodes = node.get(CHILDREN, PROPERTIES).asList();
-				for (ModelNode propNode:propNodes) {
-					PropertyMetadata prop = PropertyMetaDataMapper.unwrap(propNode);
-					if (prop != null) {
-						translator.addProperty(prop.getName(), prop.getValue());
-					}
-				}
-			}
-			return translator;
-		}
-		
-		public static ModelNode describe(ModelNode node) {
-			node.get(TYPE).set(ModelType.OBJECT);
-			addAttribute(node, TRANSLATOR_NAME, ModelType.STRING, true); 
-			addAttribute(node, BASETYPE, ModelType.STRING, true);
-			addAttribute(node, DESCRIPTION, ModelType.STRING, false);
-			addAttribute(node, MODULE_NAME, ModelType.STRING, false);
-			
-			ModelNode props = node.get(CHILDREN, PROPERTIES);
-			props.get(DESCRIPTION).set(AdminPlugin.Util.getString(PROPERTIES+DOT_DESC));
-			PropertyMetaDataMapper.describe(props);
-			return node; 
-		}		
-	}	
-	
-	/**
-	 * Property Metadata mapper
-	 */
-	public static class PropertyMetaDataMapper {
-		private static final String PROPERTY_NAME = "property-name"; //$NON-NLS-1$
-		private static final String PROPERTY_VALUE = "property-value"; //$NON-NLS-1$
-		
-		public static ModelNode wrap(PropertyMetadata property, ModelNode node) {
-			if (property == null) {
-				return null;
-			}			
-			node.get(ModelNodeConstants.TYPE).set(ModelType.OBJECT);
-			
-			node.get(PROPERTY_NAME).set(property.getName());
-			node.get(PROPERTY_VALUE).set(property.getValue());
-			
-			return node;
-		}
-		
-		public static PropertyMetadata unwrap(ModelNode node) {
-			if(node == null) {
-				return null;
-			}
-			PropertyMetadata property = new PropertyMetadata();
-			if (node.has(PROPERTY_NAME)) {
-				property.setName(node.get(PROPERTY_NAME).asString());
-			}
-			if(node.has(PROPERTY_VALUE)) {
-				property.setValue(node.get(PROPERTY_VALUE).asString());
-			}
-			return property;
-		}
-		
-		public static ModelNode describe(ModelNode node) {
-			node.get(TYPE).set(ModelType.OBJECT);
-			addAttribute(node, PROPERTY_NAME, ModelType.STRING, true);
-			addAttribute(node, PROPERTY_VALUE, ModelType.STRING, true);
-			return node; 
-		}
-	}		
-	
-	/**
-	 * DataPolicy Metadata mapper
-	 */
-	public static class DataPolicyMetadataMapper {
-		private static final String POLICY_NAME = "policy-name"; //$NON-NLS-1$
-		private static final String DATA_PERMISSIONS = "data-permissions"; //$NON-NLS-1$
-		private static final String MAPPED_ROLE_NAMES = "mapped-role-names"; //$NON-NLS-1$
-		private static final String ALLOW_CREATE_TEMP_TABLES = "allow-create-temp-tables"; //$NON-NLS-1$
-		private static final String ANY_AUTHENTICATED = "any-authenticated"; //$NON-NLS-1$
-		
-		public static ModelNode wrap(DataPolicyMetadata policy, ModelNode node) {
-			if (policy == null) {
-				return null;
-			}			
-			node.get(ModelNodeConstants.TYPE).set(ModelType.OBJECT);
-			
-			node.get(POLICY_NAME).set(policy.getName());
-			if (policy.getDescription() != null) {
-				node.get(DESCRIPTION).set(policy.getDescription());
-			}
-			if (policy.isAllowCreateTemporaryTables() != null) {
-				node.get(ALLOW_CREATE_TEMP_TABLES).set(policy.isAllowCreateTemporaryTables());
-			}
-			node.get(ANY_AUTHENTICATED).set(policy.isAnyAuthenticated());
-			
-			//DATA_PERMISSIONS
-			List<DataPolicy.DataPermission> permissions = policy.getPermissions();
-			if (permissions != null && !permissions.isEmpty()) {
-				ModelNode permissionNodes = node.get(CHILDREN, DATA_PERMISSIONS); 
-				for (DataPolicy.DataPermission dataPermission:permissions) {
-					permissionNodes.add(PermissionMetaDataMapper.wrap((PermissionMetaData)dataPermission,  new ModelNode()));
-				}			
-			}
-			
-			//MAPPED_ROLE_NAMES
-			if (policy.getMappedRoleNames() != null && !policy.getMappedRoleNames().isEmpty()) {
-				ModelNode mappedRoleNodes = node.get(CHILDREN, MAPPED_ROLE_NAMES);
-				for (String role:policy.getMappedRoleNames()) {
-					mappedRoleNodes.add(role);
-				}
-			}
-			return node;
-		}
-		
-		public static DataPolicyMetadata unwrap(ModelNode node) {
-			if(node == null) {
-				return null;
-			}
-			DataPolicyMetadata policy = new DataPolicyMetadata();
-			if (node.has(POLICY_NAME)) {
-				policy.setName(node.get(POLICY_NAME).asString());
-			}
-			if (node.has(DESCRIPTION)) {
-				policy.setDescription(node.get(DESCRIPTION).asString());
-			}
-			if (node.has(ALLOW_CREATE_TEMP_TABLES)) {
-				policy.setAllowCreateTemporaryTables(node.get(ALLOW_CREATE_TEMP_TABLES).asBoolean());
-			}
-			if (node.has(ANY_AUTHENTICATED)) {
-				policy.setAnyAuthenticated(node.get(ANY_AUTHENTICATED).asBoolean());
-			}
-			
-			//DATA_PERMISSIONS
-			if (node.get(CHILDREN, DATA_PERMISSIONS).isDefined()) {
-				List<ModelNode> permissionNodes = node.get(CHILDREN, DATA_PERMISSIONS).asList();
-				for (ModelNode permissionNode:permissionNodes) {
-					PermissionMetaData permission = PermissionMetaDataMapper.unwrap(permissionNode);
-					if (permission != null) {
-						policy.addPermission(permission);
-					}
-				}
-			}
-
-			//MAPPED_ROLE_NAMES
-			if (node.get(CHILDREN, MAPPED_ROLE_NAMES).isDefined()) {
-				List<ModelNode> roleNameNodes = node.get(CHILDREN, MAPPED_ROLE_NAMES).asList();
-				for (ModelNode roleNameNode:roleNameNodes) {
-					policy.addMappedRoleName(roleNameNode.asString());
-				}			
-			}
-			return policy;
-		}
-		
-		public static ModelNode describe(ModelNode node) {
-			node.get(TYPE).set(ModelType.OBJECT);
-			addAttribute(node, POLICY_NAME, ModelType.STRING, true);
-			addAttribute(node, DESCRIPTION, ModelType.STRING, false);
-			addAttribute(node, ALLOW_CREATE_TEMP_TABLES, ModelType.BOOLEAN, false);
-			addAttribute(node, ANY_AUTHENTICATED, ModelType.BOOLEAN, false);
-			
-			ModelNode permissions = node.get(CHILDREN, DATA_PERMISSIONS);
-			PropertyMetaDataMapper.describe(permissions);
-			permissions.get(DESCRIPTION).set(AdminPlugin.Util.getString(DATA_PERMISSIONS+DOT_DESC));
-			permissions.get(MIN_OCCURS).set(1);
-			
-			ModelNode roleNames = node.get(CHILDREN, MAPPED_ROLE_NAMES);
-			roleNames.get(TYPE).set(ModelType.LIST);
-			roleNames.get(DESCRIPTION).set(AdminPlugin.Util.getString(MAPPED_ROLE_NAMES+DOT_DESC));
-			roleNames.get("value-type").set(ModelType.STRING); //$NON-NLS-1$
-			return node; 
-		}
-	}	
-	
-	public static class PermissionMetaDataMapper{
-		private static final String RESOURCE_NAME = "resource-name"; //$NON-NLS-1$
-		private static final String ALLOW_CREATE = "allow-create"; //$NON-NLS-1$
-		private static final String ALLOW_DELETE = "allow-delete"; //$NON-NLS-1$
-		private static final String ALLOW_UPADTE = "allow-update"; //$NON-NLS-1$
-		private static final String ALLOW_READ = "allow-read"; //$NON-NLS-1$
-		private static final String ALLOW_EXECUTE = "allow-execute"; //$NON-NLS-1$
-		private static final String ALLOW_ALTER = "allow-alter"; //$NON-NLS-1$
-		
-		
-		
-		public static ModelNode wrap(PermissionMetaData permission, ModelNode node) {
-			if (permission == null) {
-				return null;
-			}
-			
-			node.get(ModelNodeConstants.TYPE).set(ModelType.OBJECT);
-			
-			node.get(RESOURCE_NAME).set(permission.getResourceName());
-			if (permission.getAllowCreate() != null) {
-				node.get(ALLOW_CREATE).set(permission.getAllowCreate().booleanValue());
-			}
-			if (permission.getAllowDelete() != null) {
-				node.get(ALLOW_DELETE).set(permission.getAllowDelete().booleanValue());
-			}
-			if (permission.getAllowUpdate() != null) {
-				node.get(ALLOW_UPADTE).set(permission.getAllowUpdate().booleanValue());
-			}
-			if (permission.getAllowRead() != null) {
-				node.get(ALLOW_READ).set(permission.getAllowRead().booleanValue());
-			}
-			if (permission.getAllowExecute() != null) {
-				node.get(ALLOW_EXECUTE).set(permission.getAllowExecute().booleanValue());
-			}
-			if(permission.getAllowAlter() != null) {
-				node.get(ALLOW_ALTER).set(permission.getAllowAlter().booleanValue());
-			}
-			return node;
-		}
-		
-		public static PermissionMetaData unwrap(ModelNode node) {
-			if (node == null) {
-				return null;
-			}
-			
-			PermissionMetaData permission = new PermissionMetaData();
-			if (node.get(RESOURCE_NAME) != null) {
-				permission.setResourceName(node.get(RESOURCE_NAME).asString());
-			}
-			if (node.has(ALLOW_CREATE)) {
-				permission.setAllowCreate(node.get(ALLOW_CREATE).asBoolean());
-			}
-			if (node.has(ALLOW_DELETE)) {
-				permission.setAllowDelete(node.get(ALLOW_DELETE).asBoolean());
-			}
-			if (node.has(ALLOW_UPADTE)) {
-				permission.setAllowUpdate(node.get(ALLOW_UPADTE).asBoolean());
-			}
-			if (node.has(ALLOW_READ)) {
-				permission.setAllowRead(node.get(ALLOW_READ).asBoolean());
-			}
-			if (node.has(ALLOW_EXECUTE)) {
-				permission.setAllowExecute(node.get(ALLOW_EXECUTE).asBoolean());
-			}
-			if (node.has(ALLOW_ALTER)) {
-				permission.setAllowAlter(node.get(ALLOW_ALTER).asBoolean());
-			}
-			return permission;
-		}
-		public static ModelNode describe(ModelNode node) {
-			addAttribute(node, RESOURCE_NAME, ModelType.STRING, true);
-			addAttribute(node, ALLOW_CREATE, ModelType.BOOLEAN, false);
-			addAttribute(node, ALLOW_DELETE, ModelType.BOOLEAN, false);
-			addAttribute(node, ALLOW_UPADTE, ModelType.BOOLEAN, false);
-			addAttribute(node, ALLOW_READ, ModelType.BOOLEAN, false);
-			addAttribute(node, ALLOW_EXECUTE, ModelType.BOOLEAN, false);
-			addAttribute(node, ALLOW_ALTER, ModelType.BOOLEAN, false);
-			return node;
-		}
-	}
-	
-	public static class CacheStatisticsMetadataMapper {
-		private static final String HITRATIO = "hit-ratio"; //$NON-NLS-1$
-		private static final String TOTAL_ENTRIES = "total-entries"; //$NON-NLS-1$
-		private static final String REQUEST_COUNT = "request-count"; //$NON-NLS-1$
-		
-		public static ModelNode wrap(CacheStatisticsMetadata object, ModelNode node) {
-			if (object == null)
-				return null;
-			
-			node.get(ModelNodeConstants.TYPE).set(ModelType.OBJECT);
-			
-			node.get(TOTAL_ENTRIES).set(object.getTotalEntries());
-			node.get(HITRATIO).set(object.getHitRatio());
-			node.get(REQUEST_COUNT).set(object.getRequestCount());
-			
-			return node;
-		}
-
-		public static CacheStatisticsMetadata unwrap(ModelNode node) {
-			if (node == null)
-				return null;
-				
-			CacheStatisticsMetadata cache = new CacheStatisticsMetadata();
-			cache.setTotalEntries(node.get(TOTAL_ENTRIES).asInt());
-			cache.setHitRatio(node.get(HITRATIO).asDouble());
-			cache.setRequestCount(node.get(REQUEST_COUNT).asInt());
-			return cache;
-		}
-		
-		public static ModelNode describe(ModelNode node) {
-			node.get(TYPE).set(ModelType.OBJECT);
-			addAttribute(node, TOTAL_ENTRIES, ModelType.STRING, true);
-			addAttribute(node, HITRATIO, ModelType.STRING, true);
-			addAttribute(node, REQUEST_COUNT, ModelType.STRING, true);
-			return node; 		
-		}
-	}	
-	
-	public static class RequestMetadataMapper {
-		private static final String TRANSACTION_ID = "transaction-id"; //$NON-NLS-1$
-		private static final String NODE_ID = "node-id"; //$NON-NLS-1$
-		private static final String SOURCE_REQUEST = "source-request"; //$NON-NLS-1$
-		private static final String COMMAND = "command"; //$NON-NLS-1$
-		private static final String START_TIME = "start-time"; //$NON-NLS-1$
-		private static final String SESSION_ID = "session-id"; //$NON-NLS-1$
-		private static final String EXECUTION_ID = "execution-id"; //$NON-NLS-1$
-		private static final String STATE = "processing-state"; //$NON-NLS-1$
-		private static final String THREAD_STATE = "thread-state"; //$NON-NLS-1$
-		
-		
-		public static ModelNode wrap(RequestMetadata request, ModelNode node) {
-			if (request == null) {
-				return null;
-			}
-			node.get(ModelNodeConstants.TYPE).set(ModelType.OBJECT);
-			
-			node.get(EXECUTION_ID).set(request.getExecutionId());
-			node.get(SESSION_ID).set(request.getSessionId());
-			node.get(START_TIME).set(request.getStartTime());
-			node.get(COMMAND).set(request.getCommand());
-			node.get(SOURCE_REQUEST).set(request.sourceRequest());
-			if (request.getNodeId() != null) {
-				node.get(NODE_ID).set(request.getNodeId());
-			}
-			if (request.getTransactionId() != null) {
-				node.get(TRANSACTION_ID).set(request.getTransactionId());
-			}
-			node.get(STATE).set(request.getState().name());
-			node.get(THREAD_STATE).set(request.getThreadState().name());
-			return node;
-		}
-
-		public static RequestMetadata unwrap(ModelNode node) {
-			if (node == null)
-				return null;
-
-			RequestMetadata request = new RequestMetadata();
-			request.setExecutionId(node.get(EXECUTION_ID).asLong());
-			request.setSessionId(node.get(SESSION_ID).asString());
-			request.setStartTime(node.get(START_TIME).asLong());
-			request.setCommand(node.get(COMMAND).asString());
-			request.setSourceRequest(node.get(SOURCE_REQUEST).asBoolean());
-			if (node.has(NODE_ID)) {
-				request.setNodeId(node.get(NODE_ID).asInt());
-			}
-			if (node.has(TRANSACTION_ID)) {
-				request.setTransactionId(node.get(TRANSACTION_ID).asString());
-			}
-			request.setState(ProcessingState.valueOf(node.get(STATE).asString()));
-			request.setThreadState(ThreadState.valueOf(node.get(THREAD_STATE).asString()));
-			return request;
-		}
-		
-		public static ModelNode describe(ModelNode node) {
-			node.get(TYPE).set(ModelType.OBJECT);
-			addAttribute(node, EXECUTION_ID, ModelType.LONG, true);
-			addAttribute(node, SESSION_ID, ModelType.STRING, true);
-			addAttribute(node, START_TIME, ModelType.LONG, true);
-			addAttribute(node, COMMAND, ModelType.STRING, true);
-			addAttribute(node, SOURCE_REQUEST, ModelType.BOOLEAN, true);
-			addAttribute(node, NODE_ID, ModelType.INT, false);
-			addAttribute(node, TRANSACTION_ID, ModelType.STRING, false);
-			addAttribute(node, STATE, ModelType.STRING, true);
-			addAttribute(node, THREAD_STATE, ModelType.STRING, true);
-			return node; 		
-		}
-	}
-	
-	public static class SessionMetadataMapper {
-		private static final String SECURITY_DOMAIN = "security-domain"; //$NON-NLS-1$
-		private static final String VDB_VERSION = "vdb-version"; //$NON-NLS-1$
-		private static final String VDB_NAME = "vdb-name"; //$NON-NLS-1$
-		private static final String USER_NAME = "user-name"; //$NON-NLS-1$
-		private static final String SESSION_ID = "session-id"; //$NON-NLS-1$
-		private static final String LAST_PING_TIME = "last-ping-time"; //$NON-NLS-1$
-		private static final String IP_ADDRESS = "ip-address"; //$NON-NLS-1$
-		private static final String CLIENT_HOST_NAME = "client-host-address"; //$NON-NLS-1$
-		private static final String CREATED_TIME = "created-time"; //$NON-NLS-1$
-		private static final String APPLICATION_NAME = "application-name"; //$NON-NLS-1$
-		private static final String CLIENT_HARDWARE_ADRESS = "client-hardware-address"; //$NON-NLS-1$
-		
-		
-		public static ModelNode wrap(SessionMetadata session, ModelNode node) {
-			if (session == null) {
-				return null;
-			}
-			node.get(ModelNodeConstants.TYPE).set(ModelType.OBJECT);
-				
-			if (session.getApplicationName() != null) {
-				node.get(APPLICATION_NAME).set(session.getApplicationName());
-			}
-			node.get(CREATED_TIME).set(session.getCreatedTime());
-			node.get(CLIENT_HOST_NAME).set(session.getClientHostName());
-			node.get(IP_ADDRESS).set(session.getIPAddress());
-			node.get(LAST_PING_TIME).set(session.getLastPingTime());
-			node.get(SESSION_ID).set(session.getSessionId());
-			node.get(USER_NAME).set(session.getUserName());
-			node.get(VDB_NAME).set(session.getVDBName());
-			node.get(VDB_VERSION).set(session.getVDBVersion());
-			if (session.getSecurityDomain() != null){
-				node.get(SECURITY_DOMAIN).set(session.getSecurityDomain());
-			}
-			if (session.getClientHardwareAddress() != null) {
-				node.get(CLIENT_HARDWARE_ADRESS).set(session.getClientHardwareAddress());
-			}
-			return node;
-		}
-
-		public static SessionMetadata unwrap(ModelNode node) {
-			if (node == null)
-				return null;
-				
-			SessionMetadata session = new SessionMetadata();
-			if (node.has(APPLICATION_NAME)) {
-				session.setApplicationName(node.get(APPLICATION_NAME).asString());
-			}
-			session.setCreatedTime(node.get(CREATED_TIME).asLong());
-			session.setClientHostName(node.get(CLIENT_HOST_NAME).asString());
-			session.setIPAddress(node.get(IP_ADDRESS).asString());
-			session.setLastPingTime(node.get(LAST_PING_TIME).asLong());
-			session.setSessionId(node.get(SESSION_ID).asString());
-			session.setUserName(node.get(USER_NAME).asString());
-			session.setVDBName(node.get(VDB_NAME).asString());
-			session.setVDBVersion(node.get(VDB_VERSION).asInt());
-			if (node.has(SECURITY_DOMAIN)) {
-				session.setSecurityDomain(node.get(SECURITY_DOMAIN).asString());
-			}
-			if (node.has(CLIENT_HARDWARE_ADRESS)) {
-				session.setClientHardwareAddress(node.get(CLIENT_HARDWARE_ADRESS).asString());
-			}
-			return session;
-		}
-		
-		public static ModelNode describe(ModelNode node) {
-			node.get(TYPE).set(ModelType.OBJECT);
-			addAttribute(node, APPLICATION_NAME, ModelType.STRING, false);
-			addAttribute(node, CREATED_TIME, ModelType.LONG, true);
-			addAttribute(node, CLIENT_HOST_NAME, ModelType.LONG, true);
-			addAttribute(node, IP_ADDRESS, ModelType.STRING, true);
-			addAttribute(node, LAST_PING_TIME, ModelType.LONG, true);
-			addAttribute(node, SESSION_ID, ModelType.STRING, true);
-			addAttribute(node, USER_NAME, ModelType.STRING, true);
-			addAttribute(node, VDB_NAME, ModelType.STRING, true);
-			addAttribute(node, VDB_VERSION, ModelType.INT, true);
-			addAttribute(node, SECURITY_DOMAIN, ModelType.STRING, false);
-			return node;
-		}
-	}	
-	
-	public static class TransactionMetadataMapper {
-		private static final String ID = "txn-id"; //$NON-NLS-1$
-		private static final String SCOPE = "txn-scope"; //$NON-NLS-1$
-		private static final String CREATED_TIME = "txn-created-time"; //$NON-NLS-1$
-		private static final String ASSOCIATED_SESSION = "session-id"; //$NON-NLS-1$
-		
-		public static ModelNode wrap(TransactionMetadata object, ModelNode transaction) {
-			if (object == null)
-				return null;
-			
-			transaction.get(ModelNodeConstants.TYPE).set(ModelType.OBJECT);
-			transaction.get(ASSOCIATED_SESSION).set(object.getAssociatedSession());
-			transaction.get(CREATED_TIME).set(object.getCreatedTime());
-			transaction.get(SCOPE).set(object.getScope());
-			transaction.get(ID).set(object.getId());
-			
-			return transaction;
-		}
-
-		public static TransactionMetadata unwrap(ModelNode node) {
-			if (node == null)
-				return null;
-
-			TransactionMetadata transaction = new TransactionMetadata();
-			transaction.setAssociatedSession(node.get(ASSOCIATED_SESSION).asString());
-			transaction.setCreatedTime(node.get(CREATED_TIME).asLong());
-			transaction.setScope(node.get(SCOPE).asString());
-			transaction.setId(node.get(ID).asString());
-			return transaction;
-		}
-		
-		public static ModelNode describe(ModelNode node) {
-			node.get(TYPE).set(ModelType.OBJECT);
-			addAttribute(node, ASSOCIATED_SESSION, ModelType.STRING, true);
-			addAttribute(node, CREATED_TIME, ModelType.LONG, true);
-			addAttribute(node, SCOPE, ModelType.LONG, true);
-			addAttribute(node, ID, ModelType.STRING, true);
-			return node;
-		}
-	}	
-
-	public static class WorkerPoolStatisticsMetadataMapper {
-		private static final String MAX_THREADS = "max-threads"; //$NON-NLS-1$
-		private static final String HIGHEST_QUEUED = "highest-queued"; //$NON-NLS-1$
-		private static final String QUEUED = "queued"; //$NON-NLS-1$
-		private static final String QUEUE_NAME = "queue-name"; //$NON-NLS-1$
-		private static final String TOTAL_SUBMITTED = "total-submitted"; //$NON-NLS-1$
-		private static final String TOTAL_COMPLETED = "total-completed"; //$NON-NLS-1$
-		private static final String HIGHEST_ACTIVE_THREADS = "highest-active-threads"; //$NON-NLS-1$
-		private static final String ACTIVE_THREADS = "active-threads"; //$NON-NLS-1$
-		
-		
-		public static ModelNode wrap(WorkerPoolStatisticsMetadata stats, ModelNode node) {
-			if (stats == null)
-				return null;
-			node.get(ModelNodeConstants.TYPE).set(ModelType.OBJECT);
-			
-			node.get(ACTIVE_THREADS).set(stats.getActiveThreads());
-			node.get(HIGHEST_ACTIVE_THREADS).set(stats.getHighestActiveThreads());
-			node.get(TOTAL_COMPLETED).set(stats.getTotalCompleted());
-			node.get(TOTAL_SUBMITTED).set(stats.getTotalSubmitted());
-			node.get(QUEUE_NAME).set(stats.getQueueName());
-			node.get(QUEUED).set(stats.getQueued());
-			node.get(HIGHEST_QUEUED).set(stats.getHighestQueued());
-			node.get(MAX_THREADS).set(stats.getMaxThreads());
-			
-			return node;
-		}
-
-		public static WorkerPoolStatisticsMetadata unwrapMetaValue(ModelNode node) {
-			if (node == null)
-				return null;
-
-			WorkerPoolStatisticsMetadata stats = new WorkerPoolStatisticsMetadata();
-			stats.setActiveThreads(node.get(ACTIVE_THREADS).asInt());
-			stats.setHighestActiveThreads(node.get(HIGHEST_ACTIVE_THREADS).asInt());
-			stats.setTotalCompleted(node.get(TOTAL_COMPLETED).asLong());
-			stats.setTotalSubmitted(node.get(TOTAL_SUBMITTED).asLong());
-			stats.setQueueName(node.get(QUEUE_NAME).asString());
-			stats.setQueued(node.get(QUEUED).asInt());
-			stats.setHighestQueued(node.get(HIGHEST_QUEUED).asInt());
-			stats.setMaxThreads(node.get(MAX_THREADS).asInt());			
-			return stats;
-		}
-		
-		public static ModelNode describe(ModelNode node) {
-			node.get(TYPE).set(ModelType.OBJECT);
-			addAttribute(node, ACTIVE_THREADS, ModelType.INT, true);
-			addAttribute(node, HIGHEST_ACTIVE_THREADS, ModelType.INT, true);
-			addAttribute(node, TOTAL_COMPLETED, ModelType.LONG, true);
-			addAttribute(node, TOTAL_SUBMITTED, ModelType.LONG, true);
-			addAttribute(node, QUEUE_NAME, ModelType.STRING, true);
-			addAttribute(node, QUEUED, ModelType.INT, true);
-			addAttribute(node, HIGHEST_QUEUED, ModelType.INT, true);
-			addAttribute(node, MAX_THREADS, ModelType.INT, true);
-			return node;
-		}
-	}	
-	
-	private static final String CHILDREN = "children"; //$NON-NLS-1$
-	private static final String ATTRIBUTES = "attributes"; //$NON-NLS-1$
-	private static final String DOT_DESC = ".describe"; //$NON-NLS-1$
-	private static final String TYPE = "type"; //$NON-NLS-1$
-	private static final String MIN_OCCURS = "min-occurs"; //$NON-NLS-1$
-	private static final String REQUIRED = "required"; //$NON-NLS-1$
-	private static final String ALLOWED = "allowed"; //$NON-NLS-1$
-	static ModelNode addAttribute(ModelNode node, String name, ModelType dataType, boolean required) {
-		node.get(ATTRIBUTES, name, TYPE).set(dataType);
-        node.get(ATTRIBUTES, name, DESCRIPTION).set(AdminPlugin.Util.getString(name+DOT_DESC));
-        node.get(ATTRIBUTES, name, REQUIRED).set(required);
-        return node;
-    }
+public interface MetadataMapper<T> {
+	ModelNode wrap(T obj, ModelNode node);
+	T unwrap(ModelNode node);
+	ModelNode describe(ModelNode node);
 }
-
-

Modified: branches/as7/admin/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java
===================================================================
--- branches/as7/admin/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java	2011-09-21 04:13:59 UTC (rev 3502)
+++ branches/as7/admin/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java	2011-09-23 04:11:11 UTC (rev 3503)
@@ -153,6 +153,10 @@
 	public List<SourceMappingMetadata> getSourceMappings(){
 		return new ArrayList<SourceMappingMetadata>(this.sources.getMap().values());
 	}
+	
+	public SourceMappingMetadata getSourceMapping(String sourceName){
+		return this.sources.getMap().get(sourceName);
+	}	
     
 	public void setSourceMappings(List<SourceMappingMetadata> sources){
 		for (SourceMappingMetadata source: sources) {

Copied: branches/as7/admin/src/main/java/org/teiid/adminapi/impl/VDBMetadataMapper.java (from rev 3450, branches/as7/admin/src/main/java/org/teiid/adminapi/impl/MetadataMapper.java)
===================================================================
--- branches/as7/admin/src/main/java/org/teiid/adminapi/impl/VDBMetadataMapper.java	                        (rev 0)
+++ branches/as7/admin/src/main/java/org/teiid/adminapi/impl/VDBMetadataMapper.java	2011-09-23 04:11:11 UTC (rev 3503)
@@ -0,0 +1,1114 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.adminapi.impl;
+
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.dmr.ModelNode;
+import org.jboss.dmr.ModelType;
+import org.teiid.adminapi.AdminPlugin;
+import org.teiid.adminapi.DataPolicy;
+import org.teiid.adminapi.Model;
+import org.teiid.adminapi.Translator;
+import org.teiid.adminapi.Request.ProcessingState;
+import org.teiid.adminapi.Request.ThreadState;
+import org.teiid.adminapi.VDB.ConnectionType;
+import org.teiid.adminapi.VDB.Status;
+import org.teiid.adminapi.impl.DataPolicyMetadata.PermissionMetaData;
+import org.teiid.adminapi.impl.ModelMetaData.ValidationError;
+ 
+public class VDBMetadataMapper implements MetadataMapper<VDBMetaData> {
+	private static final String VDBNAME = "vdb-name"; //$NON-NLS-1$
+	private static final String CONNECTIONTYPE = "connection-type"; //$NON-NLS-1$
+	private static final String STATUS = "status"; //$NON-NLS-1$
+	private static final String VERSION = "vdb-version"; //$NON-NLS-1$
+	private static final String URL = "url"; //$NON-NLS-1$
+	private static final String MODELS = "models"; //$NON-NLS-1$
+	private static final String OVERRIDE_TRANSLATORS = "override-translators"; //$NON-NLS-1$
+	private static final String DESCRIPTION = "description"; //$NON-NLS-1$
+	private static final String PROPERTIES = "properties"; //$NON-NLS-1$
+	private static final String DYNAMIC = "dynamic"; //$NON-NLS-1$
+	private static final String DATA_POLICIES = "data-policies"; //$NON-NLS-1$
+	
+	public static VDBMetadataMapper INSTANCE = new VDBMetadataMapper();
+	
+	public ModelNode wrap(VDBMetaData vdb, ModelNode node) {
+		if (vdb == null) {
+			return null;
+		}
+		node.get(ModelNodeConstants.TYPE).set(ModelType.OBJECT);
+			
+		node.get(VDBNAME).set(vdb.getName());
+		node.get(CONNECTIONTYPE).set(vdb.getConnectionType().toString());
+		node.get(STATUS).set(vdb.getStatus().toString());
+		node.get(VERSION).set(vdb.getVersion());
+		if (vdb.getUrl() != null) {
+		}
+		if (vdb.getDescription() != null) {
+			node.get(DESCRIPTION).set(vdb.getDescription());
+		}
+		node.get(DYNAMIC).set(vdb.isDynamic());
+		
+		//PROPERTIES
+		List<PropertyMetadata> properties = vdb.getJAXBProperties();
+		if (properties!= null && !properties.isEmpty()) {
+			ModelNode propsNode = node.get(CHILDREN, PROPERTIES); 
+			for (PropertyMetadata prop:properties) {
+				propsNode.add(PropertyMetaDataMapper.INSTANCE.wrap(prop, new ModelNode()));
+			}
+		}
+		
+		// MODELS
+		Map<String, ModelMetaData> models = vdb.getModelMetaDatas();
+		if (models != null && !models.isEmpty()) {
+			ModelNode modelNodes = node.get(CHILDREN, MODELS);		
+			for(ModelMetaData model:models.values()) {
+				modelNodes.add(ModelMetadataMapper.INSTANCE.wrap(model, new ModelNode()));
+			}
+		}
+		
+		// OVERRIDE_TRANSLATORS
+		List<Translator> translators = vdb.getOverrideTranslators();
+		if (translators != null && !translators.isEmpty()) {
+			ModelNode translatorNodes = node.get(CHILDREN, OVERRIDE_TRANSLATORS);
+			for (Translator translator:translators) {
+				translatorNodes.add(VDBTranslatorMetaDataMapper.INSTANCE.wrap((VDBTranslatorMetaData)translator,  new ModelNode()));
+			}
+		}
+		
+		// DATA_POLICIES
+		List<DataPolicy> policies = vdb.getDataPolicies();
+		if (policies != null && !policies.isEmpty()) {
+			ModelNode dataPoliciesNodes = node.get(CHILDREN, DATA_POLICIES);
+			for (DataPolicy policy:policies) {
+				dataPoliciesNodes.add(DataPolicyMetadataMapper.INSTANCE.wrap((DataPolicyMetadata)policy,  new ModelNode()));
+			}
+		}
+		return node;
+	}
+
+	public VDBMetaData unwrap(ModelNode node) {
+		if (node == null)
+			return null;
+			
+		VDBMetaData vdb = new VDBMetaData();
+		if (node.has(VDBNAME)) {
+			vdb.setName(node.get(VDBNAME).asString());
+		}
+		if (node.has(CONNECTIONTYPE)) {
+			vdb.setConnectionType(node.get(CONNECTIONTYPE).asString());
+		}
+		if (node.has(STATUS)) {
+			vdb.setStatus(node.get(STATUS).asString());
+		}
+		if (node.has(VERSION)) {
+			vdb.setVersion(node.get(VERSION).asInt());
+		}
+		if (node.has(URL)) {
+			vdb.setUrl(node.get(URL).asString());
+		}
+		if(node.has(DESCRIPTION)) {
+			vdb.setDescription(node.get(DESCRIPTION).asString());
+		}
+		if (node.has(DYNAMIC)) {
+			vdb.setDynamic(node.get(DYNAMIC).asBoolean());
+		}
+
+		//PROPERTIES
+		if (node.get(CHILDREN, PROPERTIES).isDefined()) {
+			List<ModelNode> propNodes = node.get(CHILDREN, PROPERTIES).asList();
+			for (ModelNode propNode:propNodes) {
+				PropertyMetadata prop = PropertyMetaDataMapper.INSTANCE.unwrap(propNode);
+				if (prop != null) {
+					vdb.addProperty(prop.getName(), prop.getValue());
+				}
+			}
+		}
+		
+		// MODELS
+		if (node.get(CHILDREN, MODELS).isDefined()) {
+			List<ModelNode> modelNodes = node.get(CHILDREN, MODELS).asList();
+			for(ModelNode modelNode:modelNodes) {
+				ModelMetaData model = ModelMetadataMapper.INSTANCE.unwrap(modelNode);
+				if (model != null) {
+					vdb.addModel(model);	
+				}
+			}
+		}
+		
+		// OVERRIDE_TRANSLATORS
+		if (node.get(CHILDREN, OVERRIDE_TRANSLATORS).isDefined()) {
+			List<ModelNode> translatorNodes = node.get(CHILDREN, OVERRIDE_TRANSLATORS).asList();
+			for (ModelNode translatorNode:translatorNodes) {
+				VDBTranslatorMetaData translator = VDBTranslatorMetaDataMapper.INSTANCE.unwrap(translatorNode);
+				if (translator != null) {
+					vdb.addOverideTranslator(translator);
+				}
+			}
+		}
+		
+		// DATA_POLICIES
+		if (node.get(CHILDREN, DATA_POLICIES).isDefined()) {
+			List<ModelNode> policiesNodes = node.get(CHILDREN, DATA_POLICIES).asList();
+			for (ModelNode policyNode:policiesNodes) {
+				DataPolicyMetadata policy = DataPolicyMetadataMapper.INSTANCE.unwrap(policyNode);
+				if (policy != null) {
+					vdb.addDataPolicy(policy);	
+				}
+				
+			}
+		}
+		return vdb;
+	}
+	
+	public ModelNode describe(ModelNode node) {
+		node.get(TYPE).set(ModelType.OBJECT);
+		addAttribute(node, VDBNAME, ModelType.STRING, true); 
+
+		ModelNode connectionsAllowed = new ModelNode();
+		connectionsAllowed.add(ConnectionType.NONE.toString());
+		connectionsAllowed.add(ConnectionType.ANY.toString());
+		connectionsAllowed.add(ConnectionType.BY_VERSION.toString());
+		addAttribute(node, CONNECTIONTYPE, ModelType.STRING, false).get(ALLOWED).set(connectionsAllowed);
+		
+		ModelNode statusAllowed = new ModelNode();
+		statusAllowed.add(Status.ACTIVE.toString());
+		statusAllowed.add(Status.INACTIVE.toString());
+		addAttribute(node, STATUS, ModelType.STRING, true).get(ALLOWED).set(statusAllowed);
+		
+		addAttribute(node, VERSION, ModelType.INT, true);
+		addAttribute(node, URL, ModelType.STRING, false);
+		addAttribute(node, DESCRIPTION, ModelType.STRING, false);
+		addAttribute(node, DYNAMIC, ModelType.BOOLEAN, false);
+		
+		ModelNode props = node.get(CHILDREN, PROPERTIES);
+		props.get(DESCRIPTION).set(AdminPlugin.Util.getString(PROPERTIES+DOT_DESC));
+		PropertyMetaDataMapper.INSTANCE.describe(props);
+
+		ModelNode models = node.get(CHILDREN, MODELS);		
+		ModelMetadataMapper.INSTANCE.describe(models);
+		models.get(DESCRIPTION).set(AdminPlugin.Util.getString(MODELS+DOT_DESC));
+		models.get(MIN_OCCURS).set(1);
+		
+		ModelNode translators = node.get(CHILDREN, OVERRIDE_TRANSLATORS);
+		translators.get(DESCRIPTION).set(AdminPlugin.Util.getString(OVERRIDE_TRANSLATORS+DOT_DESC));
+		VDBTranslatorMetaDataMapper.INSTANCE.describe(translators);
+		
+		ModelNode dataPolicies = node.get(CHILDREN, DATA_POLICIES);
+		dataPolicies.get(DESCRIPTION).set(AdminPlugin.Util.getString(DATA_POLICIES+DOT_DESC));
+		DataPolicyMetadataMapper.INSTANCE.describe(dataPolicies);
+		return node;
+	}
+	
+	/**
+	 * model metadata mapper
+	 */
+	public static class ModelMetadataMapper implements MetadataMapper<ModelMetaData>{
+		private static final String MODEL_NAME = "model-name"; //$NON-NLS-1$
+		private static final String DESCRIPTION = "description"; //$NON-NLS-1$
+		private static final String VISIBLE = "visible"; //$NON-NLS-1$
+		private static final String MODEL_TYPE = "model-type"; //$NON-NLS-1$
+		private static final String MODELPATH = "model-path"; //$NON-NLS-1$
+		private static final String PROPERTIES = "properties"; //$NON-NLS-1$
+		private static final String SOURCE_MAPPINGS = "source-mappings"; //$NON-NLS-1$
+		private static final String VALIDITY_ERRORS = "validity-errors"; //$NON-NLS-1$
+		
+		public static ModelMetadataMapper INSTANCE = new ModelMetadataMapper();
+		
+		public ModelNode wrap(ModelMetaData model, ModelNode node) {
+			if (model == null) {
+				return null;
+			}
+			node.get(TYPE).set(ModelType.OBJECT);
+			
+			node.get(MODEL_NAME).set(model.getName());
+			if (model.getDescription() != null) {
+				node.get(DESCRIPTION).set(model.getDescription());
+			}
+			node.get(VISIBLE).set(model.isVisible());
+			node.get(MODEL_TYPE).set(model.getModelType().toString());
+			if (model.getPath() != null) {
+				node.get(MODELPATH).set(model.getPath());
+			}
+
+			List<PropertyMetadata> properties = model.getJAXBProperties();
+			if (properties!= null && !properties.isEmpty()) {
+				ModelNode propsNode = node.get(CHILDREN, PROPERTIES); 
+				for (PropertyMetadata prop:properties) {
+					propsNode.add(PropertyMetaDataMapper.INSTANCE.wrap(prop,  new ModelNode()));
+				}
+			}
+			
+			List<SourceMappingMetadata> sources = model.getSourceMappings();
+			if (sources != null && !sources.isEmpty()) {
+				ModelNode sourceMappingNode = node.get(CHILDREN, SOURCE_MAPPINGS);
+				for(SourceMappingMetadata source:sources) {
+					sourceMappingNode.add(SourceMappingMetadataMapper.INSTANCE.wrap(source,  new ModelNode()));
+				}
+			}
+			
+			List<ValidationError> errors = model.getErrors();
+			if (errors != null && !errors.isEmpty()) {
+				ModelNode errorsNode = node.get(CHILDREN, VALIDITY_ERRORS);
+				for (ValidationError error:errors) {
+					errorsNode.add(ValidationErrorMapper.INSTANCE.wrap(error, new ModelNode()));
+				}
+			}
+			return node;
+		}
+		
+		public ModelMetaData unwrap(ModelNode node) {
+			if (node == null) {
+				return null;
+			}
+			
+			ModelMetaData model = new ModelMetaData();
+			if (node.has(MODEL_NAME)) {
+				model.setName(node.get(MODEL_NAME).asString());
+			}
+			if (node.has(DESCRIPTION)) {
+				model.setDescription(node.get(DESCRIPTION).asString());
+			}
+			if (node.has(VISIBLE)) {
+				model.setVisible(node.get(VISIBLE).asBoolean());
+			}
+			if(node.has(MODEL_TYPE)) {
+				model.setModelType(node.get(MODEL_TYPE).asString());
+			}
+			if(node.has(MODELPATH)) {
+				model.setPath(node.get(MODELPATH).asString());
+			}
+
+			if (node.get(CHILDREN, PROPERTIES).isDefined()) {
+				List<ModelNode> propNodes = node.get(CHILDREN, PROPERTIES).asList();
+				for (ModelNode propNode:propNodes) {
+					PropertyMetadata prop = PropertyMetaDataMapper.INSTANCE.unwrap(propNode);
+					if (prop != null) {
+						model.addProperty(prop.getName(), prop.getValue());
+					}
+				}
+			}
+		
+			if (node.get(CHILDREN, SOURCE_MAPPINGS).isDefined()) {
+				List<ModelNode> sourceMappingNodes = node.get(CHILDREN, SOURCE_MAPPINGS).asList();
+				for (ModelNode sourceMapping:sourceMappingNodes) {
+					SourceMappingMetadata source = SourceMappingMetadataMapper.INSTANCE.unwrap(sourceMapping);
+					if (source != null) {
+						model.addSourceMapping(source);
+					}
+				}
+			}
+			
+			if (node.get(CHILDREN, VALIDITY_ERRORS).isDefined()) {
+				List<ModelNode> errorNodes = node.get(CHILDREN, VALIDITY_ERRORS).asList();
+				for(ModelNode errorNode:errorNodes) {
+					ValidationError error = ValidationErrorMapper.INSTANCE.unwrap(errorNode);
+					if (error != null) {
+						model.addError(error);
+					}
+				}
+			}
+			return model;
+		}
+		
+		public ModelNode describe(ModelNode node) {
+			node.get(TYPE).set(ModelType.OBJECT);
+			
+			ModelNode modelTypes = new ModelNode();
+			modelTypes.add(Model.Type.PHYSICAL.toString());
+			modelTypes.add(Model.Type.VIRTUAL.toString());
+			modelTypes.add(Model.Type.FUNCTION.toString());
+			modelTypes.add(Model.Type.OTHER.toString());
+			addAttribute(node, MODEL_NAME, ModelType.STRING, true).get(ALLOWED).set(modelTypes);
+			
+			addAttribute(node, DESCRIPTION, ModelType.STRING, false);
+			addAttribute(node, VISIBLE, ModelType.BOOLEAN, false);
+			addAttribute(node, MODEL_TYPE, ModelType.STRING, true);
+			addAttribute(node, MODELPATH, ModelType.STRING, false);
+			
+			ModelNode props = node.get(CHILDREN, PROPERTIES);
+			props.get(DESCRIPTION).set(AdminPlugin.Util.getString(PROPERTIES+DOT_DESC));
+			PropertyMetaDataMapper.INSTANCE.describe(props);
+
+			ModelNode source = node.get(CHILDREN, SOURCE_MAPPINGS);
+			source.get(DESCRIPTION).set(AdminPlugin.Util.getString(SOURCE_MAPPINGS+DOT_DESC));
+			SourceMappingMetadataMapper.INSTANCE.describe(source);
+
+			ModelNode errors = node.get(CHILDREN, VALIDITY_ERRORS);
+			errors.get(DESCRIPTION).set(AdminPlugin.Util.getString(VALIDITY_ERRORS+DOT_DESC));
+			ValidationErrorMapper.INSTANCE.describe(errors);
+			
+			return node; 
+		}
+	}	
+	
+	/**
+	 * validation error mapper
+	 */
+	public static class ValidationErrorMapper implements MetadataMapper<ValidationError>{
+		private static final String ERROR_PATH = "error-path"; //$NON-NLS-1$
+		private static final String SEVERITY = "severity"; //$NON-NLS-1$
+		private static final String MESSAGE = "message"; //$NON-NLS-1$
+		
+		
+		public static ValidationErrorMapper INSTANCE = new ValidationErrorMapper();
+		
+		public ModelNode wrap(ValidationError error, ModelNode node) {
+			if (error == null) {
+				return null;
+			}
+			
+			node.get(TYPE).set(ModelType.OBJECT);
+			if (error.getPath() != null) {
+				node.get(ERROR_PATH).set(error.getPath());
+			}
+			node.get(SEVERITY).set(error.getSeverity());
+			node.get(MESSAGE).set(error.getValue());
+			
+			return node;
+		}
+		
+		public ValidationError unwrap(ModelNode node) {
+			if (node == null) {
+				return null;
+			}
+			
+			ValidationError error = new ValidationError();
+			if (node.has(ERROR_PATH)) {
+				error.setPath(node.get(ERROR_PATH).asString());
+			}
+			if (node.has(SEVERITY)) {
+				error.setSeverity(node.get(SEVERITY).asString());
+			}
+			if(node.has(MESSAGE)) {
+				error.setValue(node.get(MESSAGE).asString());
+			}
+			return error;
+		}
+		
+		public ModelNode describe(ModelNode node) {
+			node.get(TYPE).set(ModelType.OBJECT);
+			addAttribute(node, ERROR_PATH, ModelType.STRING, false); 
+			addAttribute(node, SEVERITY, ModelType.STRING, true);
+			addAttribute(node, MESSAGE, ModelType.STRING, true);
+			return node; 
+		}			
+	}		
+	
+	/**
+	 * Source Mapping Metadata mapper
+	 */
+	public static class SourceMappingMetadataMapper implements MetadataMapper<SourceMappingMetadata>{
+		private static final String SOURCE_NAME = "source-name"; //$NON-NLS-1$
+		private static final String JNDI_NAME = "jndi-name"; //$NON-NLS-1$
+		private static final String TRANSLATOR_NAME = "translator-name"; //$NON-NLS-1$
+		
+		public static SourceMappingMetadataMapper INSTANCE = new SourceMappingMetadataMapper();
+		
+		public ModelNode wrap(SourceMappingMetadata source, ModelNode node) {
+			if (source == null) {
+				return null;
+			}
+			
+			node.get(TYPE).set(ModelType.OBJECT);
+			
+			node.get(SOURCE_NAME).set(source.getName());
+			node.get(JNDI_NAME).set(source.getConnectionJndiName());
+			node.get(TRANSLATOR_NAME).set(source.getTranslatorName());
+			return node;
+		}
+		
+		public SourceMappingMetadata unwrap(ModelNode node) {
+			if (node == null) {
+				return null;
+			}
+			SourceMappingMetadata source = new SourceMappingMetadata();
+			if (node.has(SOURCE_NAME)) {
+				source.setName(node.get(SOURCE_NAME).asString());
+			}
+			if (node.has(JNDI_NAME)) {
+				source.setConnectionJndiName(node.get(JNDI_NAME).asString());
+			}
+			if (node.has(TRANSLATOR_NAME)) {
+				source.setTranslatorName(node.get(TRANSLATOR_NAME).asString());
+			}
+			return source;
+		}
+		
+		public ModelNode describe(ModelNode node) {
+			node.get(TYPE).set(ModelType.OBJECT);
+			addAttribute(node, SOURCE_NAME, ModelType.STRING, true); 
+			addAttribute(node, JNDI_NAME, ModelType.STRING, true);
+			addAttribute(node, TRANSLATOR_NAME, ModelType.STRING, true);
+			return node; 
+		}		
+	}		
+	
+	/**
+	 * Source Mapping Metadata mapper
+	 */
+	public static class VDBTranslatorMetaDataMapper implements MetadataMapper<VDBTranslatorMetaData>{
+		private static final String TRANSLATOR_NAME = "translator-name"; //$NON-NLS-1$
+		private static final String BASETYPE = "base-type"; //$NON-NLS-1$
+		private static final String DESCRIPTION = "description"; //$NON-NLS-1$
+		private static final String PROPERTIES = "properties"; //$NON-NLS-1$
+		private static final String MODULE_NAME = "module-name"; //$NON-NLS-1$
+		
+		
+		public static VDBTranslatorMetaDataMapper INSTANCE = new VDBTranslatorMetaDataMapper();
+		
+		public ModelNode wrap(VDBTranslatorMetaData translator, ModelNode node) {
+			if (translator == null) {
+				return null;
+			}
+			node.get(TYPE).set(ModelType.OBJECT);
+			
+			node.get(TRANSLATOR_NAME).set(translator.getName());
+			if (translator.getType() != null) {
+				node.get(BASETYPE).set(translator.getType());
+			}
+			if (translator.getDescription() != null) {
+				node.get(DESCRIPTION).set(translator.getDescription());
+			}
+			
+			if (translator.getModuleName() != null) {
+				node.get(MODULE_NAME).set(translator.getModuleName());
+			}
+
+			List<PropertyMetadata> properties = translator.getJAXBProperties();
+			if (properties!= null && !properties.isEmpty()) {
+				ModelNode propsNode = node.get(CHILDREN, PROPERTIES); 
+				for (PropertyMetadata prop:properties) {
+					propsNode.add(PropertyMetaDataMapper.INSTANCE.wrap(prop, new ModelNode()));
+				}
+			}
+			return node;
+		}
+		
+		public VDBTranslatorMetaData unwrap(ModelNode node) {
+			if (node == null) {
+				return null;
+			}
+			VDBTranslatorMetaData translator = new VDBTranslatorMetaData();
+			if (node.has(TRANSLATOR_NAME)) {
+				translator.setName(node.get(TRANSLATOR_NAME).asString());
+			}
+			if (node.has(BASETYPE)) {
+				translator.setType(node.get(BASETYPE).asString());
+			}
+			if (node.has(DESCRIPTION)) {
+				translator.setDescription(node.get(DESCRIPTION).asString());
+			}
+			if (node.has(MODULE_NAME)) {
+				translator.setModuleName(node.get(MODULE_NAME).asString());
+			}
+			
+			if (node.get(CHILDREN,PROPERTIES).isDefined()) {
+				List<ModelNode> propNodes = node.get(CHILDREN, PROPERTIES).asList();
+				for (ModelNode propNode:propNodes) {
+					PropertyMetadata prop = PropertyMetaDataMapper.INSTANCE.unwrap(propNode);
+					if (prop != null) {
+						translator.addProperty(prop.getName(), prop.getValue());
+					}
+				}
+			}
+			return translator;
+		}
+		
+		public ModelNode describe(ModelNode node) {
+			node.get(TYPE).set(ModelType.OBJECT);
+			addAttribute(node, TRANSLATOR_NAME, ModelType.STRING, true); 
+			addAttribute(node, BASETYPE, ModelType.STRING, true);
+			addAttribute(node, DESCRIPTION, ModelType.STRING, false);
+			addAttribute(node, MODULE_NAME, ModelType.STRING, false);
+			
+			ModelNode props = node.get(CHILDREN, PROPERTIES);
+			props.get(DESCRIPTION).set(AdminPlugin.Util.getString(PROPERTIES+DOT_DESC));
+			PropertyMetaDataMapper.INSTANCE.describe(props);
+			return node; 
+		}		
+	}	
+	
+	/**
+	 * Property Metadata mapper
+	 */
+	public static class PropertyMetaDataMapper implements MetadataMapper<PropertyMetadata>{
+		private static final String PROPERTY_NAME = "property-name"; //$NON-NLS-1$
+		private static final String PROPERTY_VALUE = "property-value"; //$NON-NLS-1$
+		
+		public static PropertyMetaDataMapper INSTANCE = new PropertyMetaDataMapper();
+		
+		public ModelNode wrap(PropertyMetadata property, ModelNode node) {
+			if (property == null) {
+				return null;
+			}			
+			node.get(ModelNodeConstants.TYPE).set(ModelType.OBJECT);
+			
+			node.get(PROPERTY_NAME).set(property.getName());
+			node.get(PROPERTY_VALUE).set(property.getValue());
+			
+			return node;
+		}
+		
+		public PropertyMetadata unwrap(ModelNode node) {
+			if(node == null) {
+				return null;
+			}
+			PropertyMetadata property = new PropertyMetadata();
+			if (node.has(PROPERTY_NAME)) {
+				property.setName(node.get(PROPERTY_NAME).asString());
+			}
+			if(node.has(PROPERTY_VALUE)) {
+				property.setValue(node.get(PROPERTY_VALUE).asString());
+			}
+			return property;
+		}
+		
+		public ModelNode describe(ModelNode node) {
+			node.get(TYPE).set(ModelType.OBJECT);
+			addAttribute(node, PROPERTY_NAME, ModelType.STRING, true);
+			addAttribute(node, PROPERTY_VALUE, ModelType.STRING, true);
+			return node; 
+		}
+	}		
+	
+	/**
+	 * DataPolicy Metadata mapper
+	 */
+	public static class DataPolicyMetadataMapper implements MetadataMapper<DataPolicyMetadata>{
+		private static final String POLICY_NAME = "policy-name"; //$NON-NLS-1$
+		private static final String DATA_PERMISSIONS = "data-permissions"; //$NON-NLS-1$
+		private static final String MAPPED_ROLE_NAMES = "mapped-role-names"; //$NON-NLS-1$
+		private static final String ALLOW_CREATE_TEMP_TABLES = "allow-create-temp-tables"; //$NON-NLS-1$
+		private static final String ANY_AUTHENTICATED = "any-authenticated"; //$NON-NLS-1$
+		private static final String ALLOW_CREATE = "allow-create"; //$NON-NLS-1$
+		private static final String ALLOW_READ = "allow-read"; //$NON-NLS-1$
+		private static final String ALLOW_UPDATE = "allow-update"; //$NON-NLS-1$
+		private static final String ALLOW_DELETE = "allow-delete"; //$NON-NLS-1$
+		private static final String ALLOW_EXECUTE = "allow-execute"; //$NON-NLS-1$
+		private static final String ALLOW_ALTER= "allow-alter"; //$NON-NLS-1$
+		
+		public static DataPolicyMetadataMapper INSTANCE = new DataPolicyMetadataMapper();
+		
+		public ModelNode wrap(DataPolicyMetadata policy, ModelNode node) {
+			if (policy == null) {
+				return null;
+			}			
+			node.get(ModelNodeConstants.TYPE).set(ModelType.OBJECT);
+			
+			node.get(POLICY_NAME).set(policy.getName());
+			if (policy.getDescription() != null) {
+				node.get(DESCRIPTION).set(policy.getDescription());
+			}
+			if (policy.isAllowCreateTemporaryTables() != null) {
+				node.get(ALLOW_CREATE_TEMP_TABLES).set(policy.isAllowCreateTemporaryTables());
+			}
+			node.get(ANY_AUTHENTICATED).set(policy.isAnyAuthenticated());
+			
+			//DATA_PERMISSIONS
+			List<DataPolicy.DataPermission> permissions = policy.getPermissions();
+			if (permissions != null && !permissions.isEmpty()) {
+				ModelNode permissionNodes = node.get(CHILDREN, DATA_PERMISSIONS); 
+				for (DataPolicy.DataPermission dataPermission:permissions) {
+					permissionNodes.add(PermissionMetaDataMapper.INSTANCE.wrap((PermissionMetaData)dataPermission,  new ModelNode()));
+				}			
+			}
+			
+			//MAPPED_ROLE_NAMES
+			if (policy.getMappedRoleNames() != null && !policy.getMappedRoleNames().isEmpty()) {
+				ModelNode mappedRoleNodes = node.get(CHILDREN, MAPPED_ROLE_NAMES);
+				for (String role:policy.getMappedRoleNames()) {
+					mappedRoleNodes.add(role);
+				}
+			}
+			return node;
+		}
+		
+		public DataPolicyMetadata unwrap(ModelNode node) {
+			if(node == null) {
+				return null;
+			}
+			DataPolicyMetadata policy = new DataPolicyMetadata();
+			if (node.has(POLICY_NAME)) {
+				policy.setName(node.get(POLICY_NAME).asString());
+			}
+			if (node.has(DESCRIPTION)) {
+				policy.setDescription(node.get(DESCRIPTION).asString());
+			}
+			if (node.has(ALLOW_CREATE_TEMP_TABLES)) {
+				policy.setAllowCreateTemporaryTables(node.get(ALLOW_CREATE_TEMP_TABLES).asBoolean());
+			}
+			if (node.has(ANY_AUTHENTICATED)) {
+				policy.setAnyAuthenticated(node.get(ANY_AUTHENTICATED).asBoolean());
+			}
+			
+			//DATA_PERMISSIONS
+			if (node.get(CHILDREN, DATA_PERMISSIONS).isDefined()) {
+				List<ModelNode> permissionNodes = node.get(CHILDREN, DATA_PERMISSIONS).asList();
+				for (ModelNode permissionNode:permissionNodes) {
+					PermissionMetaData permission = PermissionMetaDataMapper.INSTANCE.unwrap(permissionNode);
+					if (permission != null) {
+						policy.addPermission(permission);
+					}
+				}
+			}
+
+			//MAPPED_ROLE_NAMES
+			if (node.get(CHILDREN, MAPPED_ROLE_NAMES).isDefined()) {
+				List<ModelNode> roleNameNodes = node.get(CHILDREN, MAPPED_ROLE_NAMES).asList();
+				for (ModelNode roleNameNode:roleNameNodes) {
+					policy.addMappedRoleName(roleNameNode.asString());
+				}			
+			}
+			return policy;
+		}
+		
+		public ModelNode describe(ModelNode node) {
+			node.get(TYPE).set(ModelType.OBJECT);
+			addAttribute(node, POLICY_NAME, ModelType.STRING, true);
+			addAttribute(node, DESCRIPTION, ModelType.STRING, false);
+			addAttribute(node, ALLOW_CREATE_TEMP_TABLES, ModelType.BOOLEAN, false);
+			addAttribute(node, ANY_AUTHENTICATED, ModelType.BOOLEAN, false);
+			
+			ModelNode permissions = node.get(CHILDREN, DATA_PERMISSIONS);
+			permissions.get(DESCRIPTION).set(AdminPlugin.Util.getString(DATA_PERMISSIONS+DOT_DESC));
+			permissions.get(MIN_OCCURS).set(1);
+			
+			ModelNode create = permissions.get(CHILDREN, ALLOW_CREATE);
+			create.get(DESCRIPTION).set(AdminPlugin.Util.getString(ALLOW_CREATE+DOT_DESC));
+			
+			ModelNode read = permissions.get(CHILDREN, ALLOW_READ);
+			read.get(DESCRIPTION).set(AdminPlugin.Util.getString(ALLOW_READ+DOT_DESC));
+
+			ModelNode update = permissions.get(CHILDREN, ALLOW_UPDATE);
+			update.get(DESCRIPTION).set(AdminPlugin.Util.getString(ALLOW_UPDATE+DOT_DESC));
+
+			ModelNode delete = permissions.get(CHILDREN, ALLOW_DELETE);
+			delete.get(DESCRIPTION).set(AdminPlugin.Util.getString(ALLOW_DELETE+DOT_DESC));
+
+			ModelNode execute = permissions.get(CHILDREN, ALLOW_EXECUTE);
+			execute.get(DESCRIPTION).set(AdminPlugin.Util.getString(ALLOW_EXECUTE+DOT_DESC));
+
+			ModelNode alter = permissions.get(CHILDREN, ALLOW_ALTER);
+			alter.get(DESCRIPTION).set(AdminPlugin.Util.getString(ALLOW_ALTER+DOT_DESC));
+			
+			ModelNode roleNames = node.get(CHILDREN, MAPPED_ROLE_NAMES);
+			roleNames.get(TYPE).set(ModelType.LIST);
+			roleNames.get(DESCRIPTION).set(AdminPlugin.Util.getString(MAPPED_ROLE_NAMES+DOT_DESC));
+			roleNames.get("value-type").set(ModelType.STRING); //$NON-NLS-1$
+			return node; 
+		}
+	}	
+	
+	public static class PermissionMetaDataMapper implements MetadataMapper<PermissionMetaData>{
+		private static final String RESOURCE_NAME = "resource-name"; //$NON-NLS-1$
+		private static final String ALLOW_CREATE = "allow-create"; //$NON-NLS-1$
+		private static final String ALLOW_DELETE = "allow-delete"; //$NON-NLS-1$
+		private static final String ALLOW_UPADTE = "allow-update"; //$NON-NLS-1$
+		private static final String ALLOW_READ = "allow-read"; //$NON-NLS-1$
+		private static final String ALLOW_EXECUTE = "allow-execute"; //$NON-NLS-1$
+		private static final String ALLOW_ALTER = "allow-alter"; //$NON-NLS-1$
+		
+		public static PermissionMetaDataMapper INSTANCE = new PermissionMetaDataMapper();
+		
+		public ModelNode wrap(PermissionMetaData permission, ModelNode node) {
+			if (permission == null) {
+				return null;
+			}
+			
+			node.get(ModelNodeConstants.TYPE).set(ModelType.OBJECT);
+			
+			node.get(RESOURCE_NAME).set(permission.getResourceName());
+			if (permission.getAllowCreate() != null) {
+				node.get(ALLOW_CREATE).set(permission.getAllowCreate().booleanValue());
+			}
+			if (permission.getAllowDelete() != null) {
+				node.get(ALLOW_DELETE).set(permission.getAllowDelete().booleanValue());
+			}
+			if (permission.getAllowUpdate() != null) {
+				node.get(ALLOW_UPADTE).set(permission.getAllowUpdate().booleanValue());
+			}
+			if (permission.getAllowRead() != null) {
+				node.get(ALLOW_READ).set(permission.getAllowRead().booleanValue());
+			}
+			if (permission.getAllowExecute() != null) {
+				node.get(ALLOW_EXECUTE).set(permission.getAllowExecute().booleanValue());
+			}
+			if(permission.getAllowAlter() != null) {
+				node.get(ALLOW_ALTER).set(permission.getAllowAlter().booleanValue());
+			}
+			return node;
+		}
+		
+		public PermissionMetaData unwrap(ModelNode node) {
+			if (node == null) {
+				return null;
+			}
+			
+			PermissionMetaData permission = new PermissionMetaData();
+			if (node.get(RESOURCE_NAME) != null) {
+				permission.setResourceName(node.get(RESOURCE_NAME).asString());
+			}
+			if (node.has(ALLOW_CREATE)) {
+				permission.setAllowCreate(node.get(ALLOW_CREATE).asBoolean());
+			}
+			if (node.has(ALLOW_DELETE)) {
+				permission.setAllowDelete(node.get(ALLOW_DELETE).asBoolean());
+			}
+			if (node.has(ALLOW_UPADTE)) {
+				permission.setAllowUpdate(node.get(ALLOW_UPADTE).asBoolean());
+			}
+			if (node.has(ALLOW_READ)) {
+				permission.setAllowRead(node.get(ALLOW_READ).asBoolean());
+			}
+			if (node.has(ALLOW_EXECUTE)) {
+				permission.setAllowExecute(node.get(ALLOW_EXECUTE).asBoolean());
+			}
+			if (node.has(ALLOW_ALTER)) {
+				permission.setAllowAlter(node.get(ALLOW_ALTER).asBoolean());
+			}
+			return permission;
+		}
+		public ModelNode describe(ModelNode node) {
+			addAttribute(node, RESOURCE_NAME, ModelType.STRING, true);
+			addAttribute(node, ALLOW_CREATE, ModelType.BOOLEAN, false);
+			addAttribute(node, ALLOW_DELETE, ModelType.BOOLEAN, false);
+			addAttribute(node, ALLOW_UPADTE, ModelType.BOOLEAN, false);
+			addAttribute(node, ALLOW_READ, ModelType.BOOLEAN, false);
+			addAttribute(node, ALLOW_EXECUTE, ModelType.BOOLEAN, false);
+			addAttribute(node, ALLOW_ALTER, ModelType.BOOLEAN, false);
+			return node;
+		}
+	}
+	
+	public static class CacheStatisticsMetadataMapper implements MetadataMapper<CacheStatisticsMetadata>{
+		private static final String HITRATIO = "hit-ratio"; //$NON-NLS-1$
+		private static final String TOTAL_ENTRIES = "total-entries"; //$NON-NLS-1$
+		private static final String REQUEST_COUNT = "request-count"; //$NON-NLS-1$
+		
+		public static CacheStatisticsMetadataMapper INSTANCE = new CacheStatisticsMetadataMapper();
+		
+		public ModelNode wrap(CacheStatisticsMetadata object, ModelNode node) {
+			if (object == null)
+				return null;
+			
+			node.get(ModelNodeConstants.TYPE).set(ModelType.OBJECT);
+			
+			node.get(TOTAL_ENTRIES).set(object.getTotalEntries());
+			node.get(HITRATIO).set(object.getHitRatio());
+			node.get(REQUEST_COUNT).set(object.getRequestCount());
+			
+			return node;
+		}
+
+		public CacheStatisticsMetadata unwrap(ModelNode node) {
+			if (node == null)
+				return null;
+				
+			CacheStatisticsMetadata cache = new CacheStatisticsMetadata();
+			cache.setTotalEntries(node.get(TOTAL_ENTRIES).asInt());
+			cache.setHitRatio(node.get(HITRATIO).asDouble());
+			cache.setRequestCount(node.get(REQUEST_COUNT).asInt());
+			return cache;
+		}
+		
+		public ModelNode describe(ModelNode node) {
+			node.get(TYPE).set(ModelType.OBJECT);
+			addAttribute(node, TOTAL_ENTRIES, ModelType.STRING, true);
+			addAttribute(node, HITRATIO, ModelType.STRING, true);
+			addAttribute(node, REQUEST_COUNT, ModelType.STRING, true);
+			return node; 		
+		}
+	}	
+	
+	public static class RequestMetadataMapper implements MetadataMapper<RequestMetadata>{
+		private static final String TRANSACTION_ID = "transaction-id"; //$NON-NLS-1$
+		private static final String NODE_ID = "node-id"; //$NON-NLS-1$
+		private static final String SOURCE_REQUEST = "source-request"; //$NON-NLS-1$
+		private static final String COMMAND = "command"; //$NON-NLS-1$
+		private static final String START_TIME = "start-time"; //$NON-NLS-1$
+		private static final String SESSION_ID = "session-id"; //$NON-NLS-1$
+		private static final String EXECUTION_ID = "execution-id"; //$NON-NLS-1$
+		private static final String STATE = "processing-state"; //$NON-NLS-1$
+		private static final String THREAD_STATE = "thread-state"; //$NON-NLS-1$
+		
+		public static RequestMetadataMapper INSTANCE = new RequestMetadataMapper();
+		
+		public ModelNode wrap(RequestMetadata request, ModelNode node) {
+			if (request == null) {
+				return null;
+			}
+			node.get(ModelNodeConstants.TYPE).set(ModelType.OBJECT);
+			
+			node.get(EXECUTION_ID).set(request.getExecutionId());
+			node.get(SESSION_ID).set(request.getSessionId());
+			node.get(START_TIME).set(request.getStartTime());
+			node.get(COMMAND).set(request.getCommand());
+			node.get(SOURCE_REQUEST).set(request.sourceRequest());
+			if (request.getNodeId() != null) {
+				node.get(NODE_ID).set(request.getNodeId());
+			}
+			if (request.getTransactionId() != null) {
+				node.get(TRANSACTION_ID).set(request.getTransactionId());
+			}
+			node.get(STATE).set(request.getState().name());
+			node.get(THREAD_STATE).set(request.getThreadState().name());
+			return node;
+		}
+
+		public RequestMetadata unwrap(ModelNode node) {
+			if (node == null)
+				return null;
+
+			RequestMetadata request = new RequestMetadata();
+			request.setExecutionId(node.get(EXECUTION_ID).asLong());
+			request.setSessionId(node.get(SESSION_ID).asString());
+			request.setStartTime(node.get(START_TIME).asLong());
+			request.setCommand(node.get(COMMAND).asString());
+			request.setSourceRequest(node.get(SOURCE_REQUEST).asBoolean());
+			if (node.has(NODE_ID)) {
+				request.setNodeId(node.get(NODE_ID).asInt());
+			}
+			if (node.has(TRANSACTION_ID)) {
+				request.setTransactionId(node.get(TRANSACTION_ID).asString());
+			}
+			request.setState(ProcessingState.valueOf(node.get(STATE).asString()));
+			request.setThreadState(ThreadState.valueOf(node.get(THREAD_STATE).asString()));
+			return request;
+		}
+		
+		public ModelNode describe(ModelNode node) {
+			node.get(TYPE).set(ModelType.OBJECT);
+			addAttribute(node, EXECUTION_ID, ModelType.LONG, true);
+			addAttribute(node, SESSION_ID, ModelType.STRING, true);
+			addAttribute(node, START_TIME, ModelType.LONG, true);
+			addAttribute(node, COMMAND, ModelType.STRING, true);
+			addAttribute(node, SOURCE_REQUEST, ModelType.BOOLEAN, true);
+			addAttribute(node, NODE_ID, ModelType.INT, false);
+			addAttribute(node, TRANSACTION_ID, ModelType.STRING, false);
+			addAttribute(node, STATE, ModelType.STRING, true);
+			addAttribute(node, THREAD_STATE, ModelType.STRING, true);
+			return node; 		
+		}
+	}
+	
+	public static class SessionMetadataMapper implements MetadataMapper<SessionMetadata>{
+		private static final String SECURITY_DOMAIN = "security-domain"; //$NON-NLS-1$
+		private static final String VDB_VERSION = "vdb-version"; //$NON-NLS-1$
+		private static final String VDB_NAME = "vdb-name"; //$NON-NLS-1$
+		private static final String USER_NAME = "user-name"; //$NON-NLS-1$
+		private static final String SESSION_ID = "session-id"; //$NON-NLS-1$
+		private static final String LAST_PING_TIME = "last-ping-time"; //$NON-NLS-1$
+		private static final String IP_ADDRESS = "ip-address"; //$NON-NLS-1$
+		private static final String CLIENT_HOST_NAME = "client-host-address"; //$NON-NLS-1$
+		private static final String CREATED_TIME = "created-time"; //$NON-NLS-1$
+		private static final String APPLICATION_NAME = "application-name"; //$NON-NLS-1$
+		private static final String CLIENT_HARDWARE_ADRESS = "client-hardware-address"; //$NON-NLS-1$
+		
+		public static SessionMetadataMapper INSTANCE = new SessionMetadataMapper();
+		
+		public ModelNode wrap(SessionMetadata session, ModelNode node) {
+			if (session == null) {
+				return null;
+			}
+			node.get(ModelNodeConstants.TYPE).set(ModelType.OBJECT);
+				
+			if (session.getApplicationName() != null) {
+				node.get(APPLICATION_NAME).set(session.getApplicationName());
+			}
+			node.get(CREATED_TIME).set(session.getCreatedTime());
+			node.get(CLIENT_HOST_NAME).set(session.getClientHostName());
+			node.get(IP_ADDRESS).set(session.getIPAddress());
+			node.get(LAST_PING_TIME).set(session.getLastPingTime());
+			node.get(SESSION_ID).set(session.getSessionId());
+			node.get(USER_NAME).set(session.getUserName());
+			node.get(VDB_NAME).set(session.getVDBName());
+			node.get(VDB_VERSION).set(session.getVDBVersion());
+			if (session.getSecurityDomain() != null){
+				node.get(SECURITY_DOMAIN).set(session.getSecurityDomain());
+			}
+			if (session.getClientHardwareAddress() != null) {
+				node.get(CLIENT_HARDWARE_ADRESS).set(session.getClientHardwareAddress());
+			}
+			return node;
+		}
+
+		public SessionMetadata unwrap(ModelNode node) {
+			if (node == null)
+				return null;
+				
+			SessionMetadata session = new SessionMetadata();
+			if (node.has(APPLICATION_NAME)) {
+				session.setApplicationName(node.get(APPLICATION_NAME).asString());
+			}
+			session.setCreatedTime(node.get(CREATED_TIME).asLong());
+			session.setClientHostName(node.get(CLIENT_HOST_NAME).asString());
+			session.setIPAddress(node.get(IP_ADDRESS).asString());
+			session.setLastPingTime(node.get(LAST_PING_TIME).asLong());
+			session.setSessionId(node.get(SESSION_ID).asString());
+			session.setUserName(node.get(USER_NAME).asString());
+			session.setVDBName(node.get(VDB_NAME).asString());
+			session.setVDBVersion(node.get(VDB_VERSION).asInt());
+			if (node.has(SECURITY_DOMAIN)) {
+				session.setSecurityDomain(node.get(SECURITY_DOMAIN).asString());
+			}
+			if (node.has(CLIENT_HARDWARE_ADRESS)) {
+				session.setClientHardwareAddress(node.get(CLIENT_HARDWARE_ADRESS).asString());
+			}
+			return session;
+		}
+		
+		public ModelNode describe(ModelNode node) {
+			node.get(TYPE).set(ModelType.OBJECT);
+			addAttribute(node, APPLICATION_NAME, ModelType.STRING, false);
+			addAttribute(node, CREATED_TIME, ModelType.LONG, true);
+			addAttribute(node, CLIENT_HOST_NAME, ModelType.LONG, true);
+			addAttribute(node, IP_ADDRESS, ModelType.STRING, true);
+			addAttribute(node, LAST_PING_TIME, ModelType.LONG, true);
+			addAttribute(node, SESSION_ID, ModelType.STRING, true);
+			addAttribute(node, USER_NAME, ModelType.STRING, true);
+			addAttribute(node, VDB_NAME, ModelType.STRING, true);
+			addAttribute(node, VDB_VERSION, ModelType.INT, true);
+			addAttribute(node, SECURITY_DOMAIN, ModelType.STRING, false);
+			return node;
+		}
+	}	
+	
+	public static class TransactionMetadataMapper implements MetadataMapper<TransactionMetadata>{
+		private static final String ID = "txn-id"; //$NON-NLS-1$
+		private static final String SCOPE = "txn-scope"; //$NON-NLS-1$
+		private static final String CREATED_TIME = "txn-created-time"; //$NON-NLS-1$
+		private static final String ASSOCIATED_SESSION = "session-id"; //$NON-NLS-1$
+		
+		public static TransactionMetadataMapper INSTANCE = new TransactionMetadataMapper();
+		
+		public ModelNode wrap(TransactionMetadata object, ModelNode transaction) {
+			if (object == null)
+				return null;
+			
+			transaction.get(ModelNodeConstants.TYPE).set(ModelType.OBJECT);
+			transaction.get(ASSOCIATED_SESSION).set(object.getAssociatedSession());
+			transaction.get(CREATED_TIME).set(object.getCreatedTime());
+			transaction.get(SCOPE).set(object.getScope());
+			transaction.get(ID).set(object.getId());
+			
+			return transaction;
+		}
+
+		public TransactionMetadata unwrap(ModelNode node) {
+			if (node == null)
+				return null;
+
+			TransactionMetadata transaction = new TransactionMetadata();
+			transaction.setAssociatedSession(node.get(ASSOCIATED_SESSION).asString());
+			transaction.setCreatedTime(node.get(CREATED_TIME).asLong());
+			transaction.setScope(node.get(SCOPE).asString());
+			transaction.setId(node.get(ID).asString());
+			return transaction;
+		}
+		
+		public ModelNode describe(ModelNode node) {
+			node.get(TYPE).set(ModelType.OBJECT);
+			addAttribute(node, ASSOCIATED_SESSION, ModelType.STRING, true);
+			addAttribute(node, CREATED_TIME, ModelType.LONG, true);
+			addAttribute(node, SCOPE, ModelType.LONG, true);
+			addAttribute(node, ID, ModelType.STRING, true);
+			return node;
+		}
+	}	
+
+	public static class WorkerPoolStatisticsMetadataMapper implements MetadataMapper<WorkerPoolStatisticsMetadata>{
+		private static final String MAX_THREADS = "max-threads"; //$NON-NLS-1$
+		private static final String HIGHEST_QUEUED = "highest-queued"; //$NON-NLS-1$
+		private static final String QUEUED = "queued"; //$NON-NLS-1$
+		private static final String QUEUE_NAME = "queue-name"; //$NON-NLS-1$
+		private static final String TOTAL_SUBMITTED = "total-submitted"; //$NON-NLS-1$
+		private static final String TOTAL_COMPLETED = "total-completed"; //$NON-NLS-1$
+		private static final String HIGHEST_ACTIVE_THREADS = "highest-active-threads"; //$NON-NLS-1$
+		private static final String ACTIVE_THREADS = "active-threads"; //$NON-NLS-1$
+		
+		public static WorkerPoolStatisticsMetadataMapper INSTANCE = new WorkerPoolStatisticsMetadataMapper();
+		
+		public ModelNode wrap(WorkerPoolStatisticsMetadata stats, ModelNode node) {
+			if (stats == null)
+				return null;
+			node.get(ModelNodeConstants.TYPE).set(ModelType.OBJECT);
+			
+			node.get(ACTIVE_THREADS).set(stats.getActiveThreads());
+			node.get(HIGHEST_ACTIVE_THREADS).set(stats.getHighestActiveThreads());
+			node.get(TOTAL_COMPLETED).set(stats.getTotalCompleted());
+			node.get(TOTAL_SUBMITTED).set(stats.getTotalSubmitted());
+			node.get(QUEUE_NAME).set(stats.getQueueName());
+			node.get(QUEUED).set(stats.getQueued());
+			node.get(HIGHEST_QUEUED).set(stats.getHighestQueued());
+			node.get(MAX_THREADS).set(stats.getMaxThreads());
+			
+			return node;
+		}
+
+		public WorkerPoolStatisticsMetadata unwrap(ModelNode node) {
+			if (node == null)
+				return null;
+
+			WorkerPoolStatisticsMetadata stats = new WorkerPoolStatisticsMetadata();
+			stats.setActiveThreads(node.get(ACTIVE_THREADS).asInt());
+			stats.setHighestActiveThreads(node.get(HIGHEST_ACTIVE_THREADS).asInt());
+			stats.setTotalCompleted(node.get(TOTAL_COMPLETED).asLong());
+			stats.setTotalSubmitted(node.get(TOTAL_SUBMITTED).asLong());
+			stats.setQueueName(node.get(QUEUE_NAME).asString());
+			stats.setQueued(node.get(QUEUED).asInt());
+			stats.setHighestQueued(node.get(HIGHEST_QUEUED).asInt());
+			stats.setMaxThreads(node.get(MAX_THREADS).asInt());			
+			return stats;
+		}
+		
+		public ModelNode describe(ModelNode node) {
+			node.get(TYPE).set(ModelType.OBJECT);
+			addAttribute(node, ACTIVE_THREADS, ModelType.INT, true);
+			addAttribute(node, HIGHEST_ACTIVE_THREADS, ModelType.INT, true);
+			addAttribute(node, TOTAL_COMPLETED, ModelType.LONG, true);
+			addAttribute(node, TOTAL_SUBMITTED, ModelType.LONG, true);
+			addAttribute(node, QUEUE_NAME, ModelType.STRING, true);
+			addAttribute(node, QUEUED, ModelType.INT, true);
+			addAttribute(node, HIGHEST_QUEUED, ModelType.INT, true);
+			addAttribute(node, MAX_THREADS, ModelType.INT, true);
+			return node;
+		}
+	}	
+	
+	private static final String CHILDREN = "children"; //$NON-NLS-1$
+	private static final String ATTRIBUTES = "attributes"; //$NON-NLS-1$
+	private static final String DOT_DESC = ".describe"; //$NON-NLS-1$
+	private static final String TYPE = "type"; //$NON-NLS-1$
+	private static final String MIN_OCCURS = "min-occurs"; //$NON-NLS-1$
+	private static final String REQUIRED = "required"; //$NON-NLS-1$
+	private static final String ALLOWED = "allowed"; //$NON-NLS-1$
+	static ModelNode addAttribute(ModelNode node, String name, ModelType dataType, boolean required) {
+		node.get(ATTRIBUTES, name, TYPE).set(dataType);
+        node.get(ATTRIBUTES, name, DESCRIPTION).set(AdminPlugin.Util.getString(name+DOT_DESC));
+        node.get(ATTRIBUTES, name, REQUIRED).set(required);
+        return node;
+    }
+}
+
+


Property changes on: branches/as7/admin/src/main/java/org/teiid/adminapi/impl/VDBMetadataMapper.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Modified: branches/as7/admin/src/main/java/org/teiid/adminapi/impl/VDBMetadataParser.java
===================================================================
--- branches/as7/admin/src/main/java/org/teiid/adminapi/impl/VDBMetadataParser.java	2011-09-21 04:13:59 UTC (rev 3502)
+++ branches/as7/admin/src/main/java/org/teiid/adminapi/impl/VDBMetadataParser.java	2011-09-23 04:11:11 UTC (rev 3503)
@@ -22,19 +22,16 @@
 package org.teiid.adminapi.impl;
 
 import java.io.InputStream;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
+import java.io.OutputStream;
+import java.util.*;
 
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamConstants;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.*;
 
+import org.teiid.adminapi.DataPolicy;
 import org.teiid.adminapi.Model;
+import org.teiid.adminapi.Translator;
 import org.teiid.adminapi.impl.DataPolicyMetadata.PermissionMetaData;
 import org.teiid.adminapi.impl.ModelMetaData.ValidationError;
-import org.teiid.adminapi.impl.VDBMetaData;
 
 @SuppressWarnings("nls")
 public class VDBMetadataParser {
@@ -306,5 +303,153 @@
 	        final Element element = elements.get(localName);
 	        return element == null ? UNKNOWN : element;
 	    }	    
-	}	
+	}
+
+	public static void marshell(VDBMetaData vdb, OutputStream out) throws XMLStreamException {
+		XMLStreamWriter writer = XMLOutputFactory.newFactory().createXMLStreamWriter(out);
+        
+		writer.writeStartElement(Element.VDB.getLocalName());
+		writer.writeAttribute(Element.NAME.getLocalName(), vdb.getName());
+		writer.writeAttribute(Element.VERSION.getLocalName(), String.valueOf(vdb.getVersion()));
+		
+		if (vdb.getDescription() != null) {
+			writeElement(writer, Element.DESCRIPTION, vdb.getDescription());
+		}
+		writeProperties(writer, vdb.getProperties());
+
+		// models
+		Collection<ModelMetaData> models = vdb.getModelMetaDatas().values();
+		for (ModelMetaData model:models) {
+			writeModel(writer, model);
+		}
+		
+		// override translators
+		for(Translator translator:vdb.getOverrideTranslators()) {
+			writeTranslator(writer, translator);
+		}
+		
+		// data-roles
+		for (DataPolicy dp:vdb.getDataPolicies()) {
+			writeDataPolicy(writer, dp);
+		}
+		
+		// entry
+		// designer only 
+		
+		writer.writeEndElement();
+	}
+	
+	private static void writeDataPolicy(XMLStreamWriter writer, DataPolicy dp)  throws XMLStreamException {
+		writer.writeStartElement(Element.DATA_ROLE.getLocalName());
+		
+		writer.writeAttribute(Element.NAME.getLocalName(), dp.getName());
+		writer.writeAttribute(Element.DATA_ROLE_ANY_ATHENTICATED_ATTR.getLocalName(), String.valueOf(dp.isAnyAuthenticated()));
+		writer.writeAttribute(Element.DATA_ROLE_ALLOW_TEMP_TABLES_ATTR.getLocalName(), String.valueOf(dp.isAllowCreateTemporaryTables()));
+
+		writeElement(writer, Element.DESCRIPTION, dp.getDescription());
+		
+		// permission
+		for (DataPolicy.DataPermission permission: dp.getPermissions()) {
+			writer.writeStartElement(Element.PERMISSION.getLocalName());
+			writeElement(writer, Element.RESOURCE_NAME, permission.getResourceName());
+			if (permission.getAllowCreate() != null) {
+				writeElement(writer, Element.ALLOW_CREATE, permission.getAllowCreate().toString());
+			}
+			if (permission.getAllowRead() != null) {
+				writeElement(writer, Element.ALLOW_READ, permission.getAllowRead().toString());
+			}
+			if (permission.getAllowUpdate() != null) {
+				writeElement(writer, Element.ALLOW_UPADTE, permission.getAllowUpdate().toString());
+			}
+			if (permission.getAllowDelete() != null) {
+				writeElement(writer, Element.ALLOW_DELETE, permission.getAllowDelete().toString());
+			}
+			if (permission.getAllowExecute() != null) {
+				writeElement(writer, Element.ALLOW_EXECUTE, permission.getAllowExecute().toString());
+			}
+			if (permission.getAllowAlter() != null) {
+				writeElement(writer, Element.ALLOW_ALTER, permission.getAllowAlter().toString());
+			}
+			writer.writeEndElement();			
+		}
+		
+		// mapped role names
+		for (String roleName:dp.getMappedRoleNames()) {
+			writeElement(writer, Element.MAPPED_ROLE_NAME, roleName);	
+		}
+		
+		writer.writeEndElement();
+	}
+
+	private static void writeTranslator(final XMLStreamWriter writer, Translator translator)  throws XMLStreamException  {
+		writer.writeStartElement(Element.TRANSLATOR.getLocalName());
+		
+		writer.writeAttribute(Element.NAME.getLocalName(), translator.getName());
+		writer.writeAttribute(Element.TYPE.getLocalName(), translator.getType());
+		writer.writeAttribute(Element.DESCRIPTION.getLocalName(), translator.getDescription());
+		
+		writeProperties(writer, translator.getProperties());
+		
+		writer.writeEndElement();
+	}
+
+	private static void writeModel(final XMLStreamWriter writer, ModelMetaData model) throws XMLStreamException {
+		writer.writeStartElement(Element.MODEL.getLocalName());
+		writer.writeAttribute(Element.NAME.getLocalName(), model.getName());
+		writer.writeAttribute(Element.TYPE.getLocalName(), model.getModelType().name());
+
+		writer.writeAttribute(Element.VISIBLE.getLocalName(), String.valueOf(model.isVisible()));
+		if (model.getPath() != null) {
+			writer.writeAttribute(Element.PATH.getLocalName(), model.getPath());
+		}
+
+		if (model.getDescription() != null) {
+			writeElement(writer, Element.DESCRIPTION, model.getDescription());
+		}
+		writeProperties(writer, model.getProperties());
+		
+		// source mappings
+		for (SourceMappingMetadata source:model.getSourceMappings()) {
+			writer.writeStartElement(Element.SOURCE.getLocalName());
+			writer.writeAttribute(Element.NAME.getLocalName(), source.getName());
+			writer.writeAttribute(Element.SOURCE_TRANSLATOR_NAME_ATTR.getLocalName(), source.getTranslatorName());
+			writer.writeAttribute(Element.SOURCE_CONNECTION_JNDI_NAME_ATTR.getLocalName(), source.getConnectionJndiName());
+			writer.writeEndElement();
+		}
+		
+		// model validation errors
+		for (ValidationError ve:model.getErrors()) {
+			writer.writeStartElement(Element.VALIDATION_ERROR.getLocalName());
+			writer.writeAttribute(Element.VALIDATION_SEVERITY_ATTR.getLocalName(), ve.getSeverity());
+			if (ve.getPath() != null) {
+				writer.writeAttribute(Element.PATH.getLocalName(), ve.getPath());
+			}
+			writer.writeCharacters(ve.getValue());
+			writer.writeEndElement();
+		}
+		writer.writeEndElement();
+	}
+	
+	private static void writeProperties(final XMLStreamWriter writer, Properties props)  throws XMLStreamException  {
+		Enumeration keys = props.propertyNames();
+		while (keys.hasMoreElements()) {
+	        writer.writeStartElement(Element.PROPERTY.getLocalName());
+			String key = (String)keys.nextElement();
+			String value = props.getProperty(key);
+			writer.writeAttribute(Element.NAME.getLocalName(), key);
+			writer.writeAttribute(Element.VALUE.getLocalName(), value);
+			writer.writeEndElement();
+		}
+	}
+	
+    private static void writeElement(final XMLStreamWriter writer, final Element element, String value) throws XMLStreamException {
+        writer.writeStartElement(element.getLocalName());
+        writer.writeCharacters(value);
+        writer.writeEndElement();
+    }     
+
+    private static void writeAttribute(final XMLStreamWriter writer, final Element element, final String value) throws XMLStreamException {
+        writer.writeAttribute(element.getLocalName(),value);
+    }     
+    
 }

Copied: branches/as7/admin/src/main/resources/org/teiid/adminapi/i18n.properties (from rev 3450, branches/as7/client/src/main/resources/org/teiid/adminapi/i18n.properties)
===================================================================
--- branches/as7/admin/src/main/resources/org/teiid/adminapi/i18n.properties	                        (rev 0)
+++ branches/as7/admin/src/main/resources/org/teiid/adminapi/i18n.properties	2011-09-23 04:11:11 UTC (rev 3503)
@@ -0,0 +1,72 @@
+description.describe=Description
+vdb-name.describe=The Virtual Database Name
+model-name.describe=Name of the model
+model-path.describe=Path to model file inside the archive
+translator-name.describe=Name of the Translator
+connection-type.describe=Allowable Connections: 1) NONE - disallow new connections 2) BY VERSION - allow connections only if the version is specified or if this is the earliest 'BY VERSION' vdb and there are no vdbs marked as 'ANY' 3) ANY - allow connections with or without a version specified. If multiple versions of same VDB are deployed, connect to one specified with ANY, or if there are multiple VDBs with ANY then connect to the latest version with ANY 
+status.describe=The Virtual Database Status
+vdb-version.describe=The Virtual Database Version
+url.describe=The Virtual Database URL
+dynamic.describe=Dynamic Virtual Database
+property-name.describe=Name
+property-value.describe=Property value
+visible.describe=Visibility of the model
+model-type.describe=Type of the Model(PHYSICAL, VIRTUAL, FUNCTION, OTHER)
+source-name.describe=Source name for this model
+jndi-name.describe=Connection JNDI Name
+translator-name.describe=Name of the translator
+error-path.describe=Path to the error in the Virtual Database
+severity.describe=Severity
+message.describe=Error message
+base-type.describe=Translator Base Type
+module-name.describe=Translator's Module name
+allow-create-temp-tables.describe=Allows create of temporary table
+any-authenticated.describe=Indicates if the role is mapped to any authenticated user
+policy-name.describe=Resource Name, for which permission defined
+properties.describe=properties
+source-mappings.describe=Model to source mapping
+validity-errors.describe=Model validation errors
+models.describe=Models inside a virtual database
+override-translators.describe=Overridden translators for the Virtual Database
+data-policies.describe=Data access policies defined for the Virtual Database
+data-permissions.describe=Permissions defined for data access
+mapped-role-names.describe=Policy name to role name mapping
+
+execution-id.describe=Unique Identifier for Request
+session-id.describe=Session Identifier
+start-time.describe=Start time for the request
+command.describe=Executing Command
+source-request.describe=Is this Connector level request
+node-id.describe=Node Identifier
+transaction-id.describe=Get Transaction XID if transaction involved
+processing-state.describe=State of the Request
+thread-state.describe=Thread state
+
+application-name.describe=Application assosiated with Session
+created-time.describe=When session created
+client-host-address.describe=Host name from where the session created
+ip-address.describe=IP address from where session is created
+last-ping-time.describe=Last ping time
+user-name.describe=User name associated with session
+security-domain.describe=Security domain that session used for login
+
+
+txn-created-time.describe=Transaction created time
+txn-scope.describe=Transaction scope (Request, Local, Global)
+txn-id.describe=Transaction Identifier (XID)
+
+max-threads.describe=Max Threads
+highest-queued.describe=Highest Queued Tasks
+queued.describe=Currently Queued Tasks
+queue-name.describe=Queue Name
+total-submitted.describe=Total submitted Tasks
+total-completed.describe=Total Completed Tasks
+highest-active-threads.describe=Highest active threads
+active-threads.describe=Number of Active Threads
+
+allow-create.describe=create allowed
+allow-read.describe= read allowed
+allow-update.describe = update allowed
+allow-delete.describe = delete allowed
+allow-execute.describe = execute allowed
+allow-alter.describe = alter allowed
\ No newline at end of file


Property changes on: branches/as7/admin/src/main/resources/org/teiid/adminapi/i18n.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Modified: branches/as7/admin/src/test/java/org/teiid/adminapi/impl/TestRequestMetadata.java
===================================================================
--- branches/as7/admin/src/test/java/org/teiid/adminapi/impl/TestRequestMetadata.java	2011-09-21 04:13:59 UTC (rev 3502)
+++ branches/as7/admin/src/test/java/org/teiid/adminapi/impl/TestRequestMetadata.java	2011-09-23 04:11:11 UTC (rev 3503)
@@ -34,9 +34,9 @@
 	@Test public void testMapping() {
 		RequestMetadata request = buildRequest();
 		
-		ModelNode node = MetadataMapper.RequestMetadataMapper.wrap(request, new ModelNode());
+		ModelNode node = VDBMetadataMapper.RequestMetadataMapper.INSTANCE.wrap(request, new ModelNode());
 		
-		RequestMetadata actual = MetadataMapper.RequestMetadataMapper.unwrap(node);
+		RequestMetadata actual = VDBMetadataMapper.RequestMetadataMapper.INSTANCE.unwrap(node);
 		
 		assertEquals(request, actual);
 		assertEquals(request.getState(), actual.getState());
@@ -128,7 +128,7 @@
 			"    }\n" + 
 			"}";
 	@Test public void testDescribe() {
-		assertEquals(desc, MetadataMapper.RequestMetadataMapper.describe(new ModelNode()).toJSONString(false));
+		assertEquals(desc, VDBMetadataMapper.RequestMetadataMapper.INSTANCE.describe(new ModelNode()).toJSONString(false));
 	}
 
 }

Modified: branches/as7/admin/src/test/java/org/teiid/adminapi/impl/TestSessionMetadata.java
===================================================================
--- branches/as7/admin/src/test/java/org/teiid/adminapi/impl/TestSessionMetadata.java	2011-09-21 04:13:59 UTC (rev 3502)
+++ branches/as7/admin/src/test/java/org/teiid/adminapi/impl/TestSessionMetadata.java	2011-09-23 04:11:11 UTC (rev 3503)
@@ -42,9 +42,9 @@
 		session.setSecurityContext("auth-domain");
 		session.setUserName("user");
 
-		ModelNode node = MetadataMapper.SessionMetadataMapper.wrap(session, new ModelNode());
+		ModelNode node = VDBMetadataMapper.SessionMetadataMapper.INSTANCE.wrap(session, new ModelNode());
 		
-		SessionMetadata session1 = MetadataMapper.SessionMetadataMapper.unwrap(node);
+		SessionMetadata session1 = VDBMetadataMapper.SessionMetadataMapper.INSTANCE.unwrap(node);
 		
 		assertEquals(session.getSessionId(), session1.getSessionId());
 		assertEquals(session.getApplicationName(), session1.getApplicationName());
@@ -130,7 +130,7 @@
 			"}"; 
 	
 	@Test public void testDescribe() {
-		ModelNode n = MetadataMapper.SessionMetadataMapper.describe(new ModelNode());
+		ModelNode n = VDBMetadataMapper.SessionMetadataMapper.INSTANCE.describe(new ModelNode());
 		//System.out.println(n.toJSONString(false));
 		assertEquals(describe, n.toJSONString(false));
 	}

Modified: branches/as7/admin/src/test/java/org/teiid/adminapi/impl/TestTransactionMetadata.java
===================================================================
--- branches/as7/admin/src/test/java/org/teiid/adminapi/impl/TestTransactionMetadata.java	2011-09-21 04:13:59 UTC (rev 3502)
+++ branches/as7/admin/src/test/java/org/teiid/adminapi/impl/TestTransactionMetadata.java	2011-09-23 04:11:11 UTC (rev 3503)
@@ -37,9 +37,9 @@
 		tm.setId("tnx-id");
 		tm.setScope("scope");
 		
-		ModelNode node = MetadataMapper.TransactionMetadataMapper.wrap(tm, new ModelNode());
+		ModelNode node = VDBMetadataMapper.TransactionMetadataMapper.INSTANCE.wrap(tm, new ModelNode());
 		
-		TransactionMetadata tm1 = MetadataMapper.TransactionMetadataMapper.unwrap(node);
+		TransactionMetadata tm1 = VDBMetadataMapper.TransactionMetadataMapper.INSTANCE.unwrap(node);
 		
 		assertEquals(tm.getAssociatedSession(), tm1.getAssociatedSession());
 		
@@ -85,7 +85,7 @@
 			"}";
 	@Test
 	public void testDescribe() {
-		ModelNode n = MetadataMapper.TransactionMetadataMapper.describe(new ModelNode());
+		ModelNode n = VDBMetadataMapper.TransactionMetadataMapper.INSTANCE.describe(new ModelNode());
 		//System.out.println(n.toJSONString(false));
 		assertEquals(describe, n.toJSONString(false));
 	}

Modified: branches/as7/admin/src/test/java/org/teiid/adminapi/impl/TestVDBMetaData.java
===================================================================
--- branches/as7/admin/src/test/java/org/teiid/adminapi/impl/TestVDBMetaData.java	2011-09-21 04:13:59 UTC (rev 3502)
+++ branches/as7/admin/src/test/java/org/teiid/adminapi/impl/TestVDBMetaData.java	2011-09-23 04:11:11 UTC (rev 3503)
@@ -51,7 +51,7 @@
 public class TestVDBMetaData {
 
 	@Test
-	public void testMarshellUnmarshell() throws Exception {
+	public void testMarshellUnmarshellUsingJaxb() throws Exception {
 		
 		VDBMetaData vdb = buildVDB();
 		
@@ -65,7 +65,7 @@
 		StringWriter sw = new StringWriter();
 		marshell.marshal(vdb, sw);
 				
-		System.out.println(sw.toString());
+		//System.out.println(sw.toString());
 
 		// UnMarshell
 		Unmarshaller un = jc.createUnmarshaller();
@@ -74,7 +74,24 @@
 		
 		validateVDB(vdb);
 	}
+	
+	
+	@Test
+	public void testMarshellUnmarshellDirectParsing() throws Exception {
+		
+		VDBMetaData vdb = buildVDB();
+		
+		ByteArrayOutputStream out = new ByteArrayOutputStream();
+		VDBMetadataParser.marshell(vdb, out);
+		
+		//System.out.println(new String(out.toByteArray()));
 
+		// UnMarshell
+		vdb = VDBMetadataParser.unmarshell(new ByteArrayInputStream(out.toByteArray()));
+		
+		validateVDB(vdb);
+	}	
+
 	static void validateVDB(VDBMetaData vdb) {
 		ModelMetaData modelOne;
 		ModelMetaData modelTwo;
@@ -217,16 +234,17 @@
 	@Test public void testVDBMetaDataMapper() {
 		VDBMetaData vdb = buildVDB();
 		
-		ModelNode node = MetadataMapper.wrap(vdb, new ModelNode());
+		ModelNode node = VDBMetadataMapper.INSTANCE.wrap(vdb, new ModelNode());
 		
-		vdb = MetadataMapper.unwrap(node);
+		vdb = VDBMetadataMapper.INSTANCE.unwrap(node);
 		validateVDB(vdb);
 	}
 	
 	@Test
 	public void testVDBMetaDataDescribe() throws Exception {
-		ModelNode node = MetadataMapper.describe(new ModelNode());
+		ModelNode node = VDBMetadataMapper.INSTANCE.describe(new ModelNode());
 		String actual = node.toJSONString(false);
+		
 		assertEquals(ObjectConverterUtil.convertFileToString(new File(UnitTestUtil.getTestDataPath() + "/vdb-describe.txt")), actual);
 	}
 }

Added: branches/as7/admin/src/test/resources/vdb-describe.txt
===================================================================
--- branches/as7/admin/src/test/resources/vdb-describe.txt	                        (rev 0)
+++ branches/as7/admin/src/test/resources/vdb-describe.txt	2011-09-23 04:11:11 UTC (rev 3503)
@@ -0,0 +1,333 @@
+{
+    "type" : {
+        "TYPE_MODEL_VALUE" : "OBJECT"
+    },
+    "attributes" : {
+        "vdb-name" : {
+            "type" : {
+                "TYPE_MODEL_VALUE" : "STRING"
+            },
+            "description" : "The Virtual Database Name",
+            "required" : true
+        },
+        "connection-type" : {
+            "type" : {
+                "TYPE_MODEL_VALUE" : "STRING"
+            },
+            "description" : "Allowable Connections: 1) NONE - disallow new connections 2) BY VERSION - allow connections only if the version is specified or if this is the earliest 'BY VERSION' vdb and there are no vdbs marked as 'ANY' 3) ANY - allow connections with or without a version specified. If multiple versions of same VDB are deployed, connect to one specified with ANY, or if there are multiple VDBs with ANY then connect to the latest version with ANY ",
+            "required" : false
+        },
+        "status" : {
+            "type" : {
+                "TYPE_MODEL_VALUE" : "STRING"
+            },
+            "description" : "The Virtual Database Status",
+            "required" : true
+        },
+        "vdb-version" : {
+            "type" : {
+                "TYPE_MODEL_VALUE" : "INT"
+            },
+            "description" : "The Virtual Database Version",
+            "required" : true
+        },
+        "url" : {
+            "type" : {
+                "TYPE_MODEL_VALUE" : "STRING"
+            },
+            "description" : "The Virtual Database URL",
+            "required" : false
+        },
+        "description" : {
+            "type" : {
+                "TYPE_MODEL_VALUE" : "STRING"
+            },
+            "description" : "Description",
+            "required" : false
+        },
+        "dynamic" : {
+            "type" : {
+                "TYPE_MODEL_VALUE" : "BOOLEAN"
+            },
+            "description" : "Dynamic Virtual Database",
+            "required" : false
+        }
+    },
+    "allowed" : [
+        "ACTIVE",
+        "INACTIVE"
+    ],
+    "children" : {
+        "properties" : {
+            "description" : "properties",
+            "type" : {
+                "TYPE_MODEL_VALUE" : "OBJECT"
+            },
+            "attributes" : {
+                "property-name" : {
+                    "type" : {
+                        "TYPE_MODEL_VALUE" : "STRING"
+                    },
+                    "description" : "Name",
+                    "required" : true
+                },
+                "property-value" : {
+                    "type" : {
+                        "TYPE_MODEL_VALUE" : "STRING"
+                    },
+                    "description" : "Property value",
+                    "required" : true
+                }
+            }
+        },
+        "models" : {
+            "type" : {
+                "TYPE_MODEL_VALUE" : "OBJECT"
+            },
+            "attributes" : {
+                "model-name" : {
+                    "type" : {
+                        "TYPE_MODEL_VALUE" : "STRING"
+                    },
+                    "description" : "Name of the model",
+                    "required" : true
+                },
+                "description" : {
+                    "type" : {
+                        "TYPE_MODEL_VALUE" : "STRING"
+                    },
+                    "description" : "Description",
+                    "required" : false
+                },
+                "visible" : {
+                    "type" : {
+                        "TYPE_MODEL_VALUE" : "BOOLEAN"
+                    },
+                    "description" : "Visibility of the model",
+                    "required" : false
+                },
+                "model-type" : {
+                    "type" : {
+                        "TYPE_MODEL_VALUE" : "STRING"
+                    },
+                    "description" : "Type of the Model(PHYSICAL, VIRTUAL, FUNCTION, OTHER)",
+                    "required" : true
+                },
+                "model-path" : {
+                    "type" : {
+                        "TYPE_MODEL_VALUE" : "STRING"
+                    },
+                    "description" : "Path to model file inside the archive",
+                    "required" : false
+                }
+            },
+            "allowed" : [
+                "PHYSICAL",
+                "VIRTUAL",
+                "FUNCTION",
+                "OTHER"
+            ],
+            "children" : {
+                "properties" : {
+                    "description" : "properties",
+                    "type" : {
+                        "TYPE_MODEL_VALUE" : "OBJECT"
+                    },
+                    "attributes" : {
+                        "property-name" : {
+                            "type" : {
+                                "TYPE_MODEL_VALUE" : "STRING"
+                            },
+                            "description" : "Name",
+                            "required" : true
+                        },
+                        "property-value" : {
+                            "type" : {
+                                "TYPE_MODEL_VALUE" : "STRING"
+                            },
+                            "description" : "Property value",
+                            "required" : true
+                        }
+                    }
+                },
+                "source-mappings" : {
+                    "description" : "Model to source mapping",
+                    "type" : {
+                        "TYPE_MODEL_VALUE" : "OBJECT"
+                    },
+                    "attributes" : {
+                        "source-name" : {
+                            "type" : {
+                                "TYPE_MODEL_VALUE" : "STRING"
+                            },
+                            "description" : "Source name for this model",
+                            "required" : true
+                        },
+                        "jndi-name" : {
+                            "type" : {
+                                "TYPE_MODEL_VALUE" : "STRING"
+                            },
+                            "description" : "Connection JNDI Name",
+                            "required" : true
+                        },
+                        "translator-name" : {
+                            "type" : {
+                                "TYPE_MODEL_VALUE" : "STRING"
+                            },
+                            "description" : "Name of the translator",
+                            "required" : true
+                        }
+                    }
+                },
+                "validity-errors" : {
+                    "description" : "Model validation errors",
+                    "type" : {
+                        "TYPE_MODEL_VALUE" : "OBJECT"
+                    },
+                    "attributes" : {
+                        "error-path" : {
+                            "type" : {
+                                "TYPE_MODEL_VALUE" : "STRING"
+                            },
+                            "description" : "Path to the error in the Virtual Database",
+                            "required" : false
+                        },
+                        "severity" : {
+                            "type" : {
+                                "TYPE_MODEL_VALUE" : "STRING"
+                            },
+                            "description" : "Severity",
+                            "required" : true
+                        },
+                        "message" : {
+                            "type" : {
+                                "TYPE_MODEL_VALUE" : "STRING"
+                            },
+                            "description" : "Error message",
+                            "required" : true
+                        }
+                    }
+                }
+            },
+            "description" : "Models inside a virtual database",
+            "min-occurs" : 1
+        },
+        "override-translators" : {
+            "description" : "Overridden translators for the Virtual Database",
+            "type" : {
+                "TYPE_MODEL_VALUE" : "OBJECT"
+            },
+            "attributes" : {
+                "translator-name" : {
+                    "type" : {
+                        "TYPE_MODEL_VALUE" : "STRING"
+                    },
+                    "description" : "Name of the translator",
+                    "required" : true
+                },
+                "base-type" : {
+                    "type" : {
+                        "TYPE_MODEL_VALUE" : "STRING"
+                    },
+                    "description" : "Translator Base Type",
+                    "required" : true
+                },
+                "description" : {
+                    "type" : {
+                        "TYPE_MODEL_VALUE" : "STRING"
+                    },
+                    "description" : "Description",
+                    "required" : false
+                },
+                "module-name" : {
+                    "type" : {
+                        "TYPE_MODEL_VALUE" : "STRING"
+                    },
+                    "description" : "Translator's Module name",
+                    "required" : false
+                }
+            },
+            "children" : {"properties" : {
+                "description" : "properties",
+                "type" : {
+                    "TYPE_MODEL_VALUE" : "OBJECT"
+                },
+                "attributes" : {
+                    "property-name" : {
+                        "type" : {
+                            "TYPE_MODEL_VALUE" : "STRING"
+                        },
+                        "description" : "Name",
+                        "required" : true
+                    },
+                    "property-value" : {
+                        "type" : {
+                            "TYPE_MODEL_VALUE" : "STRING"
+                        },
+                        "description" : "Property value",
+                        "required" : true
+                    }
+                }
+            }}
+        },
+        "data-policies" : {
+            "description" : "Data access policies defined for the Virtual Database",
+            "type" : {
+                "TYPE_MODEL_VALUE" : "OBJECT"
+            },
+            "attributes" : {
+                "policy-name" : {
+                    "type" : {
+                        "TYPE_MODEL_VALUE" : "STRING"
+                    },
+                    "description" : "Resource Name, for which permission defined",
+                    "required" : true
+                },
+                "description" : {
+                    "type" : {
+                        "TYPE_MODEL_VALUE" : "STRING"
+                    },
+                    "description" : "Description",
+                    "required" : false
+                },
+                "allow-create-temp-tables" : {
+                    "type" : {
+                        "TYPE_MODEL_VALUE" : "BOOLEAN"
+                    },
+                    "description" : "Allows create of temporary table",
+                    "required" : false
+                },
+                "any-authenticated" : {
+                    "type" : {
+                        "TYPE_MODEL_VALUE" : "BOOLEAN"
+                    },
+                    "description" : "Indicates if the role is mapped to any authenticated user",
+                    "required" : false
+                }
+            },
+            "children" : {
+                "data-permissions" : {
+                    "description" : "Permissions defined for data access",
+                    "min-occurs" : 1,
+                    "children" : {
+                        "allow-create" : {"description" : "create allowed"},
+                        "allow-read" : {"description" : "read allowed"},
+                        "allow-update" : {"description" : "update allowed"},
+                        "allow-delete" : {"description" : "delete allowed"},
+                        "allow-execute" : {"description" : "execute allowed"},
+                        "allow-alter" : {"description" : "alter allowed"}
+                    }
+                },
+                "mapped-role-names" : {
+                    "type" : {
+                        "TYPE_MODEL_VALUE" : "LIST"
+                    },
+                    "description" : "Policy name to role name mapping",
+                    "value-type" : {
+                        "TYPE_MODEL_VALUE" : "STRING"
+                    }
+                }
+            }
+        }
+    }
+}
\ No newline at end of file


Property changes on: branches/as7/admin/src/test/resources/vdb-describe.txt
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Modified: branches/as7/adminshell/src/main/java/org/teiid/adminshell/AdminShell.java
===================================================================
--- branches/as7/adminshell/src/main/java/org/teiid/adminshell/AdminShell.java	2011-09-21 04:13:59 UTC (rev 3502)
+++ branches/as7/adminshell/src/main/java/org/teiid/adminshell/AdminShell.java	2011-09-23 04:11:11 UTC (rev 3503)
@@ -82,7 +82,7 @@
 	@SuppressWarnings("nls")
 	public static void connectAsAdmin() throws AdminException {
 		loadConnectionProperties();
-		connectAsAdmin(p.getProperty("admin.host", "localhost"), Integer.parseInt(p.getProperty("admin.port", "9990")), p.getProperty("admin.user", "admin"), p.getProperty("admin.password", "admin"), "conn-" + connectionCount++);
+		connectAsAdmin(p.getProperty("admin.host", "localhost"), Integer.parseInt(p.getProperty("admin.port", "9999")), p.getProperty("admin.user", "admin"), p.getProperty("admin.password", "admin"), "conn-" + connectionCount++);
 	}
 
 	static void loadConnectionProperties() {
@@ -150,11 +150,9 @@
 		getAdmin().clearCache(cacheType, vdbName, vdbVersion);
 	}	
 
-	@Doc(text = "Delete a VDB")
-	public static void deleteVDB(
-			@Doc(text = "vdb name") String vdbName, 
-			@Doc(text = "vdb version") int vdbVersion) throws AdminException {
-		getAdmin().deleteVDB(vdbName, vdbVersion);
+	@Doc(text = "Undeploy a artifact (JAR, RAR, VDB)")
+	public static void undeploy(@Doc(text = "deployed name") String deployedName) throws AdminException {
+		getAdmin().undeploy(deployedName);
 	}
 
 	@Doc(text = "Get all cache type Strings")
@@ -172,7 +170,7 @@
 	}
 
 	@Doc(text = "Get all translator instances")
-	public static Collection<Translator> getTranslators()
+	public static Collection<? extends Translator> getTranslators()
 			throws AdminException {
 		return getAdmin().getTranslators();
 	}
@@ -185,30 +183,30 @@
 	}
 
 	@Doc(text = "Get all PropertyDefinitions for the given template")
-	public static Collection<PropertyDefinition> getTemplatePropertyDefinitions(
+	public static Collection<? extends PropertyDefinition> getTemplatePropertyDefinitions(
 			@Doc(text = "template name") String templateName) throws AdminException {
 		return getAdmin().getTemplatePropertyDefinitions(templateName);
 	}
 
 	@Doc(text = "Get all Request instances")
-	public static Collection<Request> getRequests() throws AdminException {
+	public static Collection<? extends Request> getRequests() throws AdminException {
 		return getAdmin().getRequests();
 	}
 
 	@Doc(text = "Get all Request instances for the given session")
-	public static Collection<Request> getRequestsForSession(
+	public static Collection<? extends Request> getRequestsForSession(
 			@Doc(text = "session id") String sessionId)
 			throws AdminException {
 		return getAdmin().getRequestsForSession(sessionId);
 	}
 
 	@Doc(text = "Get all Session instances")
-	public static Collection<Session> getSessions() throws AdminException {
+	public static Collection<? extends Session> getSessions() throws AdminException {
 		return getAdmin().getSessions();
 	}
 
 	@Doc(text = "Get all Transaction instances")
-	public static Collection<Transaction> getTransactions() throws AdminException {
+	public static Collection<? extends Transaction> getTransactions() throws AdminException {
 		return getAdmin().getTransactions();
 	}
 
@@ -220,7 +218,7 @@
 	}
 
 	@Doc(text = "Get all VDB instances")
-	public static Set<VDB> getVDBs() throws AdminException {
+	public static Set<? extends VDB> getVDBs() throws AdminException {
 		return getAdmin().getVDBs();
 	}
 
@@ -279,7 +277,7 @@
 	
 	@Doc(text = "Checks if a translator exists")
 	public static boolean hasTranslator(@Doc(text = "deployed name") String factoryName) throws AdminException {
-	    Collection<Translator> bindings = getAdmin().getTranslators();
+	    Collection<? extends Translator> bindings = getAdmin().getTranslators();
 	    
 	    for (Translator binding:bindings) {
 	        if (binding.getName().equals(factoryName)) {
@@ -292,7 +290,7 @@
 	@Doc(text = "Checks if a VDB exists")
 	public static boolean hasVDB(
 			@Doc(text = "vdb name") String vdbName) throws AdminException {
-	    Collection<VDB> vdbs = getAdmin().getVDBs();
+	    Collection<? extends VDB> vdbs = getAdmin().getVDBs();
 	    for (VDB vdb:vdbs) {
 	        if (vdb.getName().equals(vdbName)) {
 	            return true;
@@ -305,7 +303,7 @@
 	public static boolean hasVDB(
 			@Doc(text = "vdb name") String vdbName, 
 			@Doc(text = "vdb version") int version) throws AdminException {
-	    Collection<VDB> vdbs = getAdmin().getVDBs();
+	    Collection<? extends VDB> vdbs = getAdmin().getVDBs();
 	    for (VDB vdb:vdbs) {
 	        if (vdb.getName().equals(vdbName) && vdb.getVersion() == version) {
 	            return true;
@@ -322,13 +320,12 @@
 		ObjectConverterUtil.write(contents, fileName);	
 	}*/
 	
-	@Doc(text = "Deploy a VDB from file")
-	public static void deployVDB(
-			@Doc(text = "file name") String vdbFile) throws AdminException, FileNotFoundException {
+	@Doc(text = "Deploy a Artifact (JAR, RAR, VDB) from file")
+	public static void deploy(@Doc(text = "file name") String vdbFile) throws AdminException, FileNotFoundException {
 		File file = new File(vdbFile);
 		FileInputStream fis = new FileInputStream(file);
 		try {
-			getAdmin().deployVDB(file.getName(), fis);
+			getAdmin().deploy(file.getName(), fis);
 		} finally {
 			try {
 				fis.close();

Modified: branches/as7/adminshell/src/test/java/org/teiid/adminshell/TestAdminShell.java
===================================================================
--- branches/as7/adminshell/src/test/java/org/teiid/adminshell/TestAdminShell.java	2011-09-21 04:13:59 UTC (rev 3502)
+++ branches/as7/adminshell/src/test/java/org/teiid/adminshell/TestAdminShell.java	2011-09-23 04:11:11 UTC (rev 3503)
@@ -48,8 +48,8 @@
 	}
 	
 	@Test public void testDeployVDB() throws AdminException, FileNotFoundException {
-		AdminShell.deployVDB(UnitTestUtil.getTestDataPath() + "/foo/bar.txt");
-		Mockito.verify(admin).deployVDB(Mockito.eq("bar.txt"), (InputStream)Mockito.anyObject());
+		AdminShell.deploy(UnitTestUtil.getTestDataPath() + "/foo/bar.txt");
+		Mockito.verify(admin).deploy(Mockito.eq("bar.txt"), (InputStream)Mockito.anyObject());
 	}
 	
 }

Modified: branches/as7/build/assembly/jboss-as7/dist.xml
===================================================================
--- branches/as7/build/assembly/jboss-as7/dist.xml	2011-09-21 04:13:59 UTC (rev 3502)
+++ branches/as7/build/assembly/jboss-as7/dist.xml	2011-09-23 04:11:11 UTC (rev 3503)
@@ -1,4 +1,4 @@
-<!--This script builds a JAR for the Embedded Server Installation -->
+<!--This script builds a zip for Teiid Server Installation -->
 <assembly>
   
   <id>jboss-dist</id>

Modified: branches/as7/build/kits/adminshell/connection.properties
===================================================================
--- branches/as7/build/kits/adminshell/connection.properties	2011-09-21 04:13:59 UTC (rev 3502)
+++ branches/as7/build/kits/adminshell/connection.properties	2011-09-23 04:11:11 UTC (rev 3503)
@@ -2,6 +2,7 @@
 jdbc.password=user
 jdbc.url=jdbc:teiid:admin at mm://localhost:31000;
 
-admin.url=mms://localhost:31443
+admin.host=localhost
+admin.port=9999
 admin.user=admin
 admin.password=admin

Deleted: branches/as7/client/src/main/resources/org/teiid/adminapi/i18n.properties
===================================================================
--- branches/as7/client/src/main/resources/org/teiid/adminapi/i18n.properties	2011-09-21 04:13:59 UTC (rev 3502)
+++ branches/as7/client/src/main/resources/org/teiid/adminapi/i18n.properties	2011-09-23 04:11:11 UTC (rev 3503)
@@ -1,65 +0,0 @@
-description.describe=Description
-vdb-name.describe=The Virtual Database Name
-model-name.describe=Name of the model
-model-path.describe=Path to model file inside the archive
-translator-name.describe=Name of the Translator
-connection-type.describe=Allowable Connections: 1) NONE - disallow new connections 2) BY VERSION - allow connections only if the version is specified or if this is the earliest 'BY VERSION' vdb and there are no vdbs marked as 'ANY' 3) ANY - allow connections with or without a version specified. If multiple versions of same VDB are deployed, connect to one specified with ANY, or if there are multiple VDBs with ANY then connect to the latest version with ANY 
-status.describe=The Virtual Database Status
-vdb-version.describe=The Virtual Database Version
-url.describe=The Virtual Database URL
-dynamic.describe=Dynamic Virtual Database
-property-name.describe=Name
-property-value.describe=Property value
-visible.describe=Visibility of the model
-model-type.describe=Type of the Model(PHYSICAL, VIRTUAL, FUNCTION, OTHER)
-source-name.describe=Source name for this model
-jndi-name.describe=Connection JNDI Name
-translator-name.describe=Name of the translator
-error-path.describe=Path to the error in the Virtual Database
-severity.describe=Severity
-message.describe=Error message
-base-type.describe=Translator Base Type
-module-name.describe=Translator's Module name
-allow-create-temp-tables.describe=Allows create of temporary table
-any-authenticated.describe=Indicates if the role is mapped to any authenticated user
-policy-name.describe=Resource Name, for which permission defined
-properties.describe=properties
-source-mappings.describe=Model to source mapping
-validity-errors.describe=Model validation errors
-models.describe=Models inside a virtual database
-override-translators.describe=Overridden translators for the Virtual Database
-data-policies.describe=Data access policies defined for the Virtual Database
-data-permissions.describe=Permissions defined for data access
-mapped-role-names.describe=Policy name to role name mapping
-
-execution-id.describe=Unique Identifier for Request
-session-id.describe=Session Identifier
-start-time.describe=Start time for the request
-command.describe=Executing Command
-source-request.describe=Is this Connector level request
-node-id.describe=Node Identifier
-transaction-id.describe=Get Transaction XID if transaction involved
-processing-state.describe=State of the Request
-thread-state.describe=Thread state
-
-application-name.describe=Application assosiated with Session
-created-time.describe=When session created
-client-host-address.describe=Host name from where the session created
-ip-address.describe=IP address from where session is created
-last-ping-time.describe=Last ping time
-user-name.describe=User name associated with session
-security-domain.describe=Security domain that session used for login
-
-
-txn-created-time.describe=Transaction created time
-txn-scope.describe=Transaction scope (Request, Local, Global)
-txn-id.describe=Transaction Identifier (XID)
-
-max-threads.describe=Max Threads
-highest-queued.describe=Highest Queued Tasks
-queued.describe=Currently Queued Tasks
-queue-name.describe=Queue Name
-total-submitted.describe=Total submitted Tasks
-total-completed.describe=Total Completed Tasks
-highest-active-threads.describe=Highest active threads
-active-threads.describe=Number of Active Threads
\ No newline at end of file

Modified: branches/as7/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
===================================================================
--- branches/as7/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java	2011-09-21 04:13:59 UTC (rev 3502)
+++ branches/as7/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java	2011-09-23 04:11:11 UTC (rev 3503)
@@ -535,81 +535,6 @@
         }
     }
     
-    private void clearPlanCache(){
-        LogManager.logInfo(LogConstants.CTX_DQP, QueryPlugin.Util.getString("DQPCore.Clearing_prepared_plan_cache")); //$NON-NLS-1$
-        this.prepPlanCache.clearAll();
-    }
-
-	private void clearResultSetCache() {
-		//clear cache in server
-		if(rsCache != null){
-			rsCache.clearAll();
-		}
-	}
-	
-    private void clearPlanCache(String vdbName, int version){
-        LogManager.logInfo(LogConstants.CTX_DQP, QueryPlugin.Util.getString("DQPCore.Clearing_prepared_plan_cache_for_vdb", vdbName, version)); //$NON-NLS-1$
-        this.prepPlanCache.clearForVDB(vdbName, version);
-    }
-
-	private void clearResultSetCache(String vdbName, int version) {
-		//clear cache in server
-		if(rsCache != null){
-			LogManager.logInfo(LogConstants.CTX_DQP, QueryPlugin.Util.getString("DQPCore.clearing_resultset_cache", vdbName, version)); //$NON-NLS-1$
-			rsCache.clearForVDB(vdbName, version);
-		}
-	}
-	
-	public CacheStatisticsMetadata getCacheStatistics(String cacheType) {
-		if (cacheType.equalsIgnoreCase(Admin.Cache.PREPARED_PLAN_CACHE.toString())) {
-			return buildCacheStats(Admin.Cache.PREPARED_PLAN_CACHE.toString(), this.prepPlanCache);
-		}
-		else if (cacheType.equalsIgnoreCase(Admin.Cache.QUERY_SERVICE_RESULT_SET_CACHE.toString())) {
-			return buildCacheStats(Admin.Cache.QUERY_SERVICE_RESULT_SET_CACHE.toString(), this.rsCache);
-		}
-		return null;
-	}
-	
-	private CacheStatisticsMetadata buildCacheStats(String name, SessionAwareCache cache) {
-		CacheStatisticsMetadata stats = new CacheStatisticsMetadata();
-		stats.setName(name);
-		stats.setHitRatio(cache.getRequestCount() == 0?0:((double)cache.getCacheHitCount()/cache.getRequestCount())*100);
-		stats.setTotalEntries(cache.getTotalCacheEntries());
-		stats.setRequestCount(cache.getRequestCount());
-		return stats;
-	}
-	
-    public Collection<String> getCacheTypes(){
-    	ArrayList<String> caches = new ArrayList<String>();
-    	caches.add(Admin.Cache.PREPARED_PLAN_CACHE.toString());
-    	caches.add(Admin.Cache.QUERY_SERVICE_RESULT_SET_CACHE.toString());
-    	return caches;
-    }	
-	
-	public void clearCache(String cacheType) {
-		Admin.Cache cache = Admin.Cache.valueOf(cacheType);
-		switch (cache) {
-		case PREPARED_PLAN_CACHE:
-			clearPlanCache();
-			break;
-		case QUERY_SERVICE_RESULT_SET_CACHE:
-			clearResultSetCache();
-			break;
-		}
-	}
-	
-	public void clearCache(String cacheType, String vdbName, int version) {
-		Admin.Cache cache = Admin.Cache.valueOf(cacheType);
-		switch (cache) {
-		case PREPARED_PLAN_CACHE:
-			clearPlanCache(vdbName, version);
-			break;
-		case QUERY_SERVICE_RESULT_SET_CACHE:
-			clearResultSetCache(vdbName, version);
-			break;
-		}
-	}	
-    
 	public Collection<TransactionMetadata> getTransactions() {
 		return this.transactionService.getTransactions();
 	}

Modified: branches/as7/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java
===================================================================
--- branches/as7/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java	2011-09-21 04:13:59 UTC (rev 3502)
+++ branches/as7/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java	2011-09-23 04:11:11 UTC (rev 3503)
@@ -23,12 +23,10 @@
 package org.teiid.dqp.internal.process;
 
 import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
+import java.util.*;
 import java.util.concurrent.atomic.AtomicInteger;
 
+import org.teiid.adminapi.Admin;
 import org.teiid.cache.Cachable;
 import org.teiid.cache.Cache;
 import org.teiid.cache.CacheConfiguration;
@@ -338,4 +336,15 @@
     	}
     	return this.distributedCache.keys();
     }
+    
+    public static Collection<String> getCacheTypes(){
+    	ArrayList<String> caches = new ArrayList<String>();
+    	caches.add(Admin.Cache.PREPARED_PLAN_CACHE.toString());
+    	caches.add(Admin.Cache.QUERY_SERVICE_RESULT_SET_CACHE.toString());
+    	return caches;
+    }    
+    
+    public static boolean isResultsetCache(String cacheType) {
+    	return (Admin.Cache.valueOf(cacheType) == Admin.Cache.QUERY_SERVICE_RESULT_SET_CACHE);
+    }
 }

Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/BaseOperationHandler.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/BaseOperationHandler.java	2011-09-21 04:13:59 UTC (rev 3502)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/BaseOperationHandler.java	2011-09-23 04:11:11 UTC (rev 3503)
@@ -59,12 +59,10 @@
             context.addStep(new OperationStepHandler() {
                 public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
 
-                    ModelNode model = context.getResult();
-                    
                     final ModelNode address = operation.require(OP_ADDR);
                     final PathAddress pathAddress = PathAddress.pathAddress(address);
                     
-                    executeOperation(getService(context, pathAddress), operation, model);
+                    executeOperation(context, getService(context, pathAddress, operation), operation);
                 	
                 	context.completeStep();
                 }
@@ -78,7 +76,7 @@
     }
 	
     @SuppressWarnings("unused")
-	protected T getService(OperationContext context, PathAddress pathAddress) throws OperationFailedException{
+	protected T getService(OperationContext context, PathAddress pathAddress, ModelNode operation) throws OperationFailedException{
     	return null;
     }
 	
@@ -92,15 +90,15 @@
         return operation;
     }	
     
-    protected String getReplyName() {
-    	return name()+".reply"+DESCRIBE; //$NON-NLS-1$
-    }
+//    protected String getReplyName() {
+//    	return name()+".reply"+DESCRIBE; //$NON-NLS-1$
+//    }
     
     protected String getParameterDescription(ResourceBundle bundle, String paramName) {
     	return bundle.getString(name()+"."+paramName+DESCRIBE); //$NON-NLS-1$ 
     }    
     
-	abstract protected void executeOperation(T service, ModelNode operation, ModelNode node) throws OperationFailedException;
+	abstract protected void executeOperation(OperationContext context, T service, ModelNode operation) throws OperationFailedException;
 	
 	protected void describeParameters(@SuppressWarnings("unused") ModelNode operationNode, @SuppressWarnings("unused")ResourceBundle bundle) {
 	}

Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/ObjectSerializer.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/ObjectSerializer.java	2011-09-21 04:13:59 UTC (rev 3502)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/ObjectSerializer.java	2011-09-23 04:11:11 UTC (rev 3503)
@@ -83,6 +83,10 @@
 	public File buildVDBFile(VDBMetaData vdb) {
 		return new File(baseDirectory(vdb.getName()+"_"+vdb.getVersion()), vdb.getName()+"_"+vdb.getVersion()+ATTACHMENT_SUFFIX); //$NON-NLS-1$ //$NON-NLS-2$
 	}
+	
+	public File buildVdbXml(VDBMetaData vdb) {
+		return new File(baseDirectory(vdb.getName()+"_"+vdb.getVersion()), "vdb.xml"); //$NON-NLS-1$ //$NON-NLS-2$
+	}
 
 	public File buildModelFile(VDBMetaData vdb, String modelName) {
 		return new File(baseDirectory(vdb.getName()+"_"+vdb.getVersion()), vdb.getName()+"_"+vdb.getVersion()+"_"+modelName+ATTACHMENT_SUFFIX); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
@@ -114,5 +118,11 @@
 		}
 		cacheFile.delete();
 		return null;
+	}
+
+	public OutputStream getVdbXmlOutputStream(VDBMetaData vdb) throws IOException {
+		File f = buildVdbXml(vdb);
+		f.mkdirs();
+		return new FileOutputStream(f);
 	}	
 }

Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/OperationsConstants.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/OperationsConstants.java	2011-09-21 04:13:59 UTC (rev 3502)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/OperationsConstants.java	2011-09-23 04:11:11 UTC (rev 3503)
@@ -28,6 +28,12 @@
 	public static final String EXECUTION_ID = "execution-id";//$NON-NLS-1$
 	public static final String CACHE_TYPE = "cache-type";//$NON-NLS-1$
 	public static final String XID = "xid";//$NON-NLS-1$
+	public static final String DATA_ROLE = "data-role"; //$NON-NLS-1$
+	public static final String MAPPED_ROLE = "mapped-role"; //$NON-NLS-1$
+	public static final String CONNECTION_TYPE = "connection-type"; //$NON-NLS-1$
+	public static final String MODEL_NAME = "model-name"; //$NON-NLS-1$
+	public static final String SOURCE_NAME = "source-name"; //$NON-NLS-1$
+	public static final String DS_NAME = "ds-name"; //$NON-NLS-1$
 	
 	public static final String SOURCE_VDBNAME = "source-vdb-name";//$NON-NLS-1$
 	public static final String SOURCE_VDBVERSION = "source-vdb-version";//$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-09-21 04:13:59 UTC (rev 3502)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineOperationHandler.java	2011-09-23 04:11:11 UTC (rev 3503)
@@ -33,13 +33,19 @@
 import org.jboss.dmr.ModelNode;
 import org.jboss.dmr.ModelType;
 import org.jboss.msc.service.ServiceController;
+import org.teiid.adminapi.Admin;
 import org.teiid.adminapi.AdminException;
+import org.teiid.adminapi.AdminProcessingException;
+import org.teiid.adminapi.VDB;
 import org.teiid.adminapi.impl.*;
-import org.teiid.adminapi.impl.MetadataMapper.TransactionMetadataMapper;
-import org.teiid.adminapi.impl.MetadataMapper.VDBTranslatorMetaDataMapper;
+import org.teiid.adminapi.impl.VDBMetadataMapper.TransactionMetadataMapper;
+import org.teiid.adminapi.impl.VDBMetadataMapper.VDBTranslatorMetaDataMapper;
 import org.teiid.deployers.VDBRepository;
 import org.teiid.dqp.internal.datamgr.TranslatorRepository;
+import org.teiid.dqp.internal.process.SessionAwareCache;
 import org.teiid.jboss.deployers.RuntimeEngineDeployer;
+import org.teiid.logging.LogConstants;
+import org.teiid.logging.LogManager;
 
 abstract class QueryEngineOperationHandler extends BaseOperationHandler<RuntimeEngineDeployer> {
 	
@@ -48,7 +54,7 @@
 	}
 	
 	@Override
-	protected RuntimeEngineDeployer getService(OperationContext context, PathAddress pathAddress) throws OperationFailedException {
+	protected RuntimeEngineDeployer getService(OperationContext context, PathAddress pathAddress, ModelNode operation) throws OperationFailedException {
 		String serviceName = pathAddress.getLastElement().getValue();
         ServiceController<?> sc = context.getServiceRegistry(false).getRequiredService(TeiidServiceNames.engineServiceName(serviceName));
         return RuntimeEngineDeployer.class.cast(sc.getValue());	
@@ -62,7 +68,7 @@
 	}
 	
 	@Override
-	public TranslatorRepository getService(OperationContext context, PathAddress pathAddress) throws OperationFailedException {
+	public TranslatorRepository getService(OperationContext context, PathAddress pathAddress, ModelNode operation) throws OperationFailedException {
         ServiceController<?> sc = context.getServiceRegistry(false).getRequiredService(TeiidServiceNames.TRANSLATOR_REPO);
         return TranslatorRepository.class.cast(sc.getValue());	
 	}
@@ -73,12 +79,11 @@
 		super(operationName);
 	}
 	@Override
-	protected void executeOperation(RuntimeEngineDeployer engine, ModelNode operation, ModelNode node) throws OperationFailedException{
-		node.set(engine.getRuntimeVersion());
+	protected void executeOperation(OperationContext context, RuntimeEngineDeployer engine, ModelNode operation) throws OperationFailedException{
+		context.getResult().set(engine.getRuntimeVersion());
 	}
 	protected void describeParameters(ModelNode operationNode, ResourceBundle bundle) {
 		operationNode.get(REPLY_PROPERTIES).set(ModelType.STRING);
-		operationNode.get(REPLY_PROPERTIES, DESCRIBE).set(bundle.getString(getReplyName()));
 	}	
 }
 
@@ -87,52 +92,53 @@
 		super(operationName);
 	}
 	@Override
-	protected void executeOperation(RuntimeEngineDeployer engine, ModelNode operation, ModelNode node) throws OperationFailedException{
+	protected void executeOperation(OperationContext context, RuntimeEngineDeployer engine, ModelNode operation) throws OperationFailedException{
 		try {
-			node.set(String.valueOf(engine.getActiveSessionsCount()));
+			context.getResult().set(String.valueOf(engine.getActiveSessionsCount()));
 		} catch (AdminException e) {
-			// TODO: handle exception in model node terms 
+			throw new OperationFailedException(new ModelNode().set(e.getMessage()));
 		}
 	}
 	protected void describeParameters(ModelNode operationNode, ResourceBundle bundle) {
 		operationNode.get(REPLY_PROPERTIES).set(ModelType.INT);
-		operationNode.get(REPLY_PROPERTIES, DESCRIBE).set(bundle.getString(getReplyName()));
 	}		
 }
 
-class GetActiveSessions extends QueryEngineOperationHandler{
-	protected GetActiveSessions() {
-		super("active-sessions"); //$NON-NLS-1$
+class ListSessions extends QueryEngineOperationHandler{
+	protected ListSessions() {
+		super("list-sessions"); //$NON-NLS-1$
 	}
 	@Override
-	protected void executeOperation(RuntimeEngineDeployer engine, ModelNode operation, ModelNode node) throws OperationFailedException{
+	protected void executeOperation(OperationContext context, RuntimeEngineDeployer engine, ModelNode operation) throws OperationFailedException{
 		try {
+			ModelNode result = context.getResult();
 			Collection<SessionMetadata> sessions = engine.getActiveSessions();
 			for (SessionMetadata session:sessions) {
-				MetadataMapper.SessionMetadataMapper.wrap(session, node.add());
+				VDBMetadataMapper.SessionMetadataMapper.INSTANCE.wrap(session, result.add());
 			}
 		} catch (AdminException e) {
-			// TODO: handle exception in model node terms 
+			throw new OperationFailedException(new ModelNode().set(e.getMessage()));
 		}
 	}
 	
 	protected void describeParameters(ModelNode operationNode, ResourceBundle bundle) {
-		operationNode.get(REPLY_PROPERTIES).add(MetadataMapper.SessionMetadataMapper.describe(new ModelNode()));
+		operationNode.get(REPLY_PROPERTIES).add(VDBMetadataMapper.SessionMetadataMapper.INSTANCE.describe(new ModelNode()));
 	}	
 }
 
-class GetRequestsPerSession extends QueryEngineOperationHandler{
-	protected GetRequestsPerSession() {
+class RequestsPerSession extends QueryEngineOperationHandler{
+	protected RequestsPerSession() {
 		super("requests-per-session"); //$NON-NLS-1$
 	}
 	@Override
-	protected void executeOperation(RuntimeEngineDeployer engine, ModelNode operation, ModelNode node) throws OperationFailedException{
+	protected void executeOperation(OperationContext context, RuntimeEngineDeployer engine, ModelNode operation) throws OperationFailedException{
 		if (!operation.hasDefined(OperationsConstants.SESSION)) {
 			throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.SESSION+MISSING)));
 		}
+		ModelNode result = context.getResult();
 		List<RequestMetadata> requests = engine.getRequestsForSession(operation.get(OperationsConstants.SESSION).asString());
 		for (RequestMetadata request:requests) {
-			MetadataMapper.RequestMetadataMapper.wrap(request, node.add());
+			VDBMetadataMapper.RequestMetadataMapper.INSTANCE.wrap(request, result.add());
 		}
 	}
 	
@@ -141,16 +147,33 @@
 		operationNode.get(REQUEST_PROPERTIES, OperationsConstants.SESSION, REQUIRED).set(true);
 		operationNode.get(REQUEST_PROPERTIES, OperationsConstants.SESSION, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.SESSION));
 		
-		operationNode.get(REPLY_PROPERTIES).add(MetadataMapper.RequestMetadataMapper.describe(new ModelNode()));
+		operationNode.get(REPLY_PROPERTIES).add(VDBMetadataMapper.RequestMetadataMapper.INSTANCE.describe(new ModelNode()));
 	}	
 }
 
-class GetRequestsPerVDB extends QueryEngineOperationHandler{
-	protected GetRequestsPerVDB() {
+class ListRequests extends QueryEngineOperationHandler{
+	protected ListRequests() {
+		super("list-requests"); //$NON-NLS-1$
+	}
+	@Override
+	protected void executeOperation(OperationContext context, RuntimeEngineDeployer engine, ModelNode operation) throws OperationFailedException{
+		ModelNode result = context.getResult();
+		List<RequestMetadata> requests = engine.getRequests();
+		for (RequestMetadata request:requests) {
+			VDBMetadataMapper.RequestMetadataMapper.INSTANCE.wrap(request, result.add());
+		}
+	}
+	protected void describeParameters(ModelNode operationNode, ResourceBundle bundle) {
+		operationNode.get(REPLY_PROPERTIES).add(VDBMetadataMapper.RequestMetadataMapper.INSTANCE.describe(new ModelNode()));
+	}	
+}
+
+class RequestsPerVDB extends QueryEngineOperationHandler{
+	protected RequestsPerVDB() {
 		super("requests-per-vdb"); //$NON-NLS-1$
 	}
 	@Override
-	protected void executeOperation(RuntimeEngineDeployer engine, ModelNode operation, ModelNode node) throws OperationFailedException{
+	protected void executeOperation(OperationContext context, RuntimeEngineDeployer engine, ModelNode operation) throws OperationFailedException{
 		try {
 			
 			if (!operation.hasDefined(OperationsConstants.VDB_NAME)) {
@@ -159,12 +182,13 @@
 			if (!operation.hasDefined(OperationsConstants.VDB_VERSION)) {
 				throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.VDB_VERSION+MISSING)));
 			}
-						
+			
+			ModelNode result = context.getResult();
 			String vdbName = operation.get(OperationsConstants.VDB_NAME).asString();
 			int vdbVersion = operation.get(OperationsConstants.VDB_VERSION).asInt();
 			List<RequestMetadata> requests = engine.getRequestsUsingVDB(vdbName,vdbVersion);
 			for (RequestMetadata request:requests) {
-				MetadataMapper.RequestMetadataMapper.wrap(request, node.add());
+				VDBMetadataMapper.RequestMetadataMapper.INSTANCE.wrap(request, result.add());
 			}
 		} catch (AdminException e) {
 			throw new OperationFailedException(e, new ModelNode().set(e.getMessage()));
@@ -180,7 +204,7 @@
 		operationNode.get(REQUEST_PROPERTIES, OperationsConstants.VDB_VERSION, REQUIRED).set(true);
 		operationNode.get(REQUEST_PROPERTIES, OperationsConstants.VDB_VERSION, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.VDB_VERSION)); 
 		
-		operationNode.get(REPLY_PROPERTIES).add(MetadataMapper.RequestMetadataMapper.describe(new ModelNode()));
+		operationNode.get(REPLY_PROPERTIES).add(VDBMetadataMapper.RequestMetadataMapper.INSTANCE.describe(new ModelNode()));
 	}	
 }
 
@@ -189,14 +213,15 @@
 		super("long-running-queries"); //$NON-NLS-1$
 	}
 	@Override
-	protected void executeOperation(RuntimeEngineDeployer engine, ModelNode operation, ModelNode node) throws OperationFailedException{
+	protected void executeOperation(OperationContext context, RuntimeEngineDeployer engine, ModelNode operation) throws OperationFailedException{
+		ModelNode result = context.getResult();
 		List<RequestMetadata> requests = engine.getLongRunningRequests();
 		for (RequestMetadata request:requests) {
-			MetadataMapper.RequestMetadataMapper.wrap(request, node.add());
+			VDBMetadataMapper.RequestMetadataMapper.INSTANCE.wrap(request, result.add());
 		}
 	}
 	protected void describeParameters(ModelNode operationNode, ResourceBundle bundle) {
-		operationNode.get(REPLY_PROPERTIES).add(MetadataMapper.RequestMetadataMapper.describe(new ModelNode()));
+		operationNode.get(REPLY_PROPERTIES).add(VDBMetadataMapper.RequestMetadataMapper.INSTANCE.describe(new ModelNode()));
 	}	
 }
 
@@ -205,7 +230,7 @@
 		super("terminate-session"); //$NON-NLS-1$
 	}
 	@Override
-	protected void executeOperation(RuntimeEngineDeployer engine, ModelNode operation, ModelNode node) throws OperationFailedException{
+	protected void executeOperation(OperationContext context, RuntimeEngineDeployer engine, ModelNode operation) throws OperationFailedException{
 		if (!operation.hasDefined(OperationsConstants.SESSION)) {
 			throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.SESSION+MISSING)));
 		}		
@@ -219,18 +244,22 @@
 	}		
 }
 
-class CancelQuery extends QueryEngineOperationHandler{
-	protected CancelQuery() {
-		super("cancel-query"); //$NON-NLS-1$
+class CancelRequest extends QueryEngineOperationHandler{
+	protected CancelRequest() {
+		super("cancel-request"); //$NON-NLS-1$
 	}
 	@Override
-	protected void executeOperation(RuntimeEngineDeployer engine, ModelNode operation, ModelNode node) throws OperationFailedException{
+	protected void executeOperation(OperationContext context, RuntimeEngineDeployer engine, ModelNode operation) throws OperationFailedException{
 		try {
 			if (!operation.hasDefined(OperationsConstants.SESSION)) {
 				throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.SESSION+MISSING)));
 			}
+			if (!operation.hasDefined(OperationsConstants.EXECUTION_ID)) {
+				throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.EXECUTION_ID+MISSING)));
+			}			
 			boolean pass = engine.cancelRequest(operation.get(OperationsConstants.SESSION).asString(), operation.get(OperationsConstants.EXECUTION_ID).asLong());
-			node.set(pass);
+			ModelNode result = context.getResult();
+			result.set(pass);
 		} catch (AdminException e) {
 			throw new OperationFailedException(e, new ModelNode().set(e.getMessage()));
 		} 
@@ -246,19 +275,47 @@
 		operationNode.get(REQUEST_PROPERTIES, OperationsConstants.EXECUTION_ID, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.EXECUTION_ID));
 		
 		operationNode.get(REPLY_PROPERTIES).set(ModelType.BOOLEAN);
-		operationNode.get(REPLY_PROPERTIES, DESCRIBE).set(bundle.getString(getReplyName()));
 	}		
 }
 
-class CacheTypes extends QueryEngineOperationHandler{
+abstract class BaseCachehandler extends BaseOperationHandler<SessionAwareCache>{
+	BaseCachehandler(String operationName){
+		super(operationName);
+	}
+	
+	@Override
+	protected SessionAwareCache getService(OperationContext context, PathAddress pathAddress, ModelNode operation) throws OperationFailedException {
+		String cacheType = Admin.Cache.QUERY_SERVICE_RESULT_SET_CACHE.name();
+		
+		if (operation.hasDefined(OperationsConstants.CACHE_TYPE)) {
+			cacheType = operation.get(OperationsConstants.CACHE_TYPE).asString();
+			//throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.CACHE_TYPE+MISSING)));
+		}
+		
+		ServiceController<?> sc;
+		if (SessionAwareCache.isResultsetCache(cacheType)) {
+			sc = context.getServiceRegistry(false).getRequiredService(TeiidServiceNames.CACHE_RESULTSET); 
+		}
+		else {
+			sc = context.getServiceRegistry(false).getRequiredService(TeiidServiceNames.CACHE_PREPAREDPLAN);
+		}
+		
+        return SessionAwareCache.class.cast(sc.getValue());	
+	}	
+}
+
+
+class CacheTypes extends BaseCachehandler {
 	protected CacheTypes() {
 		super("cache-types"); //$NON-NLS-1$
 	}
+	
 	@Override
-	protected void executeOperation(RuntimeEngineDeployer engine, ModelNode operation, ModelNode node) throws OperationFailedException {
-		Collection<String> types = engine.getCacheTypes();
+	protected void executeOperation(OperationContext context, SessionAwareCache cache, ModelNode operation) throws OperationFailedException {
+		ModelNode result = context.getResult();
+		Collection<String> types = SessionAwareCache.getCacheTypes();
 		for (String type:types) {
-			node.add(type);
+			result.add(type);
 		}
 	}
 	
@@ -271,27 +328,28 @@
 	}	
 }
 
-class ClearCache extends QueryEngineOperationHandler{
+class ClearCache extends BaseCachehandler {
 	
 	protected ClearCache() {
 		super("clear-cache"); //$NON-NLS-1$
 	}
+	
 	@Override
-	protected void executeOperation(RuntimeEngineDeployer engine, ModelNode operation, ModelNode node) throws OperationFailedException {
-		
-		if (!operation.hasDefined(OperationsConstants.CACHE_TYPE)) {
+	protected void executeOperation(OperationContext context, SessionAwareCache cache, ModelNode operation) throws OperationFailedException {
+		if (operation.hasDefined(OperationsConstants.CACHE_TYPE)) {
 			throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.CACHE_TYPE+MISSING)));
 		}
-		
+
 		String cacheType = operation.get(OperationsConstants.CACHE_TYPE).asString();
-		
-		if (operation.get(OperationsConstants.VDB_NAME) != null && operation.get(OperationsConstants.VDB_VERSION) != null) {
+		if (operation.hasDefined(OperationsConstants.VDB_NAME) && operation.hasDefined(OperationsConstants.VDB_VERSION)) {
 			String vdbName = operation.get(OperationsConstants.VDB_NAME).asString();
 			int vdbVersion = operation.get(OperationsConstants.VDB_VERSION).asInt();
-			engine.clearCache(cacheType, vdbName, vdbVersion);
+			LogManager.logInfo(LogConstants.CTX_DQP, IntegrationPlugin.Util.getString("clearing_cache_vdb", cacheType, vdbName, vdbVersion)); //$NON-NLS-1$
+			cache.clearForVDB(vdbName, vdbVersion);
 		}
 		else {
-			engine.clearCache(cacheType);
+			LogManager.logInfo(LogConstants.CTX_DQP, IntegrationPlugin.Util.getString("clearing_cache", cacheType)); //$NON-NLS-1$
+			cache.clearAll();
 		}
 	}
 	
@@ -311,28 +369,39 @@
 	}	
 }
 
-class CacheStatistics extends QueryEngineOperationHandler{
+class CacheStatistics extends BaseCachehandler {
 	
 	protected CacheStatistics() {
 		super("cache-statistics"); //$NON-NLS-1$
 	}
+	
 	@Override
-	protected void executeOperation(RuntimeEngineDeployer engine, ModelNode operation, ModelNode node) throws OperationFailedException {
+	protected void executeOperation(OperationContext context, SessionAwareCache cache, ModelNode operation) throws OperationFailedException {
 		if (!operation.hasDefined(OperationsConstants.CACHE_TYPE)) {
 			throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.CACHE_TYPE+MISSING)));
 		}
+		ModelNode result = context.getResult();
 		String cacheType = operation.get(OperationsConstants.CACHE_TYPE).asString();
-		CacheStatisticsMetadata stats = engine.getCacheStatistics(cacheType);
-		MetadataMapper.CacheStatisticsMetadataMapper.wrap(stats, node);
+		CacheStatisticsMetadata stats = buildCacheStats(cacheType, cache);
+		VDBMetadataMapper.CacheStatisticsMetadataMapper.INSTANCE.wrap(stats, result);
 	}
 	
+	private CacheStatisticsMetadata buildCacheStats(String name, SessionAwareCache cache) {
+		CacheStatisticsMetadata stats = new CacheStatisticsMetadata();
+		stats.setName(name);
+		stats.setHitRatio(cache.getRequestCount() == 0?0:((double)cache.getCacheHitCount()/cache.getRequestCount())*100);
+		stats.setTotalEntries(cache.getTotalCacheEntries());
+		stats.setRequestCount(cache.getRequestCount());
+		return stats;
+	}	
+	
 	protected void describeParameters(ModelNode operationNode, ResourceBundle bundle) {
 		operationNode.get(REQUEST_PROPERTIES, OperationsConstants.CACHE_TYPE, TYPE).set(ModelType.STRING);
 		operationNode.get(REQUEST_PROPERTIES, OperationsConstants.CACHE_TYPE, REQUIRED).set(true);
 		operationNode.get(REQUEST_PROPERTIES, OperationsConstants.CACHE_TYPE, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.CACHE_TYPE));
 		
 		ModelNode node = new ModelNode();
-		operationNode.get(REPLY_PROPERTIES).add(MetadataMapper.CacheStatisticsMetadataMapper.describe(node));
+		operationNode.get(REPLY_PROPERTIES).add(VDBMetadataMapper.CacheStatisticsMetadataMapper.INSTANCE.describe(node));
 	}	
 }
 
@@ -342,30 +411,32 @@
 		super("workerpool-statistics"); //$NON-NLS-1$
 	}
 	@Override
-	protected void executeOperation(RuntimeEngineDeployer engine, ModelNode operation, ModelNode node) throws OperationFailedException {
+	protected void executeOperation(OperationContext context, RuntimeEngineDeployer engine, ModelNode operation) throws OperationFailedException {
+		ModelNode result = context.getResult();
 		WorkerPoolStatisticsMetadata stats = engine.getWorkerPoolStatistics();
-		MetadataMapper.WorkerPoolStatisticsMetadataMapper.wrap(stats, node);
+		VDBMetadataMapper.WorkerPoolStatisticsMetadataMapper.INSTANCE.wrap(stats, result);
 	}
 	protected void describeParameters(ModelNode operationNode, ResourceBundle bundle) {
-		operationNode.get(REPLY_PROPERTIES).add(MetadataMapper.WorkerPoolStatisticsMetadataMapper.describe(new ModelNode()));
+		operationNode.get(REPLY_PROPERTIES).add(VDBMetadataMapper.WorkerPoolStatisticsMetadataMapper.INSTANCE.describe(new ModelNode()));
 	}		
 }
 
-class ActiveTransactions extends QueryEngineOperationHandler{
+class ListTransactions extends QueryEngineOperationHandler{
 	
-	protected ActiveTransactions() {
-		super("active-transactions"); //$NON-NLS-1$
+	protected ListTransactions() {
+		super("list-transactions"); //$NON-NLS-1$
 	}
 	@Override
-	protected void executeOperation(RuntimeEngineDeployer engine, ModelNode operation, ModelNode node) throws OperationFailedException {
+	protected void executeOperation(OperationContext context, RuntimeEngineDeployer engine, ModelNode operation) throws OperationFailedException {
+		ModelNode result = context.getResult();
 		Collection<TransactionMetadata> txns = engine.getTransactions();
 		for (TransactionMetadata txn:txns) {
-			MetadataMapper.TransactionMetadataMapper.wrap(txn, node.add());
+			VDBMetadataMapper.TransactionMetadataMapper.INSTANCE.wrap(txn, result.add());
 		}
 	}
 	protected void describeParameters(ModelNode operationNode, ResourceBundle bundle) {
 		ModelNode node = new ModelNode();
-		operationNode.get(REPLY_PROPERTIES).add(TransactionMetadataMapper.describe(node));
+		operationNode.get(REPLY_PROPERTIES).add(TransactionMetadataMapper.INSTANCE.describe(node));
 	}	
 }
 
@@ -375,7 +446,7 @@
 		super("terminate-transaction"); //$NON-NLS-1$
 	}
 	@Override
-	protected void executeOperation(RuntimeEngineDeployer engine, ModelNode operation, ModelNode node) throws OperationFailedException {
+	protected void executeOperation(OperationContext context, RuntimeEngineDeployer engine, ModelNode operation) throws OperationFailedException {
 		
 		if (!operation.hasDefined(OperationsConstants.XID)) {
 			throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.XID+MISSING)));
@@ -403,13 +474,13 @@
 	}
 	
 	@Override
-	protected VDBRepository getService(OperationContext context, PathAddress pathAddress) throws OperationFailedException {
+	protected VDBRepository getService(OperationContext context, PathAddress pathAddress, ModelNode operation) throws OperationFailedException {
         ServiceController<?> sc = context.getServiceRegistry(false).getRequiredService(TeiidServiceNames.VDB_REPO);
         return VDBRepository.class.cast(sc.getValue());	
 	}
 	
 	@Override
-	protected void executeOperation(VDBRepository repo, ModelNode operation, ModelNode node) throws OperationFailedException {
+	protected void executeOperation(OperationContext context, VDBRepository repo, ModelNode operation) throws OperationFailedException {
 		if (!operation.hasDefined(OperationsConstants.SOURCE_VDBNAME)) {
 			throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.SOURCE_VDBNAME+MISSING)));
 		}
@@ -460,7 +531,7 @@
 		super("execute-query"); //$NON-NLS-1$
 	}
 	@Override
-	protected void executeOperation(RuntimeEngineDeployer engine, ModelNode operation, ModelNode node) throws OperationFailedException {
+	protected void executeOperation(OperationContext context, RuntimeEngineDeployer engine, ModelNode operation) throws OperationFailedException {
 		
 		if (!operation.hasDefined(OperationsConstants.VDB_NAME)) {
 			throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.VDB_NAME+MISSING)));
@@ -475,6 +546,7 @@
 			throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.TIMEOUT_IN_MILLI+MISSING)));
 		}		
 		
+		ModelNode result = context.getResult();
 		String vdbName = operation.get(OperationsConstants.VDB_NAME).asString();
 		int vdbVersion = operation.get(OperationsConstants.VDB_VERSION).asInt();
 		String sql = operation.get(OperationsConstants.SQL_QUERY).asString();
@@ -492,7 +564,7 @@
 					//TODO: support in native types instead of string here.
 					rowNode.get(ATTRIBUTES, colNames.get(colNum).toString()).set(row.get(colNum).toString());
 				}
-				node.add(rowNode);
+				result.add(rowNode);
 			}
 		} catch (AdminException e) {
 			throw new OperationFailedException(new ModelNode().set(e.getMessage()));
@@ -527,13 +599,13 @@
 	}
 	
 	@Override
-	protected VDBRepository getService(OperationContext context, PathAddress pathAddress) throws OperationFailedException {
+	protected VDBRepository getService(OperationContext context, PathAddress pathAddress, ModelNode operation) throws OperationFailedException {
         ServiceController<?> sc = context.getServiceRegistry(false).getRequiredService(TeiidServiceNames.VDB_REPO);
         return VDBRepository.class.cast(sc.getValue());	
 	}
 	
 	@Override
-	protected void executeOperation(VDBRepository repo, ModelNode operation, ModelNode node) throws OperationFailedException {
+	protected void executeOperation(OperationContext context, VDBRepository repo, ModelNode operation) throws OperationFailedException {
 		if (!operation.hasDefined(OperationsConstants.VDB_NAME)) {
 			throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.VDB_NAME+MISSING)));
 		}
@@ -541,11 +613,12 @@
 			throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.VDB_VERSION+MISSING)));
 		}
 		
+		ModelNode result = context.getResult();
 		String vdbName = operation.get(OperationsConstants.VDB_NAME).asString();
 		int vdbVersion = operation.get(OperationsConstants.VDB_VERSION).asInt();
 
 		VDBMetaData vdb = repo.getVDB(vdbName, vdbVersion);
-		MetadataMapper.wrap(vdb, node);
+		VDBMetadataMapper.INSTANCE.wrap(vdb, result);
 	}
 	
 	protected void describeParameters(ModelNode operationNode, ResourceBundle bundle) {
@@ -557,7 +630,7 @@
 		operationNode.get(REQUEST_PROPERTIES, OperationsConstants.VDB_VERSION, REQUIRED).set(true);
 		operationNode.get(REQUEST_PROPERTIES, OperationsConstants.VDB_VERSION, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.VDB_VERSION));
 
-		operationNode.get(REPLY_PROPERTIES).set(MetadataMapper.describe(new ModelNode()));
+		operationNode.get(REPLY_PROPERTIES).set(VDBMetadataMapper.INSTANCE.describe(new ModelNode()));
 	}	
 }
 
@@ -568,40 +641,41 @@
 	}
 	
 	@Override
-	protected VDBRepository getService(OperationContext context, PathAddress pathAddress) throws OperationFailedException {
+	protected VDBRepository getService(OperationContext context, PathAddress pathAddress, ModelNode operation) throws OperationFailedException {
         ServiceController<?> sc = context.getServiceRegistry(false).getRequiredService(TeiidServiceNames.VDB_REPO);
         return VDBRepository.class.cast(sc.getValue());	
 	}	
 	
 	@Override
-	protected void executeOperation(VDBRepository repo, ModelNode operation, ModelNode node) throws OperationFailedException {
+	protected void executeOperation(OperationContext context, VDBRepository repo, ModelNode operation) throws OperationFailedException {
+		ModelNode result = context.getResult();
 		List<VDBMetaData> vdbs = repo.getVDBs();
 		for (VDBMetaData vdb:vdbs) {
-			MetadataMapper.wrap(vdb, node.add());
+			VDBMetadataMapper.INSTANCE.wrap(vdb, result.add());
 		}
 	}
 	protected void describeParameters(ModelNode operationNode, ResourceBundle bundle) {
-		operationNode.get(REPLY_PROPERTIES).add(MetadataMapper.describe(new ModelNode()));
+		operationNode.get(REPLY_PROPERTIES).add(VDBMetadataMapper.INSTANCE.describe(new ModelNode()));
 	}	
 }
 
-class GetTranslators extends TranslatorOperationHandler{
+class ListTranslators extends TranslatorOperationHandler{
 	
-	protected GetTranslators() {
+	protected ListTranslators() {
 		super("list-translators"); //$NON-NLS-1$
 	}
 	
 	@Override
-	protected void executeOperation(TranslatorRepository repo, ModelNode operation, ModelNode node) throws OperationFailedException {
+	protected void executeOperation(OperationContext context, TranslatorRepository repo, ModelNode operation) throws OperationFailedException {
+		ModelNode result = context.getResult();
 		List<VDBTranslatorMetaData> translators = repo.getTranslators();
 		for (VDBTranslatorMetaData t:translators) {
-			MetadataMapper.VDBTranslatorMetaDataMapper.wrap(t, node.add());
+			VDBMetadataMapper.VDBTranslatorMetaDataMapper.INSTANCE.wrap(t, result.add());
 		}
 	}
 	
 	protected void describeParameters(ModelNode operationNode, ResourceBundle bundle) {
-		operationNode.get(REPLY_PROPERTIES, DESCRIPTION).set(bundle.getString(getReplyName()));
-		operationNode.get(REPLY_PROPERTIES).add(MetadataMapper.VDBTranslatorMetaDataMapper.describe(new ModelNode()));
+		operationNode.get(REPLY_PROPERTIES).add(VDBMetadataMapper.VDBTranslatorMetaDataMapper.INSTANCE.describe(new ModelNode()));
 	}	
 }
 
@@ -612,16 +686,16 @@
 	}
 	
 	@Override
-	protected void executeOperation(TranslatorRepository repo, ModelNode operation, ModelNode node) throws OperationFailedException {
+	protected void executeOperation(OperationContext context, TranslatorRepository repo, ModelNode operation) throws OperationFailedException {
 		
 		if (!operation.hasDefined(OperationsConstants.TRANSLATOR_NAME)) {
 			throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.TRANSLATOR_NAME+MISSING)));
 		}
 		
+		ModelNode result = context.getResult();
 		String translatorName = operation.get(OperationsConstants.TRANSLATOR_NAME).asString();
-		
 		VDBTranslatorMetaData translator = repo.getTranslatorMetaData(translatorName);
-		MetadataMapper.VDBTranslatorMetaDataMapper.wrap(translator, node);
+		VDBMetadataMapper.VDBTranslatorMetaDataMapper.INSTANCE.wrap(translator, result);
 	}
 	
 	protected void describeParameters(ModelNode operationNode, ResourceBundle bundle) {
@@ -629,36 +703,270 @@
 		operationNode.get(REQUEST_PROPERTIES, OperationsConstants.TRANSLATOR_NAME, REQUIRED).set(true);
 		operationNode.get(REQUEST_PROPERTIES, OperationsConstants.TRANSLATOR_NAME, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.TRANSLATOR_NAME));
 		
-		operationNode.get(REPLY_PROPERTIES).set(VDBTranslatorMetaDataMapper.describe(new ModelNode()));
-		operationNode.get(REPLY_PROPERTIES, DESCRIPTION).set(bundle.getString(getReplyName()));
+		operationNode.get(REPLY_PROPERTIES).set(VDBTranslatorMetaDataMapper.INSTANCE.describe(new ModelNode()));
 	}	
 }
 
-class ListQueryEngines extends TranslatorOperationHandler{
+abstract class VDBOperations extends BaseOperationHandler<VDBService>{
+	public VDBOperations(String operationName) {
+		super(operationName);
+	}
+	@Override
+	public VDBService getService(OperationContext context, PathAddress pathAddress, ModelNode operation) throws OperationFailedException {
+		if (!operation.hasDefined(OperationsConstants.VDB_NAME)) {
+			throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.VDB_NAME+MISSING)));
+		}
+		
+		if (!operation.hasDefined(OperationsConstants.VDB_VERSION)) {
+			throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.VDB_VERSION+MISSING)));
+		}
+
+		String vdbName = operation.get(OperationsConstants.VDB_NAME).asString();
+		int vdbVersion = operation.get(OperationsConstants.VDB_VERSION).asInt();
+		ServiceController<?> sc = context.getServiceRegistry(false).getRequiredService(TeiidServiceNames.vdbServiceName(vdbName, vdbVersion));
+        return VDBService.class.cast(sc.getValue());	
+	}
 	
-	protected ListQueryEngines() {
-		super("list-engines"); //$NON-NLS-1$
+	protected void describeParameters(ModelNode operationNode, ResourceBundle bundle) {
+		operationNode.get(REQUEST_PROPERTIES, OperationsConstants.VDB_NAME, TYPE).set(ModelType.STRING);
+		operationNode.get(REQUEST_PROPERTIES, OperationsConstants.VDB_NAME, REQUIRED).set(true);
+		operationNode.get(REQUEST_PROPERTIES, OperationsConstants.VDB_NAME, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.VDB_NAME));
+		
+		operationNode.get(REQUEST_PROPERTIES, OperationsConstants.VDB_VERSION, TYPE).set(ModelType.STRING);
+		operationNode.get(REQUEST_PROPERTIES, OperationsConstants.VDB_VERSION, REQUIRED).set(true);
+		operationNode.get(REQUEST_PROPERTIES, OperationsConstants.VDB_VERSION, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.VDB_VERSION));
+	}	
+}
+
+class AddDataRole extends VDBOperations {
+
+	public AddDataRole() {
+		super("add-data-role"); //$NON-NLS-1$
 	}
 	
 	@Override
-	protected void executeOperation(TranslatorRepository repo, ModelNode operation, ModelNode node) throws OperationFailedException {
+	protected void executeOperation(OperationContext context, VDBService service, ModelNode operation) throws OperationFailedException {
+		if (!operation.hasDefined(OperationsConstants.DATA_ROLE)) {
+			throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.DATA_ROLE+MISSING)));
+		}
+
+		if (!operation.hasDefined(OperationsConstants.MAPPED_ROLE)) {
+			throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.MAPPED_ROLE+MISSING)));
+		}
+
+		String dataRole = operation.get(OperationsConstants.DATA_ROLE).asString();
+		String mappedRole = operation.get(OperationsConstants.MAPPED_ROLE).asString();
 		
+		try {
+			service.addDataRole(dataRole, mappedRole);
+		} catch (AdminProcessingException e) {
+			throw new OperationFailedException(new ModelNode().set(e.getMessage()));
+		}
+	}
+	
+	@Override
+	protected void describeParameters(ModelNode operationNode, ResourceBundle bundle) {
+		super.describeParameters(operationNode, bundle);
+
+		operationNode.get(REQUEST_PROPERTIES, OperationsConstants.DATA_ROLE, TYPE).set(ModelType.STRING);
+		operationNode.get(REQUEST_PROPERTIES, OperationsConstants.DATA_ROLE, REQUIRED).set(true);
+		operationNode.get(REQUEST_PROPERTIES, OperationsConstants.DATA_ROLE, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.DATA_ROLE));
+		
+		operationNode.get(REQUEST_PROPERTIES, OperationsConstants.MAPPED_ROLE, TYPE).set(ModelType.STRING);
+		operationNode.get(REQUEST_PROPERTIES, OperationsConstants.MAPPED_ROLE, REQUIRED).set(true);
+		operationNode.get(REQUEST_PROPERTIES, OperationsConstants.MAPPED_ROLE, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.MAPPED_ROLE));
+	}		
+}
+
+class RemoveDataRole extends VDBOperations {
+
+	public RemoveDataRole() {
+		super("remove-data-role"); //$NON-NLS-1$
+	}
+	
+	@Override
+	protected void executeOperation(OperationContext context, VDBService service, ModelNode operation) throws OperationFailedException {
+		if (!operation.hasDefined(OperationsConstants.DATA_ROLE)) {
+			throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.DATA_ROLE+MISSING)));
+		}
+
+		if (!operation.hasDefined(OperationsConstants.MAPPED_ROLE)) {
+			throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.MAPPED_ROLE+MISSING)));
+		}
+
+		String dataRole = operation.get(OperationsConstants.DATA_ROLE).asString();
+		String mappedRole = operation.get(OperationsConstants.MAPPED_ROLE).asString();
+		
+		try {
+			service.addDataRole(dataRole, mappedRole);
+		} catch (AdminProcessingException e) {
+			throw new OperationFailedException(new ModelNode().set(e.getMessage()));
+		}
+	}
+	
+	@Override
+	protected void describeParameters(ModelNode operationNode, ResourceBundle bundle) {
+		super.describeParameters(operationNode, bundle);
+
+		operationNode.get(REQUEST_PROPERTIES, OperationsConstants.DATA_ROLE, TYPE).set(ModelType.STRING);
+		operationNode.get(REQUEST_PROPERTIES, OperationsConstants.DATA_ROLE, REQUIRED).set(true);
+		operationNode.get(REQUEST_PROPERTIES, OperationsConstants.DATA_ROLE, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.DATA_ROLE));
+		
+		operationNode.get(REQUEST_PROPERTIES, OperationsConstants.MAPPED_ROLE, TYPE).set(ModelType.STRING);
+		operationNode.get(REQUEST_PROPERTIES, OperationsConstants.MAPPED_ROLE, REQUIRED).set(true);
+		operationNode.get(REQUEST_PROPERTIES, OperationsConstants.MAPPED_ROLE, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.MAPPED_ROLE));
+	}		
+}
+
+class AddAnyAuthenticatedDataRole extends VDBOperations {
+
+	public AddAnyAuthenticatedDataRole() {
+		super("add-anyauthenticated-role"); //$NON-NLS-1$
+	}
+	
+	@Override
+	protected void executeOperation(OperationContext context, VDBService service, ModelNode operation) throws OperationFailedException {
+		if (!operation.hasDefined(OperationsConstants.DATA_ROLE)) {
+			throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.DATA_ROLE+MISSING)));
+		}
+
+		String dataRole = operation.get(OperationsConstants.DATA_ROLE).asString();
+		
+		try {
+			service.addAnyAuthenticated(dataRole);
+		} catch (AdminProcessingException e) {
+			throw new OperationFailedException(new ModelNode().set(e.getMessage()));
+		}
+	}
+	
+	@Override
+	protected void describeParameters(ModelNode operationNode, ResourceBundle bundle) {
+		super.describeParameters(operationNode, bundle);
+
+		operationNode.get(REQUEST_PROPERTIES, OperationsConstants.DATA_ROLE, TYPE).set(ModelType.STRING);
+		operationNode.get(REQUEST_PROPERTIES, OperationsConstants.DATA_ROLE, REQUIRED).set(true);
+		operationNode.get(REQUEST_PROPERTIES, OperationsConstants.DATA_ROLE, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.DATA_ROLE));
+	}		
+	
+}
+
+class RemoveAnyAuthenticatedDataRole extends VDBOperations {
+
+	public RemoveAnyAuthenticatedDataRole() {
+		super("remove-anyauthenticated-role"); //$NON-NLS-1$
+	}
+	
+	@Override
+	protected void executeOperation(OperationContext context, VDBService service, ModelNode operation) throws OperationFailedException {
+		if (!operation.hasDefined(OperationsConstants.DATA_ROLE)) {
+			throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.DATA_ROLE+MISSING)));
+		}
+
+		String dataRole = operation.get(OperationsConstants.DATA_ROLE).asString();
+		
+		try {
+			service.removeAnyAuthenticated(dataRole);
+		} catch (AdminProcessingException e) {
+			throw new OperationFailedException(new ModelNode().set(e.getMessage()));
+		}
+	}
+	
+	@Override
+	protected void describeParameters(ModelNode operationNode, ResourceBundle bundle) {
+		super.describeParameters(operationNode, bundle);
+
+		operationNode.get(REQUEST_PROPERTIES, OperationsConstants.DATA_ROLE, TYPE).set(ModelType.STRING);
+		operationNode.get(REQUEST_PROPERTIES, OperationsConstants.DATA_ROLE, REQUIRED).set(true);
+		operationNode.get(REQUEST_PROPERTIES, OperationsConstants.DATA_ROLE, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.DATA_ROLE));
+	}			
+}
+
+class ChangeVDBConnectionType extends VDBOperations {
+
+	public ChangeVDBConnectionType() {
+		super("change-vdb-connection-type"); //$NON-NLS-1$
+	}
+	
+	@Override
+	protected void executeOperation(OperationContext context, VDBService service, ModelNode operation) throws OperationFailedException {
+		if (!operation.hasDefined(OperationsConstants.CONNECTION_TYPE)) {
+			throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.CONNECTION_TYPE+MISSING)));
+		}
+
+		String connectionType = operation.get(OperationsConstants.CONNECTION_TYPE).asString();
+		try {
+			service.changeConnectionType(VDB.ConnectionType.valueOf(connectionType));
+		} catch (AdminProcessingException e) {
+			throw new OperationFailedException(new ModelNode().set(e.getMessage()));
+		}
+	}
+	
+	@Override
+	protected void describeParameters(ModelNode operationNode, ResourceBundle bundle) {
+		super.describeParameters(operationNode, bundle);
+		
+		operationNode.get(REQUEST_PROPERTIES, OperationsConstants.CONNECTION_TYPE, TYPE).set(ModelType.STRING);
+		operationNode.get(REQUEST_PROPERTIES, OperationsConstants.CONNECTION_TYPE, REQUIRED).set(true);
+		operationNode.get(REQUEST_PROPERTIES, OperationsConstants.CONNECTION_TYPE, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.CONNECTION_TYPE));
+	}		
+}
+
+class AssignDataSource extends VDBOperations {
+
+	public AssignDataSource() {
+		super("assign-datasource"); //$NON-NLS-1$
+	}
+	
+	@Override
+	protected void executeOperation(OperationContext context, VDBService service, ModelNode operation) throws OperationFailedException {
+		if (!operation.hasDefined(OperationsConstants.MODEL_NAME)) {
+			throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.MODEL_NAME+MISSING)));
+		}
+
+		if (!operation.hasDefined(OperationsConstants.SOURCE_NAME)) {
+			throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.SOURCE_NAME+MISSING)));
+		}
+
 		if (!operation.hasDefined(OperationsConstants.TRANSLATOR_NAME)) {
 			throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.TRANSLATOR_NAME+MISSING)));
 		}
+
+		if (!operation.hasDefined(OperationsConstants.DS_NAME)) {
+			throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.DS_NAME+MISSING)));
+		}
 		
+		
+		String modelName = operation.get(OperationsConstants.MODEL_NAME).asString();
+		String sourceName = operation.get(OperationsConstants.SOURCE_NAME).asString();
 		String translatorName = operation.get(OperationsConstants.TRANSLATOR_NAME).asString();
+		String dsName = operation.get(OperationsConstants.DS_NAME).asString();
 		
-		VDBTranslatorMetaData translator = repo.getTranslatorMetaData(translatorName);
-		MetadataMapper.VDBTranslatorMetaDataMapper.wrap(translator, node);
+		try {
+			service.assignDatasource(modelName, sourceName, translatorName, dsName);
+		} catch (AdminProcessingException e) {
+			throw new OperationFailedException(new ModelNode().set(e.getMessage()));
+		}
 	}
 	
+	@Override
 	protected void describeParameters(ModelNode operationNode, ResourceBundle bundle) {
+		super.describeParameters(operationNode, bundle);
+
+		operationNode.get(REQUEST_PROPERTIES, OperationsConstants.MODEL_NAME, TYPE).set(ModelType.STRING);
+		operationNode.get(REQUEST_PROPERTIES, OperationsConstants.MODEL_NAME, REQUIRED).set(true);
+		operationNode.get(REQUEST_PROPERTIES, OperationsConstants.MODEL_NAME, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.MODEL_NAME));
+
+		operationNode.get(REQUEST_PROPERTIES, OperationsConstants.SOURCE_NAME, TYPE).set(ModelType.STRING);
+		operationNode.get(REQUEST_PROPERTIES, OperationsConstants.SOURCE_NAME, REQUIRED).set(true);
+		operationNode.get(REQUEST_PROPERTIES, OperationsConstants.SOURCE_NAME, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.MODEL_NAME));
+
 		operationNode.get(REQUEST_PROPERTIES, OperationsConstants.TRANSLATOR_NAME, TYPE).set(ModelType.STRING);
 		operationNode.get(REQUEST_PROPERTIES, OperationsConstants.TRANSLATOR_NAME, REQUIRED).set(true);
 		operationNode.get(REQUEST_PROPERTIES, OperationsConstants.TRANSLATOR_NAME, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.TRANSLATOR_NAME));
+
+		operationNode.get(REQUEST_PROPERTIES, OperationsConstants.DS_NAME, TYPE).set(ModelType.STRING);
+		operationNode.get(REQUEST_PROPERTIES, OperationsConstants.DS_NAME, REQUIRED).set(true);
+		operationNode.get(REQUEST_PROPERTIES, OperationsConstants.DS_NAME, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.DS_NAME));
 		
-		operationNode.get(REPLY_PROPERTIES).set(VDBTranslatorMetaDataMapper.describe(new ModelNode()));
-		operationNode.get(REPLY_PROPERTIES, DESCRIPTION).set(bundle.getString(getReplyName()));
-	}	
+	}		
 }
\ No newline at end of file

Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineRemove.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineRemove.java	2011-09-21 04:13:59 UTC (rev 3502)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineRemove.java	2011-09-23 04:11:11 UTC (rev 3503)
@@ -72,7 +72,7 @@
         final ResourceBundle bundle = IntegrationPlugin.getResourceBundle(locale);
         final ModelNode operation = new ModelNode();
         operation.get(OPERATION_NAME).set(REMOVE);
-        operation.get(DESCRIPTION).set(bundle.getString(REMOVE+DESCRIBE));
+        operation.get(DESCRIPTION).set(bundle.getString(REMOVE+"."+DESCRIBE)); //$NON-NLS-1$
         return operation;
 	}
     

Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidBootServicesAdd.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidBootServicesAdd.java	2011-09-21 04:13:59 UTC (rev 3502)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidBootServicesAdd.java	2011-09-23 04:11:11 UTC (rev 3503)
@@ -77,11 +77,11 @@
 
 	static void describeTeiidRoot(final ResourceBundle bundle, String type, final ModelNode node) {
 		addAttribute(node, Configuration.ALLOW_ENV_FUNCTION, type, bundle.getString(Configuration.ALLOW_ENV_FUNCTION+DESC), ModelType.BOOLEAN, false, "false"); //$NON-NLS-1$
-        addAttribute(node, Configuration.ASYNC_THREAD_GROUP, type, bundle.getString(Configuration.ASYNC_THREAD_GROUP+DESC), ModelType.STRING, true, "teiid-async-threads"); //$NON-NLS-1$
+        addAttribute(node, Configuration.ASYNC_THREAD_GROUP, type, bundle.getString(Configuration.ASYNC_THREAD_GROUP+DESC), ModelType.STRING, true, null); 
 
-        addAttribute(node, Configuration.AUTHORIZATION_VALIDATOR_MODULE, type, bundle.getString(Configuration.AUTHORIZATION_VALIDATOR_MODULE+DESC), ModelType.BOOLEAN, false, "false"); //$NON-NLS-1$
-        addAttribute(node, Configuration.POLICY_DECIDER_MODULE, type, bundle.getString(Configuration.POLICY_DECIDER_MODULE+DESC), ModelType.STRING, false, "teiid-async-threads"); //$NON-NLS-1$
-        addAttribute(node, Configuration.OBJECT_REPLICATOR, type, bundle.getString(Configuration.OBJECT_REPLICATOR+DESC), ModelType.STRING, false, "teiid/event-distributor"); //$NON-NLS-1$
+        addAttribute(node, Configuration.AUTHORIZATION_VALIDATOR_MODULE, type, bundle.getString(Configuration.AUTHORIZATION_VALIDATOR_MODULE+DESC), ModelType.BOOLEAN, false, null);
+        addAttribute(node, Configuration.POLICY_DECIDER_MODULE, type, bundle.getString(Configuration.POLICY_DECIDER_MODULE+DESC), ModelType.STRING, false, null);
+        addAttribute(node, Configuration.OBJECT_REPLICATOR, type, bundle.getString(Configuration.OBJECT_REPLICATOR+DESC), ModelType.STRING, false, null);
         
 		ModelNode bufferNode = node.get(CHILDREN, Configuration.BUFFER_SERVICE);
 		bufferNode.get(TYPE).set(ModelType.OBJECT);

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-09-21 04:13:59 UTC (rev 3502)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidExtension.java	2011-09-23 04:11:11 UTC (rev 3503)
@@ -109,23 +109,26 @@
 		
 		// teiid level admin api operation handlers
 		new GetTranslator().register(teiidSubsystem);
-		new GetTranslators().register(teiidSubsystem);
+		new ListTranslators().register(teiidSubsystem);
 		new MergeVDBs().register(teiidSubsystem);
 		new ListVDBs().register(teiidSubsystem);
 		new GetVDB().register(teiidSubsystem);
+		new CacheTypes().register(teiidSubsystem);
+		new ClearCache().register(teiidSubsystem);
+		new CacheStatistics().register(teiidSubsystem);
+		new AddDataRole().register(teiidSubsystem);
+		new RemoveDataRole().register(teiidSubsystem);
+		new AddAnyAuthenticatedDataRole().register(teiidSubsystem);
 		
 		// engine level admin api handlers
-		new GetActiveSessions().register(engineSubsystem);
-		new GetRequestsPerSession().register(engineSubsystem);
-		new GetRequestsPerVDB().register(engineSubsystem);
+		new ListSessions().register(engineSubsystem);
+		new RequestsPerSession().register(engineSubsystem);
+		new RequestsPerVDB().register(engineSubsystem);
 		new GetLongRunningQueries().register(engineSubsystem);
 		new TerminateSession().register(engineSubsystem);
-		new CancelQuery().register(engineSubsystem);
-		new CacheTypes().register(engineSubsystem);
-		new ClearCache().register(engineSubsystem);
-		new CacheStatistics().register(engineSubsystem);
+		new CancelRequest().register(engineSubsystem);
 		new WorkerPoolStatistics().register(engineSubsystem);
-		new ActiveTransactions().register(engineSubsystem);
+		new ListTransactions().register(engineSubsystem);
 		new TerminateTransaction().register(engineSubsystem);
 		new ExecuteQuery().register(engineSubsystem);
 	}

Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBDeployer.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBDeployer.java	2011-09-21 04:13:59 UTC (rev 3502)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBDeployer.java	2011-09-23 04:11:11 UTC (rev 3503)
@@ -29,11 +29,11 @@
 import org.jboss.as.server.deployment.DeploymentUnit;
 import org.jboss.as.server.deployment.DeploymentUnitProcessingException;
 import org.jboss.as.server.deployment.DeploymentUnitProcessor;
-import org.jboss.msc.service.*;
+import org.jboss.msc.service.ServiceBuilder;
 import org.jboss.msc.service.ServiceBuilder.DependencyType;
+import org.jboss.msc.service.ServiceController;
 import org.jboss.msc.service.ServiceController.Mode;
 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.TeiidAttachments;

Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBParserDeployer.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBParserDeployer.java	2011-09-21 04:13:59 UTC (rev 3502)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBParserDeployer.java	2011-09-23 04:11:11 UTC (rev 3503)
@@ -21,12 +21,14 @@
  */
 package org.teiid.jboss;
 
+import java.io.FileInputStream;
 import java.io.IOException;
 import java.util.List;
 
 import javax.xml.stream.XMLStreamException;
 
 import org.jboss.as.server.deployment.*;
+import org.jboss.msc.service.ServiceController;
 import org.jboss.vfs.VirtualFile;
 import org.teiid.adminapi.Model;
 import org.teiid.adminapi.impl.ModelMetaData;
@@ -56,31 +58,31 @@
 		}
 
 		VirtualFile file = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT).getRoot();
-
+		
 		if (TeiidAttachments.isDynamicVDB(deploymentUnit)) {
-			parseVDBXML(file, deploymentUnit).setDynamic(true);			
+			parseVDBXML(file, deploymentUnit, phaseContext).setDynamic(true);			
 		}
 		else {
 			// scan for different files 
 			List<VirtualFile> childFiles = file.getChildren();
 			for (VirtualFile childFile:childFiles) {
-				scanVDB(childFile, deploymentUnit);
+				scanVDB(childFile, deploymentUnit, phaseContext);
 			}
 			
 			mergeMetaData(deploymentUnit);
 		}
 	}
 	
-	private void scanVDB(VirtualFile file, DeploymentUnit deploymentUnit) throws DeploymentUnitProcessingException {
+	private void scanVDB(VirtualFile file, DeploymentUnit deploymentUnit, DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
 		if (file.isDirectory()) {
 			List<VirtualFile> childFiles = file.getChildren();
 			for (VirtualFile childFile:childFiles) {
-				scanVDB(childFile, deploymentUnit);
+				scanVDB(childFile, deploymentUnit, phaseContext);
 			}
 		}
 		else {
 			if (file.getName().toLowerCase().equals(VdbConstants.DEPLOYMENT_FILE)) {
-				parseVDBXML(file, deploymentUnit);
+				parseVDBXML(file, deploymentUnit, phaseContext);
 			}
 			else if (file.getName().endsWith(VdbConstants.INDEX_EXT)) {
 				IndexMetadataFactory imf = deploymentUnit.getAttachment(TeiidAttachments.INDEX_METADATA);
@@ -101,9 +103,14 @@
 		}
 	}
 
-	private VDBMetaData parseVDBXML(VirtualFile file, DeploymentUnit deploymentUnit) throws DeploymentUnitProcessingException {
+	private VDBMetaData parseVDBXML(VirtualFile file, DeploymentUnit deploymentUnit, DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
 		try {
 			VDBMetaData vdb = VDBMetadataParser.unmarshell(file.openStream());
+			ServiceController<?> sc = phaseContext.getServiceRegistry().getService(TeiidServiceNames.OBJECT_SERIALIZER);
+			ObjectSerializer serializer = ObjectSerializer.class.cast(sc.getValue());
+			if (serializer.buildVdbXml(vdb).exists()) {
+				vdb = VDBMetadataParser.unmarshell(new FileInputStream(serializer.buildVdbXml(vdb)));
+			}
 			deploymentUnit.putAttachment(TeiidAttachments.VDB_METADATA, vdb);
 			LogManager.logDetail(LogConstants.CTX_RUNTIME,"VDB "+file.getName()+" has been parsed.");  //$NON-NLS-1$ //$NON-NLS-2$
 			return vdb;

Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBService.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBService.java	2011-09-21 04:13:59 UTC (rev 3502)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBService.java	2011-09-23 04:11:11 UTC (rev 3503)
@@ -27,18 +27,16 @@
 import java.util.*;
 import java.util.concurrent.Executor;
 
+import javax.xml.stream.XMLStreamException;
+
 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.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.adminapi.*;
+import org.teiid.adminapi.VDB.ConnectionType;
+import org.teiid.adminapi.impl.*;
 import org.teiid.common.buffer.BufferManager;
 import org.teiid.core.TeiidException;
 import org.teiid.deployers.*;
@@ -457,4 +455,80 @@
 	public void undeployInProgress() {
 		this.undeployInProgress = true;
 	}
+	
+	public void addDataRole(String policyName, String mappedRole) throws AdminProcessingException{
+		DataPolicyMetadata policy = vdb.getDataPolicy(policyName);
+		
+		if (policy == null) {
+			throw new AdminProcessingException(IntegrationPlugin.Util.getString("policy_not_found", policyName, this.vdb.getName(), this.vdb.getVersion())); //$NON-NLS-1$
+		}		
+		
+		policy.addMappedRoleName(mappedRole);
+		save();
+	}
+	
+	public void remoteDataRole(String policyName, String mappedRole) throws AdminProcessingException{
+		DataPolicyMetadata policy = vdb.getDataPolicy(policyName);
+		
+		if (policy == null) {
+			throw new AdminProcessingException(IntegrationPlugin.Util.getString("policy_not_found", policyName, this.vdb.getName(), this.vdb.getVersion())); //$NON-NLS-1$
+		}		
+		
+		policy.removeMappedRoleName(mappedRole);
+		save();
+	}	
+	
+	public void addAnyAuthenticated(String policyName) throws AdminProcessingException{
+		DataPolicyMetadata policy = vdb.getDataPolicy(policyName);
+		
+		if (policy == null) {
+			throw new AdminProcessingException(IntegrationPlugin.Util.getString("policy_not_found", policyName, this.vdb.getName(), this.vdb.getVersion())); //$NON-NLS-1$
+		}		
+		
+		policy.setAnyAuthenticated(true);
+		save();
+	}	
+	
+	public void removeAnyAuthenticated(String policyName) throws AdminProcessingException{
+		DataPolicyMetadata policy = vdb.getDataPolicy(policyName);
+		
+		if (policy == null) {
+			throw new AdminProcessingException(IntegrationPlugin.Util.getString("policy_not_found", policyName, this.vdb.getName(), this.vdb.getVersion())); //$NON-NLS-1$
+		}		
+		
+		policy.setAnyAuthenticated(false);
+		save();
+	}		
+	
+	public void changeConnectionType(ConnectionType type) throws AdminProcessingException {
+		this.vdb.setConnectionType(type);
+		save();
+	}
+	
+	public void assignDatasource(String modelName, String sourceName, String translatorName, String dsName) throws AdminProcessingException{
+		ModelMetaData model = this.vdb.getModel(modelName);
+		
+		if (model == null) {
+			throw new AdminProcessingException(IntegrationPlugin.Util.getString("model_not_found", modelName, this.vdb.getName(), this.vdb.getVersion())); //$NON-NLS-1$
+		}
+		
+		SourceMappingMetadata source = model.getSourceMapping(sourceName);
+		if(source == null) {
+			throw new AdminProcessingException(IntegrationPlugin.Util.getString("source_not_found", sourceName, modelName, this.vdb.getName(), this.vdb.getVersion())); //$NON-NLS-1$
+		}
+		source.setTranslatorName(translatorName);
+		source.setConnectionJndiName(dsName);
+		save();
+	}
+	
+	private void save() throws AdminProcessingException{
+		try {
+			ObjectSerializer os = getSerializer();
+			VDBMetadataParser.marshell(this.vdb, os.getVdbXmlOutputStream(this.vdb));
+		} catch (IOException e) {
+			throw new AdminProcessingException(e);
+		} catch (XMLStreamException e) {
+			throw new AdminProcessingException(e);
+		}
+	}
 }

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-09-21 04:13:59 UTC (rev 3502)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java	2011-09-23 04:11:11 UTC (rev 3503)
@@ -46,7 +46,6 @@
 import org.jboss.msc.service.StartContext;
 import org.jboss.msc.service.StopContext;
 import org.jboss.msc.value.InjectedValue;
-import org.teiid.adminapi.Admin.Cache;
 import org.teiid.adminapi.AdminComponentException;
 import org.teiid.adminapi.AdminException;
 import org.teiid.adminapi.AdminProcessingException;
@@ -261,8 +260,8 @@
 				}
 
 				// dump the caches. 
-				dqpCore.clearCache(Cache.PREPARED_PLAN_CACHE.toString(), name, version);
-				dqpCore.clearCache(Cache.QUERY_SERVICE_RESULT_SET_CACHE.toString(), name, version);
+				getResultSetCacheInjector().getValue().clearForVDB(name, version);
+				getPreparedPlanCacheInjector().getValue().clearForVDB(name, version);
 			}			
 		});
 	}	
@@ -399,26 +398,6 @@
     }
     
 	@Override
-    public Collection<String> getCacheTypes(){
-		return this.dqpCore.getCacheTypes();
-	}
-	
-	@Override
-	public void clearCache(String cacheType) {
-		this.dqpCore.clearCache(cacheType);
-	}
-	
-	@Override
-	public void clearCache(String cacheType, String vdbName, int version) {
-		this.dqpCore.clearCache(cacheType, vdbName, version);
-	}	
-	
-	@Override
-	public CacheStatisticsMetadata getCacheStatistics(String cacheType) {
-		return this.dqpCore.getCacheStatistics(cacheType);
-	}
-	
-	@Override
 	public Collection<SessionMetadata> getActiveSessions() throws AdminException {
 		try {
 			return this.sessionService.getActiveSessions();
@@ -779,5 +758,5 @@
 
 	public InjectedValue<ObjectReplicator> getObjectReplicatorInjector() {
 		return objectReplicatorInjector;
-	}	
+	}
 }

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-09-21 04:13:59 UTC (rev 3502)
+++ branches/as7/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties	2011-09-23 04:11:11 UTC (rev 3503)
@@ -29,6 +29,7 @@
 bad_vdb_extension=The extension of the file name must be either ".vdb" for designer vdb or "xxx-vdb.xml" for dynamic VDBs
 vdb_not_found=VDB with name "{0}" version "{1}" not found in configuration
 model_not_found=Model name "{0}" not found in the VDB with name "{1}" version "{2}"
+model_not_found=Source name "{0}" not found in model {1} in the VDB with name "{2}" version "{3}"
 policy_not_found=Policy name "{0}" not found in the VDB with name "{1}" version "{2}"
 datasource_not_found=Datasource {0} not found in the configuration.
 sourcename_not_found=No source name {0} found in the model: {1}.{2}.{3}
@@ -59,6 +60,7 @@
 translator.added = Teiid translator "{0}" added.
 
 # subsystem description
+susbsystem.add = Add the Teiid Subsystem
 buffer-service.describe=Buffer Manager Configuration
 resultset-cache.describe=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
 preparedplan-cache.describe=PreparedPlan Cache Configuration
@@ -142,53 +144,7 @@
 truststore-password.describe=Truststore Password
 authentication-mode.describe=Authentication Mode (1-way, 2-way, anonymous)
 ssl.describe=SSL
-
-
-
-# Add
-susbsystem.add = Add the Teiid Subsystem
-
-#engine managed operations
-active-sessions.describe=List of all the current active sessions in the Teiid subsystem. 
-requests-per-session.describe=Current active requests in progress in the query engine for a given session identifier
-requests-per-session.session.describe=The session Identifier
-requests-per-vdb.describe=Current active requests in progress in the query engine for a given VDB name and its version.
-requests-per-vdb.vdb_name.describe=VDB Name
-requests-per-vdb.vdb_version.describe=VDB Version
-long-running-queries.describe=Long running queries that exceeded the threshold set by the 'queryThresholdInSecs' configuration property.
-terminate-session.describe=Terminate the session
-terminate-session.session.describe=The session Identifier of session to be terminated
-cancel-query.describe=Cancel the execution of the actively running query
-cancel-query.session.describe=The session Identifier of the user
-cancel-query.execution-id.describe=The Execution Identifier of the query
-cache-types.describe=List the available cache types
-
-clear-cache.describe=Clear the caches in the system of the given type
-clear-cache.cache-type.describe=cache type to be cleared. (PREPARED_PLAN_CACHE, QUERY_SERVICE_RESULT_SET_CACHE)
-clear-cache.vdb-name.describe=VDB name
-clear-cache.vdb_version.describe=VDB version
-cache-statistics.describe=Get the cache statistics for the given cache type
-cache-statistics.cache-type.describe=cache type (PREPARED_PLAN_CACHE, QUERY_SERVICE_RESULT_SET_CACHE)
-
-workerpool-statistics.describe=Get thread statistics worker pool
-active-transactions.describe=Active Transactions in the Query Engine
-
-terminate-transaction.describe=Terminate the XA transaction
-terminate-transaction.xid.describe=xid identifier of the XA transaction
-merge-vdbs.describe=Merge Two VDBs
-merge-vdbs.source-vdb-name.describe=Source VDB name
-merge-vdbs.source-vdb-version.describe=Source VDB version number
-merge-vdbs.target-vdb-name.describe=Target VDB name
-merge-vdbs.target-vdb-version.describe=Target VDB version number
-
-execute-query.describe=Execute a sql query
-execute-query.vdb-name.describe=vdb name
-execute-query.vdb-version.describe=vdb version
-execute-query.sql-query.describe=sql query to execute
-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
 module.describe = Name of the implementing module
 engine.remove = Remove Teiid query engine
@@ -202,22 +158,22 @@
 hit-ratio.describe = Cache Hit ratio
 request-count.describe=Total request count
 
-cache-types.cache-type.describe=cache type
-get-translators.reply.describe=Returns list of translators registered in the teiid container
-get-translator.reply.describe=Returns translator if found with given name
-active-session-count.reply.describe=Returns the count of active sessions
-runtime-version.reply.describe=Teiid runtime version
-list-vdbs.describe=List the available virtual databases in the system
-cancel-query.reply.describe=True if successful; false otherwise.
-clear-cache.vdb-version.describe=vdb version
-get-vdb.describe=Get the VDB with the given name and version
-get-vdb.vdb-name.describe=name of the vdb
-get-vdb.vdb-version.describe=vdb version
-requests-per-vdb.vdb-name.describe=vdb name
-requests-per-vdb.vdb-version.describe=vdb version
+engine_service_not_found= Query Engine Service with name {0} is not found
+translator.removed = Translator "{0}" removed
+translator.failed-to-load = Translator "{0}" not found in the module "{1}" 
+cache-container-name-required=container-name required for the resultset cache configuration
+object-replicator.describe=Object Replication
+enable.describe=enabled
+
+clearing_cache=Clearing cache {0} for all the deployed vdbs. 
+clearing_cache_vdb=Clearing cache {0} for vdb {1}.{2}
+vdb-inactive=VDB {0}.{1} deployed in inactive state due to unavailability of data sources {2}
+
+
 remove.reply.describe=remove service
 remove.describe=remove service
 
+# paramters missing
 vdb-name.missing=Parameter "vdb-name" is required
 vdb-version.missing=Parameter "vdb-version" is required
 cache-type.missing=Parameter "cache-type" is required
@@ -231,10 +187,118 @@
 sql-query.missing=Parameter "sql-query" is required
 timeout-in-milli.missing=Parameter "timeout-in-milli" is required
 translator-name.missing=Parameter "translator-name" is required
-engine_service_not_found= Query Engine Service with name {0} is not found
-translator.removed = Translator "{0}" removed
-translator.failed-to-load = Translator "{0}" not found in the module "{1}" 
-cache-container-name-required=container-name required for the resultset cache configuration
+data-role.missing = Data Role is missing from parameters
+mapped-role.missing = security domain role is missing from parameters
+source-name.missing=Model source name is required
+ds-name.missing=Data source name required
+translator-name.missing=translator name required
+model-name.missing=Model Name required
+connection-type.missing = VDB connection type is required
 
 
-vdb-inactive=VDB {0}.{1} deployed in inactive state due to unavailability of data sources {2}
\ No newline at end of file
+
+
+# Operation descriptions (alpha layout)
+add-anyauthenticated-role.describe=Mark any authenticated to the datarole
+add-anyauthenticated-role.vdb-name.describe=VDB Name
+add-anyauthenticated-role.vdb-version.describe=VDB Version
+add-anyauthenticated-role.data-role.describe=VDB Defined Data Role Name
+
+add-data-role.describe= Map a JAAS based role to the VDB data role, for granting permission
+add-data-role.vdb-name.describe=VDB Name
+add-data-role.vdb-version.describe=VDB Version
+add-data-role.data-role.describe=VDB Defined Data Role Name
+add-data-role.mapped-role.describe=Security domain defined role name
+
+assign-datasource.describe=Assign a data source or translator names to a given model in the VDB
+assign-datasource.vdb-name.describe=VDB Name
+assign-datasource.vdb-version.describe=VDB Version
+assign-datasource.source-name.describe=Model Source Name
+assign-datasource.ds-name.describe=Data source name
+assign-datasource.translator-name.describe=translator name
+assign-datasource.model-name.describe=Model Name
+
+cache-statistics.describe=Get the cache statistics for the given cache type
+cache-statistics.cache-type.describe=cache type (PREPARED_PLAN_CACHE, QUERY_SERVICE_RESULT_SET_CACHE)
+
+cache-types.describe=List the available cache types
+
+cancel-request.describe=Cancel the execution of the actively running query
+cancel-request.session.describe=The session Identifier of the user
+cancel-request.execution-id.describe=The Execution Identifier of the query
+cancel-request.reply.describe=True if successful; false otherwise.
+
+change-vdb-connection-type.describe=Change the default VDB version selection 
+change-vdb-connection-type.vdb-name.describe=VDB Name
+change-vdb-connection-type.vdb-version.describe=VDB Version
+change-vdb-connection-type.connection-type.describe=VDB Connection Type
+
+clear-cache.describe=Clear the caches in the system of the given type
+clear-cache.cache-type.describe=cache type to be cleared. (PREPARED_PLAN_CACHE, QUERY_SERVICE_RESULT_SET_CACHE)
+clear-cache.vdb-name.describe=VDB name
+clear-cache.vdb_version.describe=VDB version
+
+execute-query.describe=Execute a sql query
+execute-query.vdb-name.describe=vdb name
+execute-query.vdb-version.describe=vdb version
+execute-query.sql-query.describe=sql query to execute
+execute-query.timeout-in-milli.describe=timeout
+
+active-session-count.describe=Number of active sessions
+active-session-count.reply.describe=Returns the count of active sessions
+
+long-running-queries.describe=Long running queries that exceeded the threshold set by the 'query-threshold-in-seconds' configuration property.
+
+runtime-version.describe = Runtime version of the Teiid subsystem
+runtime-version.reply.describe=Teiid runtime version
+
+get-translator.describe=retrieve translator
+get-translator.translator-name.describe=translator name
+get-translator.reply.describe=Returns translator if found with given name
+
+get-vdb.describe=Get the VDB with the given name and version
+get-vdb.vdb-name.describe=name of the vdb
+get-vdb.vdb-version.describe=vdb version
+
+list-requests.describe=List of active requests
+
+list-sessions.describe=List of all the current active sessions in the Teiid subsystem.
+
+list-transactions.describe=Active Transactions in the Query Engine
+
+list-translators.describe=List of translators registered in the teiid container
+list-translators.reply.describe=List of translators registered in the teiid container
+
+list-vdbs.describe=List the available virtual databases in the system
+
+merge-vdbs.describe=Merge Two VDBs
+merge-vdbs.source-vdb-name.describe=Source VDB name
+merge-vdbs.source-vdb-version.describe=Source VDB version number
+merge-vdbs.target-vdb-name.describe=Target VDB name
+merge-vdbs.target-vdb-version.describe=Target VDB version number
+
+remove-anyauthenticated-role.describe=remove any authenticated from the data role provided
+remove-anyauthenticated-role.vdb-name.describe=VDB Name
+remove-anyauthenticated-role.vdb-version.describe=VDB Version
+remove-anyauthenticated-role.data-role.describe=VDB Defined Data Role Name
+
+remove-data-role.describe=remove the JAAS based role mapping from VDB data role
+remove-data-role.vdb-name.describe=VDB Name
+remove-data-role.vdb-version.describe=VDB Version
+remove-data-role.data-role.describe=VDB Defined Data Role Name
+remove-data-role.mapped-role.describe=Security domain defined role name
+
+requests-per-session.describe=Current active requests in progress in the query engine for a given session identifier
+requests-per-session.session.describe=The session Identifier
+
+requests-per-vdb.describe=Current active requests in progress in the query engine for a given VDB name and its version.
+requests-per-vdb.vdb_name.describe=VDB Name
+requests-per-vdb.vdb_version.describe=VDB Version
+
+terminate-session.describe=Terminate the session
+terminate-session.session.describe=The session Identifier of session to be terminated
+
+terminate-transaction.describe=Terminate the XA transaction
+terminate-transaction.xid.describe=xid identifier of the XA transaction
+
+workerpool-statistics.describe=Get thread statistics worker pool
\ No newline at end of file

Modified: branches/as7/jboss-integration/src/test/java/org/teiid/adminapi/jboss/TestAdminObjectBuilder.java
===================================================================
--- branches/as7/jboss-integration/src/test/java/org/teiid/adminapi/jboss/TestAdminObjectBuilder.java	2011-09-21 04:13:59 UTC (rev 3502)
+++ branches/as7/jboss-integration/src/test/java/org/teiid/adminapi/jboss/TestAdminObjectBuilder.java	2011-09-23 04:11:11 UTC (rev 3503)
@@ -97,8 +97,8 @@
 		vdb.addDataPolicy(roleOne);
 		
 		// convert to managed object and build the VDB out of MO
-		ModelNode node = MetadataMapper.wrap(vdb, new ModelNode());
-		vdb = MetadataMapper.unwrap(node);
+		ModelNode node = VDBMetadataMapper.INSTANCE.wrap(vdb, new ModelNode());
+		vdb = VDBMetadataMapper.INSTANCE.unwrap(node);
 		
 		assertEquals("myVDB", vdb.getName()); 
 		assertEquals("vdb description", vdb.getDescription()); 
@@ -169,8 +169,8 @@
 		tm.addProperty("ExtensionTranslationClassName", "org.teiid.translator.jdbc.oracle.OracleSQLTranslator");
 		
 		// convert to managed object and build the VDB out of MO
-		ModelNode node = MetadataMapper.VDBTranslatorMetaDataMapper.wrap(tm, new ModelNode());
-		VDBTranslatorMetaData tm1 = MetadataMapper.VDBTranslatorMetaDataMapper.unwrap(node);
+		ModelNode node = VDBMetadataMapper.VDBTranslatorMetaDataMapper.INSTANCE.wrap(tm, new ModelNode());
+		VDBTranslatorMetaData tm1 = VDBMetadataMapper.VDBTranslatorMetaDataMapper.INSTANCE.unwrap(node);
 		
 		assertEquals("Oracle", tm1.getName());
 		assertEquals(ExecutionFactory.class.getName(), tm1.getPropertyValue(Translator.EXECUTION_FACTORY_CLASS));



More information about the teiid-commits mailing list