[teiid-commits] teiid SVN: r3312 - in branches/as7: jboss-integration/src/main/java/org/teiid/jboss and 4 other directories.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Thu Jul 14 10:07:36 EDT 2011


Author: rareddy
Date: 2011-07-14 10:07:35 -0400 (Thu, 14 Jul 2011)
New Revision: 3312

Added:
   branches/as7/jboss-integration/src/main/java/org/teiid/jboss/SystemVDBService.java
Modified:
   branches/as7/build/kits/jboss-as7/standalone/configuration/standalone-teiid.xml
   branches/as7/jboss-integration/src/main/java/org/teiid/jboss/Configuration.java
   branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineAdd.java
   branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidServiceNames.java
   branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidSubsystemParser.java
   branches/as7/jboss-integration/src/test/resources/teiid-model-config.txt
   branches/as7/jboss-integration/src/test/resources/teiid-sample-config.xml
   branches/as7/metadata/src/main/java/org/teiid/metadata/index/IndexMetadataFactory.java
   branches/as7/runtime/src/main/java/org/teiid/deployers/SystemVDBDeployer.java
   branches/as7/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java
   branches/as7/test-integration/common/src/test/java/org/teiid/jdbc/TestLocalConnections.java
Log:
Added System VDB deployment

Modified: branches/as7/build/kits/jboss-as7/standalone/configuration/standalone-teiid.xml
===================================================================
--- branches/as7/build/kits/jboss-as7/standalone/configuration/standalone-teiid.xml	2011-07-13 20:34:20 UTC (rev 3311)
+++ branches/as7/build/kits/jboss-as7/standalone/configuration/standalone-teiid.xml	2011-07-14 14:07:35 UTC (rev 3312)
@@ -213,6 +213,7 @@
                 <module identifier="org.apache.aries.jmx" startlevel="2"/>
                 <module identifier="org.apache.felix.eventadmin" startlevel="2"/>
                 <module identifier="org.apache.felix.metatype" startlevel="2"/>
+                <module identifier="org.apache.felix.scr" startlevel="2"/>
                 <module identifier="org.apache.felix.webconsole" startlevel="2"/>
                 <module identifier="org.jboss.osgi.jmx" startlevel="2"/>
                 <module identifier="org.jboss.osgi.http" startlevel="2"/>
@@ -244,8 +245,8 @@
         </subsystem>
         <subsystem xmlns="urn:jboss:domain:teiid:1.0">
             <query-engine>
-                <thread-group-async>teiid-async</thread-group-async>
-                <eventDistributorName>teiid/event-distributor</eventDistributorName>
+                <async-thread-group>teiid-async</async-thread-group>
+                <event-distributor-name>teiid/event-distributor</event-distributor-name>
                 <security-domain>teiid-security</security-domain>
                 <jdbc>
                     <socket-binding>teiid-jdbc</socket-binding>

Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/Configuration.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/Configuration.java	2011-07-13 20:34:20 UTC (rev 3311)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/Configuration.java	2011-07-14 14:07:35 UTC (rev 3312)
@@ -37,30 +37,30 @@
 	public static final String TRANSLATOR = "translator"; //$NON-NLS-1$
 	
 	// Query-ENGINE
-	public static final String ASYNC_THREAD_GROUP = "thread-group-async";//$NON-NLS-1$
-	public static final String MAX_THREADS = "maxThreads";//$NON-NLS-1$
-	public static final String MAX_ACTIVE_PLANS = "maxActivePlans";//$NON-NLS-1$
+	public static final String ASYNC_THREAD_GROUP = "async-thread-group";//$NON-NLS-1$
+	public static final String MAX_THREADS = "max-threads";//$NON-NLS-1$
+	public static final String MAX_ACTIVE_PLANS = "max-active-plans";//$NON-NLS-1$
 	public static final String USER_REQUEST_SOURCE_CONCURRENCY = "userRequestSourceConcurrency";//$NON-NLS-1$
-	public static final String TIME_SLICE_IN_MILLI = "timeSliceInMilli";//$NON-NLS-1$
-	public static final String MAX_ROWS_FETCH_SIZE = "maxRowsFetchSize";//$NON-NLS-1$
-	public static final String LOB_CHUNK_SIZE_IN_KB = "lobChunkSizeInKB";//$NON-NLS-1$
-	public static final String USE_DATA_ROLES = "useDataRoles";//$NON-NLS-1$
-	public static final String ALLOW_CREATE_TEMPORY_TABLES_BY_DEFAULT = "allowCreateTemporaryTablesByDefault";//$NON-NLS-1$
-	public static final String ALLOW_FUNCTION_CALLS_BY_DEFAULT = "allowFunctionCallsByDefault";//$NON-NLS-1$
-	public static final String QUERY_THRESHOLD_IN_SECS = "queryThresholdInSecs";//$NON-NLS-1$
-	public static final String MAX_SOURCE_ROWS = "maxSourceRows";//$NON-NLS-1$
-	public static final String EXCEPTION_ON_MAX_SOURCE_ROWS = "exceptionOnMaxSourceRows";//$NON-NLS-1$
-	public static final String MAX_ODBC_LOB_SIZE_ALLOWED = "maxODBCLobSizeAllowed";//$NON-NLS-1$
-	public static final String EVENT_DISTRIBUTOR_NAME = "eventDistributorName";//$NON-NLS-1$
-	public static final String DETECTING_CHANGE_EVENTS = "detectingChangeEvents";//$NON-NLS-1$
+	public static final String TIME_SLICE_IN_MILLI = "time-slice-in-millseconds";//$NON-NLS-1$
+	public static final String MAX_ROWS_FETCH_SIZE = "max-row-fetch-size";//$NON-NLS-1$
+	public static final String LOB_CHUNK_SIZE_IN_KB = "lob-chunk-size-in-kb";//$NON-NLS-1$
+	public static final String USE_DATA_ROLES = "use-dataroles";//$NON-NLS-1$
+	public static final String ALLOW_CREATE_TEMPORY_TABLES_BY_DEFAULT = "allow-creation-of-temporary-tables";//$NON-NLS-1$
+	public static final String ALLOW_FUNCTION_CALLS_BY_DEFAULT = "allow-function-calls";//$NON-NLS-1$
+	public static final String QUERY_THRESHOLD_IN_SECS = "query-threshold-in-seconds";//$NON-NLS-1$
+	public static final String MAX_SOURCE_ROWS = "max-source-rows-allowed";//$NON-NLS-1$
+	public static final String EXCEPTION_ON_MAX_SOURCE_ROWS = "exception-on-max-source-rows";//$NON-NLS-1$
+	public static final String MAX_ODBC_LOB_SIZE_ALLOWED = "max-odbc-lob-size-allowed";//$NON-NLS-1$
+	public static final String EVENT_DISTRIBUTOR_NAME = "event-distributor-name";//$NON-NLS-1$
+	public static final String DETECTING_CHANGE_EVENTS = "detect-change-events";//$NON-NLS-1$
 	public static final String SECURITY_DOMAIN = "security-domain";//$NON-NLS-1$
 	public static final String MAX_SESSIONS_ALLOWED = "max-sessions-allowed";//$NON-NLS-1$
 	public static final String SESSION_EXPIRATION_TIME_LIMIT = "sessions-expiration-timelimit";//$NON-NLS-1$
 	public static final String ALLOW_ENV_FUNCTION = "allow-env-function";//$NON-NLS-1$
 	
-	public static final String USE_DISK = "useDisk";//$NON-NLS-1$
-	public static final String PROCESSOR_BATCH_SIZE = "processorBatchSize";//$NON-NLS-1$
-	public static final String CONNECTOR_BATCH_SIZE = "connectorBatchSize";//$NON-NLS-1$
+	public static final String USE_DISK = "use-disk";//$NON-NLS-1$
+	public static final String PROCESSOR_BATCH_SIZE = "processor-batch-size";//$NON-NLS-1$
+	public static final String CONNECTOR_BATCH_SIZE = "connector-batch-size";//$NON-NLS-1$
 	public static final String MAX_RESERVE_BATCH_COLUMNS = "maxReserveBatchColumns";//$NON-NLS-1$
 	public static final String MAX_PROCESSING_BATCH_COLUMNS = "maxProcessingBatchesColumns";//$NON-NLS-1$
 	public static final String MAX_FILE_SIZE = "maxFileSize";//$NON-NLS-1$

Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineAdd.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineAdd.java	2011-07-13 20:34:20 UTC (rev 3311)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineAdd.java	2011-07-14 14:07:35 UTC (rev 3312)
@@ -45,6 +45,7 @@
 import org.jboss.dmr.ModelNode;
 import org.jboss.msc.inject.ConcurrentMapInjector;
 import org.jboss.msc.service.*;
+import org.jboss.msc.value.InjectedValue;
 import org.teiid.cache.CacheConfiguration;
 import org.teiid.cache.CacheFactory;
 import org.teiid.cache.DefaultCacheFactory;
@@ -78,6 +79,11 @@
     	final VDBRepository vdbRepo = buildVDBRepository(queryEngineNode);
     	final JBossLifeCycleListener shutdownListener = new JBossLifeCycleListener();
     	
+    	SystemVDBDeployer systemVDB = new SystemVDBDeployer();
+    	systemVDB.setVDBRepository(vdbRepo);
+    	SystemVDBService systemVDBService = new SystemVDBService(systemVDB);
+    	newControllers.add(target.addService(TeiidServiceNames.SYSTEM_VDB, systemVDBService).install());
+    	
     	//FIXME *******************
     	final ObjectSerializer serializer = new ObjectSerializer("/tmp");
     	//FIXME *******************
@@ -86,7 +92,7 @@
     	TranslatorRepositoryService translatorService = new TranslatorRepositoryService(translatorRepo);
     	newControllers.add(target.addService(TeiidServiceNames.TRANSLATOR_REPO, translatorService).install());
 
-    	RelativePathService.addService(TeiidServiceNames.BUFFER_DIR, "teiid-buffer", "jboss.server.temp.dir", target); //$NON-NLS-1$ //$NON-NLS-2$
+    	newControllers.add(RelativePathService.addService(TeiidServiceNames.BUFFER_DIR, "teiid-buffer", "jboss.server.temp.dir", target)); //$NON-NLS-1$ //$NON-NLS-2$
     	
     	// TODO: remove verbose service by moving the buffer service from runtime project
     	final BufferServiceImpl bufferManager = buildBufferManager(queryEngineNode.get(Configuration.BUFFER_SERVICE));
@@ -133,7 +139,8 @@
         serviceBuilder.addDependency(ServiceName.JBOSS.append("txn", "TransactionManager"), TransactionManager.class, engine.txnManagerInjector); //$NON-NLS-1$ //$NON-NLS-2$
         serviceBuilder.addDependency(ServiceName.JBOSS.append("thread", "executor", asyncExecutor), Executor.class, engine.threadPoolInjector); //$NON-NLS-1$ //$NON-NLS-2$
         serviceBuilder.addDependency(TeiidServiceNames.BUFFER_MGR, BufferServiceImpl.class, engine.bufferServiceInjector);
-       
+        serviceBuilder.addDependency(TeiidServiceNames.SYSTEM_VDB, SystemVDBDeployer.class,  new InjectedValue<SystemVDBDeployer>());
+        
         if (jdbc != null) {
         	serviceBuilder.addDependency(ServiceName.JBOSS.append("binding", jdbc.getSocketBinding()), SocketBinding.class, engine.jdbcSocketBindingInjector); //$NON-NLS-1$
         }

Added: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/SystemVDBService.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/SystemVDBService.java	                        (rev 0)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/SystemVDBService.java	2011-07-14 14:07:35 UTC (rev 3312)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.jboss;
+
+import org.jboss.msc.service.Service;
+import org.jboss.msc.service.StartContext;
+import org.jboss.msc.service.StartException;
+import org.jboss.msc.service.StopContext;
+import org.teiid.deployers.SystemVDBDeployer;
+
+public class SystemVDBService implements Service<SystemVDBDeployer> {
+	private SystemVDBDeployer deployer;
+	
+	public SystemVDBService(SystemVDBDeployer deployer){
+		this.deployer = deployer;
+	}
+	
+	@Override
+	public void start(StartContext context) throws StartException {
+		deployer.start();
+	}
+
+	@Override
+	public void stop(StopContext context) {
+		deployer.stop();
+	}
+
+	@Override
+	public SystemVDBDeployer getValue() throws IllegalStateException, IllegalArgumentException {
+		return deployer;
+	}
+
+}


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

Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidServiceNames.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidServiceNames.java	2011-07-13 20:34:20 UTC (rev 3311)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidServiceNames.java	2011-07-14 14:07:35 UTC (rev 3312)
@@ -29,6 +29,7 @@
 	static ServiceName TRANSLATOR_BASE = ServiceName.JBOSS.append("teiid", "translator");
 	public static ServiceName BUFFER_DIR = ServiceName.JBOSS.append("teiid", "buffer.dir");
 	public static ServiceName BUFFER_MGR = ServiceName.JBOSS.append("teiid", "buffer-mgr");
+	public static ServiceName SYSTEM_VDB = ServiceName.JBOSS.append("teiid", "system.vdb");
 	
 	public static ServiceName translatorServiceName(String name) {
 		return TRANSLATOR_BASE.append(name);

Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidSubsystemParser.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidSubsystemParser.java	2011-07-13 20:34:20 UTC (rev 3311)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidSubsystemParser.java	2011-07-14 14:07:35 UTC (rev 3312)
@@ -45,25 +45,137 @@
     @Override
     public void writeContent(final XMLExtendedStreamWriter writer, final SubsystemMarshallingContext context) throws XMLStreamException {
         context.startSubsystemElement(Namespace.CURRENT.getUri(), false);
-        writer.writeStartElement(Configuration.QUERY_ENGINE);
-
         ModelNode node = context.getModelNode();
-        ModelNode teiidRuntime = node.require(Configuration.QUERY_ENGINE);
-        //writeElement(writer, Element.batchSize, teiidRuntime.require("batch-size"));
-
-        //writer.writeEndElement(); // End teiid-runtime element.
+        if (!node.isDefined()) {
+        	return;
+        }
+        writer.writeStartElement(Element.QUERY_ENGINE_ELEMENT.getLocalName());
+        writeQueryEngine(writer, node);
+        writer.writeEndElement();
         writer.writeEndElement(); // End of subsystem element
     }
     
-    private boolean has(ModelNode node, String name) {
+    // write the elements according to the schema defined.
+    private void writeQueryEngine( XMLExtendedStreamWriter writer, ModelNode node) throws XMLStreamException {
+    	writeElement(writer, Element.ASYNC_THREAD_GROUP_ELEMENT, node);
+    	writeElement(writer, Element.MAX_THREADS_ELEMENT, node);
+    	writeElement(writer, Element.MAX_ACTIVE_PLANS_ELEMENT, node);
+    	writeElement(writer, Element.USER_REQUEST_SOURCE_CONCURRENCY_ELEMENT, node);
+    	writeElement(writer, Element.TIME_SLICE_IN_MILLI_ELEMENT, node);
+    	writeElement(writer, Element.MAX_ROWS_FETCH_SIZE_ELEMENT, node);
+    	writeElement(writer, Element.LOB_CHUNK_SIZE_IN_KB_ELEMENT, node);
+    	writeElement(writer, Element.USE_DATA_ROLES_ELEMENT, node);
+    	writeElement(writer, Element.ALLOW_CREATE_TEMPORY_TABLES_BY_DEFAULT_ELEMENT, node);
+    	writeElement(writer, Element.ALLOW_FUNCTION_CALLS_BY_DEFAULT_ELEMENT, node);
+    	writeElement(writer, Element.QUERY_THRESHOLD_IN_SECS_ELEMENT, node);
+    	writeElement(writer, Element.MAX_SOURCE_ROWS_ELEMENT, node);
+    	writeElement(writer, Element.EXCEPTION_ON_MAX_SOURCE_ROWS_ELEMENT, node);
+    	writeElement(writer, Element.MAX_ODBC_LOB_SIZE_ALLOWED_ELEMENT, node);
+    	writeElement(writer, Element.EVENT_DISTRIBUTOR_NAME_ELEMENT, node);
+    	writeElement(writer, Element.DETECTING_CHANGE_EVENTS_ELEMENT, node);
+    	writeElement(writer, Element.JDBC_SECURITY_DOMAIN_ELEMENT, node);
+    	writeElement(writer, Element.MAX_SESSIONS_ALLOWED_ELEMENT, node);
+    	writeElement(writer, Element.SESSION_EXPIRATION_TIME_LIMIT_ELEMENT, node);
+    	writeElement(writer, Element.ALLOW_ENV_FUNCTION_ELEMENT, node);
+
+    	if (has(node, Element.BUFFER_SERVICE_ELEMENT.getLocalName())){
+    		writer.writeStartElement(Element.BUFFER_SERVICE_ELEMENT.getLocalName());
+    		writeBufferService(writer, node.get(Element.BUFFER_SERVICE_ELEMENT.getLocalName()));
+    		writer.writeEndElement();
+    	}
+    	
+    	if (has(node, Element.CACHE_FACORY_ELEMENT.getLocalName())){
+    		writer.writeStartElement(Element.CACHE_FACORY_ELEMENT.getLocalName());
+    		writeCacheFactoryConfiguration(writer, node.get(Element.CACHE_FACORY_ELEMENT.getLocalName()));
+    		writer.writeEndElement();
+    	}    	
+    	
+    	if (has(node, Element.RESULTSET_CACHE_ELEMENT.getLocalName())){
+    		writer.writeStartElement(Element.RESULTSET_CACHE_ELEMENT.getLocalName());
+    		writeCacheConfiguration(writer, node.get(Element.RESULTSET_CACHE_ELEMENT.getLocalName()));
+    		writer.writeEndElement();
+    	}
+    	
+    	if (has(node, Element.PREPAREDPLAN_CACHE_ELEMENT.getLocalName())){
+    		writer.writeStartElement(Element.RESULTSET_CACHE_ELEMENT.getLocalName());
+    		writeCacheConfiguration(writer, node.get(Element.PREPAREDPLAN_CACHE_ELEMENT.getLocalName()));
+    		writer.writeEndElement();
+    	}
+    	
+    	//jdbc
+    	if (has(node, Element.JDBC_ELEMENT.getLocalName())){
+    		writer.writeStartElement(Element.JDBC_ELEMENT.getLocalName());
+    		writeSocketConfiguration(writer, node.get(Element.JDBC_ELEMENT.getLocalName()));
+    		writer.writeEndElement();
+    	}
+    	
+    	//odbc
+    	if (has(node, Element.ODBC_ELEMENT.getLocalName())) {
+    		writer.writeStartElement(Element.ODBC_ELEMENT.getLocalName());
+    		writeSocketConfiguration(writer, node.get(Element.ODBC_ELEMENT.getLocalName()));
+    		writer.writeEndElement();
+    	}
+    }
+    
+    private void writeSocketConfiguration(XMLExtendedStreamWriter writer, ModelNode node) throws XMLStreamException {
+    	writeElement(writer, Element.MAX_SOCKET_SIZE_ELEMENT, node);
+    	writeElement(writer, Element.IN_BUFFER_SIZE_ELEMENT, node);
+    	writeElement(writer, Element.OUT_BUFFER_SIZE_ELEMENT, node);
+    	writeElement(writer, Element.SOCKET_BINDING_ELEMENT, node);
+    	
+    	if (has(node, Element.SSL_ELEMENT.getLocalName())) {
+    		writer.writeStartElement(Element.SSL_ELEMENT.getLocalName());
+    		writeSSLConfiguration(writer, node.get(Element.SSL_ELEMENT.getLocalName()));
+    		writer.writeEndElement();
+    	}
+	}
+
+	private void writeSSLConfiguration(XMLExtendedStreamWriter writer, ModelNode node) throws XMLStreamException {
+		writeElement(writer, Element.SSL_MODE_ELEMENT, node);
+		writeElement(writer, Element.KEY_STORE_FILE_ELEMENT, node);
+		writeElement(writer, Element.KEY_STORE_PASSWD_ELEMENT, node);
+		writeElement(writer, Element.KEY_STORE_TYPE_ELEMENT, node);
+		writeElement(writer, Element.SSL_PROTOCOL_ELEMENT, node);
+		writeElement(writer, Element.TRUST_FILE_ELEMENT, node);
+		writeElement(writer, Element.TRUST_PASSWD_ELEMENT, node);
+		writeElement(writer, Element.AUTH_MODE_ELEMENT, node);    
+		writeElement(writer, Element.KEY_MANAGEMENT_ALG_ELEMENT, node);  
+	}
+
+	private void writeBufferService(XMLExtendedStreamWriter writer, ModelNode node) throws XMLStreamException {
+		writeElement(writer, Element.USE_DISK_ELEMENT, node);
+		writeElement(writer, Element.PROCESSOR_BATCH_SIZE_ELEMENT, node);
+		writeElement(writer, Element.CONNECTOR_BATCH_SIZE_ELEMENT, node);
+		writeElement(writer, Element.MAX_RESERVE_BATCH_COLUMNS_ELEMENT, node);
+		writeElement(writer, Element.MAX_PROCESSING_BATCH_COLUMNS_ELEMENT, node);
+		writeElement(writer, Element.MAX_FILE_SIZE_ELEMENT, node);
+		writeElement(writer, Element.MAX_BUFFER_SPACE_ELEMENT, node);
+		writeElement(writer, Element.MAX_OPEN_FILES_ELEMENT, node);
+	}
+
+	private void writeCacheFactoryConfiguration(XMLExtendedStreamWriter writer, ModelNode node) throws XMLStreamException {
+		writeElement(writer, Element.CACHE_SERVICE_JNDI_NAME_ELEMENT, node);
+		writeElement(writer, Element.RESULTSET_CACHE_NAME_ELEMENT, node);
+	}
+
+	private void writeCacheConfiguration(XMLExtendedStreamWriter writer, ModelNode node) throws XMLStreamException {
+		writeElement(writer, Element.MAX_ENTRIES_ELEMENT, node);
+		writeElement(writer, Element.MAX_AGE_IN_SECS_ELEMENT, node);
+		writeElement(writer, Element.MAX_STALENESS_ELEMENT, node);
+		writeElement(writer, Element.CACHE_TYPE_ELEMENT, node);
+		writeElement(writer, Element.CACHE_LOCATION_ELEMENT, node);
+	}
+
+	private boolean has(ModelNode node, String name) {
         return node.has(name) && node.get(name).isDefined();
     }
 
-    private void writeElement(final XMLExtendedStreamWriter writer, final Element element, final ModelNode value)
-            throws XMLStreamException {
-        writer.writeStartElement(element.getLocalName());
-        writer.writeCharacters(value.asString());
-        writer.writeEndElement();
+    private void writeElement(final XMLExtendedStreamWriter writer, final Element element, final ModelNode node) throws XMLStreamException {
+    	if (has(node, element.getLocalName())) {
+	        writer.writeStartElement(element.getLocalName());
+	        writer.writeCharacters(node.get(element.getLocalName()).asString());
+	        writer.writeEndElement();
+    	}
     }        
 
     @Override
@@ -88,12 +200,6 @@
                     switch (element) {
                         case QUERY_ENGINE_ELEMENT:
                         	ModelNode node = parseQueryEngine(reader);
-//                        	node.get(OP).set(ADD);
-//                        	ModelNode nodeAddress = address.clone();
-//                        	nodeAddress.add(Configuration.QUERY_ENGINE, "teiid-query-engine"); // should this be for each instance name? // //$NON-NLS-1$
-//                        	nodeAddress.protect();
-//                          node.get(OP_ADDR).set(nodeAddress);       
-//                          list.add(node);
                         	subsystem.get(Configuration.QUERY_ENGINE).set(node);
                             break;                            
                         default: 

Modified: branches/as7/jboss-integration/src/test/resources/teiid-model-config.txt
===================================================================
--- branches/as7/jboss-integration/src/test/resources/teiid-model-config.txt	2011-07-13 20:34:20 UTC (rev 3311)
+++ branches/as7/jboss-integration/src/test/resources/teiid-model-config.txt	2011-07-14 14:07:35 UTC (rev 3312)
@@ -1,12 +1,5 @@
 {
     "attributes" => {
-        "jndi-name" => {
-            "type" => STRING,
-            "description" => "JNDI name of the Teiid Query Engine",
-            "required" => true,
-            "max-occurs" => 1,
-            "default" => "teiid/engine-deployer"
-        },
         "thread-group-async" => {
             "type" => STRING,
             "description" => "Thread Pool to be used with Asynchronous operations in Teiid",

Modified: branches/as7/jboss-integration/src/test/resources/teiid-sample-config.xml
===================================================================
--- branches/as7/jboss-integration/src/test/resources/teiid-sample-config.xml	2011-07-13 20:34:20 UTC (rev 3311)
+++ branches/as7/jboss-integration/src/test/resources/teiid-sample-config.xml	2011-07-14 14:07:35 UTC (rev 3312)
@@ -1,5 +1,5 @@
 <subsystem xmlns="urn:jboss:domain:teiid:1.0">
-    <query-engine jndi-name="teiid/engine-deployer">
+    <query-engine>
         <thread-group-async>teiid-async</thread-group-async>
         <maxThreads>64</maxThreads>
         <maxActivePlans>20</maxActivePlans>

Modified: branches/as7/metadata/src/main/java/org/teiid/metadata/index/IndexMetadataFactory.java
===================================================================
--- branches/as7/metadata/src/main/java/org/teiid/metadata/index/IndexMetadataFactory.java	2011-07-13 20:34:20 UTC (rev 3311)
+++ branches/as7/metadata/src/main/java/org/teiid/metadata/index/IndexMetadataFactory.java	2011-07-14 14:07:35 UTC (rev 3312)
@@ -24,10 +24,8 @@
 
 import java.io.IOException;
 import java.net.URISyntaxException;
-import java.net.URL;
 import java.util.*;
 
-import org.jboss.vfs.VFS;
 import org.jboss.vfs.VirtualFile;
 import org.jboss.vfs.VirtualFileFilter;
 import org.teiid.adminapi.impl.ModelMetaData;
@@ -71,8 +69,7 @@
 	 * @throws IOException
 	 * @throws URISyntaxException
 	 */
-	public IndexMetadataFactory(URL url) throws IOException, URISyntaxException {
-		VirtualFile vdb = VFS.getChild(url.toURI());
+	public IndexMetadataFactory(VirtualFile vdb) throws IOException, URISyntaxException {
 		List<VirtualFile> children = vdb.getChildrenRecursively(new VirtualFileFilter() {
 			@Override
 			public boolean accepts(VirtualFile file) {

Modified: branches/as7/runtime/src/main/java/org/teiid/deployers/SystemVDBDeployer.java
===================================================================
--- branches/as7/runtime/src/main/java/org/teiid/deployers/SystemVDBDeployer.java	2011-07-13 20:34:20 UTC (rev 3311)
+++ branches/as7/runtime/src/main/java/org/teiid/deployers/SystemVDBDeployer.java	2011-07-14 14:07:35 UTC (rev 3312)
@@ -21,11 +21,15 @@
  */
 package org.teiid.deployers;
 
+import java.io.Closeable;
 import java.io.IOException;
-import java.net.URI;
+import java.io.InputStream;
 import java.net.URISyntaxException;
-import java.net.URL;
 
+import org.jboss.as.server.deployment.module.TempFileProviderService;
+import org.jboss.modules.Module;
+import org.jboss.vfs.VFS;
+import org.jboss.vfs.VirtualFile;
 import org.teiid.core.CoreConstants;
 import org.teiid.core.TeiidRuntimeException;
 import org.teiid.metadata.index.IndexMetadataFactory;
@@ -35,17 +39,21 @@
 
 public class SystemVDBDeployer {
 	private VDBRepository vdbRepository;
-	
+	private Closeable file;
 
 	public void start() {
 		try {
-			URL url = Thread.currentThread().getContextClassLoader().getResource(CoreConstants.SYSTEM_VDB);
-			if (url == null) {
-				throw new TeiidRuntimeException(RuntimeMetadataPlugin.Util.getString("system_vdb_not_found")); //$NON-NLS-1$
+			VirtualFile mountPoint = VFS.getChild("content/" + CoreConstants.SYSTEM_VDB); //$NON-NLS-1$
+			if (!mountPoint.exists()) {
+				InputStream contents = Module.getCallerModule().getClassLoader().findResourceAsStream(CoreConstants.SYSTEM_VDB, false);
+				if (contents == null) {
+					throw new TeiidRuntimeException(RuntimeMetadataPlugin.Util.getString("system_vdb_not_found")); //$NON-NLS-1$
+				}
+				this.file = VFS.mountZip(contents, CoreConstants.SYSTEM_VDB, mountPoint, TempFileProviderService.provider());
 			}
+			
 			// uri conversion is only to remove the spaces in URL, note this only with above kind situation  
-			URI uri = new URI(url.getProtocol(), url.getPath(), null);
-			this.vdbRepository.setSystemStore(new IndexMetadataFactory(uri.toURL()).getMetadataStore(null));
+			this.vdbRepository.setSystemStore(new IndexMetadataFactory(mountPoint).getMetadataStore(null));
 		} catch (URISyntaxException e) {
 			throw new TeiidRuntimeException(e, RuntimePlugin.Util.getString("system_vdb_load_error")); //$NON-NLS-1$
 		} catch (IOException e) {
@@ -57,4 +65,13 @@
 		this.vdbRepository = repo;
 	}	
 	
+	public void stop() {
+		try {
+			if (file != null) {
+				file.close();
+			}
+		} catch (IOException e) {
+			//ignore
+		}
+	}
 }

Modified: branches/as7/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java
===================================================================
--- branches/as7/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java	2011-07-13 20:34:20 UTC (rev 3311)
+++ branches/as7/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java	2011-07-14 14:07:35 UTC (rev 3312)
@@ -261,6 +261,9 @@
 
 	@Override
 	public void undeploy(final DeploymentUnit deploymentUnit) {
+		if (!TeiidAttachments.isVDBDeployment(deploymentUnit)) {
+			return;
+		}		
 		VDBMetaData deployment = deploymentUnit.getAttachment(TeiidAttachments.VDB_METADATA);
 		VirtualFile file = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT).getRoot();
 		

Modified: branches/as7/test-integration/common/src/test/java/org/teiid/jdbc/TestLocalConnections.java
===================================================================
--- branches/as7/test-integration/common/src/test/java/org/teiid/jdbc/TestLocalConnections.java	2011-07-13 20:34:20 UTC (rev 3311)
+++ branches/as7/test-integration/common/src/test/java/org/teiid/jdbc/TestLocalConnections.java	2011-07-14 14:07:35 UTC (rev 3312)
@@ -22,17 +22,17 @@
 
 package org.teiid.jdbc;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.fail;
 
 import java.lang.Thread.UncaughtExceptionHandler;
 import java.sql.Connection;
 import java.sql.Statement;
 import java.util.LinkedHashMap;
 import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
 import java.util.concurrent.locks.Condition;
 import java.util.concurrent.locks.ReentrantLock;
 
-import org.jboss.netty.handler.timeout.TimeoutException;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -62,7 +62,7 @@
 	static Condition waiting = lock.newCondition();
 	static Condition wait = lock.newCondition();
 	
-	public static int blocking() throws InterruptedException {
+	public static int blocking() throws InterruptedException, TimeoutException {
 		lock.lock();
 		try {
 			waiting.signal();



More information about the teiid-commits mailing list