teiid SVN: r3430 - in branches/7.4.x/engine/src: test/java/org/teiid/query/processor/relational and 1 other directory.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-08-29 14:37:36 -0400 (Mon, 29 Aug 2011)
New Revision: 3430
Modified:
branches/7.4.x/engine/src/main/java/org/teiid/query/processor/relational/SortUtility.java
branches/7.4.x/engine/src/test/java/org/teiid/query/processor/relational/TestSortNode.java
Log:
TEIID-1731 fix for incorrect results
Modified: branches/7.4.x/engine/src/main/java/org/teiid/query/processor/relational/SortUtility.java
===================================================================
--- branches/7.4.x/engine/src/main/java/org/teiid/query/processor/relational/SortUtility.java 2011-08-27 01:51:27 UTC (rev 3429)
+++ branches/7.4.x/engine/src/main/java/org/teiid/query/processor/relational/SortUtility.java 2011-08-29 18:37:36 UTC (rev 3430)
@@ -324,7 +324,7 @@
while (sublists.size() > 0) {
SortedSublist sortedSublist = sublists.remove(sublists.size() - 1);
merged.addTuple(sortedSublist.tuple);
- if (this.output != null && sortedSublist.index > masterSortIndex) {
+ if (this.output != null && masterSortIndex < maxSortIndex && sortedSublist.index != masterSortIndex) {
this.output.addTuple(sortedSublist.tuple); //a new distinct row
}
incrementWorkingTuple(sublists, sortedSublist);
@@ -339,7 +339,7 @@
}
merged.saveBatch();
this.activeTupleBuffers.add(merged);
- masterSortIndex = masterSortIndex - maxSortIndex + 1;
+ masterSortIndex = masterSortIndex - maxSortIndex;
if (masterSortIndex < 0) {
masterSortIndex = this.activeTupleBuffers.size() - 1;
}
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/processor/relational/TestSortNode.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/processor/relational/TestSortNode.java 2011-08-27 01:51:27 UTC (rev 3429)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/processor/relational/TestSortNode.java 2011-08-29 18:37:36 UTC (rev 3430)
@@ -46,7 +46,7 @@
import org.teiid.query.sql.symbol.ElementSymbol;
import org.teiid.query.util.CommandContext;
-
+@SuppressWarnings("unchecked")
public class TestSortNode {
public static final int BATCH_SIZE = 100;
@@ -321,4 +321,37 @@
assertEquals(Arrays.asList(2), ts.nextTuple());
}
+ @Test public void testDupRemoveLowMemory() throws Exception {
+ ElementSymbol es1 = new ElementSymbol("e1"); //$NON-NLS-1$
+ es1.setType(DataTypeManager.DefaultDataClasses.INTEGER);
+ BufferManager bm = BufferManagerFactory.getTestBufferManager(0, 2);
+ TupleBuffer tsid = bm.createTupleBuffer(Arrays.asList(es1), "test", TupleSourceType.PROCESSOR); //$NON-NLS-1$
+ tsid.addTuple(Arrays.asList(1));
+ tsid.addTuple(Arrays.asList(2));
+ SortUtility su = new SortUtility(tsid.createIndexedTupleSource(), Arrays.asList(es1), Arrays.asList(Boolean.TRUE), Mode.DUP_REMOVE, bm, "test", tsid.getSchema()); //$NON-NLS-1$
+ TupleBuffer out = su.sort();
+ TupleSource ts = out.createIndexedTupleSource();
+ assertEquals(Arrays.asList(1), ts.nextTuple());
+ assertEquals(Arrays.asList(2), ts.nextTuple());
+ try {
+ ts.nextTuple();
+ fail();
+ } catch (BlockedException e) {
+
+ }
+ tsid.addTuple(Arrays.asList(3));
+ tsid.addTuple(Arrays.asList(4));
+ tsid.addTuple(Arrays.asList(5));
+ tsid.addTuple(Arrays.asList(6));
+ tsid.addTuple(Arrays.asList(6));
+ tsid.addTuple(Arrays.asList(6));
+ tsid.close();
+ su.sort();
+ ts.nextTuple();
+ ts.nextTuple();
+ assertNotNull(ts.nextTuple());
+ assertNotNull(ts.nextTuple());
+ assertNull(ts.nextTuple());
+ }
+
}
13 years, 4 months
teiid SVN: r3429 - branches/7.4.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-08-26 21:51:27 -0400 (Fri, 26 Aug 2011)
New Revision: 3429
Modified:
branches/7.4.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCache.java
Log:
TEIID-1728 change to perform a removal of expired items
Modified: branches/7.4.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCache.java
===================================================================
--- branches/7.4.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCache.java 2011-08-27 01:41:12 UTC (rev 3428)
+++ branches/7.4.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCache.java 2011-08-27 01:51:27 UTC (rev 3429)
@@ -51,8 +51,11 @@
public V get(K key) {
Node<K, V> node = getRootNode();
Node child = node.getChild(getFqn(key));
- if (child != null && validateNode(child)) {
- return (V)child.get(key);
+ if (child != null) {
+ if (validateNode(child)) {
+ return (V)child.get(key);
+ }
+ remove(key);
}
return null;
}
13 years, 4 months
teiid SVN: r3428 - branches/7.4.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-08-26 21:41:12 -0400 (Fri, 26 Aug 2011)
New Revision: 3428
Modified:
branches/7.4.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/ExpirationAwareCache.java
branches/7.4.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCache.java
branches/7.4.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCacheFactory.java
Log:
TEIID-1728 fix for expirations not being handled
Modified: branches/7.4.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/ExpirationAwareCache.java
===================================================================
--- branches/7.4.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/ExpirationAwareCache.java 2011-08-26 16:59:18 UTC (rev 3427)
+++ branches/7.4.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/ExpirationAwareCache.java 2011-08-27 01:41:12 UTC (rev 3428)
@@ -35,6 +35,12 @@
public ExpirationAwareCache(Cache cacheStore, Fqn fqn) {
super(cacheStore, fqn);
}
+
+ @Override
+ protected boolean validateNode(Node node) {
+ Long future = (Long) node.get(ExpirationAlgorithmConfig.EXPIRATION_KEY);
+ return future == null || future > System.currentTimeMillis();
+ }
@Override
public V put(K key, V value) {
Modified: branches/7.4.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCache.java
===================================================================
--- branches/7.4.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCache.java 2011-08-26 16:59:18 UTC (rev 3427)
+++ branches/7.4.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCache.java 2011-08-27 01:41:12 UTC (rev 3428)
@@ -51,11 +51,15 @@
public V get(K key) {
Node<K, V> node = getRootNode();
Node child = node.getChild(getFqn(key));
- if (child != null) {
+ if (child != null && validateNode(child)) {
return (V)child.get(key);
}
return null;
}
+
+ protected boolean validateNode(Node node) {
+ return true;
+ }
protected Fqn<String> getFqn(K key) {
if (key.getClass().isPrimitive() || key instanceof String) {
Modified: branches/7.4.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCacheFactory.java
===================================================================
--- branches/7.4.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCacheFactory.java 2011-08-26 16:59:18 UTC (rev 3427)
+++ branches/7.4.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCacheFactory.java 2011-08-27 01:41:12 UTC (rev 3428)
@@ -29,6 +29,7 @@
import org.jboss.cache.Node;
import org.jboss.cache.Region;
import org.jboss.cache.config.EvictionAlgorithmConfig;
+import org.jboss.cache.config.EvictionConfig;
import org.jboss.cache.config.EvictionRegionConfig;
import org.jboss.cache.eviction.ExpirationAlgorithmConfig;
import org.jboss.cache.eviction.LRUAlgorithmConfig;
@@ -71,6 +72,8 @@
Region cacheRegion = this.cacheStore.getRegion(node.getFqn(), true);
cacheRegion.setEvictionRegionConfig(buildEvictionConfig(node.getFqn(), config));
cacheRegion.activate();
+ cacheRegion = this.cacheStore.getRegion(node.getFqn(), true);
+ cacheRegion.setEvictionRegionConfig(buildEvictionConfig(node.getFqn(), config));
JBossCache jc = null;
if (config != null && config.getPolicy().equals(Policy.EXPIRATION)) {
13 years, 4 months
teiid SVN: r3427 - trunk/test-integration/common/src/test/java/org/teiid/systemmodel.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-08-26 12:59:18 -0400 (Fri, 26 Aug 2011)
New Revision: 3427
Modified:
trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestMatViewReplication.java
Log:
TEIID-1673 switching to local host
Modified: trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestMatViewReplication.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestMatViewReplication.java 2011-08-26 15:46:08 UTC (rev 3426)
+++ trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestMatViewReplication.java 2011-08-26 16:59:18 UTC (rev 3427)
@@ -35,6 +35,7 @@
import java.util.logging.Logger;
import org.jgroups.JChannelFactory;
+import org.junit.BeforeClass;
import org.junit.Test;
import org.teiid.core.types.DataTypeManager;
import org.teiid.core.util.UnitTestUtil;
@@ -51,6 +52,10 @@
private static final String MATVIEWS = "matviews";
private static final boolean DEBUG = false;
+ @BeforeClass public static void oneTimeSetup() {
+ System.setProperty("jgroups.bind_addr", "127.0.0.1");
+ }
+
@Test public void testReplication() throws Exception {
if (DEBUG) {
Logger logger = Logger.getLogger("org.teiid");
13 years, 4 months
teiid SVN: r3426 - in branches/7.4.x/engine/src: test/java/org/teiid/query/processor and 1 other directory.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-08-26 11:46:08 -0400 (Fri, 26 Aug 2011)
New Revision: 3426
Modified:
branches/7.4.x/engine/src/main/java/org/teiid/query/xquery/saxon/SaxonXQueryExpression.java
branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestSQLXMLProcessing.java
Log:
TEIID-1729 fix for xml processing
Modified: branches/7.4.x/engine/src/main/java/org/teiid/query/xquery/saxon/SaxonXQueryExpression.java
===================================================================
--- branches/7.4.x/engine/src/main/java/org/teiid/query/xquery/saxon/SaxonXQueryExpression.java 2011-08-26 15:17:29 UTC (rev 3425)
+++ branches/7.4.x/engine/src/main/java/org/teiid/query/xquery/saxon/SaxonXQueryExpression.java 2011-08-26 15:46:08 UTC (rev 3426)
@@ -171,7 +171,7 @@
throws QueryResolverException {
config.setErrorListener(ERROR_LISTENER);
this.xQueryString = xQueryString;
- StaticQueryContext context = new StaticQueryContext(config);
+ StaticQueryContext context = config.newStaticQueryContext();
IndependentContext ic = new IndependentContext(config);
namespaceMap.put(EMPTY_STRING, EMPTY_STRING);
if (namespaces != null) {
@@ -242,7 +242,13 @@
}
}
this.contextRoot = null;
- PathMap map = this.xQuery.getPathMap();
+ //we'll use a new pathmap, since we don't want to modify the one associated with the xquery.
+ PathMap map = null;
+ if (columns == null) {
+ map = this.xQuery.getPathMap();
+ } else {
+ map = new PathMap(this.xQuery.getExpression());
+ }
PathMapRoot parentRoot;
try {
parentRoot = map.getContextRoot();
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestSQLXMLProcessing.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestSQLXMLProcessing.java 2011-08-26 15:17:29 UTC (rev 3425)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestSQLXMLProcessing.java 2011-08-26 15:46:08 UTC (rev 3426)
@@ -216,7 +216,11 @@
ProcessorPlan plan = helpGetPlan(helpParse(sql), metadata, new DefaultCapabilitiesFinder(), createCommandContext());
- helpProcess(plan, createCommandContext(), dataManager, expected);
+ helpProcess(plan, createCommandContext(), dataManager, expected);
+
+ plan = helpGetPlan(helpParse(sql), metadata, new DefaultCapabilitiesFinder(), createCommandContext());
+
+ doProcess(plan, dataManager, expected, createCommandContext());
}
@Test public void testXmlTableDefaultAndParent() throws Exception {
13 years, 4 months
teiid SVN: r3425 - in trunk: api/src/main/java/org/teiid and 25 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-08-26 11:17:29 -0400 (Fri, 26 Aug 2011)
New Revision: 3425
Added:
trunk/api/src/main/java/org/teiid/Replicated.java
trunk/cache-jbosscache/src/main/java/org/teiid/replication/
trunk/cache-jbosscache/src/main/java/org/teiid/replication/jboss/
trunk/cache-jbosscache/src/main/java/org/teiid/replication/jboss/JGroupsInputStream.java
trunk/cache-jbosscache/src/main/java/org/teiid/replication/jboss/JGroupsObjectReplicator.java
trunk/cache-jbosscache/src/main/java/org/teiid/replication/jboss/JGroupsOutputStream.java
trunk/engine/src/main/java/org/teiid/query/ObjectReplicator.java
trunk/engine/src/main/java/org/teiid/query/ReplicatedObject.java
trunk/engine/src/main/java/org/teiid/query/tempdata/GlobalTableStore.java
trunk/engine/src/main/java/org/teiid/query/tempdata/GlobalTableStoreImpl.java
trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestMatViewReplication.java
Removed:
trunk/cache-jbosscache/src/main/java/org/teiid/events/jboss/
Modified:
trunk/api/src/main/java/org/teiid/events/EventDistributor.java
trunk/build/kits/jboss-container/deploy/teiid/teiid-cache-manager-jboss-beans-rename-me.xml
trunk/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml
trunk/build/pom.xml
trunk/cache-jbosscache/pom.xml
trunk/connectors/connector-file/src/main/rar/META-INF/ra.xml
trunk/engine/src/main/java/org/teiid/common/buffer/STree.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/AccessInfo.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierManagerImpl.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java
trunk/engine/src/main/java/org/teiid/query/optimizer/relational/RelationalPlanner.java
trunk/engine/src/main/java/org/teiid/query/processor/relational/RelationalNode.java
trunk/engine/src/main/java/org/teiid/query/tempdata/AlterTempTable.java
trunk/engine/src/main/java/org/teiid/query/tempdata/TempTable.java
trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java
trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableStore.java
trunk/engine/src/main/java/org/teiid/query/util/CommandContext.java
trunk/engine/src/test/java/org/teiid/query/optimizer/relational/TestMaterialization.java
trunk/engine/src/test/java/org/teiid/query/processor/TestMaterialization.java
trunk/engine/src/test/java/org/teiid/query/processor/TestProcessor.java
trunk/engine/src/test/java/org/teiid/query/processor/TestTempTables.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
trunk/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties
trunk/pom.xml
trunk/runtime/src/main/java/org/teiid/deployers/CompositeVDB.java
trunk/runtime/src/main/java/org/teiid/deployers/VDBLifeCycleListener.java
trunk/runtime/src/main/java/org/teiid/deployers/VDBRepository.java
trunk/runtime/src/test/java/org/teiid/deployers/TestCompositeVDB.java
trunk/test-integration/common/pom.xml
trunk/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java
Log:
TEIID-1727 TEIID-1673 adding matview load coordination and replication directly into jgroups and correcting pom warnings
Added: trunk/api/src/main/java/org/teiid/Replicated.java
===================================================================
--- trunk/api/src/main/java/org/teiid/Replicated.java (rev 0)
+++ trunk/api/src/main/java/org/teiid/Replicated.java 2011-08-26 15:17:29 UTC (rev 3425)
@@ -0,0 +1,58 @@
+/*
+ * 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;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Used to replicate Teiid components - this should be used in extension logic.
+ */
+(a)Target({ElementType.METHOD})
+(a)Retention(RetentionPolicy.RUNTIME)
+@Inherited
+@Documented
+public @interface Replicated {
+ /**
+ * @return true if members should be called asynchronously. asynch methods should be void.
+ */
+ boolean asynch() default true;
+ /**
+ * @return the timeout in milliseconds, or 0 if no timeout. affects only synch calls.
+ */
+ long timeout() default 0;
+ /**
+ * @return true if only remote members should be called. should not be used with replicateState. method should be void.
+ */
+ boolean remoteOnly() default false;
+ /**
+ * @return true if the remote members should have a partial state replication called using the first argument as the state after
+ * the local method has been invoked. should not be used with remoteOnly.
+ */
+ boolean replicateState() default false;
+
+}
\ No newline at end of file
Property changes on: trunk/api/src/main/java/org/teiid/Replicated.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/api/src/main/java/org/teiid/events/EventDistributor.java
===================================================================
--- trunk/api/src/main/java/org/teiid/events/EventDistributor.java 2011-08-25 01:22:57 UTC (rev 3424)
+++ trunk/api/src/main/java/org/teiid/events/EventDistributor.java 2011-08-26 15:17:29 UTC (rev 3425)
@@ -24,6 +24,7 @@
import java.util.List;
+import org.teiid.Replicated;
import org.teiid.metadata.ColumnStats;
import org.teiid.metadata.Table;
import org.teiid.metadata.TableStats;
@@ -45,6 +46,7 @@
* @param tuple
* @param delete
*/
+ @Replicated(remoteOnly=true)
void updateMatViewRow(String vdbName, int vdbVersion, String schema, String viewName, List<?> tuple, boolean delete);
/**
@@ -54,6 +56,7 @@
* @param schema
* @param tableNames
*/
+ @Replicated(remoteOnly=true)
void dataModification(String vdbName, int vdbVersion, String schema, String... tableNames);
/**
@@ -65,6 +68,7 @@
* @param columnName
* @param stats
*/
+ @Replicated(remoteOnly=true)
void setColumnStats(String vdbName, int vdbVersion, String schemaName,
String tableName, String columnName, ColumnStats stats);
@@ -76,6 +80,7 @@
* @param tableName
* @param stats
*/
+ @Replicated(remoteOnly=true)
void setTableStats(String vdbName, int vdbVersion, String schemaName,
String tableName, TableStats stats);
@@ -87,6 +92,7 @@
* @param name
* @param value
*/
+ @Replicated(remoteOnly=true)
void setProperty(String vdbName, int vdbVersion, String uuid, String name, String value);
/**
@@ -99,6 +105,7 @@
* @param triggerDefinition
* @param enabled
*/
+ @Replicated(remoteOnly=true)
void setInsteadOfTriggerDefinition(String vdbName, int vdbVersion, String schema, String viewName, Table.TriggerEvent triggerEvent, String triggerDefinition, Boolean enabled);
/**
@@ -109,6 +116,7 @@
* @param procName
* @param definition
*/
+ @Replicated(remoteOnly=true)
void setProcedureDefinition(String vdbName, int vdbVersion, String schema, String procName, String definition);
/**
@@ -119,13 +127,7 @@
* @param viewName
* @param definition
*/
+ @Replicated(remoteOnly=true)
void setViewDefinition(String vdbName, int vdbVersion, String schema, String viewName, String definition);
- /**
- *
- * @param vdbName
- * @param vdbVersion
- * @param viewName
- */
- void refreshMatView(String vdbName, int vdbVersion, String tableName);
}
Modified: trunk/build/kits/jboss-container/deploy/teiid/teiid-cache-manager-jboss-beans-rename-me.xml
===================================================================
--- trunk/build/kits/jboss-container/deploy/teiid/teiid-cache-manager-jboss-beans-rename-me.xml 2011-08-25 01:22:57 UTC (rev 3424)
+++ trunk/build/kits/jboss-container/deploy/teiid/teiid-cache-manager-jboss-beans-rename-me.xml 2011-08-26 15:17:29 UTC (rev 3425)
@@ -138,14 +138,13 @@
</property>
</bean>
- <bean name="EventDistributorFactory" class="org.teiid.events.jboss.JGroupsEventDistributor">
- <property name="jndiName">teiid/event-distributor</property>
+ <bean name="ObjectReplicator" class="org.teiid.replication.jboss.JGroupsObjectReplicator">
+ <property name="jndiName">teiid/replicator</property>
<property name="channelFactory">
<inject bean="JChannelFactory" />
</property>
- <property name="clusterName">${jboss.partition.name:DefaultPartition}-teiid-events</property>
+ <property name="clusterName">${jboss.partition.name:DefaultPartition}-teiid-rep</property>
<property name="multiplexerStack">${jboss.default.jgroups.stack:udp}</property>
- <property name="localEventDistributorName">teiid/engine-deployer</property>
</bean>
</deployment>
\ No newline at end of file
Modified: trunk/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml
===================================================================
--- trunk/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml 2011-08-25 01:22:57 UTC (rev 3424)
+++ trunk/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml 2011-08-26 15:17:29 UTC (rev 3425)
@@ -131,7 +131,7 @@
<!-- Maximum size of lob allowed through ODBC connection in bytes (default 5MB) -->
<property name="maxODBCLobSizeAllowed">5242880</property>
<!-- The JNDI name of the Teiid Event Distributor -->
- <property name="eventDistributorName">teiid/event-distributor</property>
+ <property name="objectReplicatorName">teiid/replicator</property>
<!-- Set to true for the engine to detect local change events. Should be disabled if using external change data capture tools. (default true) -->
<property name="detectingChangeEvents">true</property>
</bean>
Modified: trunk/build/pom.xml
===================================================================
--- trunk/build/pom.xml 2011-08-25 01:22:57 UTC (rev 3424)
+++ trunk/build/pom.xml 2011-08-26 15:17:29 UTC (rev 3425)
@@ -12,7 +12,7 @@
<dependency>
<groupId>org.jboss.teiid</groupId>
<artifactId>teiid-client-jdk15</artifactId>
- <version>${version}</version>
+ <version>${project.version}</version>
</dependency>
<dependency>
<groupId>net.sf.retrotranslator</groupId>
@@ -119,9 +119,9 @@
<mainClass>net.sf.retrotranslator.transformer.Retrotranslator</mainClass>
<arguments>
<argument>-srcjar</argument>
- <argument>${pom.basedir}/target/teiid-${pom.version}-client.jar</argument>
+ <argument>${project.basedir}/target/teiid-${project.version}-client.jar</argument>
<argument>-destjar</argument>
- <argument>${pom.basedir}/target/teiid-${pom.version}-client-jdk15.jar</argument>
+ <argument>${project.basedir}/target/teiid-${project.version}-client-jdk15.jar</argument>
<argument>-embed</argument>
<argument>org.teiid.retroruntime</argument>
</arguments>
Modified: trunk/cache-jbosscache/pom.xml
===================================================================
--- trunk/cache-jbosscache/pom.xml 2011-08-25 01:22:57 UTC (rev 3424)
+++ trunk/cache-jbosscache/pom.xml 2011-08-26 15:17:29 UTC (rev 3425)
@@ -30,6 +30,10 @@
<artifactId>jbosscache-core</artifactId>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </dependency>
<dependency>
<groupId>org.jboss.man</groupId>
<artifactId>jboss-managed</artifactId>
Added: trunk/cache-jbosscache/src/main/java/org/teiid/replication/jboss/JGroupsInputStream.java
===================================================================
--- trunk/cache-jbosscache/src/main/java/org/teiid/replication/jboss/JGroupsInputStream.java (rev 0)
+++ trunk/cache-jbosscache/src/main/java/org/teiid/replication/jboss/JGroupsInputStream.java 2011-08-26 15:17:29 UTC (rev 3425)
@@ -0,0 +1,111 @@
+/*
+ * 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.replication.jboss;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import java.util.concurrent.locks.Condition;
+import java.util.concurrent.locks.ReentrantLock;
+
+public class JGroupsInputStream extends InputStream {
+
+ static long TIME_OUT = 15000; //TODO make configurable
+
+ private volatile byte[] buf;
+ private volatile int index=0;
+ private ReentrantLock lock = new ReentrantLock();
+ private Condition write = lock.newCondition();
+ private Condition doneReading = lock.newCondition();
+
+ @Override
+ public int read() throws IOException {
+ if (index < 0) {
+ return -1;
+ }
+ if (buf == null) {
+ lock.lock();
+ try {
+ write.await(TIME_OUT, TimeUnit.MILLISECONDS);
+ if (index < 0) {
+ return -1;
+ }
+ if (buf == null) {
+ throw new IOException(new TimeoutException());
+ }
+ } catch(InterruptedException e) {
+ throw new IOException(e);
+ } finally {
+ lock.unlock();
+ }
+ }
+ if (index == buf.length) {
+ lock.lock();
+ try {
+ buf = null;
+ index = 0;
+ doneReading.signal();
+ } finally {
+ lock.unlock();
+ }
+ return read();
+ }
+ return buf[index++] & 0xff;
+ }
+
+ @Override
+ public void close() {
+ lock.lock();
+ try {
+ buf = null;
+ index = -1;
+ doneReading.signal();
+ } finally {
+ lock.unlock();
+ }
+ }
+
+ public void receive(byte[] bytes) throws InterruptedException {
+ lock.lock();
+ try {
+ if (index == -1) {
+ return;
+ }
+ if (buf != null) {
+ doneReading.await();
+ }
+ if (index == -1) {
+ return;
+ }
+ buf = bytes;
+ if (bytes == null) {
+ index = -1;
+ }
+ write.signal();
+ } finally {
+ lock.unlock();
+ }
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/cache-jbosscache/src/main/java/org/teiid/replication/jboss/JGroupsInputStream.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/cache-jbosscache/src/main/java/org/teiid/replication/jboss/JGroupsObjectReplicator.java
===================================================================
--- trunk/cache-jbosscache/src/main/java/org/teiid/replication/jboss/JGroupsObjectReplicator.java (rev 0)
+++ trunk/cache-jbosscache/src/main/java/org/teiid/replication/jboss/JGroupsObjectReplicator.java 2011-08-26 15:17:29 UTC (rev 3425)
@@ -0,0 +1,446 @@
+/*
+ * 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.replication.jboss;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.Serializable;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.Executor;
+import java.util.concurrent.Executors;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.jgroups.Address;
+import org.jgroups.Channel;
+import org.jgroups.ChannelFactory;
+import org.jgroups.ExtendedReceiverAdapter;
+import org.jgroups.Message;
+import org.jgroups.View;
+import org.jgroups.blocks.GroupRequest;
+import org.jgroups.blocks.MethodCall;
+import org.jgroups.blocks.MethodLookup;
+import org.jgroups.blocks.RpcDispatcher;
+import org.jgroups.util.Promise;
+import org.jgroups.util.RspList;
+import org.jgroups.util.Util;
+import org.teiid.Replicated;
+import org.teiid.logging.LogConstants;
+import org.teiid.logging.LogManager;
+import org.teiid.query.ObjectReplicator;
+import org.teiid.query.ReplicatedObject;
+
+public class JGroupsObjectReplicator implements ObjectReplicator, Serializable {
+
+ private static final long serialVersionUID = -6851804958313095166L;
+ private static final String CREATE_STATE = "createState"; //$NON-NLS-1$
+ private static final String BUILD_STATE = "buildState"; //$NON-NLS-1$
+ private static final String FINISH_STATE = "finishState"; //$NON-NLS-1$
+
+ private final class StreamingRunner implements Runnable {
+ private final Object object;
+ private final String stateId;
+ private final JGroupsInputStream is;
+
+ private StreamingRunner(Object object, String stateId, JGroupsInputStream is) {
+ this.object = object;
+ this.stateId = stateId;
+ this.is = is;
+ }
+
+ @Override
+ public void run() {
+ try {
+ ((ReplicatedObject)object).setState(stateId, is);
+ LogManager.logDetail(LogConstants.CTX_RUNTIME, "state set " + stateId); //$NON-NLS-1$
+ } catch (Exception e) {
+ LogManager.logError(LogConstants.CTX_RUNTIME, e, "error setting state " + stateId); //$NON-NLS-1$
+ } finally {
+ is.close();
+ }
+ }
+ }
+
+ private final static class ReplicatedInvocationHandler<S> extends ExtendedReceiverAdapter implements
+ InvocationHandler, Serializable {
+
+ private static final long serialVersionUID = -2943462899945966103L;
+ private final S object;
+ private RpcDispatcher disp;
+ private final HashMap<Method, Short> methodMap;
+ protected Vector<Address> remoteMembers = new Vector<Address>();
+ protected final transient Promise<Boolean> state_promise=new Promise<Boolean>();
+
+ private ReplicatedInvocationHandler(S object,
+ HashMap<Method, Short> methodMap) {
+ this.object = object;
+ this.methodMap = methodMap;
+ }
+
+ public void setDisp(RpcDispatcher disp) {
+ this.disp = disp;
+ }
+
+ @Override
+ public Object invoke(Object proxy, Method method, Object[] args)
+ throws Throwable {
+ Short methodNum = methodMap.get(method);
+ if (methodNum == null || remoteMembers.isEmpty()) {
+ if (methodNum != null) {
+ Replicated annotation = method.getAnnotation(Replicated.class);
+ if (annotation != null && annotation.remoteOnly()) {
+ return null;
+ }
+ }
+ try {
+ return method.invoke(object, args);
+ } catch (InvocationTargetException e) {
+ throw e.getCause();
+ }
+ }
+ try {
+ Replicated annotation = method.getAnnotation(Replicated.class);
+ if (annotation.replicateState()) {
+ Object result = null;
+ try {
+ result = method.invoke(object, args);
+ } catch (InvocationTargetException e) {
+ throw e.getCause();
+ }
+ Vector<Address> dests = null;
+ synchronized (remoteMembers) {
+ dests = new Vector<Address>(remoteMembers);
+ }
+ ReplicatedObject ro = (ReplicatedObject)object;
+ String stateId = (String)args[0];
+ LogManager.logDetail(LogConstants.CTX_RUNTIME, object, "replicating state", stateId); //$NON-NLS-1$
+ JGroupsOutputStream oStream = new JGroupsOutputStream(disp, dests, stateId, (short)(methodMap.size() - 3));
+ try {
+ ro.getState(stateId, oStream);
+ } finally {
+ oStream.close();
+ }
+ LogManager.logTrace(LogConstants.CTX_RUNTIME, object, "sent state", stateId); //$NON-NLS-1$
+ return result;
+ }
+ MethodCall call=new MethodCall(methodNum, args);
+ Vector<Address> dests = null;
+ if (annotation.remoteOnly()) {
+ synchronized (remoteMembers) {
+ dests = new Vector<Address>(remoteMembers);
+ }
+ }
+ RspList responses = disp.callRemoteMethods(dests, call, annotation.asynch()?GroupRequest.GET_NONE:GroupRequest.GET_ALL, annotation.timeout());
+ if (annotation.asynch()) {
+ return null;
+ }
+ Vector<Object> results = responses.getResults();
+ if (method.getReturnType() == boolean.class) {
+ for (Object o : results) {
+ if (!Boolean.TRUE.equals(o)) {
+ return false;
+ }
+ }
+ return true;
+ } else if (method.getReturnType() == Collection.class) {
+ ArrayList<Object> result = new ArrayList<Object>();
+ for (Object o : results) {
+ result.addAll((Collection)o);
+ }
+ return results;
+ }
+ return null;
+ } catch(Exception e) {
+ throw new RuntimeException(method + " " + args + " failed"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+
+ @Override
+ public void viewAccepted(View newView) {
+ if (newView.getMembers() != null) {
+ synchronized (remoteMembers) {
+ remoteMembers.removeAll(newView.getMembers());
+ if (object instanceof ReplicatedObject && !remoteMembers.isEmpty()) {
+ ((ReplicatedObject)object).droppedMembers(new HashSet<Serializable>(remoteMembers));
+ }
+ remoteMembers.clear();
+ remoteMembers.addAll(newView.getMembers());
+ remoteMembers.remove(this.disp.getChannel().getLocalAddress());
+ }
+ }
+ }
+
+ @Override
+ public void setState(InputStream istream) {
+ LogManager.logDetail(LogConstants.CTX_RUNTIME, object, "loading initial state"); //$NON-NLS-1$
+ try {
+ ((ReplicatedObject)object).setState(istream);
+ state_promise.setResult(Boolean.TRUE);
+ } catch (Exception e) {
+ state_promise.setResult(Boolean.FALSE);
+ LogManager.logError(LogConstants.CTX_RUNTIME, e, "error loading initial state"); //$NON-NLS-1$
+ } finally {
+ Util.close(istream);
+ }
+ }
+
+ @Override
+ public void getState(OutputStream ostream) {
+ LogManager.logDetail(LogConstants.CTX_RUNTIME, object, "getting initial state"); //$NON-NLS-1$
+ try {
+ ((ReplicatedObject)object).getState(ostream);
+ } catch (Exception e) {
+ LogManager.logError(LogConstants.CTX_RUNTIME, e, "error gettting initial state"); //$NON-NLS-1$
+ } finally {
+ Util.close(ostream);
+ }
+ }
+ }
+
+ private interface Streaming {
+ void createState(String id);
+ void buildState(String id, byte[] bytes);
+ void finishState(String id);
+ }
+
+ private transient ChannelFactory channelFactory;
+ private String multiplexerStack;
+ private String clusterName;
+ private String jndiName;
+ //TODO: this should be configurable, or use a common executor
+ private transient Executor executor = Executors.newCachedThreadPool();
+
+ public ChannelFactory getChannelFactory() {
+ return channelFactory;
+ }
+
+ public void setJndiName(String jndiName) {
+ this.jndiName = jndiName;
+ }
+
+ public String getJndiName() {
+ return jndiName;
+ }
+
+ public String getMultiplexerStack() {
+ return multiplexerStack;
+ }
+
+ public String getClusterName() {
+ return clusterName;
+ }
+
+ public void setChannelFactory(ChannelFactory channelFactory) {
+ this.channelFactory = channelFactory;
+ }
+
+ public void setClusterName(String clusterName) {
+ this.clusterName = clusterName;
+ }
+
+ public void setMultiplexerStack(String multiplexerStack) {
+ this.multiplexerStack = multiplexerStack;
+ }
+
+ public void start() throws Exception {
+ if (this.channelFactory == null) {
+ return; //no need to distribute events
+ }
+ if (jndiName != null) {
+ final InitialContext ic = new InitialContext();
+ org.jboss.util.naming.Util.bind(ic, jndiName, this);
+ }
+ }
+
+ public void stop() {
+ if (jndiName != null) {
+ final InitialContext ic ;
+ try {
+ ic = new InitialContext() ;
+ org.jboss.util.naming.Util.unbind(ic, jndiName) ;
+ } catch (final NamingException ne) {
+ }
+ }
+ }
+
+ public void stop(Object object) {
+ ReplicatedInvocationHandler<?> handler = (ReplicatedInvocationHandler<?>) Proxy.getInvocationHandler(object);
+ Channel c = handler.disp.getChannel();
+ handler.disp.stop();
+ c.close();
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public <T, S> T replicate(String mux_id,
+ Class<T> iface, final S object, long startTimeout) throws Exception {
+ Channel channel = this.channelFactory.createMultiplexerChannel(this.multiplexerStack, mux_id);
+ Method[] methods = iface.getMethods();
+
+ final HashMap<Method, Short> methodMap = new HashMap<Method, Short>();
+ final ArrayList<Method> methodList = new ArrayList<Method>();
+
+ for (Method method : methods) {
+ if (method.getAnnotation(Replicated.class) == null) {
+ continue;
+ }
+ methodList.add(method);
+ methodMap.put(method, (short)(methodList.size() - 1));
+ }
+
+ //add in streaming methods
+ Method createState = JGroupsObjectReplicator.Streaming.class.getMethod(CREATE_STATE, new Class<?>[] {String.class});
+ methodList.add(createState);
+ methodMap.put(createState, (short)(methodList.size() - 1));
+ Method buildState = JGroupsObjectReplicator.Streaming.class.getMethod(BUILD_STATE, new Class<?>[] {String.class, byte[].class});
+ methodList.add(buildState);
+ methodMap.put(buildState, (short)(methodList.size() - 1));
+ Method finishState = JGroupsObjectReplicator.Streaming.class.getMethod(FINISH_STATE, new Class<?>[] {String.class});
+ methodList.add(finishState);
+ methodMap.put(finishState, (short)(methodList.size() - 1));
+
+ ReplicatedInvocationHandler<S> proxy = new ReplicatedInvocationHandler<S>(object, methodMap);
+ /*
+ * TODO: could have an object implement streaming
+ * Override the normal handle method to support streaming
+ */
+ RpcDispatcher disp = new RpcDispatcher(channel, proxy, proxy, object) {
+ Map<List<?>, JGroupsInputStream> inputStreams = new ConcurrentHashMap<List<?>, JGroupsInputStream>();
+ @Override
+ public Object handle(Message req) {
+ Object body=null;
+
+ if(req == null || req.getLength() == 0) {
+ if(log.isErrorEnabled()) log.error("message or message buffer is null"); //$NON-NLS-1$
+ return null;
+ }
+
+ try {
+ body=req_marshaller != null?
+ req_marshaller.objectFromByteBuffer(req.getBuffer(), req.getOffset(), req.getLength())
+ : req.getObject();
+ }
+ catch(Throwable e) {
+ if(log.isErrorEnabled()) log.error("exception marshalling object", e); //$NON-NLS-1$
+ return e;
+ }
+
+ if(!(body instanceof MethodCall)) {
+ if(log.isErrorEnabled()) log.error("message does not contain a MethodCall object"); //$NON-NLS-1$
+
+ // create an exception to represent this and return it
+ return new IllegalArgumentException("message does not contain a MethodCall object") ; //$NON-NLS-1$
+ }
+
+ final MethodCall method_call=(MethodCall)body;
+
+ try {
+ if(log.isTraceEnabled())
+ log.trace("[sender=" + req.getSrc() + "], method_call: " + method_call); //$NON-NLS-1$ //$NON-NLS-2$
+
+ if(method_lookup == null)
+ throw new Exception("MethodCall uses ID=" + method_call.getId() + ", but method_lookup has not been set"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ if (method_call.getId() >= methodList.size() - 3) {
+ Serializable address = req.getSrc();
+ String stateId = (String)method_call.getArgs()[0];
+ List<?> key = Arrays.asList(stateId, address);
+ JGroupsInputStream is = inputStreams.get(key);
+ if (method_call.getId() == methodList.size() - 3) {
+ LogManager.logTrace(LogConstants.CTX_RUNTIME, object, "create state", stateId); //$NON-NLS-1$
+ if (is != null) {
+ is.receive(null);
+ }
+ is = new JGroupsInputStream();
+ this.inputStreams.put(key, is);
+ executor.execute(new StreamingRunner(object, stateId, is));
+ } else if (method_call.getId() == methodList.size() - 2) {
+ LogManager.logTrace(LogConstants.CTX_RUNTIME, object, "building state", stateId); //$NON-NLS-1$
+ if (is != null) {
+ is.receive((byte[])method_call.getArgs()[1]);
+ }
+ } else if (method_call.getId() == methodList.size() - 1) {
+ LogManager.logTrace(LogConstants.CTX_RUNTIME, object, "finished state", stateId); //$NON-NLS-1$
+ if (is != null) {
+ is.receive(null);
+ }
+ this.inputStreams.remove(key);
+ }
+ return null;
+ }
+
+ Method m=method_lookup.findMethod(method_call.getId());
+ if(m == null)
+ throw new Exception("no method found for " + method_call.getId()); //$NON-NLS-1$
+ method_call.setMethod(m);
+
+ return method_call.invoke(server_obj);
+ }
+ catch(Throwable x) {
+ return x;
+ }
+ }
+ };
+
+ proxy.setDisp(disp);
+ disp.setMethodLookup(new MethodLookup() {
+ public Method findMethod(short id) {
+ return methodList.get(id);
+ }
+ });
+
+ T replicatedProxy = (T) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class[] {iface}, proxy);
+
+ channel.connect(clusterName);
+ if (object instanceof ReplicatedObject) {
+ ((ReplicatedObject)object).setLocalAddress(channel.getLocalAddress());
+ boolean getState = channel.getState(null, startTimeout);
+ if (getState) {
+ boolean loaded = proxy.state_promise.getResult(startTimeout);
+ if (loaded) {
+ LogManager.logDetail(LogConstants.CTX_RUNTIME, object, "loaded"); //$NON-NLS-1$
+ } else {
+ LogManager.logWarning(LogConstants.CTX_RUNTIME, object + " load timeout"); //$NON-NLS-1$
+ }
+ } else {
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, object + " first member or timeout exceeded"); //$NON-NLS-1$
+ }
+ }
+
+ return replicatedProxy;
+ }
+
+}
Property changes on: trunk/cache-jbosscache/src/main/java/org/teiid/replication/jboss/JGroupsObjectReplicator.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/cache-jbosscache/src/main/java/org/teiid/replication/jboss/JGroupsOutputStream.java
===================================================================
--- trunk/cache-jbosscache/src/main/java/org/teiid/replication/jboss/JGroupsOutputStream.java (rev 0)
+++ trunk/cache-jbosscache/src/main/java/org/teiid/replication/jboss/JGroupsOutputStream.java 2011-08-26 15:17:29 UTC (rev 3425)
@@ -0,0 +1,96 @@
+/*
+ * 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.replication.jboss;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Arrays;
+import java.util.Vector;
+
+import org.jgroups.Address;
+import org.jgroups.blocks.GroupRequest;
+import org.jgroups.blocks.MethodCall;
+import org.jgroups.blocks.RpcDispatcher;
+import org.teiid.core.types.Streamable;
+
+public class JGroupsOutputStream extends OutputStream {
+
+ static final int CHUNK_SIZE=Streamable.STREAMING_BATCH_SIZE_IN_BYTES;
+
+ protected final RpcDispatcher disp;
+ protected final Vector<Address> dests;
+ protected final String stateId;
+ protected final short methodOffset;
+
+ private volatile boolean closed=false;
+ private final byte[] buffer=new byte[CHUNK_SIZE];
+ private int index=0;
+
+ public JGroupsOutputStream(RpcDispatcher disp, Vector<Address> dests, String stateId, short methodOffset) {
+ this.disp=disp;
+ this.dests=dests;
+ this.stateId=stateId;
+ this.methodOffset = methodOffset;
+ disp.callRemoteMethods(this.dests, new MethodCall(methodOffset, new Object[] {stateId}), GroupRequest.GET_NONE, 0);
+ }
+
+ public void close() throws IOException {
+ if(closed) {
+ return;
+ }
+ flush();
+ try {
+ disp.callRemoteMethods(dests, new MethodCall((short)(methodOffset + 2), new Object[] {stateId}), GroupRequest.GET_NONE, 0);
+ } catch(Exception e) {
+ }
+ closed=true;
+ }
+
+ public void flush() throws IOException {
+ checkClosed();
+ try {
+ if(index == 0) {
+ return;
+ }
+ disp.callRemoteMethods(dests, new MethodCall((short)(methodOffset + 1), new Object[] {stateId, Arrays.copyOf(buffer, index)}), GroupRequest.GET_NONE, 0);
+ index=0;
+ } catch(Exception e) {
+ throw new IOException(e);
+ }
+ }
+
+ private void checkClosed() throws IOException {
+ if(closed) {
+ throw new IOException("output stream is closed"); //$NON-NLS-1$
+ }
+ }
+
+ public void write(int b) throws IOException {
+ checkClosed();
+ if(index >= buffer.length) {
+ flush();
+ }
+ buffer[index++]=(byte)b;
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/cache-jbosscache/src/main/java/org/teiid/replication/jboss/JGroupsOutputStream.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/connectors/connector-file/src/main/rar/META-INF/ra.xml
===================================================================
--- trunk/connectors/connector-file/src/main/rar/META-INF/ra.xml 2011-08-25 01:22:57 UTC (rev 3424)
+++ trunk/connectors/connector-file/src/main/rar/META-INF/ra.xml 2011-08-26 15:17:29 UTC (rev 3425)
@@ -1,10 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
-<connector xmlns="http://java.sun.com/xml/ns/j2ee"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
- http://java.sun.com/xml/ns/j2ee/connector_1_5.xsd"
- version="1.5">
+<connector version="1.5">
<vendor-name>Red Hat Middleware LLC</vendor-name>
<eis-type>Teiid Text Connector</eis-type>
@@ -55,7 +51,7 @@
<config-property>
<description>{$display:"Allow Parent Paths"}</description>
<config-property-name>AllowParentPaths</config-property-name>
- <config-property-type>java.lang.Boolean</config-property-type>
+ <config-property-type>boolean</config-property-type>
<config-property-value>true</config-property-value>
</config-property>
Modified: trunk/engine/src/main/java/org/teiid/common/buffer/STree.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/common/buffer/STree.java 2011-08-25 01:22:57 UTC (rev 3424)
+++ trunk/engine/src/main/java/org/teiid/common/buffer/STree.java 2011-08-26 15:17:29 UTC (rev 3425)
@@ -23,6 +23,8 @@
package org.teiid.common.buffer;
import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
@@ -31,6 +33,7 @@
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.ReentrantLock;
+import org.teiid.client.BatchSerializer;
import org.teiid.common.buffer.SPage.SearchResult;
import org.teiid.core.TeiidComponentException;
import org.teiid.query.processor.relational.ListNestedSortComparator;
@@ -88,6 +91,29 @@
this.keytypes = Arrays.copyOf(types, keyLength);
}
+ public void writeValuesTo(ObjectOutputStream oos) throws TeiidComponentException, IOException {
+ SPage page = header[0];
+ oos.writeInt(this.rowCount.get());
+ while (true) {
+ TupleBatch batch = page.getValues();
+ BatchSerializer.writeBatch(oos, types, batch.getAllTuples());
+ if (page.next == null) {
+ break;
+ }
+ }
+ }
+
+ public void readValuesFrom(ObjectInputStream ois) throws IOException, ClassNotFoundException, TeiidComponentException {
+ int size = ois.readInt();
+ int sizeHint = this.getExpectedHeight(size);
+ while (this.getRowCount() < size) {
+ List[] batch = BatchSerializer.readBatch(ois, types);
+ for (List list : batch) {
+ this.insert(list, InsertMode.ORDERED, sizeHint);
+ }
+ }
+ }
+
protected SPage findChildTail(SPage page) {
if (page == null) {
page = header[header.length - 1];
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/AccessInfo.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/AccessInfo.java 2011-08-25 01:22:57 UTC (rev 3424)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/AccessInfo.java 2011-08-26 15:17:29 UTC (rev 3425)
@@ -41,7 +41,7 @@
import org.teiid.query.metadata.TempMetadataID;
import org.teiid.query.metadata.TransformationMetadata;
import org.teiid.query.optimizer.relational.RelationalPlanner;
-import org.teiid.query.tempdata.TempTableStore;
+import org.teiid.query.tempdata.GlobalTableStore;
import org.teiid.query.util.CommandContext;
/**
@@ -117,17 +117,17 @@
}
VDBMetaData vdb = DQPWorkContext.getWorkContext().getVDB();
TransformationMetadata tm = vdb.getAttachment(TransformationMetadata.class);
- TempTableStore globalStore = vdb.getAttachment(TempTableStore.class);
+ GlobalTableStore globalStore = vdb.getAttachment(GlobalTableStore.class);
if (!externalNames.isEmpty()) {
this.objectsAccessed = new HashSet<Object>(externalNames.size());
for (List<String> key : this.externalNames) {
if (key.size() == 1) {
String matTableName = key.get(0);
- TempMetadataID id = globalStore.getMetadataStore().getTempGroupID(matTableName);
+ TempMetadataID id = globalStore.getTempTableStore().getMetadataStore().getTempGroupID(matTableName);
if (id == null) {
//if the id is null, then create a local instance
String viewFullName = matTableName.substring(RelationalPlanner.MAT_PREFIX.length());
- id = globalStore.getGlobalTempTableMetadataId(tm.getGroupID(viewFullName), tm);
+ id = globalStore.getGlobalTempTableMetadataId(tm.getGroupID(viewFullName));
}
this.objectsAccessed.add(id);
} else {
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2011-08-25 01:22:57 UTC (rev 3424)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2011-08-26 15:17:29 UTC (rev 3425)
@@ -28,7 +28,6 @@
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import java.util.concurrent.Callable;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.FutureTask;
@@ -43,11 +42,10 @@
import org.teiid.adminapi.Request.ThreadState;
import org.teiid.adminapi.impl.CacheStatisticsMetadata;
import org.teiid.adminapi.impl.RequestMetadata;
-import org.teiid.adminapi.impl.VDBMetaData;
import org.teiid.adminapi.impl.WorkerPoolStatisticsMetadata;
import org.teiid.cache.CacheConfiguration;
-import org.teiid.cache.CacheConfiguration.Policy;
import org.teiid.cache.CacheFactory;
+import org.teiid.cache.CacheConfiguration.Policy;
import org.teiid.client.DQP;
import org.teiid.client.RequestMessage;
import org.teiid.client.ResultsMessage;
@@ -59,29 +57,24 @@
import org.teiid.client.xa.XidImpl;
import org.teiid.common.buffer.BufferManager;
import org.teiid.core.TeiidComponentException;
-import org.teiid.core.TeiidException;
import org.teiid.core.TeiidProcessingException;
import org.teiid.core.TeiidRuntimeException;
import org.teiid.core.types.Streamable;
-import org.teiid.dqp.internal.process.SessionAwareCache.CacheID;
import org.teiid.dqp.internal.process.ThreadReuseExecutor.PrioritizedRunnable;
import org.teiid.dqp.message.AtomicRequestMessage;
import org.teiid.dqp.message.RequestID;
import org.teiid.dqp.service.BufferService;
import org.teiid.dqp.service.TransactionContext;
-import org.teiid.dqp.service.TransactionContext.Scope;
import org.teiid.dqp.service.TransactionService;
+import org.teiid.dqp.service.TransactionContext.Scope;
import org.teiid.events.EventDistributor;
import org.teiid.logging.CommandLogMessage;
-import org.teiid.logging.CommandLogMessage.Event;
import org.teiid.logging.LogConstants;
import org.teiid.logging.LogManager;
import org.teiid.logging.MessageLevel;
+import org.teiid.logging.CommandLogMessage.Event;
import org.teiid.metadata.MetadataRepository;
import org.teiid.query.QueryPlugin;
-import org.teiid.query.metadata.QueryMetadataInterface;
-import org.teiid.query.metadata.TempMetadataAdapter;
-import org.teiid.query.optimizer.relational.RelationalPlanner;
import org.teiid.query.tempdata.TempTableDataManager;
import org.teiid.query.tempdata.TempTableStore;
@@ -738,96 +731,12 @@
DataTierManagerImpl processorDataManager = new DataTierManagerImpl(this,this.bufferService, this.config.isDetectingChangeEvents());
processorDataManager.setEventDistributor(eventDistributor);
processorDataManager.setMetadataRepository(metadataRepository);
- dataTierMgr = new TempTableDataManager(processorDataManager, this.bufferManager, this.processWorkerPool, this.rsCache, this.matTables, this.cacheFactory);
+ dataTierMgr = new TempTableDataManager(processorDataManager, this.bufferManager, this.processWorkerPool, this.rsCache);
dataTierMgr.setEventDistributor(eventDistributor);
LogManager.logDetail(LogConstants.CTX_DQP, "DQPCore started maxThreads", this.config.getMaxThreads(), "maxActivePlans", this.maxActivePlans, "source concurrency", this.userRequestSourceConcurrency); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- public void synchronizeInternalMaterializedViews(final ContextProvider contextProvider) {
- if (!cacheFactory.isReplicated() || matTables == null) {
- return;
- }
- Set<CacheID> keys = this.matTables.replicatableKeys();
- for (final CacheID key:keys) {
- if (key.getSql().startsWith(RelationalPlanner.MAT_PREFIX)) {
- refreshMatView(contextProvider, key.getVDBKey().getName(), key.getVDBKey().getVersion(), key.getSql().substring(RelationalPlanner.MAT_PREFIX.length()));
- }
- }
- }
-
- public void refreshMatView(final ContextProvider contextProvider, final String vdbName, final int vdbVersion, final String viewName) {
- if (!cacheFactory.isReplicated() || matTables == null) {
- return;
- }
-
- final DQPWorkContext context = contextProvider.getContext(vdbName, vdbVersion);
-
- final VDBMetaData vdb = context.getVDB();
- if (vdb == null) {
- return;
- }
-
- final TempTableStore globalStore = vdb.getAttachment(TempTableStore.class);
- if (globalStore == null) {
- return;
- }
- DQPWorkContext.setWorkContext(context);
-
- Runnable work = new Runnable() {
- @Override
- public void run() {
- QueryMetadataInterface metadata = vdb.getAttachment(QueryMetadataInterface.class);
- TempTableStore tempStore = new TempTableStore("internal"); //$NON-NLS-1$
- TempMetadataAdapter tma = new TempMetadataAdapter(metadata, tempStore.getMetadataStore());
- try {
- dataTierMgr.refreshMatView(vdb.getName(), vdb.getVersion(), viewName, tma, globalStore);
- } catch (TeiidException e) {
- LogManager.logError(LogConstants.CTX_DQP, e, QueryPlugin.Util.getString("error_refresh", viewName )); //$NON-NLS-1$
- }
- }
- };
- addWork(work);
- }
-
- public void updateMatViewRow(final ContextProvider contextProvider, final String vdbName, final int vdbVersion, final String schema,
- final String viewName, final List<?> tuple, final boolean delete) {
-
- if (!cacheFactory.isReplicated() || matTables == null) {
- return;
- }
-
- final DQPWorkContext context = contextProvider.getContext(vdbName, vdbVersion);
-
- final VDBMetaData vdb = context.getVDB();
- if (vdb == null) {
- return;
- }
-
- final TempTableStore globalStore = vdb.getAttachment(TempTableStore.class);
- if (globalStore == null) {
- return;
- }
-
- Runnable work = new Runnable() {
- @Override
- public void run() {
- context.runInContext(new Runnable() {
- @Override
- public void run() {
- try {
- dataTierMgr.updateMatViewRow(globalStore, RelationalPlanner.MAT_PREFIX + (schema + '.' + viewName).toUpperCase(), tuple, delete);
- } catch (TeiidException e) {
- LogManager.logError(LogConstants.CTX_DQP, e, QueryPlugin.Util.getString("DQPCore.unable_to_process_event")); //$NON-NLS-1$
- }
- }
- });
- }
- };
- addWork(work);
-
- }
-
public void setBufferService(BufferService service) {
this.bufferService = service;
}
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierManagerImpl.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierManagerImpl.java 2011-08-25 01:22:57 UTC (rev 3424)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierManagerImpl.java 2011-08-26 15:17:29 UTC (rev 3425)
@@ -89,8 +89,8 @@
import org.teiid.query.sql.symbol.Constant;
import org.teiid.query.sql.symbol.GroupSymbol;
import org.teiid.query.sql.visitor.GroupCollectorVisitor;
-import org.teiid.query.tempdata.TempTableStore;
-import org.teiid.query.tempdata.TempTableStore.MatTableInfo;
+import org.teiid.query.tempdata.GlobalTableStore;
+import org.teiid.query.tempdata.GlobalTableStoreImpl.MatTableInfo;
import org.teiid.query.util.CommandContext;
/**
@@ -243,13 +243,13 @@
Integer cardinaltity = null;
Boolean valid = null;
if (table.getMaterializedTable() == null) {
- TempTableStore globalStore = context.getGlobalTableStore();
+ GlobalTableStore globalStore = context.getGlobalTableStore();
matTableName = RelationalPlanner.MAT_PREFIX+table.getFullName().toUpperCase();
MatTableInfo info = globalStore.getMatTableInfo(matTableName);
valid = info.isValid();
state = info.getState().name();
updated = info.getUpdateTime()==-1?null:new Timestamp(info.getUpdateTime());
- TempMetadataID id = globalStore.getMetadataStore().getTempGroupID(matTableName);
+ TempMetadataID id = globalStore.getTempTableStore().getMetadataStore().getTempGroupID(matTableName);
if (id != null) {
cardinaltity = id.getCardinality();
}
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java 2011-08-25 01:22:57 UTC (rev 3424)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java 2011-08-26 15:17:29 UTC (rev 3425)
@@ -83,6 +83,7 @@
import org.teiid.query.sql.symbol.Reference;
import org.teiid.query.sql.visitor.GroupCollectorVisitor;
import org.teiid.query.sql.visitor.ReferenceCollectorVisitor;
+import org.teiid.query.tempdata.GlobalTableStore;
import org.teiid.query.tempdata.TempTableStore;
import org.teiid.query.util.CommandContext;
import org.teiid.query.util.ContextProperties;
@@ -128,7 +129,7 @@
protected Command userCommand;
protected boolean returnsUpdateCount;
- private TempTableStore globalTables;
+ private GlobalTableStore globalTables;
private SessionAwareCache<PreparedPlan> planCache;
private boolean resultSetCacheEnabled = true;
private int userRequestConcurrency;
@@ -185,7 +186,7 @@
VDBMetaData vdbMetadata = workContext.getVDB();
metadata = vdbMetadata.getAttachment(QueryMetadataInterface.class);
- globalTables = vdbMetadata.getAttachment(TempTableStore.class);
+ globalTables = vdbMetadata.getAttachment(GlobalTableStore.class);
if (metadata == null) {
throw new TeiidComponentException(QueryPlugin.Util.getString("DQPCore.Unable_to_load_metadata_for_VDB_name__{0},_version__{1}", this.vdbName, this.vdbVersion)); //$NON-NLS-1$
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java 2011-08-25 01:22:57 UTC (rev 3424)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java 2011-08-26 15:17:29 UTC (rev 3425)
@@ -287,10 +287,6 @@
return true;
}
- public String getSql() {
- return sql;
- }
-
void setUserName(String name) {
this.userName = name;
}
Added: trunk/engine/src/main/java/org/teiid/query/ObjectReplicator.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/ObjectReplicator.java (rev 0)
+++ trunk/engine/src/main/java/org/teiid/query/ObjectReplicator.java 2011-08-26 15:17:29 UTC (rev 3425)
@@ -0,0 +1,31 @@
+/*
+ * 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.query;
+
+public interface ObjectReplicator {
+
+ public <T, S> T replicate(String id, Class<T> iface, S object, long startTimeout) throws Exception;
+
+ public void stop(Object o);
+
+}
Property changes on: trunk/engine/src/main/java/org/teiid/query/ObjectReplicator.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/engine/src/main/java/org/teiid/query/ReplicatedObject.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/ReplicatedObject.java (rev 0)
+++ trunk/engine/src/main/java/org/teiid/query/ReplicatedObject.java 2011-08-26 15:17:29 UTC (rev 3425)
@@ -0,0 +1,78 @@
+/*
+ * 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.query;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.Serializable;
+import java.util.Collection;
+
+/**
+ * Optional interface to be implemented by a replicated object to support full and partial state transfer.
+ *
+ */
+public interface ReplicatedObject {
+
+ /**
+ * Allows an application to write a state through a provided OutputStream.
+ *
+ * @param ostream the OutputStream
+ */
+ void getState(OutputStream ostream);
+
+ /**
+ * Allows an application to write a partial state through a provided OutputStream.
+ *
+ * @param state_id id of the partial state requested
+ * @param ostream the OutputStream
+ */
+ void getState(String state_id, OutputStream ostream);
+
+ /**
+ * Allows an application to read a state through a provided InputStream.
+ *
+ * @param istream the InputStream
+ */
+ void setState(InputStream istream);
+
+ /**
+ * Allows an application to read a partial state through a provided InputStream.
+ *
+ * @param state_id id of the partial state requested
+ * @param istream the InputStream
+ */
+ void setState(String state_id, InputStream istream);
+
+ /**
+ * Allows the replicator to set the local address from the channel
+ * @param address
+ */
+ void setLocalAddress(Serializable address);
+
+ /**
+ * Called when members are dropped
+ * @param addresses
+ */
+ void droppedMembers(Collection<Serializable> addresses);
+
+}
Property changes on: trunk/engine/src/main/java/org/teiid/query/ReplicatedObject.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/RelationalPlanner.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/RelationalPlanner.java 2011-08-25 01:22:57 UTC (rev 3424)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/RelationalPlanner.java 2011-08-26 15:17:29 UTC (rev 3425)
@@ -1216,7 +1216,7 @@
CacheHint hint = null;
boolean isImplicitGlobal = matMetadataId == null;
if (isImplicitGlobal) {
- TempMetadataID tid = context.getGlobalTableStore().getGlobalTempTableMetadataId(metadataID, metadata);
+ TempMetadataID tid = context.getGlobalTableStore().getGlobalTempTableMetadataId(metadataID);
matTableName = tid.getID();
hint = tid.getCacheHint();
if (hint != null) {
Modified: trunk/engine/src/main/java/org/teiid/query/processor/relational/RelationalNode.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/relational/RelationalNode.java 2011-08-25 01:22:57 UTC (rev 3424)
+++ trunk/engine/src/main/java/org/teiid/query/processor/relational/RelationalNode.java 2011-08-26 15:17:29 UTC (rev 3425)
@@ -46,7 +46,6 @@
import org.teiid.query.processor.BatchCollector.BatchProducer;
import org.teiid.query.sql.symbol.AliasSymbol;
import org.teiid.query.sql.symbol.Expression;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
import org.teiid.query.util.CommandContext;
@@ -358,7 +357,7 @@
/**
* Helper method for all the node that will filter the elements needed for the next node.
*/
- public static int[] getProjectionIndexes(Map<SingleElementSymbol, Integer> tupleElements, List<? extends Expression> projectElements) {
+ public static int[] getProjectionIndexes(Map<? extends Expression, Integer> tupleElements, List<? extends Expression> projectElements) {
int[] result = new int[projectElements.size()];
int i = 0;
Modified: trunk/engine/src/main/java/org/teiid/query/tempdata/AlterTempTable.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/tempdata/AlterTempTable.java 2011-08-25 01:22:57 UTC (rev 3424)
+++ trunk/engine/src/main/java/org/teiid/query/tempdata/AlterTempTable.java 2011-08-26 15:17:29 UTC (rev 3425)
@@ -1,12 +1,3 @@
-package org.teiid.query.tempdata;
-
-import java.util.List;
-
-import org.teiid.query.sql.LanguageVisitor;
-import org.teiid.query.sql.lang.Command;
-import org.teiid.query.sql.symbol.ElementSymbol;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
-
/*
* JBoss, Home of Professional Open Source.
* See the COPYRIGHT.txt file distributed with this work for information
@@ -29,6 +20,15 @@
* 02110-1301 USA.
*/
+package org.teiid.query.tempdata;
+
+import java.util.List;
+
+import org.teiid.query.sql.LanguageVisitor;
+import org.teiid.query.sql.lang.Command;
+import org.teiid.query.sql.symbol.ElementSymbol;
+import org.teiid.query.sql.symbol.SingleElementSymbol;
+
public class AlterTempTable extends Command {
private String tempTable;
Added: trunk/engine/src/main/java/org/teiid/query/tempdata/GlobalTableStore.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/tempdata/GlobalTableStore.java (rev 0)
+++ trunk/engine/src/main/java/org/teiid/query/tempdata/GlobalTableStore.java 2011-08-26 15:17:29 UTC (rev 3425)
@@ -0,0 +1,67 @@
+/*
+ * 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.query.tempdata;
+
+import java.io.Serializable;
+import java.util.List;
+
+import org.teiid.Replicated;
+import org.teiid.api.exception.query.QueryMetadataException;
+import org.teiid.api.exception.query.QueryResolverException;
+import org.teiid.api.exception.query.QueryValidatorException;
+import org.teiid.core.TeiidComponentException;
+import org.teiid.query.metadata.TempMetadataID;
+import org.teiid.query.sql.symbol.GroupSymbol;
+import org.teiid.query.tempdata.GlobalTableStoreImpl.MatTableInfo;
+
+public interface GlobalTableStore {
+
+ TempMetadataID getGlobalTempTableMetadataId(Object groupID) throws QueryMetadataException, TeiidComponentException, QueryResolverException, QueryValidatorException;
+
+ TempMetadataID getCodeTableMetadataId(String codeTableName,
+ String returnElementName, String keyElementName,
+ String matTableName) throws TeiidComponentException,
+ QueryMetadataException;
+
+ MatTableInfo getMatTableInfo(String matTableName);
+
+ TempTableStore getTempTableStore();
+
+ Serializable getLocalAddress();
+
+ List<?> updateMatViewRow(String matTableName, List<?> tuple, boolean delete) throws TeiidComponentException;
+
+ TempTable createMatTable(String tableName, GroupSymbol group)
+ throws TeiidComponentException, QueryMetadataException, QueryResolverException, QueryValidatorException;
+
+ @Replicated
+ void failedLoad(String matTableName);
+
+ @Replicated(asynch=false, timeout=5000)
+ boolean needsLoading(String matTableName, Serializable loadingAddress,
+ boolean firstPass, boolean refresh, boolean invalidate);
+
+ @Replicated(replicateState=true)
+ void loaded(String matTableName, TempTable table);
+
+}
Property changes on: trunk/engine/src/main/java/org/teiid/query/tempdata/GlobalTableStore.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/engine/src/main/java/org/teiid/query/tempdata/GlobalTableStoreImpl.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/tempdata/GlobalTableStoreImpl.java (rev 0)
+++ trunk/engine/src/main/java/org/teiid/query/tempdata/GlobalTableStoreImpl.java 2011-08-26 15:17:29 UTC (rev 3425)
@@ -0,0 +1,471 @@
+/*
+ * 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.query.tempdata;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.OutputStream;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.teiid.api.exception.query.QueryMetadataException;
+import org.teiid.api.exception.query.QueryResolverException;
+import org.teiid.api.exception.query.QueryValidatorException;
+import org.teiid.common.buffer.BufferManager;
+import org.teiid.core.TeiidComponentException;
+import org.teiid.core.TeiidRuntimeException;
+import org.teiid.core.types.DataTypeManager;
+import org.teiid.language.SQLConstants;
+import org.teiid.language.SQLConstants.Reserved;
+import org.teiid.logging.LogConstants;
+import org.teiid.logging.LogManager;
+import org.teiid.query.ReplicatedObject;
+import org.teiid.query.mapping.relational.QueryNode;
+import org.teiid.query.metadata.QueryMetadataInterface;
+import org.teiid.query.metadata.TempMetadataAdapter;
+import org.teiid.query.metadata.TempMetadataID;
+import org.teiid.query.metadata.TempMetadataStore;
+import org.teiid.query.optimizer.relational.RelationalPlanner;
+import org.teiid.query.resolver.QueryResolver;
+import org.teiid.query.resolver.util.ResolverUtil;
+import org.teiid.query.sql.lang.CacheHint;
+import org.teiid.query.sql.lang.Command;
+import org.teiid.query.sql.lang.Create;
+import org.teiid.query.sql.symbol.ElementSymbol;
+import org.teiid.query.sql.symbol.GroupSymbol;
+
+public class GlobalTableStoreImpl implements GlobalTableStore, ReplicatedObject {
+
+ public enum MatState {
+ NEEDS_LOADING,
+ LOADING,
+ FAILED_LOAD,
+ LOADED
+ }
+
+ public class MatTableInfo {
+ private long updateTime = -1;
+ private MatState state = MatState.NEEDS_LOADING;
+ private Serializable loadingAddress;
+ private long ttl = -1;
+ private boolean valid;
+
+ protected MatTableInfo() {}
+
+ private synchronized boolean shouldLoad(Serializable possibleLoadingAddress, boolean firstPass, boolean refresh, boolean invalidate) {
+ if (invalidate) {
+ LogManager.logDetail(LogConstants.CTX_MATVIEWS, this, "invalidating"); //$NON-NLS-1$
+ valid = false;
+ }
+ switch (state) {
+ case NEEDS_LOADING:
+ case FAILED_LOAD:
+ if (!firstPass) {
+ this.loadingAddress = possibleLoadingAddress;
+ setState(MatState.LOADING, null);
+ }
+ return true;
+ case LOADING:
+ if (!firstPass && localAddress instanceof Comparable<?> && ((Comparable)localAddress).compareTo(possibleLoadingAddress) < 0) {
+ this.loadingAddress = possibleLoadingAddress; //ties go to the lowest address
+ return true;
+ }
+ return false;
+ case LOADED:
+ if (!firstPass
+ || refresh
+ || ttl >= 0 && System.currentTimeMillis() - updateTime - ttl > 0) {
+ if (firstPass) {
+ setState(MatState.NEEDS_LOADING, null);
+ } else {
+ this.loadingAddress = possibleLoadingAddress;
+ setState(MatState.LOADING, null);
+ }
+ return true;
+ }
+ return false;
+ }
+ throw new AssertionError();
+ }
+
+ private synchronized void setState(MatState state, Boolean valid) {
+ MatState oldState = this.state;
+ long timestamp = System.currentTimeMillis();
+ LogManager.logDetail(LogConstants.CTX_MATVIEWS, this, "setting matState to", state, valid, timestamp, "old values", oldState, this.valid); //$NON-NLS-1$ //$NON-NLS-2$
+ if (valid != null) {
+ this.valid = valid;
+ }
+ this.state = state;
+ this.updateTime = System.currentTimeMillis();
+ notifyAll();
+ }
+
+ public synchronized void setTtl(long ttl) {
+ this.ttl = ttl;
+ }
+
+ public synchronized long getUpdateTime() {
+ return updateTime;
+ }
+
+ public synchronized MatState getState() {
+ return state;
+ }
+
+ public synchronized boolean isUpToDate() {
+ return isValid() && (ttl < 0 || System.currentTimeMillis() - updateTime - ttl <= 0);
+ }
+
+ public synchronized boolean isValid() {
+ return valid;
+ }
+
+ public synchronized long getTtl() {
+ return ttl;
+ }
+
+ }
+
+ private ConcurrentHashMap<String, MatTableInfo> matTables = new ConcurrentHashMap<String, MatTableInfo>();
+ private TempTableStore tableStore = new TempTableStore("SYSTEM"); //$NON-NLS-1$
+ private BufferManager bufferManager;
+ private QueryMetadataInterface metadata;
+ private Serializable localAddress;
+
+ public GlobalTableStoreImpl(BufferManager bufferManager, QueryMetadataInterface metadata) {
+ this.bufferManager = bufferManager;
+ this.metadata = new TempMetadataAdapter(metadata, new TempMetadataStore());
+ }
+
+ public synchronized MatTableInfo getMatTableInfo(final String tableName) {
+ MatTableInfo info = matTables.get(tableName);
+ if (info == null) {
+ info = new MatTableInfo();
+ matTables.put(tableName, info);
+ }
+ return info;
+ }
+
+ @Override
+ public void failedLoad(String matTableName) {
+ MatTableInfo info = getMatTableInfo(matTableName);
+ synchronized (info) {
+ if (info.state != MatState.LOADED) {
+ info.setState(MatState.FAILED_LOAD, null);
+ }
+ }
+ }
+
+ @Override
+ public boolean needsLoading(String matTableName, Serializable loadingAddress, boolean firstPass, boolean refresh, boolean invalidate) {
+ MatTableInfo info = getMatTableInfo(matTableName);
+ return info.shouldLoad(loadingAddress, firstPass, refresh, invalidate);
+ }
+
+ @Override
+ public TempMetadataID getGlobalTempTableMetadataId(Object viewId)
+ throws QueryMetadataException, TeiidComponentException, QueryResolverException, QueryValidatorException {
+ String matViewName = metadata.getFullName(viewId);
+ String matTableName = RelationalPlanner.MAT_PREFIX+matViewName.toUpperCase();
+ GroupSymbol group = new GroupSymbol(matViewName);
+ group.setMetadataID(viewId);
+ TempMetadataID id = tableStore.tempMetadataStore.getTempGroupID(matTableName);
+ //define the table preserving the key/index information and ensure that only a single instance exists
+ if (id == null) {
+ synchronized (viewId) {
+ id = tableStore.tempMetadataStore.getTempGroupID(matTableName);
+ if (id == null) {
+ id = tableStore.tempMetadataStore.addTempGroup(matTableName, ResolverUtil.resolveElementsInGroup(group, metadata), false, true);
+ id.setQueryNode(metadata.getVirtualPlan(viewId));
+ id.setCardinality(metadata.getCardinality(viewId));
+ id.setOriginalMetadataID(viewId);
+
+ Object pk = metadata.getPrimaryKey(viewId);
+ if (pk != null) {
+ ArrayList<TempMetadataID> primaryKey = resolveIndex(metadata, id, pk);
+ id.setPrimaryKey(primaryKey);
+ }
+ Collection keys = metadata.getUniqueKeysInGroup(viewId);
+ for (Object key : keys) {
+ id.addUniqueKey(resolveIndex(metadata, id, key));
+ }
+ Collection indexes = metadata.getIndexesInGroup(viewId);
+ for (Object index : indexes) {
+ id.addIndex(resolveIndex(metadata, id, index));
+ }
+ }
+ }
+ }
+ updateCacheHint(viewId, group, id);
+ return id;
+ }
+
+ @Override
+ public TempMetadataID getCodeTableMetadataId(
+ String codeTableName, String returnElementName,
+ String keyElementName, String matTableName) throws TeiidComponentException,
+ QueryMetadataException {
+ ElementSymbol keyElement = new ElementSymbol(matTableName + ElementSymbol.SEPARATOR + keyElementName);
+ ElementSymbol returnElement = new ElementSymbol(matTableName + ElementSymbol.SEPARATOR + returnElementName);
+ keyElement.setType(DataTypeManager.getDataTypeClass(metadata.getElementType(metadata.getElementID(codeTableName + ElementSymbol.SEPARATOR + keyElementName))));
+ returnElement.setType(DataTypeManager.getDataTypeClass(metadata.getElementType(metadata.getElementID(codeTableName + ElementSymbol.SEPARATOR + returnElementName))));
+ TempMetadataID id = this.getTempTableStore().getMetadataStore().getTempGroupID(matTableName);
+ if (id == null) {
+ synchronized (this) {
+ id = this.getTempTableStore().getMetadataStore().addTempGroup(matTableName, Arrays.asList(keyElement, returnElement), false, true);
+ String queryString = Reserved.SELECT + ' ' + keyElementName + " ," + returnElementName + ' ' + Reserved.FROM + ' ' + codeTableName; //$NON-NLS-1$
+ id.setQueryNode(new QueryNode(queryString));
+ id.setPrimaryKey(id.getElements().subList(0, 1));
+ CacheHint hint = new CacheHint(true, null);
+ id.setCacheHint(hint);
+ }
+ }
+ return id;
+ }
+
+ private void updateCacheHint(Object viewId, GroupSymbol group,
+ TempMetadataID id) throws TeiidComponentException,
+ QueryMetadataException, QueryResolverException,
+ QueryValidatorException {
+ Command c = QueryResolver.resolveView(group, metadata.getVirtualPlan(viewId), SQLConstants.Reserved.SELECT, metadata).getCommand();
+ CacheHint hint = c.getCacheHint();
+ id.setCacheHint(hint);
+ }
+
+ static ArrayList<TempMetadataID> resolveIndex(
+ QueryMetadataInterface metadata, TempMetadataID id, Object pk)
+ throws TeiidComponentException, QueryMetadataException {
+ List cols = metadata.getElementIDsInKey(pk);
+ ArrayList<TempMetadataID> primaryKey = new ArrayList<TempMetadataID>(cols.size());
+ for (Object coldId : cols) {
+ int pos = metadata.getPosition(coldId) - 1;
+ primaryKey.add(id.getElements().get(pos));
+ }
+ return primaryKey;
+ }
+
+ @Override
+ public void loaded(String matTableName, TempTable table) {
+ this.tableStore.swapTempTable(matTableName, table);
+ this.getMatTableInfo(matTableName).setState(MatState.LOADED, true);
+ }
+
+ @Override
+ public List<?> updateMatViewRow(String matTableName, List<?> tuple,
+ boolean delete) throws TeiidComponentException {
+ TempTable tempTable = tableStore.getTempTable(matTableName);
+ if (tempTable != null) {
+ return tempTable.updateTuple(tuple, delete);
+ }
+ return null;
+ }
+
+ @Override
+ public TempTableStore getTempTableStore() {
+ return this.tableStore;
+ }
+
+ @Override
+ public TempTable createMatTable(final String tableName, GroupSymbol group) throws TeiidComponentException,
+ QueryMetadataException, QueryResolverException, QueryValidatorException {
+ Create create = new Create();
+ create.setTable(group);
+ List<ElementSymbol> allColumns = ResolverUtil.resolveElementsInGroup(group, metadata);
+ create.setElementSymbolsAsColumns(allColumns);
+ Object pk = metadata.getPrimaryKey(group.getMetadataID());
+ if (pk != null) {
+ List<ElementSymbol> pkColumns = resolveIndex(metadata, allColumns, pk);
+ create.getPrimaryKey().addAll(pkColumns);
+ }
+ TempTable table = getTempTableStore().addTempTable(tableName, create, bufferManager, false);
+ table.setUpdatable(false);
+ CacheHint hint = table.getCacheHint();
+ if (hint != null) {
+ table.setPreferMemory(hint.getPrefersMemory());
+ if (hint.getTtl() != null) {
+ getMatTableInfo(tableName).setTtl(hint.getTtl());
+ }
+ if (pk != null) {
+ table.setUpdatable(hint.isUpdatable());
+ }
+ }
+ return table;
+ }
+
+ /**
+ * Return a list of ElementSymbols for the given index/key object
+ */
+ public static List<ElementSymbol> resolveIndex(QueryMetadataInterface metadata, List<ElementSymbol> allColumns, Object pk)
+ throws TeiidComponentException, QueryMetadataException {
+ Collection<?> pkIds = metadata.getElementIDsInKey(pk);
+ List<ElementSymbol> pkColumns = new ArrayList<ElementSymbol>(pkIds.size());
+ for (Object col : pkIds) {
+ pkColumns.add(allColumns.get(metadata.getPosition(col)-1));
+ }
+ return pkColumns;
+ }
+
+ //begin replication methods
+
+ @Override
+ public void setLocalAddress(Serializable address) {
+ this.localAddress = address;
+ }
+
+ @Override
+ public Serializable getLocalAddress() {
+ return localAddress;
+ }
+
+ @Override
+ public void getState(OutputStream ostream) {
+ try {
+ ObjectOutputStream oos = new ObjectOutputStream(ostream);
+ for (Map.Entry<String, TempTable> entry : tableStore.getTempTables().entrySet()) {
+ sendTable(entry.getKey(), oos, true);
+ }
+ oos.writeObject(null);
+ oos.close();
+ } catch (IOException e) {
+ throw new TeiidRuntimeException(e);
+ } catch (TeiidComponentException e) {
+ throw new TeiidRuntimeException(e);
+ }
+ }
+
+ @Override
+ public void setState(InputStream istream) {
+ try {
+ ObjectInputStream ois = new ObjectInputStream(istream);
+ while (true) {
+ String tableName = (String)ois.readObject();
+ if (tableName == null) {
+ break;
+ }
+ loadTable(tableName, ois);
+ }
+ ois.close();
+ } catch (Exception e) {
+ throw new TeiidRuntimeException(e);
+ }
+ }
+
+ @Override
+ public void getState(String stateId, OutputStream ostream) {
+ try {
+ ObjectOutputStream oos = new ObjectOutputStream(ostream);
+ sendTable(stateId, oos, false);
+ oos.close();
+ } catch (IOException e) {
+ throw new TeiidRuntimeException(e);
+ } catch (TeiidComponentException e) {
+ throw new TeiidRuntimeException(e);
+ }
+ }
+
+ private void sendTable(String stateId, ObjectOutputStream oos, boolean writeName)
+ throws IOException, TeiidComponentException {
+ TempTable tempTable = this.tableStore.getTempTable(stateId);
+ if (tempTable == null) {
+ return;
+ }
+ MatTableInfo info = getMatTableInfo(stateId);
+ if (!info.isValid()) {
+ return;
+ }
+ if (writeName) {
+ oos.writeObject(stateId);
+ }
+ oos.writeLong(info.updateTime);
+ oos.writeObject(info.loadingAddress);
+ oos.writeObject(info.state);
+ tempTable.writeTo(oos);
+ }
+
+ @Override
+ public void setState(String stateId, InputStream istream) {
+ try {
+ ObjectInputStream ois = new ObjectInputStream(istream);
+ loadTable(stateId, ois);
+ ois.close();
+ } catch (Exception e) {
+ MatTableInfo info = this.getMatTableInfo(stateId);
+ info.setState(MatState.FAILED_LOAD, null);
+ throw new TeiidRuntimeException(e);
+ }
+ }
+
+ private void loadTable(String stateId, ObjectInputStream ois)
+ throws TeiidComponentException, QueryMetadataException,
+ QueryResolverException, QueryValidatorException, IOException,
+ ClassNotFoundException {
+ LogManager.logDetail(LogConstants.CTX_DQP, "loading table from remote stream", stateId); //$NON-NLS-1$
+ long updateTime = ois.readLong();
+ Serializable loadingAddress = (Serializable) ois.readObject();
+ MatState state = (MatState)ois.readObject();
+ GroupSymbol group = new GroupSymbol(stateId);
+ if (stateId.startsWith(RelationalPlanner.MAT_PREFIX)) {
+ String viewName = stateId.substring(RelationalPlanner.MAT_PREFIX.length());
+ Object viewId = this.metadata.getGroupID(viewName);
+ group.setMetadataID(getGlobalTempTableMetadataId(viewId));
+ } else {
+ String viewName = stateId.substring(TempTableDataManager.CODE_PREFIX.length());
+ int index = viewName.lastIndexOf('.');
+ String returnElementName = viewName.substring(index + 1);
+ viewName = viewName.substring(0, index);
+ index = viewName.lastIndexOf('.');
+ String keyElementName = viewName.substring(index + 1);
+ viewName = viewName.substring(0, index);
+ group.setMetadataID(getCodeTableMetadataId(viewName, returnElementName, keyElementName, stateId));
+ }
+ TempTable tempTable = this.createMatTable(stateId, group);
+ tempTable.readFrom(ois);
+ MatTableInfo info = this.getMatTableInfo(stateId);
+ synchronized (info) {
+ this.tableStore.swapTempTable(stateId, tempTable);
+ info.setState(state, true);
+ info.updateTime = updateTime;
+ info.loadingAddress = loadingAddress;
+ }
+ }
+
+ @Override
+ public void droppedMembers(Collection<Serializable> addresses) {
+ for (MatTableInfo info : this.matTables.values()) {
+ synchronized (info) {
+ if (info.getState() == MatState.LOADING
+ && addresses.contains(info.loadingAddress)) {
+ info.setState(MatState.FAILED_LOAD, null);
+ }
+ }
+ }
+ }
+
+}
Property changes on: trunk/engine/src/main/java/org/teiid/query/tempdata/GlobalTableStoreImpl.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/engine/src/main/java/org/teiid/query/tempdata/TempTable.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/tempdata/TempTable.java 2011-08-25 01:22:57 UTC (rev 3424)
+++ trunk/engine/src/main/java/org/teiid/query/tempdata/TempTable.java 2011-08-26 15:17:29 UTC (rev 3425)
@@ -22,6 +22,9 @@
package org.teiid.query.tempdata;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -72,7 +75,7 @@
* TODO: in this implementation blocked exceptions will not happen
* allowing for subquery evaluation though would cause pauses
*/
-class TempTable {
+public class TempTable {
private final class InsertUpdateProcessor extends UpdateProcessor {
@@ -275,7 +278,7 @@
private int keyBatchSize;
private int leafBatchSize;
- private Map columnMap;
+ private Map<ElementSymbol, Integer> columnMap;
private List<Integer> notNull = new LinkedList<Integer>();
private Map<Integer, AtomicInteger> sequences;
@@ -326,8 +329,17 @@
if (keyColumns.equals(indexColumns) || (indexTables != null && indexTables.containsKey(indexColumns))) {
return;
}
+ TempTable indexTable = createIndexTable(indexColumns, unique);
+ //TODO: ordered insert optimization
+ TupleSource ts = createTupleSource(indexTable.getColumns(), null, null);
+ indexTable.insert(ts, indexTable.getColumns());
+ indexTable.getTree().compact();
+ }
+
+ private TempTable createIndexTable(List<ElementSymbol> indexColumns,
+ boolean unique) {
List<ElementSymbol> allColumns = new ArrayList<ElementSymbol>(indexColumns);
- for (ElementSymbol elementSymbol : keyColumns) {
+ for (ElementSymbol elementSymbol : columns.subList(0, tree.getKeyLength())) {
if (allColumns.indexOf(elementSymbol) < 0) {
allColumns.add(elementSymbol);
}
@@ -342,10 +354,8 @@
indexTables = new LinkedHashMap<List<ElementSymbol>, TempTable>();
indexTables.put(indexColumns, indexTable);
}
- //TODO: ordered insert optimization
- TupleSource ts = createTupleSource(allColumns, null, null);
- indexTable.insert(ts, allColumns);
- indexTable.getTree().compact();
+ indexTable.setUpdatable(this.updatable);
+ return indexTable;
}
private int reserveBuffers() {
@@ -531,7 +541,7 @@
BlockedException, TeiidComponentException {
List<Object> newTuple = new ArrayList<Object>(tuple);
for (Map.Entry<ElementSymbol, Expression> entry : update.getClauseMap().entrySet()) {
- newTuple.set((Integer)columnMap.get(entry.getKey()), eval.evaluate(entry.getValue(), tuple));
+ newTuple.set(columnMap.get(entry.getKey()), eval.evaluate(entry.getValue(), tuple));
}
if (primaryKeyChangePossible) {
browser.removed();
@@ -628,6 +638,44 @@
}
}
+ void writeTo(ObjectOutputStream oos) throws TeiidComponentException, IOException {
+ this.lock.readLock().lock();
+ try {
+ this.tree.writeValuesTo(oos);
+ if (this.indexTables == null) {
+ oos.writeInt(0);
+ } else {
+ oos.writeInt(this.indexTables.size());
+ for (Map.Entry<List<ElementSymbol>, TempTable> entry : this.indexTables.entrySet()) {
+ oos.writeBoolean(entry.getValue().uniqueColIndex > 0);
+ oos.writeInt(entry.getKey().size());
+ for (ElementSymbol es : entry.getKey()) {
+ oos.writeInt(this.columnMap.get(es));
+ }
+ entry.getValue().writeTo(oos);
+ }
+ }
+ } finally {
+ this.lock.readLock().unlock();
+ }
+ }
+
+ void readFrom(ObjectInputStream ois) throws TeiidComponentException, IOException, ClassNotFoundException {
+ this.tree.readValuesFrom(ois);
+ int numIdx = ois.readInt();
+ for (int i = 0; i < numIdx; i++) {
+ boolean unique = ois.readBoolean();
+ int numCols = ois.readInt();
+ ArrayList<ElementSymbol> indexColumns = new ArrayList<ElementSymbol>(numCols);
+ for (int j = 0; j < numCols; j++) {
+ int colIndex = ois.readInt();
+ indexColumns.add(this.columns.get(colIndex));
+ }
+ TempTable tt = this.createIndexTable(indexColumns, unique);
+ tt.readFrom(ois);
+ }
+ }
+
List<?> updateTuple(List<?> tuple, boolean remove) throws TeiidComponentException {
try {
lock.writeLock().lock();
@@ -698,7 +746,7 @@
return tid.getID() + " (" + columns + ")\n"; //$NON-NLS-1$ //$NON-NLS-2$
}
- Map getColumnMap() {
+ Map<ElementSymbol, Integer> getColumnMap() {
return this.columnMap;
}
Modified: trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java 2011-08-25 01:22:57 UTC (rev 3424)
+++ trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java 2011-08-26 15:17:29 UTC (rev 3425)
@@ -22,10 +22,8 @@
package org.teiid.query.tempdata;
-import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.Callable;
@@ -37,10 +35,6 @@
import org.teiid.api.exception.query.QueryProcessingException;
import org.teiid.api.exception.query.QueryResolverException;
import org.teiid.api.exception.query.QueryValidatorException;
-import org.teiid.cache.Cache;
-import org.teiid.cache.CacheConfiguration;
-import org.teiid.cache.CacheFactory;
-import org.teiid.cache.CacheConfiguration.Policy;
import org.teiid.common.buffer.BlockedException;
import org.teiid.common.buffer.BufferManager;
import org.teiid.common.buffer.TupleBuffer;
@@ -49,7 +43,6 @@
import org.teiid.core.TeiidComponentException;
import org.teiid.core.TeiidProcessingException;
import org.teiid.core.types.DataTypeManager;
-import org.teiid.core.util.HashCodeUtil;
import org.teiid.core.util.StringUtil;
import org.teiid.dqp.internal.process.CachedResults;
import org.teiid.dqp.internal.process.SessionAwareCache;
@@ -62,7 +55,6 @@
import org.teiid.metadata.FunctionMethod.Determinism;
import org.teiid.query.QueryPlugin;
import org.teiid.query.eval.Evaluator;
-import org.teiid.query.mapping.relational.QueryNode;
import org.teiid.query.metadata.QueryMetadataInterface;
import org.teiid.query.metadata.TempMetadataID;
import org.teiid.query.optimizer.relational.RelationalPlanner;
@@ -92,10 +84,8 @@
import org.teiid.query.sql.symbol.Expression;
import org.teiid.query.sql.symbol.GroupSymbol;
import org.teiid.query.sql.visitor.ExpressionMappingVisitor;
-import org.teiid.query.tempdata.TempTableStore.MatState;
-import org.teiid.query.tempdata.TempTableStore.MatTableInfo;
+import org.teiid.query.tempdata.GlobalTableStoreImpl.MatTableInfo;
import org.teiid.query.util.CommandContext;
-import org.teiid.vdb.runtime.VDBKey;
/**
* This proxy ProcessorDataManager is used to handle temporary tables.
@@ -107,57 +97,21 @@
private static final String REFRESHMATVIEWROW = ".refreshmatviewrow"; //$NON-NLS-1$
private static final String REFRESHMATVIEW = ".refreshmatview"; //$NON-NLS-1$
- private static final String CODE_PREFIX = "#CODE_"; //$NON-NLS-1$
+ public static final String CODE_PREFIX = "#CODE_"; //$NON-NLS-1$
private ProcessorDataManager processorDataManager;
private BufferManager bufferManager;
private SessionAwareCache<CachedResults> cache;
private Executor executor;
- private static class MatTableKey implements Serializable {
- private static final long serialVersionUID = 5481692896572663992L;
- String name;
- VDBKey vdb;
-
- @Override
- public int hashCode() {
- return HashCodeUtil.hashCode(name.hashCode(), vdb);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj == this) {
- return true;
- }
- if (!(obj instanceof MatTableKey)) {
- return false;
- }
- MatTableKey other = (MatTableKey)obj;
- return this.name.equals(other.name) && this.vdb.equals(other.vdb);
- }
- }
-
- private static class MatTableEntry implements Serializable {
- private static final long serialVersionUID = 8559613701442751579L;
- long lastUpdate = System.currentTimeMillis();
- boolean valid;
- }
-
- private Cache<MatTableKey, MatTableEntry> tables;
- private SessionAwareCache<CachedResults> distributedCache;
private EventDistributor eventDistributor;
public TempTableDataManager(ProcessorDataManager processorDataManager, BufferManager bufferManager,
- Executor executor, SessionAwareCache<CachedResults> cache, SessionAwareCache<CachedResults> distibutedCache, CacheFactory cacheFactory){
+ Executor executor, SessionAwareCache<CachedResults> cache){
this.processorDataManager = processorDataManager;
this.bufferManager = bufferManager;
this.executor = executor;
this.cache = cache;
- this.distributedCache = distibutedCache;
- if (distibutedCache != null) {
- CacheConfiguration cc = new CacheConfiguration(Policy.LRU, -1, -1, "MaterializationUpdates"); //$NON-NLS-1$
- tables = cacheFactory.get(cc.getLocation(), cc);
- }
}
public void setEventDistributor(EventDistributor eventDistributor) {
@@ -316,37 +270,21 @@
QueryValidatorException, TeiidProcessingException,
ExpressionEvaluationException {
QueryMetadataInterface metadata = context.getMetadata();
- TempTableStore globalStore = context.getGlobalTableStore();
+ GlobalTableStore globalStore = context.getGlobalTableStore();
if (StringUtil.endsWithIgnoreCase(proc.getProcedureCallableName(), REFRESHMATVIEW)) {
Object groupID = validateMatView(metadata, (String)((Constant)proc.getParameter(1).getExpression()).getValue());
- Object matTableId = context.getGlobalTableStore().getGlobalTempTableMetadataId(groupID, metadata);
+ Object matTableId = globalStore.getGlobalTempTableMetadataId(groupID);
String matViewName = metadata.getFullName(groupID);
String matTableName = metadata.getFullName(matTableId);
LogManager.logDetail(LogConstants.CTX_MATVIEWS, "processing refreshmatview for", matViewName); //$NON-NLS-1$
- MatTableInfo info = globalStore.getMatTableInfo(matTableName);
- Long loadTime = null;
- boolean useCache = false;
- if (this.distributedCache != null) {
- MatTableKey key = new MatTableKey();
- key.name = matTableName;
- key.vdb = new VDBKey(context.getVdbName(),context.getVdbVersion());
- MatTableEntry entry = this.tables.get(key);
- useCache = (entry != null && entry.valid && entry.lastUpdate > info.getUpdateTime());
- if (useCache) {
- loadTime = entry.lastUpdate;
- }
- }
boolean invalidate = Boolean.TRUE.equals(((Constant)proc.getParameter(2).getExpression()).getValue());
- if (invalidate) {
- touchTable(context, matTableName, false, System.currentTimeMillis());
- }
- MatState oldState = info.setState(MatState.NEEDS_LOADING, invalidate?Boolean.FALSE:null, null);
- if (oldState == MatState.LOADING) {
+ boolean needsLoading = globalStore.needsLoading(matTableName, globalStore.getLocalAddress(), true, true, invalidate);
+ if (!needsLoading) {
return CollectionTupleSource.createUpdateCountTupleSource(-1);
}
GroupSymbol matTable = new GroupSymbol(matTableName);
matTable.setMetadataID(matTableId);
- int rowCount = loadGlobalTable(context, matTable, matTableName, matViewName, globalStore, info, invalidate?null:loadTime, !invalidate && useCache);
+ int rowCount = loadGlobalTable(context, matTable, matTableName, globalStore);
return CollectionTupleSource.createUpdateCountTupleSource(rowCount);
} else if (StringUtil.endsWithIgnoreCase(proc.getProcedureCallableName(), REFRESHMATVIEWROW)) {
Object groupID = validateMatView(metadata, (String)((Constant)proc.getParameter(1).getExpression()).getValue());
@@ -364,7 +302,7 @@
if (!info.isValid()) {
return CollectionTupleSource.createUpdateCountTupleSource(-1);
}
- TempTable tempTable = globalStore.getOrCreateTempTable(matTableName, new Query(), bufferManager, false);
+ TempTable tempTable = globalStore.getTempTableStore().getTempTable(matTableName);
if (!tempTable.isUpdatable()) {
throw new QueryProcessingException(QueryPlugin.Util.getString("TempTableDataManager.row_refresh_updatable", matViewName)); //$NON-NLS-1$
}
@@ -381,10 +319,11 @@
if (tuple == null) {
delete = true;
tuple = Arrays.asList(key.getValue());
+ } else {
+ tuple = new ArrayList<Object>(tuple); //ensure the list is serializable
}
- List<?> result = updateMatViewRow(globalStore, matTableName, tuple, delete);
- if (result != null && eventDistributor != null) {
- result = new ArrayList<Object>(result); //ensure the list is serializable
+ List<?> result = globalStore.updateMatViewRow(matTableName, tuple, delete);
+ if (eventDistributor != null) {
this.eventDistributor.updateMatViewRow(context.getVdbName(), context.getVdbVersion(), metadata.getName(metadata.getModelID(groupID)), metadata.getName(groupID), tuple, delete);
}
return CollectionTupleSource.createUpdateCountTupleSource(result != null ? 1 : 0);
@@ -392,36 +331,6 @@
return null;
}
- public List<?> updateMatViewRow(TempTableStore globalStore,
- String matTableName, List<?> tuple, boolean delete)
- throws QueryProcessingException, TeiidComponentException {
- TempTable tempTable = globalStore.getOrCreateTempTable(matTableName, new Query(), bufferManager, false);
- return tempTable.updateTuple(tuple, delete);
- }
-
- public void refreshMatView(String vdbName, int vdbVersion, String viewName,
- QueryMetadataInterface metadata, TempTableStore globalStore)
- throws QueryProcessingException, TeiidComponentException, TeiidProcessingException {
-
- Object groupID = validateMatView(metadata, viewName);
- Object matTableId = globalStore.getGlobalTempTableMetadataId(groupID, metadata);
- String matViewName = metadata.getFullName(groupID);
- String matTableName = metadata.getFullName(matTableId);
- LogManager.logDetail(LogConstants.CTX_MATVIEWS, "processing refreshmatview for", matViewName); //$NON-NLS-1$
- MatTableInfo info = globalStore.getMatTableInfo(matTableName);
-
- MatState oldState = info.setState(MatState.NEEDS_LOADING, Boolean.FALSE, null);
- if (oldState == MatState.LOADING) {
- return;
- }
- GroupSymbol matTable = new GroupSymbol(matTableName);
- matTable.setMetadataID(matTableId);
- CommandContext context = new CommandContext(new Object(), "internal", "internal", vdbName, vdbVersion); //$NON-NLS-1$ //$NON-NLS-2$
- context.setMetadata(metadata);
- context.setGlobalTableStore(globalStore);
- loadGlobalTable(context, matTable, matTableName, matViewName, globalStore, info, null, true);
- }
-
private Object validateMatView(QueryMetadataInterface metadata, String viewName) throws TeiidComponentException,
TeiidProcessingException {
try {
@@ -444,44 +353,38 @@
if (!group.isTempGroupSymbol()) {
return null;
}
- String viewName = null;
final String tableName = group.getNonCorrelationName().toUpperCase();
boolean remapColumns = !tableName.equalsIgnoreCase(group.getName());
- TempMetadataID groupID = (TempMetadataID)group.getMetadataID();
- if (groupID.getOriginalMetadataID() != null) {
- viewName = context.getMetadata().getFullName(groupID.getOriginalMetadataID());
- }
TempTable table = null;
if (group.isGlobalTable()) {
- final TempTableStore globalStore = context.getGlobalTableStore();
+ final GlobalTableStore globalStore = context.getGlobalTableStore();
final MatTableInfo info = globalStore.getMatTableInfo(tableName);
- Long loadTime = null;
- if (this.distributedCache != null) {
- MatTableKey key = new MatTableKey();
- key.name = tableName;
- key.vdb = new VDBKey(context.getVdbName(), context.getVdbVersion());
-
- MatTableEntry entry = this.tables.get(key);
- boolean notValid = !info.isValid();
- if (entry != null && entry.lastUpdate > info.getUpdateTime()
- && info.getState() != MatState.LOADING
- //TODO: use extension metadata or a config parameter to make this skew configurable
- && !(!notValid && entry.valid && info.getState() == MatState.LOADED && entry.lastUpdate < info.getUpdateTime() + 30000)) {
- //trigger a remote load due to the cache being more up to date than the local copy
- info.setState(MatState.NEEDS_LOADING, notValid?false:entry.valid, null);
- loadTime = entry.lastUpdate;
+ boolean load = false;
+ while (!info.isUpToDate()) {
+ load = globalStore.needsLoading(tableName, globalStore.getLocalAddress(), true, false, false);
+ if (load) {
+ load = globalStore.needsLoading(tableName, globalStore.getLocalAddress(), false, false, false);
+ if (load) {
+ break;
+ }
}
+ synchronized (info) {
+ try {
+ info.wait(30000);
+ } catch (InterruptedException e) {
+ throw new TeiidComponentException(e);
+ }
+ }
}
- boolean load = info.shouldLoad();
if (load) {
if (!info.isValid()) {
//blocking load
- loadGlobalTable(context, group, tableName, viewName, globalStore, info, loadTime, true);
+ loadGlobalTable(context, group, tableName, globalStore);
} else {
- loadAsynch(context, group, tableName, viewName, globalStore, info, loadTime);
+ loadAsynch(context, group, tableName, globalStore);
}
}
- table = globalStore.getOrCreateTempTable(tableName, query, bufferManager, false);
+ table = globalStore.getTempTableStore().getOrCreateTempTable(tableName, query, bufferManager, false);
context.accessedDataObject(group.getMetadataID());
} else {
table = contextStore.getOrCreateTempTable(tableName, query, bufferManager, true);
@@ -511,13 +414,11 @@
}
private void loadAsynch(final CommandContext context,
- final GroupSymbol group, final String tableName, final String viewName,
- final TempTableStore globalStore, final MatTableInfo info,
- final Long loadTime) {
+ final GroupSymbol group, final String tableName, final GlobalTableStore globalStore) {
Callable<Integer> toCall = new Callable<Integer>() {
@Override
public Integer call() throws Exception {
- return loadGlobalTable(context, group, tableName, viewName, globalStore, info, loadTime, true);
+ return loadGlobalTable(context, group, tableName, globalStore);
}
};
FutureTask<Integer> task = new FutureTask<Integer>(toCall);
@@ -525,89 +426,39 @@
}
private int loadGlobalTable(CommandContext context,
- GroupSymbol group, final String tableName, final String viewName,
- TempTableStore globalStore, MatTableInfo info, Long loadTime, boolean useCache)
+ GroupSymbol group, final String tableName, GlobalTableStore globalStore)
throws TeiidComponentException, TeiidProcessingException {
LogManager.logInfo(LogConstants.CTX_MATVIEWS, QueryPlugin.Util.getString("TempTableDataManager.loading", tableName)); //$NON-NLS-1$
QueryMetadataInterface metadata = context.getMetadata();
- Create create = new Create();
- create.setTable(group);
List<ElementSymbol> allColumns = ResolverUtil.resolveElementsInGroup(group, metadata);
- create.setElementSymbolsAsColumns(allColumns);
- Object pk = metadata.getPrimaryKey(group.getMetadataID());
- if (pk != null) {
- List<ElementSymbol> pkColumns = resolveIndex(metadata, allColumns, pk);
- create.getPrimaryKey().addAll(pkColumns);
- }
- TempTable table = globalStore.addTempTable(tableName, create, bufferManager, false);
+ TempTable table = globalStore.createMatTable(tableName, group);
table.setUpdatable(false);
- CacheHint hint = table.getCacheHint();
- boolean updatable = false;
- if (hint != null) {
- table.setPreferMemory(hint.getPrefersMemory());
- if (hint.getTtl() != null) {
- info.setTtl(hint.getTtl());
- }
- if (pk != null) {
- updatable = hint.isUpdatable();
- }
- }
int rowCount = -1;
- boolean viewFetched = false;
try {
String fullName = metadata.getFullName(group.getMetadataID());
- TupleSource ts = null;
- CacheID cid = null;
- if (distributedCache != null) {
- cid = new CacheID(new ParseInfo(), fullName, context.getVdbName(),
- context.getVdbVersion(), context.getConnectionID(), context.getUserName());
- if (useCache) {
- CachedResults cr = this.distributedCache.get(cid);
- if (cr != null) {
- ts = cr.getResults().createIndexedTupleSource();
- LogManager.logInfo(LogConstants.CTX_MATVIEWS, QueryPlugin.Util.getString("TempTableDataManager.cache_load", tableName)); //$NON-NLS-1$
- }
- }
- }
+ String transformation = metadata.getVirtualPlan(group.getMetadataID()).getQuery();
+ QueryProcessor qp = context.getQueryProcessorFactory().createQueryProcessor(transformation, fullName, context);
+ qp.setNonBlocking(true);
+ qp.getContext().setDataObjects(null);
+ TupleSource ts = new BatchCollector.BatchProducerTupleSource(qp);
- List<ElementSymbol> variables = table.getColumns();
-
- if (ts == null) {
- variables = allColumns;
- //TODO: coordinate a distributed load
- //TODO: order by primary key nulls first - then have an insert ordered optimization
- String transformation = metadata.getVirtualPlan(group.getMetadataID()).getQuery();
- QueryProcessor qp = context.getQueryProcessorFactory().createQueryProcessor(transformation, fullName, context);
- qp.setNonBlocking(true);
- qp.getContext().setDataObjects(null);
- if (distributedCache != null) {
- CachedResults cr = new CachedResults();
- BatchCollector bc = qp.createBatchCollector();
- TupleBuffer tb = bc.collectTuples();
- cr.setResults(tb, qp.getProcessorPlan());
- touchTable(context, fullName, true, info.getUpdateTime());
- this.distributedCache.put(cid, Determinism.VDB_DETERMINISTIC, cr, info.getTtl());
- ts = tb.createIndexedTupleSource();
- viewFetched = true;
- } else {
- ts = new BatchCollector.BatchProducerTupleSource(qp);
- }
- }
-
//TODO: if this insert fails, it's unnecessary to do the undo processing
- table.insert(ts, variables);
+ table.insert(ts, allColumns);
table.getTree().compact();
rowCount = table.getRowCount();
//TODO: could pre-process indexes to remove overlap
for (Object index : metadata.getIndexesInGroup(group.getMetadataID())) {
- List<ElementSymbol> columns = resolveIndex(metadata, allColumns, index);
+ List<ElementSymbol> columns = GlobalTableStoreImpl.resolveIndex(metadata, allColumns, index);
table.addIndex(columns, false);
}
for (Object key : metadata.getUniqueKeysInGroup(group.getMetadataID())) {
- List<ElementSymbol> columns = resolveIndex(metadata, allColumns, key);
+ List<ElementSymbol> columns = GlobalTableStoreImpl.resolveIndex(metadata, allColumns, key);
table.addIndex(columns, true);
}
- table.setUpdatable(updatable);
+ CacheHint hint = table.getCacheHint();
+ if (hint != null && table.getPkLength() > 0) {
+ table.setUpdatable(hint.isUpdatable());
+ }
} catch (TeiidComponentException e) {
LogManager.logError(LogConstants.CTX_MATVIEWS, e, QueryPlugin.Util.getString("TempTableDataManager.failed_load", tableName)); //$NON-NLS-1$
throw e;
@@ -616,66 +467,30 @@
throw e;
} finally {
if (rowCount == -1) {
- info.setState(MatState.FAILED_LOAD, null, null);
+ globalStore.failedLoad(tableName);
} else {
- globalStore.swapTempTable(tableName, table);
- info.setState(MatState.LOADED, true, loadTime);
- if (viewFetched & viewName != null && this.eventDistributor != null) {
- this.eventDistributor.refreshMatView(context.getVdbName(), context.getVdbVersion(), viewName);
- }
+ globalStore.loaded(tableName, table);
LogManager.logInfo(LogConstants.CTX_MATVIEWS, QueryPlugin.Util.getString("TempTableDataManager.loaded", tableName, rowCount)); //$NON-NLS-1$
}
}
return rowCount;
}
- private void touchTable(CommandContext context, String fullName, boolean valid, long loadtime) {
- MatTableKey key = new MatTableKey();
- key.name = fullName;
- key.vdb = new VDBKey(context.getVdbName(), context.getVdbVersion());
- MatTableEntry matTableEntry = new MatTableEntry();
- matTableEntry.valid = valid;
- matTableEntry.lastUpdate = loadtime;
- tables.put(key, matTableEntry, null);
- }
-
- /**
- * Return a list of ElementSymbols for the given index/key object
- */
- private List<ElementSymbol> resolveIndex(QueryMetadataInterface metadata,
- List<ElementSymbol> allColumns, Object pk)
- throws TeiidComponentException, QueryMetadataException {
- Collection<?> pkIds = metadata.getElementIDsInKey(pk);
- List<ElementSymbol> pkColumns = new ArrayList<ElementSymbol>(pkIds.size());
- for (Object col : pkIds) {
- pkColumns.add(allColumns.get(metadata.getPosition(col)-1));
- }
- return pkColumns;
- }
-
public Object lookupCodeValue(CommandContext context, String codeTableName,
String returnElementName, String keyElementName, Object keyValue)
throws BlockedException, TeiidComponentException,
TeiidProcessingException {
String matTableName = CODE_PREFIX + (codeTableName + ElementSymbol.SEPARATOR + keyElementName + ElementSymbol.SEPARATOR + returnElementName).toUpperCase();
+ QueryMetadataInterface metadata = context.getMetadata();
+ TempMetadataID id = context.getGlobalTableStore().getCodeTableMetadataId(codeTableName,
+ returnElementName, keyElementName, matTableName);
+
ElementSymbol keyElement = new ElementSymbol(matTableName + ElementSymbol.SEPARATOR + keyElementName);
ElementSymbol returnElement = new ElementSymbol(matTableName + ElementSymbol.SEPARATOR + returnElementName);
-
- QueryMetadataInterface metadata = context.getMetadata();
-
keyElement.setType(DataTypeManager.getDataTypeClass(metadata.getElementType(metadata.getElementID(codeTableName + ElementSymbol.SEPARATOR + keyElementName))));
returnElement.setType(DataTypeManager.getDataTypeClass(metadata.getElementType(metadata.getElementID(codeTableName + ElementSymbol.SEPARATOR + returnElementName))));
- TempMetadataID id = context.getGlobalTableStore().getMetadataStore().getTempGroupID(matTableName);
- if (id == null) {
- id = context.getGlobalTableStore().getMetadataStore().addTempGroup(matTableName, Arrays.asList(keyElement, returnElement), false, true);
- String queryString = Reserved.SELECT + ' ' + keyElementName + " ," + returnElementName + ' ' + Reserved.FROM + ' ' + codeTableName; //$NON-NLS-1$
- id.setQueryNode(new QueryNode(queryString));
- id.setPrimaryKey(id.getElements().subList(0, 1));
- CacheHint hint = new CacheHint(true, null);
- id.setCacheHint(hint);
- }
Query query = RelationalPlanner.createMatViewQuery(id, matTableName, Arrays.asList(returnElement), true);
query.setCriteria(new CompareCriteria(keyElement, CompareCriteria.EQ, new Constant(keyValue)));
Modified: trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableStore.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableStore.java 2011-08-25 01:22:57 UTC (rev 3424)
+++ trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableStore.java 2011-08-26 15:17:29 UTC (rev 3425)
@@ -23,31 +23,20 @@
package org.teiid.query.tempdata;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
-import org.teiid.api.exception.query.QueryMetadataException;
import org.teiid.api.exception.query.QueryProcessingException;
-import org.teiid.api.exception.query.QueryResolverException;
-import org.teiid.api.exception.query.QueryValidatorException;
import org.teiid.common.buffer.BufferManager;
-import org.teiid.core.TeiidComponentException;
-import org.teiid.language.SQLConstants;
import org.teiid.logging.LogConstants;
import org.teiid.logging.LogManager;
import org.teiid.query.QueryPlugin;
-import org.teiid.query.metadata.QueryMetadataInterface;
import org.teiid.query.metadata.TempMetadataID;
import org.teiid.query.metadata.TempMetadataStore;
-import org.teiid.query.optimizer.relational.RelationalPlanner;
-import org.teiid.query.resolver.QueryResolver;
import org.teiid.query.resolver.command.TempTableResolver;
-import org.teiid.query.resolver.util.ResolverUtil;
-import org.teiid.query.sql.lang.CacheHint;
import org.teiid.query.sql.lang.Command;
import org.teiid.query.sql.lang.Create;
import org.teiid.query.sql.lang.Insert;
@@ -56,91 +45,8 @@
public class TempTableStore {
- public enum MatState {
- NEEDS_LOADING,
- LOADING,
- FAILED_LOAD,
- LOADED
- }
-
- public static class MatTableInfo {
- private long updateTime = -1;
- private MatState state = MatState.NEEDS_LOADING;
- private long ttl = -1;
- private boolean valid;
-
- synchronized boolean shouldLoad() throws TeiidComponentException {
- for (;;) {
- switch (state) {
- case NEEDS_LOADING:
- case FAILED_LOAD:
- setState(MatState.LOADING);
- return true;
- case LOADING:
- if (valid) {
- return false;
- }
- try {
- wait();
- } catch (InterruptedException e) {
- throw new TeiidComponentException(e);
- }
- continue;
- case LOADED:
- if (ttl >= 0 && System.currentTimeMillis() - updateTime - ttl > 0) {
- setState(MatState.LOADING);
- return true;
- }
- return false;
- }
- }
- }
-
- public synchronized MatState setState(MatState state, Boolean valid, Long timestamp) {
- MatState oldState = this.state;
- LogManager.logDetail(LogConstants.CTX_MATVIEWS, this, "setting matState to", state, valid, timestamp, "old values", oldState, this.valid); //$NON-NLS-1$ //$NON-NLS-2$
- if (valid != null) {
- this.valid = valid;
- }
- setState(state);
- if (timestamp != null) {
- this.updateTime = timestamp;
- }
- notifyAll();
- return oldState;
- }
-
- private void setState(MatState state) {
- this.state = state;
- this.updateTime = System.currentTimeMillis();
- }
-
- public synchronized void setTtl(long ttl) {
- this.ttl = ttl;
- }
-
- public synchronized long getUpdateTime() {
- return updateTime;
- }
-
- public synchronized MatState getState() {
- return state;
- }
-
- public synchronized boolean isValid() {
- return valid;
- }
-
- public synchronized long getTtl() {
- return ttl;
- }
-
- }
-
- private ConcurrentHashMap<String, MatTableInfo> matTables = new ConcurrentHashMap<String, MatTableInfo>();
-
- private TempMetadataStore tempMetadataStore = new TempMetadataStore(new ConcurrentHashMap<String, TempMetadataID>());
- private Map<String, TempTable> groupToTupleSourceID = new ConcurrentHashMap<String, TempTable>();
+ TempMetadataStore tempMetadataStore = new TempMetadataStore(new ConcurrentHashMap<String, TempMetadataID>());
+ private Map<String, TempTable> tempTables = new ConcurrentHashMap<String, TempTable>();
private String sessionID;
private TempTableStore parentTempTableStore;
@@ -148,21 +54,12 @@
this.sessionID = sessionID;
}
- public MatTableInfo getMatTableInfo(final String tableName) {
- MatTableInfo newInfo = new MatTableInfo();
- MatTableInfo info = matTables.putIfAbsent(tableName, newInfo);
- if (info == null) {
- info = newInfo;
- }
- return info;
- }
-
public void setParentTempTableStore(TempTableStore parentTempTableStore) {
this.parentTempTableStore = parentTempTableStore;
}
public boolean hasTempTable(String tempTableName) {
- return groupToTupleSourceID.containsKey(tempTableName);
+ return tempTables.containsKey(tempTableName);
}
TempTable addTempTable(String tempTableName, Create create, BufferManager buffer, boolean add) {
@@ -182,18 +79,18 @@
}
TempTable tempTable = new TempTable(id, buffer, columns, create.getPrimaryKey().size(), sessionID);
if (add) {
- groupToTupleSourceID.put(tempTableName, tempTable);
+ tempTables.put(tempTableName, tempTable);
}
return tempTable;
}
void swapTempTable(String tempTableName, TempTable tempTable) {
- groupToTupleSourceID.put(tempTableName, tempTable);
+ tempTables.put(tempTableName, tempTable);
}
public void removeTempTableByName(String tempTableName) {
tempMetadataStore.removeTempGroup(tempTableName);
- TempTable table = this.groupToTupleSourceID.remove(tempTableName);
+ TempTable table = this.tempTables.remove(tempTableName);
if(table != null) {
table.remove();
}
@@ -204,18 +101,22 @@
}
public void removeTempTables() {
- for (String name : groupToTupleSourceID.keySet()) {
+ for (String name : tempTables.keySet()) {
removeTempTableByName(name);
}
}
public void setUpdatable(String name, boolean updatable) {
- TempTable table = groupToTupleSourceID.get(name);
+ TempTable table = tempTables.get(name);
if (table != null) {
table.setUpdatable(updatable);
}
}
+ TempTable getTempTable(String tempTableID) {
+ return this.tempTables.get(tempTableID);
+ }
+
TempTable getOrCreateTempTable(String tempTableID, Command command, BufferManager buffer, boolean delegate) throws QueryProcessingException{
TempTable tempTable = getTempTable(tempTableID, command, buffer, delegate);
if (tempTable != null) {
@@ -243,7 +144,7 @@
private TempTable getTempTable(String tempTableID, Command command,
BufferManager buffer, boolean delegate)
throws QueryProcessingException {
- TempTable tsID = groupToTupleSourceID.get(tempTableID);
+ TempTable tsID = tempTables.get(tempTableID);
if(tsID != null) {
return tsID;
}
@@ -254,66 +155,11 @@
}
public Set<String> getAllTempTables() {
- return new HashSet<String>(this.groupToTupleSourceID.keySet());
+ return new HashSet<String>(this.tempTables.keySet());
}
-
- public TempMetadataID getGlobalTempTableMetadataId(Object viewId, QueryMetadataInterface metadata)
- throws QueryMetadataException, TeiidComponentException, QueryResolverException, QueryValidatorException {
- String matViewName = metadata.getFullName(viewId);
- String matTableName = RelationalPlanner.MAT_PREFIX+matViewName.toUpperCase();
- GroupSymbol group = new GroupSymbol(matViewName);
- group.setMetadataID(viewId);
- TempMetadataID id = tempMetadataStore.getTempGroupID(matTableName);
- //define the table preserving the key/index information and ensure that only a single instance exists
- if (id == null) {
- synchronized (viewId) {
- id = tempMetadataStore.getTempGroupID(matTableName);
- if (id == null) {
- id = tempMetadataStore.addTempGroup(matTableName, ResolverUtil.resolveElementsInGroup(group, metadata), false, true);
- id.setQueryNode(metadata.getVirtualPlan(viewId));
- id.setCardinality(metadata.getCardinality(viewId));
- id.setOriginalMetadataID(viewId);
-
- Object pk = metadata.getPrimaryKey(viewId);
- if (pk != null) {
- ArrayList<TempMetadataID> primaryKey = resolveIndex(metadata, id, pk);
- id.setPrimaryKey(primaryKey);
- }
- Collection keys = metadata.getUniqueKeysInGroup(viewId);
- for (Object key : keys) {
- id.addUniqueKey(resolveIndex(metadata, id, key));
- }
- Collection indexes = metadata.getIndexesInGroup(viewId);
- for (Object index : indexes) {
- id.addIndex(resolveIndex(metadata, id, index));
- }
- }
- }
- }
- updateCacheHint(viewId, metadata, group, id);
- return id;
+
+ Map<String, TempTable> getTempTables() {
+ return tempTables;
}
-
- private void updateCacheHint(Object viewId,
- QueryMetadataInterface metadata, GroupSymbol group,
- TempMetadataID id) throws TeiidComponentException,
- QueryMetadataException, QueryResolverException,
- QueryValidatorException {
- Command c = QueryResolver.resolveView(group, metadata.getVirtualPlan(viewId), SQLConstants.Reserved.SELECT, metadata).getCommand();
- CacheHint hint = c.getCacheHint();
- id.setCacheHint(hint);
- }
-
- static ArrayList<TempMetadataID> resolveIndex(
- QueryMetadataInterface metadata, TempMetadataID id, Object pk)
- throws TeiidComponentException, QueryMetadataException {
- List cols = metadata.getElementIDsInKey(pk);
- ArrayList<TempMetadataID> primaryKey = new ArrayList<TempMetadataID>(cols.size());
- for (Object coldId : cols) {
- int pos = metadata.getPosition(coldId) - 1;
- primaryKey.add(id.getElements().get(pos));
- }
- return primaryKey;
- }
}
Modified: trunk/engine/src/main/java/org/teiid/query/util/CommandContext.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/util/CommandContext.java 2011-08-25 01:22:57 UTC (rev 3424)
+++ trunk/engine/src/main/java/org/teiid/query/util/CommandContext.java 2011-08-26 15:17:29 UTC (rev 3425)
@@ -58,6 +58,7 @@
import org.teiid.query.sql.symbol.ElementSymbol;
import org.teiid.query.sql.symbol.Expression;
import org.teiid.query.sql.util.VariableContext;
+import org.teiid.query.tempdata.GlobalTableStore;
import org.teiid.query.tempdata.TempTableStore;
/**
@@ -116,7 +117,7 @@
private BufferManager bufferManager;
- private TempTableStore globalTables;
+ private GlobalTableStore globalTables;
private SessionAwareCache<PreparedPlan> planCache;
@@ -484,11 +485,11 @@
globalState.bufferManager = bm;
}
- public TempTableStore getGlobalTableStore() {
+ public GlobalTableStore getGlobalTableStore() {
return globalState.globalTables;
}
- public void setGlobalTableStore(TempTableStore tempTableStore) {
+ public void setGlobalTableStore(GlobalTableStore tempTableStore) {
globalState.globalTables = tempTableStore;
}
Modified: trunk/engine/src/test/java/org/teiid/query/optimizer/relational/TestMaterialization.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/relational/TestMaterialization.java 2011-08-25 01:22:57 UTC (rev 3424)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/relational/TestMaterialization.java 2011-08-26 15:17:29 UTC (rev 3425)
@@ -37,7 +37,7 @@
import org.teiid.query.processor.ProcessorPlan;
import org.teiid.query.processor.relational.RelationalPlan;
import org.teiid.query.sql.lang.Command;
-import org.teiid.query.tempdata.TempTableStore;
+import org.teiid.query.tempdata.GlobalTableStoreImpl;
import org.teiid.query.unittest.RealMetadataFactory;
import org.teiid.query.util.CommandContext;
@@ -151,7 +151,8 @@
Command command = helpGetCommand(userSql, metadata, null);
CommandContext cc = new CommandContext();
- cc.setGlobalTableStore(new TempTableStore("SYSTEM"));
+ GlobalTableStoreImpl gts = new GlobalTableStoreImpl(null, metadata);
+ cc.setGlobalTableStore(gts);
ProcessorPlan plan = TestOptimizer.getPlan(command, metadata, getGenericFinder(), analysis, true, cc);
TestOptimizer.checkAtomicQueries(new String[] {"SELECT #MAT_MATVIEW.VGROUP2.x FROM #MAT_MATVIEW.VGROUP2"}, plan);
Collection<Annotation> annotations = analysis.getAnnotations();
@@ -168,7 +169,8 @@
Command command = helpGetCommand(userSql, metadata, null);
CommandContext cc = new CommandContext();
- cc.setGlobalTableStore(new TempTableStore("SYSTEM"));
+ GlobalTableStoreImpl gts = new GlobalTableStoreImpl(null, metadata);
+ cc.setGlobalTableStore(gts);
RelationalPlan plan = (RelationalPlan)TestOptimizer.getPlan(command, metadata, getGenericFinder(), analysis, true, cc);
assertEquals(1f, plan.getRootNode().getEstimateNodeCardinality());
TestOptimizer.checkAtomicQueries(new String[] {"SELECT #MAT_MATVIEW.VGROUP3.x, #MAT_MATVIEW.VGROUP3.y FROM #MAT_MATVIEW.VGROUP3 WHERE #MAT_MATVIEW.VGROUP3.x = 'foo'"}, plan);
@@ -186,7 +188,8 @@
Command command = helpGetCommand(userSql, metadata, null);
CommandContext cc = new CommandContext();
- cc.setGlobalTableStore(new TempTableStore("SYSTEM"));
+ GlobalTableStoreImpl gts = new GlobalTableStoreImpl(null, metadata);
+ cc.setGlobalTableStore(gts);
ProcessorPlan plan = TestOptimizer.getPlan(command, metadata, getGenericFinder(), analysis, true, cc);
TestOptimizer.checkAtomicQueries(new String[] {"SELECT #MAT_MATVIEW.VGROUP4.x FROM #MAT_MATVIEW.VGROUP4"}, plan);
Collection<Annotation> annotations = analysis.getAnnotations();
Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestMaterialization.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestMaterialization.java 2011-08-25 01:22:57 UTC (rev 3424)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestMaterialization.java 2011-08-26 15:17:29 UTC (rev 3425)
@@ -25,24 +25,29 @@
import static org.junit.Assert.*;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.Executor;
import org.junit.Before;
import org.junit.Test;
-import org.teiid.cache.DefaultCacheFactory;
import org.teiid.common.buffer.BufferManager;
import org.teiid.common.buffer.BufferManagerFactory;
import org.teiid.core.TeiidProcessingException;
import org.teiid.dqp.internal.process.CachedResults;
import org.teiid.dqp.internal.process.QueryProcessorFactoryImpl;
import org.teiid.dqp.internal.process.SessionAwareCache;
+import org.teiid.query.metadata.QueryMetadataInterface;
import org.teiid.query.metadata.TempMetadataAdapter;
import org.teiid.query.optimizer.capabilities.CapabilitiesFinder;
import org.teiid.query.optimizer.capabilities.DefaultCapabilitiesFinder;
+import org.teiid.query.optimizer.relational.RelationalPlanner;
+import org.teiid.query.tempdata.GlobalTableStoreImpl;
import org.teiid.query.tempdata.TempTableDataManager;
import org.teiid.query.tempdata.TempTableStore;
+import org.teiid.query.tempdata.GlobalTableStoreImpl.MatTableInfo;
import org.teiid.query.unittest.RealMetadataFactory;
import org.teiid.query.util.CommandContext;
@@ -52,20 +57,21 @@
private TempMetadataAdapter metadata;
private TempTableDataManager dataManager;
private TempTableStore tempStore;
- private TempTableStore globalStore;
+ private GlobalTableStoreImpl globalStore;
private ProcessorPlan previousPlan;
private HardcodedDataManager hdm;
@Before public void setUp() {
tempStore = new TempTableStore("1"); //$NON-NLS-1$
- globalStore = new TempTableStore("SYSTEM");
- metadata = new TempMetadataAdapter(RealMetadataFactory.exampleMaterializedView(), tempStore.getMetadataStore());
+ BufferManager bm = BufferManagerFactory.getStandaloneBufferManager();
+ QueryMetadataInterface actualMetadata = RealMetadataFactory.exampleMaterializedView();
+ globalStore = new GlobalTableStoreImpl(bm, actualMetadata);
+ metadata = new TempMetadataAdapter(actualMetadata, tempStore.getMetadataStore());
hdm = new HardcodedDataManager();
hdm.addData("SELECT matsrc.x FROM matsrc", new List[] {Arrays.asList((String)null), Arrays.asList("one"), Arrays.asList("two"), Arrays.asList("three")});
hdm.addData("SELECT mattable.info.e1, mattable.info.e2 FROM mattable.info", new List[] {Arrays.asList("a", 1), Arrays.asList("a", 2)});
hdm.addData("SELECT mattable.info.e2, mattable.info.e1 FROM mattable.info", new List[] {Arrays.asList(1, "a"), Arrays.asList(2, "a")});
- BufferManager bm = BufferManagerFactory.getStandaloneBufferManager();
SessionAwareCache<CachedResults> cache = new SessionAwareCache<CachedResults>();
cache.setBufferManager(bm);
Executor executor = new Executor() {
@@ -74,7 +80,7 @@
command.run();
}
};
- dataManager = new TempTableDataManager(hdm, bm, executor, cache, cache, new DefaultCacheFactory());
+ dataManager = new TempTableDataManager(hdm, bm, executor, cache);
}
private void execute(String sql, List<?>... expectedResults) throws Exception {
@@ -95,6 +101,25 @@
assertEquals(1, hdm.getCommandHistory().size());
}
+ @Test public void testReadWrite() throws Exception {
+ execute("SELECT * from vgroup3 where x = 'one'", Arrays.asList("one", "zne"));
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ String matTableName = RelationalPlanner.MAT_PREFIX + "MATVIEW.VGROUP3";
+ this.globalStore.getState(matTableName, baos);
+ MatTableInfo matTableInfo = this.globalStore.getMatTableInfo(matTableName);
+ long time = matTableInfo.getUpdateTime();
+ this.globalStore.failedLoad(matTableName);
+ this.globalStore.setState(matTableName, new ByteArrayInputStream(baos.toByteArray()));
+ assertEquals(time, matTableInfo.getUpdateTime());
+ execute("SELECT * from vgroup3 where x = 'one'", Arrays.asList("one", "zne"));
+
+ execute("select lookup('mattable.info', 'e1', 'e2', 5)", Arrays.asList((String)null));
+ baos = new ByteArrayOutputStream();
+ String codeTableName = "#CODE_MATTABLE.INFO.E2.E1";
+ this.globalStore.getState(codeTableName, baos);
+ this.globalStore.setState(codeTableName, new ByteArrayInputStream(baos.toByteArray()));
+ }
+
@Test(expected=TeiidProcessingException.class) public void testCodeTableResponseException() throws Exception {
//duplicate key
execute("select lookup('mattable.info', 'e2', 'e1', 'a')");
Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestProcessor.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestProcessor.java 2011-08-25 01:22:57 UTC (rev 3424)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestProcessor.java 2011-08-26 15:17:29 UTC (rev 3425)
@@ -93,6 +93,7 @@
import org.teiid.query.sql.symbol.Reference;
import org.teiid.query.sql.util.VariableContext;
import org.teiid.query.sql.visitor.ReferenceCollectorVisitor;
+import org.teiid.query.tempdata.GlobalTableStoreImpl;
import org.teiid.query.tempdata.TempTableDataManager;
import org.teiid.query.tempdata.TempTableStore;
import org.teiid.query.unittest.RealMetadataFactory;
@@ -246,7 +247,8 @@
context.setTempTableStore(new TempTableStore(context.getConnectionID()));
}
if (context.getGlobalTableStore() == null) {
- context.setGlobalTableStore(new TempTableStore("SYSTEM"));
+ GlobalTableStoreImpl gts = new GlobalTableStoreImpl(bufferMgr, context.getMetadata());
+ context.setGlobalTableStore(gts);
}
if (!(dataManager instanceof TempTableDataManager)) {
SessionAwareCache<CachedResults> cache = new SessionAwareCache<CachedResults>();
@@ -257,7 +259,7 @@
command.run();
}
};
- dataManager = new TempTableDataManager(dataManager, bufferMgr, executor, cache, null, null);
+ dataManager = new TempTableDataManager(dataManager, bufferMgr, executor, cache);
}
if (context.getQueryProcessorFactory() == null) {
context.setQueryProcessorFactory(new QueryProcessorFactoryImpl(bufferMgr, dataManager, new DefaultCapabilitiesFinder(), null, context.getMetadata()));
Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestTempTables.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestTempTables.java 2011-08-25 01:22:57 UTC (rev 3424)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestTempTables.java 2011-08-26 15:17:29 UTC (rev 3425)
@@ -81,7 +81,7 @@
command.run();
}
};
- dataManager = new TempTableDataManager(fdm, bm, executor, cache, null, null);
+ dataManager = new TempTableDataManager(fdm, bm, executor, cache);
}
@Test public void testInsertWithQueryExpression() throws Exception {
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2011-08-25 01:22:57 UTC (rev 3424)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2011-08-26 15:17:29 UTC (rev 3425)
@@ -60,10 +60,10 @@
import org.jboss.profileservice.spi.ProfileService;
import org.jboss.util.naming.Util;
import org.teiid.adminapi.Admin;
-import org.teiid.adminapi.Admin.Cache;
import org.teiid.adminapi.AdminComponentException;
import org.teiid.adminapi.AdminException;
import org.teiid.adminapi.AdminProcessingException;
+import org.teiid.adminapi.Admin.Cache;
import org.teiid.adminapi.impl.CacheStatisticsMetadata;
import org.teiid.adminapi.impl.DQPManagement;
import org.teiid.adminapi.impl.RequestMetadata;
@@ -83,13 +83,13 @@
import org.teiid.core.TeiidComponentException;
import org.teiid.core.TeiidRuntimeException;
import org.teiid.core.util.LRUCache;
+import org.teiid.deployers.CompositeVDB;
import org.teiid.deployers.ContainerLifeCycleListener;
import org.teiid.deployers.VDBLifeCycleListener;
import org.teiid.deployers.VDBRepository;
import org.teiid.deployers.VDBStatusChecker;
import org.teiid.dqp.internal.process.DQPConfiguration;
import org.teiid.dqp.internal.process.DQPCore;
-import org.teiid.dqp.internal.process.DQPCore.ContextProvider;
import org.teiid.dqp.internal.process.DQPWorkContext;
import org.teiid.dqp.internal.process.DataTierManagerImpl;
import org.teiid.dqp.internal.process.TransactionServerImpl;
@@ -110,11 +110,15 @@
import org.teiid.metadata.Procedure;
import org.teiid.metadata.Schema;
import org.teiid.metadata.Table;
+import org.teiid.metadata.TableStats;
import org.teiid.metadata.Table.TriggerEvent;
-import org.teiid.metadata.TableStats;
import org.teiid.net.TeiidURL;
+import org.teiid.query.ObjectReplicator;
import org.teiid.query.metadata.TransformationMetadata;
+import org.teiid.query.optimizer.relational.RelationalPlanner;
import org.teiid.query.processor.DdlPlan;
+import org.teiid.query.tempdata.GlobalTableStore;
+import org.teiid.query.tempdata.GlobalTableStoreImpl;
import org.teiid.security.SecurityHelper;
import org.teiid.transport.ClientServiceRegistry;
import org.teiid.transport.ClientServiceRegistryImpl;
@@ -148,12 +152,12 @@
private transient ProfileService profileService;
private transient String jndiName;
- private String eventDistributorName;
+ private transient ObjectReplicator objectReplicator;
+ private String objectReplicatorName;
private transient EventDistributor eventDistributor;
private transient EventDistributor eventDistributorProxy;
- private transient ContainerLifeCycleListener lifecycleListener;
- public RuntimeEngineDeployer() {
+ public RuntimeEngineDeployer() {
// TODO: this does not belong here
LogManager.setLogListener(new Log4jListener());
}
@@ -172,13 +176,18 @@
public void start() {
dqpCore.setTransactionService((TransactionService)LogManager.createLoggingProxy(LogConstants.CTX_TXN_LOG, transactionServerImpl, new Class[] {TransactionService.class}, MessageLevel.DETAIL));
- if (this.eventDistributorName != null) {
+ if (this.objectReplicatorName != null) {
try {
InitialContext ic = new InitialContext();
- this.eventDistributor = (EventDistributor) ic.lookup(this.eventDistributorName);
+ this.objectReplicator = (ObjectReplicator) ic.lookup(this.objectReplicatorName);
+ try {
+ this.eventDistributor = this.objectReplicator.replicate(this.jndiName, EventDistributor.class, this, 0);
+ } catch (Exception e) {
+ LogManager.logError(LogConstants.CTX_RUNTIME, e, IntegrationPlugin.Util.getString("replication_failed", this)); //$NON-NLS-1$
+ }
} catch (NamingException ne) {
//log at a detail level since we may not be in the all profile
- LogManager.logDetail(LogConstants.CTX_RUNTIME, ne, IntegrationPlugin.Util.getString("jndi_failed", new Date(System.currentTimeMillis()).toString())); //$NON-NLS-1$
+ LogManager.logDetail(LogConstants.CTX_RUNTIME, ne, IntegrationPlugin.Util.getString("jndi_failed", this.objectReplicatorName)); //$NON-NLS-1$
}
}
this.dqpCore.setMetadataRepository(this.vdbRepository.getMetadataRepository());
@@ -260,7 +269,7 @@
Util.bind(ic, jndiName, this) ;
} catch (final NamingException ne) {
// Add jndi_failed to bundle
- LogManager.logError(LogConstants.CTX_RUNTIME, ne, IntegrationPlugin.Util.getString("jndi_failed", new Date(System.currentTimeMillis()).toString())); //$NON-NLS-1$
+ LogManager.logError(LogConstants.CTX_RUNTIME, ne, IntegrationPlugin.Util.getString("jndi_failed", jndiName)); //$NON-NLS-1$
}
}
@@ -270,12 +279,25 @@
private Set<VDBKey> recentlyRemoved = Collections.newSetFromMap(new LRUCache<VDBKey, Boolean>(10000));
@Override
- public void removed(String name, int version) {
+ public void removed(String name, int version, CompositeVDB vdb) {
recentlyRemoved.add(new VDBKey(name, version));
+ if (objectReplicator != null) {
+ GlobalTableStore gts = vdb.getVDB().getAttachment(GlobalTableStore.class);
+ objectReplicator.stop(gts);
+ }
}
@Override
- public void added(String name, int version) {
+ public void added(String name, int version, CompositeVDB vdb) {
+ GlobalTableStore gts = new GlobalTableStoreImpl(dqpCore.getBufferManager(), vdb.getVDB().getAttachment(TransformationMetadata.class));
+ if (objectReplicator != null) {
+ try {
+ gts = objectReplicator.replicate(name + version, GlobalTableStore.class, gts, 300000);
+ } catch (Exception e) {
+ LogManager.logError(LogConstants.CTX_RUNTIME, e, IntegrationPlugin.Util.getString("replication_failed", gts)); //$NON-NLS-1$
+ }
+ }
+ vdb.getVDB().addAttchment(GlobalTableStore.class, gts);
if (!recentlyRemoved.remove(new VDBKey(name, version))) {
return;
}
@@ -296,8 +318,6 @@
dqpCore.clearCache(Cache.QUERY_SERVICE_RESULT_SET_CACHE.toString(), name, version);
}
});
-
- synchronizeMaterializeViews();
}
public void stop() {
@@ -332,6 +352,10 @@
this.odbcSocket = null;
}
LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.getString("engine_stopped", new Date(System.currentTimeMillis()).toString())); //$NON-NLS-1$
+
+ if (this.objectReplicator != null && this.eventDistributor != null) {
+ this.objectReplicator.stop(this.eventDistributor);
+ }
}
private void createClientServices() {
@@ -672,26 +696,31 @@
return newResults;
}
- public String getEventDistributorName() {
- return eventDistributorName;
+ public String getObjectReplicatorName() {
+ return objectReplicatorName;
}
- public void setEventDistributorName(String eventDistributorName) {
- this.eventDistributorName = eventDistributorName;
+ public void setObjectReplicatorName(String eventDistributorName) {
+ this.objectReplicatorName = eventDistributorName;
}
@Override
public void updateMatViewRow(String vdbName, int vdbVersion, String schema,
String viewName, List<?> tuple, boolean delete) {
- this.dqpCore.updateMatViewRow(getcontextProvider(), vdbName, vdbVersion, schema, viewName, tuple, delete);
+ VDBMetaData metadata = this.vdbRepository.getVDB(vdbName, vdbVersion);
+ if (metadata != null) {
+ GlobalTableStore gts = metadata.getAttachment(GlobalTableStore.class);
+ if (gts != null) {
+ try {
+ gts.updateMatViewRow((RelationalPlanner.MAT_PREFIX + schema + '.' + viewName).toUpperCase(), tuple, delete);
+ } catch (TeiidComponentException e) {
+ LogManager.logError(LogConstants.CTX_RUNTIME, e, IntegrationPlugin.Util.getString("replication_failed", "updateMatViewRow")); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+ }
}
@Override
- public void refreshMatView(final String vdbName, final int vdbVersion, final String viewName) {
- this.dqpCore.refreshMatView(getcontextProvider(), vdbName, vdbVersion, viewName);
- }
-
- @Override
public void dataModification(String vdbName, int vdbVersion, String schema,
String... tableNames) {
updateModified(true, vdbName, vdbVersion, schema, tableNames);
@@ -823,38 +852,9 @@
return this.eventDistributorProxy;
}
- private void synchronizeMaterializeViews() {
- this.lifecycleListener.addListener(new ContainerLifeCycleListener.LifeCycleEventListener() {
- @Override
- public void onStartupFinish() {
- dqpCore.synchronizeInternalMaterializedViews(getcontextProvider());
- }
- @Override
- public void onShutdownStart() {
- }
- });
- }
-
- private ContextProvider getcontextProvider() {
- return new DQPCore.ContextProvider() {
- @Override
- public DQPWorkContext getContext(final String vdbName, final int vdbVersion) {
- return new DQPWorkContext() {
- public VDBMetaData getVDB() {
- return vdbRepository.getVDB(vdbName, vdbVersion);
- }
- public String getVdbName() {
- return vdbName;
- }
- public int getVdbVersion() {
- return vdbVersion;
- }
- };
- }
- };
- }
-
+ /**
+ * @param listener
+ */
public void setContainerLifeCycleListener(ContainerLifeCycleListener listener) {
- this.lifecycleListener = listener;
}
}
Modified: trunk/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties
===================================================================
--- trunk/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties 2011-08-25 01:22:57 UTC (rev 3424)
+++ trunk/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties 2011-08-26 15:17:29 UTC (rev 3425)
@@ -42,7 +42,8 @@
class_not_found=Class {0} not found.
datasource_exists=Data source with name {0} already exists!
datasource_template_not_found=Template {0} for creating the data source is not found.
-jndi_failed=JNDI lookup failed.
+jndi_failed=JNDI lookup failed {0}.
+replication_failed=Could not replicate object {0}
distribute_failed=Deploy of the archive failed {0}
template_not_found=Template not found for {0}
admin_executing=JOPR admin {0} is executing command {1}
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2011-08-25 01:22:57 UTC (rev 3424)
+++ trunk/pom.xml 2011-08-26 15:17:29 UTC (rev 3425)
@@ -14,6 +14,7 @@
<scm>
<connection>scm:svn:https://anonsvn.jboss.org/repos/teiid/trunk</connection>
<developerConnection>scm:svn:https://svn.jboss.org/repos/teiid/trunk</developerConnection>
+ <url>http://anonsvn.jboss.org/repos/teiid/trunk</url>
</scm>
<licenses>
<license>
@@ -108,6 +109,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
+ <version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
@@ -117,6 +119,7 @@
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
+ <version>2.9</version>
<configuration>
<includes>
<include>**/*TestCase.java</include>
@@ -161,7 +164,7 @@
<addDefaultImplementationEntries> true</addDefaultImplementationEntries>
</manifest>
<manifestEntries>
- <Implementation-URL>${pom.url}</Implementation-URL>
+ <Implementation-URL>${project.url}</Implementation-URL>
</manifestEntries>
</archive>
</configuration>
@@ -169,6 +172,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
+ <version>2.1.2</version>
<executions>
<execution>
<id>attach-sources</id>
@@ -190,6 +194,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
+ <version>2.8</version>
<configuration>
<aggregate>true</aggregate>
<maxmemory>512m</maxmemory>
Modified: trunk/runtime/src/main/java/org/teiid/deployers/CompositeVDB.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/CompositeVDB.java 2011-08-25 01:22:57 UTC (rev 3424)
+++ trunk/runtime/src/main/java/org/teiid/deployers/CompositeVDB.java 2011-08-26 15:17:29 UTC (rev 3425)
@@ -44,7 +44,6 @@
import org.teiid.query.metadata.QueryMetadataInterface;
import org.teiid.query.metadata.TransformationMetadata;
import org.teiid.query.metadata.TransformationMetadata.Resource;
-import org.teiid.query.tempdata.TempTableStore;
import org.teiid.vdb.runtime.VDBKey;
@@ -95,8 +94,6 @@
TransformationMetadata metadata = buildTransformationMetaData(mergedVDB, getVisibilityMap(), getMetadataStores(), getUDF(), systemFunctions, this.additionalStores);
mergedVDB.addAttchment(QueryMetadataInterface.class, metadata);
mergedVDB.addAttchment(TransformationMetadata.class, metadata);
- TempTableStore globalTables = new TempTableStore("SYSTEM"); //$NON-NLS-1$
- mergedVDB.addAttchment(TempTableStore.class, globalTables);
}
private static TransformationMetadata buildTransformationMetaData(VDBMetaData vdb, LinkedHashMap<String, Resource> visibilityMap, MetadataStoreGroup stores, UDFMetaData udf, FunctionTree systemFunctions, MetadataStore[] additionalStores) {
@@ -134,6 +131,13 @@
return this.mergedVDB;
}
+ public boolean hasChildVdb(VDBKey child) {
+ if (this.children != null) {
+ return this.children.containsKey(child);
+ }
+ return false;
+ }
+
private VDBMetaData buildVDB() {
VDBMetaData newMergedVDB = new VDBMetaData();
newMergedVDB.setName(this.vdb.getName());
Modified: trunk/runtime/src/main/java/org/teiid/deployers/VDBLifeCycleListener.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/VDBLifeCycleListener.java 2011-08-25 01:22:57 UTC (rev 3424)
+++ trunk/runtime/src/main/java/org/teiid/deployers/VDBLifeCycleListener.java 2011-08-26 15:17:29 UTC (rev 3425)
@@ -22,6 +22,6 @@
package org.teiid.deployers;
public interface VDBLifeCycleListener {
- void added(String name, int version);
- void removed(String name, int version);
+ void added(String name, int version, CompositeVDB vdb);
+ void removed(String name, int version, CompositeVDB vdb);
}
Modified: trunk/runtime/src/main/java/org/teiid/deployers/VDBRepository.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/VDBRepository.java 2011-08-25 01:22:57 UTC (rev 3424)
+++ trunk/runtime/src/main/java/org/teiid/deployers/VDBRepository.java 2011-08-26 15:17:29 UTC (rev 3425)
@@ -101,7 +101,7 @@
cvdb = new CompositeVDB(vdb, stores, visibilityMap, udf, this.systemFunctionManager.getSystemFunctions(), cmr, this.systemStore, odbcStore);
}
this.vdbRepo.put(vdbId(vdb), cvdb);
- notifyAdd(vdb.getName(), vdb.getVersion());
+ notifyAdd(vdb.getName(), vdb.getVersion(), cvdb);
}
private void updateFromMetadataRepository(CompositeVDB cvdb) {
@@ -270,9 +270,15 @@
if (removed != null) {
// if this VDB was part of another VDB; then remove them.
for (CompositeVDB other:this.vdbRepo.values()) {
- other.removeChild(key);
+ if (other.hasChildVdb(key)) {
+ notifyRemove(other.getVDB().getName(), other.getVDB().getVersion(), other);
+
+ other.removeChild(key);
+
+ notifyAdd(other.getVDB().getName(), other.getVDB().getVersion(), other);
+ }
}
- notifyRemove(key.getName(), key.getVersion());
+ notifyRemove(key.getName(), key.getVersion(), removed);
return true;
}
return false;
@@ -303,11 +309,11 @@
throw new AdminProcessingException(RuntimePlugin.Util.getString("vdb_not_found", sourceVDBName, sourceVDBVersion)); //$NON-NLS-1$
}
- notifyRemove(targetVDBName, targetVDBVersion);
+ notifyRemove(targetVDBName, targetVDBVersion, target);
// merge them
target.addChild(source);
- notifyAdd(targetVDBName, targetVDBVersion);
+ notifyAdd(targetVDBName, targetVDBVersion, target);
}
// this is called by mc
@@ -333,15 +339,15 @@
this.listeners.remove(listener);
}
- private void notifyAdd(String name, int version) {
+ private void notifyAdd(String name, int version, CompositeVDB vdb) {
for(VDBLifeCycleListener l:this.listeners) {
- l.added(name, version);
+ l.added(name, version, vdb);
}
}
- private void notifyRemove(String name, int version) {
+ private void notifyRemove(String name, int version, CompositeVDB vdb) {
for(VDBLifeCycleListener l:this.listeners) {
- l.removed(name, version);
+ l.removed(name, version, vdb);
}
}
Modified: trunk/runtime/src/test/java/org/teiid/deployers/TestCompositeVDB.java
===================================================================
--- trunk/runtime/src/test/java/org/teiid/deployers/TestCompositeVDB.java 2011-08-25 01:22:57 UTC (rev 3424)
+++ trunk/runtime/src/test/java/org/teiid/deployers/TestCompositeVDB.java 2011-08-26 15:17:29 UTC (rev 3425)
@@ -149,8 +149,13 @@
@Test public void testRemoveChild() throws Exception {
CompositeVDB vdb = createCompositeVDB(RealMetadataFactory.exampleBQTStore(), "bqt");
- vdb.removeChild(new VDBKey("foo", 1));
+ VDBKey child = new VDBKey("foo", 1);
+ vdb.removeChild(child);
assertNotNull(vdb.getVDB());
+ assertFalse(vdb.hasChildVdb(child));
+ vdb.addChild(createCompositeVDB(RealMetadataFactory.example1Store(), "foo"));
+ assertTrue(vdb.hasChildVdb(child));
+ assertNotNull(vdb.getVDB());
}
}
Modified: trunk/test-integration/common/pom.xml
===================================================================
--- trunk/test-integration/common/pom.xml 2011-08-25 01:22:57 UTC (rev 3424)
+++ trunk/test-integration/common/pom.xml 2011-08-26 15:17:29 UTC (rev 3425)
@@ -20,6 +20,18 @@
<artifactId>h2</artifactId>
<version>1.2.147</version>
</dependency>
+ <dependency>
+ <artifactId>teiid-cache-jbosscache</artifactId>
+ <groupId>org.jboss.teiid</groupId>
+ </dependency>
+ <dependency>
+ <groupId>jgroups</groupId>
+ <artifactId>jgroups</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </dependency>
</dependencies>
</project>
\ No newline at end of file
Modified: trunk/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java 2011-08-25 01:22:57 UTC (rev 3424)
+++ trunk/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java 2011-08-26 15:17:29 UTC (rev 3425)
@@ -38,8 +38,10 @@
import org.teiid.cache.CacheConfiguration.Policy;
import org.teiid.client.DQP;
import org.teiid.client.security.ILogon;
+import org.teiid.deployers.CompositeVDB;
import org.teiid.deployers.MetadataStoreGroup;
import org.teiid.deployers.UDFMetaData;
+import org.teiid.deployers.VDBLifeCycleListener;
import org.teiid.deployers.VDBRepository;
import org.teiid.dqp.internal.datamgr.ConnectorManager;
import org.teiid.dqp.internal.datamgr.ConnectorManagerRepository;
@@ -55,10 +57,14 @@
import org.teiid.metadata.index.VDBMetadataFactory;
import org.teiid.net.CommunicationException;
import org.teiid.net.ConnectionException;
+import org.teiid.query.ObjectReplicator;
import org.teiid.query.function.SystemFunctionManager;
+import org.teiid.query.metadata.TransformationMetadata;
import org.teiid.query.metadata.TransformationMetadata.Resource;
import org.teiid.query.optimizer.capabilities.BasicSourceCapabilities;
import org.teiid.query.optimizer.capabilities.SourceCapabilities;
+import org.teiid.query.tempdata.GlobalTableStore;
+import org.teiid.query.tempdata.GlobalTableStoreImpl;
import org.teiid.services.SessionServiceImpl;
import org.teiid.transport.ClientServiceRegistry;
import org.teiid.transport.ClientServiceRegistryImpl;
@@ -74,14 +80,38 @@
VDBRepository repo = new VDBRepository();
private ConnectorManagerRepository cmr;
private boolean useCallingThread = true;
+ private ObjectReplicator replicator;
public FakeServer() {
this(new DQPConfiguration());
}
+ public void setReplicator(ObjectReplicator replicator) {
+ this.replicator = replicator;
+ }
+
public FakeServer(DQPConfiguration config) {
this.logon = new LogonImpl(sessionService, null);
-
+ this.repo.addListener(new VDBLifeCycleListener() {
+
+ @Override
+ public void removed(String name, int version, CompositeVDB vdb) {
+
+ }
+
+ @Override
+ public void added(String name, int version, CompositeVDB vdb) {
+ GlobalTableStore gts = new GlobalTableStoreImpl(dqp.getBufferManager(), vdb.getVDB().getAttachment(TransformationMetadata.class));
+ if (replicator != null) {
+ try {
+ gts = replicator.replicate(name + version, GlobalTableStore.class, gts, 300000);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+ vdb.getVDB().addAttchment(GlobalTableStore.class, gts);
+ }
+ });
this.repo.setSystemStore(VDBMetadataFactory.getSystem());
this.repo.setSystemFunctionManager(new SystemFunctionManager());
this.repo.odbcEnabled();
Added: trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestMatViewReplication.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestMatViewReplication.java (rev 0)
+++ trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestMatViewReplication.java 2011-08-26 15:17:29 UTC (rev 3425)
@@ -0,0 +1,136 @@
+/*
+ * 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.systemmodel;
+
+import static org.junit.Assert.*;
+
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.Statement;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.logging.Handler;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.jgroups.JChannelFactory;
+import org.junit.Test;
+import org.teiid.core.types.DataTypeManager;
+import org.teiid.core.util.UnitTestUtil;
+import org.teiid.jdbc.FakeServer;
+import org.teiid.metadata.FunctionMethod;
+import org.teiid.metadata.FunctionParameter;
+import org.teiid.metadata.FunctionMethod.Determinism;
+import org.teiid.metadata.FunctionMethod.PushDown;
+import org.teiid.replication.jboss.JGroupsObjectReplicator;
+
+@SuppressWarnings("nls")
+public class TestMatViewReplication {
+
+ private static final String MATVIEWS = "matviews";
+ private static final boolean DEBUG = false;
+
+ @Test public void testReplication() throws Exception {
+ if (DEBUG) {
+ Logger logger = Logger.getLogger("org.teiid");
+ logger.setLevel(Level.FINEST);
+ for (Handler h : logger.getHandlers()) {
+ h.setLevel(Level.FINEST);
+ }
+ /*org.apache.log4j.Logger l = LogManager.getLogger("org.jgroups");
+ l.setLevel(org.apache.log4j.Level.TRACE);
+ ConsoleAppender ca = new ConsoleAppender(new PatternLayout());
+ ca.setName("x");
+ l.addAppender(ca);*/
+ }
+
+ FakeServer server1 = createServer();
+
+ Connection c1 = server1.createConnection("jdbc:teiid:matviews");
+ Statement stmt = c1.createStatement();
+ stmt.execute("select * from TEST.RANDOMVIEW");
+ ResultSet rs = stmt.getResultSet();
+ assertTrue(rs.next());
+ double d1 = rs.getDouble(1);
+ double d2 = rs.getDouble(2);
+
+ FakeServer server2 = createServer();
+ Connection c2 = server2.createConnection("jdbc:teiid:matviews");
+ Statement stmt2 = c2.createStatement();
+ ResultSet rs2 = stmt2.executeQuery("select * from matviews where name = 'RandomView'");
+ assertTrue(rs2.next());
+ assertEquals("LOADED", rs2.getString("loadstate"));
+ assertEquals(true, rs2.getBoolean("valid"));
+ stmt2.execute("select * from TEST.RANDOMVIEW");
+ rs2 = stmt2.getResultSet();
+ assertTrue(rs2.next());
+ assertEquals(d1, rs2.getDouble(1), 0);
+ assertEquals(d2, rs2.getDouble(2), 0);
+
+ rs2 = stmt2.executeQuery("select * from (call refreshMatView('TEST.RANDOMVIEW', false)) p");
+
+ Thread.sleep(1000);
+
+ //make sure we're still valid and the same
+ stmt.execute("select * from TEST.RANDOMVIEW");
+ rs = stmt.getResultSet();
+ assertTrue(rs.next());
+ d1 = rs.getDouble(1);
+ d2 = rs.getDouble(2);
+ stmt2.execute("select * from TEST.RANDOMVIEW");
+ rs2 = stmt2.getResultSet();
+ assertTrue(rs2.next());
+ assertEquals(d1, rs2.getDouble(1), 0);
+ assertEquals(d2, rs2.getDouble(2), 0);
+
+ //ensure a lookup is usable on each side
+ rs2 = stmt2.executeQuery("select lookup('sys.schemas', 'VDBName', 'name', 'SYS')");
+ Thread.sleep(1000);
+
+ rs = stmt.executeQuery("select lookup('sys.schemas', 'VDBName', 'name', 'SYS')");
+ rs.next();
+ assertEquals("matviews", rs.getString(1));
+
+ server1.stop();
+ server2.stop();
+ }
+
+ private FakeServer createServer() throws Exception {
+ FakeServer server = new FakeServer();
+
+ JGroupsObjectReplicator jor = new JGroupsObjectReplicator();
+ jor.setClusterName("demo");
+ jor.setMultiplexerStack("tcp");
+ JChannelFactory jcf = new JChannelFactory();
+ jcf.setMultiplexerConfig(this.getClass().getClassLoader().getResource("stacks.xml")); //$NON-NLS-1$
+ jor.setChannelFactory(jcf);
+
+ server.setReplicator(jor);
+ HashMap<String, Collection<FunctionMethod>> udfs = new HashMap<String, Collection<FunctionMethod>>();
+ udfs.put("funcs", Arrays.asList(new FunctionMethod("pause", null, null, PushDown.CANNOT_PUSHDOWN, TestMatViews.class.getName(), "pause", null, new FunctionParameter("return", DataTypeManager.DefaultDataTypes.INTEGER), false, Determinism.NONDETERMINISTIC)));
+ server.deployVDB(MATVIEWS, UnitTestUtil.getTestDataPath() + "/matviews.vdb", udfs);
+ return server;
+ }
+
+}
Property changes on: trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestMatViewReplication.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
13 years, 4 months
teiid SVN: r3424 - in branches/7.4.x/runtime/src: test/java/org/teiid/deployers and 1 other directory.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-08-24 21:22:57 -0400 (Wed, 24 Aug 2011)
New Revision: 3424
Modified:
branches/7.4.x/runtime/src/main/java/org/teiid/deployers/CompositeVDB.java
branches/7.4.x/runtime/src/main/java/org/teiid/deployers/VDBRepository.java
branches/7.4.x/runtime/src/test/java/org/teiid/deployers/TestCompositeVDB.java
Log:
TEIID-1727 fix for removeVDB
Modified: branches/7.4.x/runtime/src/main/java/org/teiid/deployers/CompositeVDB.java
===================================================================
--- branches/7.4.x/runtime/src/main/java/org/teiid/deployers/CompositeVDB.java 2011-08-24 17:35:13 UTC (rev 3423)
+++ branches/7.4.x/runtime/src/main/java/org/teiid/deployers/CompositeVDB.java 2011-08-25 01:22:57 UTC (rev 3424)
@@ -134,6 +134,13 @@
return this.mergedVDB;
}
+ public boolean hasChildVdb(VDBKey child) {
+ if (this.children != null) {
+ return this.children.containsKey(child);
+ }
+ return false;
+ }
+
private VDBMetaData buildVDB() {
VDBMetaData newMergedVDB = new VDBMetaData();
newMergedVDB.setName(this.vdb.getName());
Modified: branches/7.4.x/runtime/src/main/java/org/teiid/deployers/VDBRepository.java
===================================================================
--- branches/7.4.x/runtime/src/main/java/org/teiid/deployers/VDBRepository.java 2011-08-24 17:35:13 UTC (rev 3423)
+++ branches/7.4.x/runtime/src/main/java/org/teiid/deployers/VDBRepository.java 2011-08-25 01:22:57 UTC (rev 3424)
@@ -270,7 +270,13 @@
if (removed != null) {
// if this VDB was part of another VDB; then remove them.
for (CompositeVDB other:this.vdbRepo.values()) {
- other.removeChild(key);
+ if (other.hasChildVdb(key)) {
+ notifyRemove(other.getVDB().getName(), other.getVDB().getVersion());
+
+ other.removeChild(key);
+
+ notifyAdd(other.getVDB().getName(), other.getVDB().getVersion());
+ }
}
notifyRemove(key.getName(), key.getVersion());
return true;
Modified: branches/7.4.x/runtime/src/test/java/org/teiid/deployers/TestCompositeVDB.java
===================================================================
--- branches/7.4.x/runtime/src/test/java/org/teiid/deployers/TestCompositeVDB.java 2011-08-24 17:35:13 UTC (rev 3423)
+++ branches/7.4.x/runtime/src/test/java/org/teiid/deployers/TestCompositeVDB.java 2011-08-25 01:22:57 UTC (rev 3424)
@@ -149,8 +149,13 @@
@Test public void testRemoveChild() throws Exception {
CompositeVDB vdb = createCompositeVDB(RealMetadataFactory.exampleBQTStore(), "bqt");
- vdb.removeChild(new VDBKey("foo", 1));
+ VDBKey child = new VDBKey("foo", 1);
+ vdb.removeChild(child);
assertNotNull(vdb.getVDB());
+ assertFalse(vdb.hasChildVdb(child));
+ vdb.addChild(createCompositeVDB(RealMetadataFactory.example1Store(), "foo"));
+ assertTrue(vdb.hasChildVdb(child));
+ assertNotNull(vdb.getVDB());
}
}
13 years, 4 months
teiid SVN: r3423 - in branches/as7: build/kits/jboss-as7/modules/org/jboss/teiid/translator/olap/main and 13 other directories.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2011-08-24 13:35:13 -0400 (Wed, 24 Aug 2011)
New Revision: 3423
Added:
branches/as7/jboss-integration/src/test/java/org/teiid/jboss/MockXMLExtendedWriter.java
branches/as7/jboss-integration/src/test/java/org/teiid/jboss/TestObjectSerializer.java
Removed:
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/AuthorizationValidatorService.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidModelDescription.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorRepositoryService.java
branches/as7/runtime/src/test/java/org/teiid/deployers/TestObjectSerializer.java
Modified:
branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/ldap/main/module.xml
branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/olap/main/module.xml
branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/ws/main/module.xml
branches/as7/build/kits/jboss-as7/standalone/configuration/standalone-teiid.xml
branches/as7/client/src/main/java/org/teiid/net/TeiidURL.java
branches/as7/connectors/translator-ldap/src/main/resources/META-INF/services/org.teiid.translator.ExecutionFactory
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/ObjectSerializer.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/ObjectsSerializerService.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineAdd.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/TeiidServiceNames.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidSubsystemParser.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorAdd.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/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/main/resources/schema/jboss-teiid.xsd
branches/as7/jboss-integration/src/test/java/org/teiid/jboss/TestTeiidConfiguration.java
branches/as7/jboss-integration/src/test/resources/teiid-model-config.txt
branches/as7/jboss-integration/src/test/resources/teiid-sample-config.xml
branches/as7/runtime/src/main/java/org/teiid/deployers/TeiidAttachments.java
branches/as7/runtime/src/main/java/org/teiid/deployers/UDFMetaData.java
branches/as7/runtime/src/main/java/org/teiid/transport/LocalServerConnection.java
Log:
TEIID-1720: Engine starts and translators deploy
Modified: branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/ldap/main/module.xml
===================================================================
--- branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/ldap/main/module.xml 2011-08-22 14:36:06 UTC (rev 3422)
+++ branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/ldap/main/module.xml 2011-08-24 17:35:13 UTC (rev 3423)
@@ -1,12 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
-<module xmlns="urn:jboss:module:1.0" name="org.jboss.teiid.translator.file">
+<module xmlns="urn:jboss:module:1.0" name="org.jboss.teiid.translator.ldap">
<resources>
- <resource-root path="translator-file-${project.version}.jar" />
+ <resource-root path="translator-ldap-${project.version}.jar" />
<!-- Insert resources here -->
</resources>
<dependencies>
+ <module name="javax.api"/>
<module name="javax.resource.api"/>
<module name="org.apache.commons.logging" />
<module name="org.apache.log4j"/>
Modified: branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/olap/main/module.xml
===================================================================
--- branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/olap/main/module.xml 2011-08-22 14:36:06 UTC (rev 3422)
+++ branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/olap/main/module.xml 2011-08-24 17:35:13 UTC (rev 3423)
@@ -1,11 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
-<module xmlns="urn:jboss:module:1.0" name="org.jboss.teiid.translator.file">
+<module xmlns="urn:jboss:module:1.0" name="org.jboss.teiid.translator.olap">
<resources>
- <resource-root path="translator-loopback-${project.version}.jar" />
+ <resource-root path="translator-olap-${project.version}.jar" />
<!-- Insert resources here -->
</resources>
<dependencies>
+ <module name="javax.api"/>
<module name="javax.resource.api"/>
<module name="org.apache.commons.logging" />
<module name="org.apache.log4j"/>
Modified: branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/ws/main/module.xml
===================================================================
--- branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/ws/main/module.xml 2011-08-22 14:36:06 UTC (rev 3422)
+++ branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/ws/main/module.xml 2011-08-24 17:35:13 UTC (rev 3423)
@@ -1,11 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="org.jboss.teiid.translator.ws">
<resources>
- <resource-root path="translator-ws-${project.name}.jar" />
+ <resource-root path="translator-ws-${project.version}.jar" />
<!-- Insert resources here -->
</resources>
<dependencies>
+ <module name="javax.xml.ws.api"/>
+ <module name="javax.api"/>
<module name="javax.resource.api"/>
<module name="org.apache.commons.logging" />
<module name="org.apache.log4j"/>
Modified: branches/as7/build/kits/jboss-as7/standalone/configuration/standalone-teiid.xml
===================================================================
--- branches/as7/build/kits/jboss-as7/standalone/configuration/standalone-teiid.xml 2011-08-22 14:36:06 UTC (rev 3422)
+++ branches/as7/build/kits/jboss-as7/standalone/configuration/standalone-teiid.xml 2011-08-24 17:35:13 UTC (rev 3423)
@@ -257,8 +257,9 @@
</security-domains>
</subsystem>
<subsystem xmlns="urn:jboss:domain:teiid:1.0">
+ <async-thread-group>teiid-async</async-thread-group>
+
<query-engine name = "default">
- <async-thread-group>teiid-async</async-thread-group>
<event-distributor-name>teiid/event-distributor</event-distributor-name>
<security-domain>teiid-security</security-domain>
<jdbc>
@@ -268,7 +269,34 @@
<socket-binding>teiid-odbc</socket-binding>
</odbc>
</query-engine>
+ <translator name="jdbc-simple" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="jdbc-ansi" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="access" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="db2" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="derby" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="h2" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="hsql" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="informix" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="metamatrix" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="mysql" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="mysql5" module="org.jboss.teiid.translator.jdbc"/>
<translator name="oracle" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="postgresql" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="sqlserver" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="sybase" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="teiid" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="teradata" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="modeshape" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="ingres" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="ingres93" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="intersystems-cache" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="netezza" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="file" module="org.jboss.teiid.translator.file"/>
+ <translator name="ldap" module="org.jboss.teiid.translator.ldap"/>
+ <translator name="loopback" module="org.jboss.teiid.translator.loopback"/>
+ <translator name="olap" module="org.jboss.teiid.translator.olap"/>
+ <translator name="ws" module="org.jboss.teiid.translator.ws"/>
+
</subsystem>
<subsystem xmlns="urn:jboss:domain:threads:1.0">
<queueless-thread-pool name="teiid-async">
Modified: branches/as7/client/src/main/java/org/teiid/net/TeiidURL.java
===================================================================
--- branches/as7/client/src/main/java/org/teiid/net/TeiidURL.java 2011-08-22 14:36:06 UTC (rev 3422)
+++ branches/as7/client/src/main/java/org/teiid/net/TeiidURL.java 2011-08-24 17:35:13 UTC (rev 3423)
@@ -90,6 +90,8 @@
public enum AuthenticationType {
CLEARTEXT,KRB5
};
+
+ public static final String ENGINE_NAME = "engineName"; //$NON-NLS-1$
}
public static final String DOT_DELIMITER = "."; //$NON-NLS-1$
Modified: branches/as7/connectors/translator-ldap/src/main/resources/META-INF/services/org.teiid.translator.ExecutionFactory
===================================================================
--- branches/as7/connectors/translator-ldap/src/main/resources/META-INF/services/org.teiid.translator.ExecutionFactory 2011-08-22 14:36:06 UTC (rev 3422)
+++ branches/as7/connectors/translator-ldap/src/main/resources/META-INF/services/org.teiid.translator.ExecutionFactory 2011-08-24 17:35:13 UTC (rev 3423)
@@ -1 +1 @@
-org.teiid.translator.ldap.LdapExecutionFactory
\ No newline at end of file
+org.teiid.translator.ldap.LDAPExecutionFactory
\ No newline at end of file
Deleted: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/AuthorizationValidatorService.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/AuthorizationValidatorService.java 2011-08-22 14:36:06 UTC (rev 3422)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/AuthorizationValidatorService.java 2011-08-24 17:35:13 UTC (rev 3423)
@@ -1,50 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.jboss;
-
-import org.jboss.msc.service.Service;
-import org.jboss.msc.service.StartContext;
-import org.jboss.msc.service.StartException;
-import org.jboss.msc.service.StopContext;
-import org.teiid.dqp.internal.process.AuthorizationValidator;
-
-public class AuthorizationValidatorService implements Service<AuthorizationValidator> {
- private AuthorizationValidator validator;
-
- public AuthorizationValidatorService(AuthorizationValidator value){
- this.validator = value;
- }
-
- @Override
- public void start(StartContext context) throws StartException {
- }
-
- @Override
- public void stop(StopContext context) {
- }
-
- @Override
- public AuthorizationValidator getValue() throws IllegalStateException, IllegalArgumentException {
- return validator;
- }
-
-}
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-08-22 14:36:06 UTC (rev 3422)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/ObjectSerializer.java 2011-08-24 17:35:13 UTC (rev 3423)
@@ -24,6 +24,7 @@
import java.io.*;
import org.jboss.logging.Logger;
+import org.teiid.adminapi.impl.VDBMetaData;
import org.teiid.core.util.FileUtils;
import org.teiid.logging.LogConstants;
import org.teiid.logging.LogManager;
@@ -58,43 +59,44 @@
}
}
- public void saveAttachment(File attachmentsStore, Object attachment) throws IOException {
+ public boolean saveAttachment(File attachmentsStore, Object attachment, boolean force) throws IOException {
if (log.isTraceEnabled()) {
log.trace("saveAttachment, attachmentsStore=" + attachmentsStore + ", attachment=" + attachment); //$NON-NLS-1$ //$NON-NLS-2$
}
- ObjectOutputStream oos = null;
- try {
- oos = new ObjectOutputStream(new FileOutputStream(attachmentsStore));
- oos.writeObject(attachment);
- } finally {
- if (oos != null) {
- oos.close();
+ if (!attachmentsStore.exists() || force) {
+ ObjectOutputStream oos = null;
+ try {
+ oos = new ObjectOutputStream(new FileOutputStream(attachmentsStore));
+ oos.writeObject(attachment);
+ return true;
+ } finally {
+ if (oos != null) {
+ oos.close();
+ }
}
}
+ return false;
}
- public boolean isStale(File cacheFile, long timeAfter) {
+ 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 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$
+ }
+
+ public boolean isStale(VDBMetaData vdb, long timeAfter) {
+ File cacheFile = buildVDBFile(vdb);
return (cacheFile.exists() && timeAfter > cacheFile.lastModified());
}
- public void removeAttachments(String fileName) {
- String dirName = baseDirectory(fileName);
+ public void removeAttachments(VDBMetaData vdb) {
+ String dirName = baseDirectory(vdb.getName()+"_"+vdb.getVersion()); //$NON-NLS-1$
FileUtils.removeDirectoryAndChildren(new File(dirName));
}
- public File getAttachmentPath(String fileName, String baseName) {
-
- String dirName = baseDirectory(fileName);
-
- final String vfsPath = baseName + ATTACHMENT_SUFFIX;
- File f = new File(dirName, vfsPath);
- if (!f.getParentFile().exists()) {
- f.getParentFile().mkdirs();
- }
- return f;
- }
-
private String baseDirectory(String fileName) {
String dirName = this.storagePath + File.separator + fileName + File.separator;
return dirName;
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/ObjectsSerializerService.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/ObjectsSerializerService.java 2011-08-22 14:36:06 UTC (rev 3422)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/ObjectsSerializerService.java 2011-08-24 17:35:13 UTC (rev 3423)
@@ -45,10 +45,10 @@
@Override
public ObjectSerializer getValue() throws IllegalStateException, IllegalArgumentException {
- return serializer;
+ return this.serializer;
}
public InjectedValue<String> getPathInjector() {
- return pathInjector;
+ return this.pathInjector;
}
}
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineAdd.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineAdd.java 2011-08-22 14:36:06 UTC (rev 3422)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineAdd.java 2011-08-24 17:35:13 UTC (rev 3423)
@@ -22,6 +22,8 @@
package org.teiid.jboss;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.*;
+import static org.teiid.jboss.Configuration.DESC;
+import static org.teiid.jboss.Configuration.addAttribute;
import java.util.List;
import java.util.Locale;
@@ -43,9 +45,11 @@
import org.jboss.as.network.SocketBinding;
import org.jboss.as.security.plugins.SecurityDomainContext;
import org.jboss.dmr.ModelNode;
+import org.jboss.dmr.ModelType;
import org.jboss.msc.inject.ConcurrentMapInjector;
import org.jboss.msc.service.*;
import org.jboss.msc.value.InjectedValue;
+import org.teiid.cache.CacheFactory;
import org.teiid.deployers.SystemVDBDeployer;
import org.teiid.deployers.VDBRepository;
import org.teiid.dqp.internal.datamgr.TranslatorRepository;
@@ -55,7 +59,6 @@
import org.teiid.logging.LogManager;
import org.teiid.services.BufferServiceImpl;
import org.teiid.transport.ClientServiceRegistry;
-import org.teiid.transport.LocalServerConnection;
import org.teiid.transport.SSLConfiguration;
import org.teiid.transport.SocketConfiguration;
@@ -70,76 +73,72 @@
node.get(DESCRIPTION).set("engine.add"); //$NON-NLS-1$
ModelNode engine = node.get(REQUEST_PROPERTIES, Configuration.QUERY_ENGINE);
- TeiidModelDescription.getQueryEngineDescription(engine, ATTRIBUTES, bundle);
+ describeQueryEngine(engine, ATTRIBUTES, bundle);
return node;
}
@Override
protected void populateModel(ModelNode operation, ModelNode model) {
- final ModelNode queryEngineNode = operation.require(Configuration.QUERY_ENGINE);
- model.set(Configuration.QUERY_ENGINE).set(queryEngineNode.clone());
-
+ populateQueryEngine(operation, model);
}
@Override
protected void performBoottime(OperationContext context, ModelNode operation, ModelNode model, ServiceVerificationHandler verificationHandler, List<ServiceController<?>> newControllers) throws OperationFailedException {
- final ModelNode queryEngineNode = operation.require(Configuration.QUERY_ENGINE);
ServiceTarget target = context.getServiceTarget();
final JBossLifeCycleListener shutdownListener = new JBossLifeCycleListener();
-
- SocketConfiguration jdbc = null;
- if (queryEngineNode.hasDefined(Configuration.JDBC)) {
- jdbc = buildSocketConfiguration(queryEngineNode.get(Configuration.JDBC));
- }
-
- SocketConfiguration odbc = null;
- if (queryEngineNode.hasDefined(Configuration.ODBC)) {
- odbc = buildSocketConfiguration(queryEngineNode.get(Configuration.ODBC));
- }
-
+
// now build the engine
- final RuntimeEngineDeployer engine = buildQueryEngine(queryEngineNode);
- engine.setJdbcSocketConfiguration(jdbc);
- engine.setOdbcSocketConfiguration(odbc);
+ final RuntimeEngineDeployer engine = buildQueryEngine(operation);
engine.setSecurityHelper(new JBossSecurityHelper());
engine.setContainerLifeCycleListener(shutdownListener);
// TODO: none of the caching is configured..
+ SocketConfiguration jdbc = null;
+ if (operation.hasDefined(Configuration.JDBC)) {
+ jdbc = buildSocketConfiguration(operation.get(Configuration.JDBC));
+ engine.setJdbcSocketConfiguration(jdbc);
+ }
+
+ SocketConfiguration odbc = null;
+ if (operation.hasDefined(Configuration.ODBC)) {
+ odbc = buildSocketConfiguration(operation.get(Configuration.ODBC));
+ engine.setOdbcSocketConfiguration(odbc);
+ }
ServiceBuilder<ClientServiceRegistry> serviceBuilder = target.addService(TeiidServiceNames.engineServiceName(engine.getName()), engine);
-
- serviceBuilder.addDependency(ServiceName.JBOSS.append("connector", "workmanager"), WorkManager.class, engine.workManagerInjector); //$NON-NLS-1$ //$NON-NLS-2$
- serviceBuilder.addDependency(ServiceName.JBOSS.append("txn", "XATerminator"), XATerminator.class, engine.xaTerminatorInjector); //$NON-NLS-1$ //$NON-NLS-2$
- serviceBuilder.addDependency(ServiceName.JBOSS.append("txn", "TransactionManager"), TransactionManager.class, engine.txnManagerInjector); //$NON-NLS-1$ //$NON-NLS-2$
- serviceBuilder.addDependency(TeiidServiceNames.BUFFER_MGR, BufferServiceImpl.class, engine.bufferServiceInjector);
+ serviceBuilder.addDependency(ServiceName.JBOSS.append("connector", "workmanager"), WorkManager.class, engine.getWorkManagerInjector()); //$NON-NLS-1$ //$NON-NLS-2$
+ serviceBuilder.addDependency(ServiceName.JBOSS.append("txn", "XATerminator"), XATerminator.class, engine.getXaTerminatorInjector()); //$NON-NLS-1$ //$NON-NLS-2$
+ serviceBuilder.addDependency(ServiceName.JBOSS.append("txn", "TransactionManager"), TransactionManager.class, engine.getTxnManagerInjector()); //$NON-NLS-1$ //$NON-NLS-2$
+ serviceBuilder.addDependency(TeiidServiceNames.BUFFER_MGR, BufferServiceImpl.class, engine.getBufferServiceInjector());
serviceBuilder.addDependency(TeiidServiceNames.SYSTEM_VDB, SystemVDBDeployer.class, new InjectedValue<SystemVDBDeployer>());
- serviceBuilder.addDependency(TeiidServiceNames.TRANSLATOR_REPO, TranslatorRepository.class, engine.translatorRepositoryInjector);
- serviceBuilder.addDependency(TeiidServiceNames.VDB_REPO, VDBRepository.class, engine.vdbRepositoryInjector);
- serviceBuilder.addDependency(TeiidServiceNames.AUTHORIZATION_VALIDATOR, AuthorizationValidator.class, engine.authorizationValidatorInjector);
+ serviceBuilder.addDependency(TeiidServiceNames.TRANSLATOR_REPO, TranslatorRepository.class, engine.getTranslatorRepositoryInjector());
+ serviceBuilder.addDependency(TeiidServiceNames.VDB_REPO, VDBRepository.class, engine.getVdbRepositoryInjector());
+ serviceBuilder.addDependency(TeiidServiceNames.AUTHORIZATION_VALIDATOR, AuthorizationValidator.class, engine.getAuthorizationValidatorInjector());
+ serviceBuilder.addDependency(TeiidServiceNames.CACHE_FACTORY, CacheFactory.class, engine.getCachefactoryInjector());
if (jdbc != null) {
- serviceBuilder.addDependency(ServiceName.JBOSS.append("binding", jdbc.getSocketBinding()), SocketBinding.class, engine.jdbcSocketBindingInjector); //$NON-NLS-1$
+ serviceBuilder.addDependency(ServiceName.JBOSS.append("binding", jdbc.getSocketBinding()), SocketBinding.class, engine.getJdbcSocketBindingInjector()); //$NON-NLS-1$
}
if (odbc != null) {
- serviceBuilder.addDependency(ServiceName.JBOSS.append("binding", odbc.getSocketBinding()), SocketBinding.class, engine.odbcSocketBindingInjector); //$NON-NLS-1$
+ serviceBuilder.addDependency(ServiceName.JBOSS.append("binding", odbc.getSocketBinding()), SocketBinding.class, engine.getOdbcSocketBindingInjector()); //$NON-NLS-1$
}
// register JNDI Name
- ServiceName javaContext = ServiceName.JBOSS.append("naming", "context", "java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- BinderService binder = new BinderService(LocalServerConnection.TEIID_RUNTIME);
- ServiceBuilder<ManagedReferenceFactory> namingBuilder = target.addService(javaContext.append(LocalServerConnection.TEIID_RUNTIME), binder);
- namingBuilder.addDependency(javaContext, NamingStore.class, binder.getNamingStoreInjector());
+ ServiceName teiidContext = ServiceName.JBOSS.append("naming", "context", "teiid"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ BinderService binder = new BinderService(engine.getName());
+ ServiceBuilder<ManagedReferenceFactory> namingBuilder = target.addService(teiidContext.append(engine.getName()), binder);
+ namingBuilder.addDependency(teiidContext, NamingStore.class, binder.getNamingStoreInjector());
namingBuilder.addDependency(TeiidServiceNames.engineServiceName(engine.getName()), RuntimeEngineDeployer.class, new ManagedReferenceInjector<RuntimeEngineDeployer>(binder.getManagedObjectInjector()));
namingBuilder.setInitialMode(ServiceController.Mode.ON_DEMAND);
newControllers.add(namingBuilder.install());
// add security domains
- if ( queryEngineNode.hasDefined(Configuration.SECURITY_DOMAIN)) {
- String domainNameOrder = queryEngineNode.get(Configuration.SECURITY_DOMAIN).asString();
+ if ( operation.hasDefined(Configuration.SECURITY_DOMAIN)) {
+ String domainNameOrder = operation.get(Configuration.SECURITY_DOMAIN).asString();
if (domainNameOrder != null && domainNameOrder.trim().length()>0) {
LogManager.logInfo(LogConstants.CTX_SECURITY, "Security Enabled: true"); //$NON-NLS-1$
String[] domainNames = domainNameOrder.split(","); //$NON-NLS-1$
@@ -270,4 +269,176 @@
return socket;
}
+
+ static void describeQueryEngine(ModelNode node, String type, ResourceBundle bundle) {
+ addAttribute(node, Configuration.ENGINE_NAME, type, bundle.getString(Configuration.ENGINE_NAME+Configuration.DESC), ModelType.STRING, true, null);
+ addAttribute(node, Configuration.MAX_THREADS, type, bundle.getString(Configuration.MAX_THREADS+DESC), ModelType.INT, false, "64"); //$NON-NLS-1$
+ addAttribute(node, Configuration.MAX_ACTIVE_PLANS, type, bundle.getString(Configuration.MAX_ACTIVE_PLANS+DESC), ModelType.INT, false, "20"); //$NON-NLS-1$
+ addAttribute(node, Configuration.USER_REQUEST_SOURCE_CONCURRENCY, type, bundle.getString(Configuration.USER_REQUEST_SOURCE_CONCURRENCY+DESC), ModelType.INT, false, "0"); //$NON-NLS-1$
+ addAttribute(node, Configuration.TIME_SLICE_IN_MILLI, type, bundle.getString(Configuration.TIME_SLICE_IN_MILLI+DESC), ModelType.INT, false, "2000"); //$NON-NLS-1$
+ addAttribute(node, Configuration.MAX_ROWS_FETCH_SIZE, type, bundle.getString(Configuration.MAX_ROWS_FETCH_SIZE+DESC), ModelType.INT, false, "20480"); //$NON-NLS-1$
+ addAttribute(node, Configuration.LOB_CHUNK_SIZE_IN_KB, type, bundle.getString(Configuration.LOB_CHUNK_SIZE_IN_KB+DESC), ModelType.INT, false, "100"); //$NON-NLS-1$
+ addAttribute(node, Configuration.QUERY_THRESHOLD_IN_SECS, type, bundle.getString(Configuration.QUERY_THRESHOLD_IN_SECS+DESC), ModelType.INT, false, "600"); //$NON-NLS-1$
+ addAttribute(node, Configuration.MAX_SOURCE_ROWS, type, bundle.getString(Configuration.MAX_SOURCE_ROWS+DESC), ModelType.INT, false, "-1"); //$NON-NLS-1$
+ addAttribute(node, Configuration.EXCEPTION_ON_MAX_SOURCE_ROWS, type, bundle.getString(Configuration.EXCEPTION_ON_MAX_SOURCE_ROWS+DESC), ModelType.BOOLEAN, false, "true"); //$NON-NLS-1$
+ addAttribute(node, Configuration.MAX_ODBC_LOB_SIZE_ALLOWED, type, bundle.getString(Configuration.MAX_ODBC_LOB_SIZE_ALLOWED+DESC), ModelType.INT, false, "5242880"); //$NON-NLS-1$
+ addAttribute(node, Configuration.EVENT_DISTRIBUTOR_NAME, type, bundle.getString(Configuration.EVENT_DISTRIBUTOR_NAME+DESC), ModelType.STRING, false, "teiid/event-distributor"); //$NON-NLS-1$
+ addAttribute(node, Configuration.DETECTING_CHANGE_EVENTS, type, bundle.getString(Configuration.DETECTING_CHANGE_EVENTS+DESC), ModelType.BOOLEAN, false, "true"); //$NON-NLS-1$
+
+ //session stuff
+ addAttribute(node, Configuration.SECURITY_DOMAIN, type, bundle.getString(Configuration.SECURITY_DOMAIN+DESC), ModelType.STRING, false, null);
+ addAttribute(node, Configuration.MAX_SESSIONS_ALLOWED, type, bundle.getString(Configuration.MAX_SESSIONS_ALLOWED+DESC), ModelType.INT, false, "5000"); //$NON-NLS-1$
+ addAttribute(node, Configuration.SESSION_EXPIRATION_TIME_LIMIT, type, bundle.getString(Configuration.SESSION_EXPIRATION_TIME_LIMIT+DESC), ModelType.INT, false, "0"); //$NON-NLS-1$
+
+ //jdbc
+ ModelNode jdbcSocketNode = node.get(CHILDREN, Configuration.JDBC);
+ jdbcSocketNode.get(TYPE).set(ModelType.OBJECT);
+ jdbcSocketNode.get(DESCRIPTION).set(bundle.getString(Configuration.JDBC+DESC));
+ jdbcSocketNode.get(REQUIRED).set(false);
+ jdbcSocketNode.get(MAX_OCCURS).set(1);
+ jdbcSocketNode.get(MIN_OCCURS).set(1);
+ describeSocketConfig(jdbcSocketNode, type, bundle);
+
+ //odbc
+ ModelNode odbcSocketNode = node.get(CHILDREN, Configuration.ODBC);
+ odbcSocketNode.get(TYPE).set(ModelType.OBJECT);
+ odbcSocketNode.get(DESCRIPTION).set(bundle.getString(Configuration.ODBC+DESC));
+ odbcSocketNode.get(REQUIRED).set(false);
+ odbcSocketNode.get(MAX_OCCURS).set(1);
+ odbcSocketNode.get(MIN_OCCURS).set(1);
+ describeSocketConfig(odbcSocketNode, type, bundle);
+ }
+
+
+ private static void describeSocketConfig(ModelNode node, String type, ResourceBundle bundle) {
+ addAttribute(node, Configuration.SOCKET_ENABLED, type, bundle.getString(Configuration.SOCKET_ENABLED+DESC), ModelType.BOOLEAN, false, "true"); //$NON-NLS-1$
+ addAttribute(node, Configuration.MAX_SOCKET_THREAD_SIZE, type, bundle.getString(Configuration.MAX_SOCKET_THREAD_SIZE+DESC), ModelType.INT, false, "0"); //$NON-NLS-1$
+ addAttribute(node, Configuration.IN_BUFFER_SIZE, type, bundle.getString(Configuration.IN_BUFFER_SIZE+DESC), ModelType.INT, false, "0"); //$NON-NLS-1$
+ addAttribute(node, Configuration.OUT_BUFFER_SIZE, type, bundle.getString(Configuration.OUT_BUFFER_SIZE+DESC), ModelType.INT, false, "0"); //$NON-NLS-1$
+ addAttribute(node, Configuration.SOCKET_BINDING, type, bundle.getString(Configuration.SOCKET_BINDING+DESC), ModelType.INT, true, null);
+
+ ModelNode sslNode = node.get(CHILDREN, Configuration.SSL);
+ sslNode.get(TYPE).set(ModelType.OBJECT);
+ sslNode.get(DESCRIPTION).set(bundle.getString(Configuration.SSL+DESC));
+ sslNode.get(REQUIRED).set(false);
+ sslNode.get(MAX_OCCURS).set(1);
+ sslNode.get(MIN_OCCURS).set(0);
+ addAttribute(node, Configuration.SSL_MODE, type, bundle.getString(Configuration.SSL_MODE+DESC), ModelType.STRING, false, "login"); //$NON-NLS-1$
+ addAttribute(node, Configuration.KEY_STORE_FILE, type, bundle.getString(Configuration.KEY_STORE_FILE+DESC), ModelType.STRING, false, null);
+ addAttribute(node, Configuration.KEY_STORE_PASSWD, type, bundle.getString(Configuration.KEY_STORE_PASSWD+DESC), ModelType.STRING, false, null);
+ addAttribute(node, Configuration.KEY_STORE_TYPE, type, bundle.getString(Configuration.KEY_STORE_TYPE+DESC), ModelType.STRING, false, "JKS"); //$NON-NLS-1$
+ addAttribute(node, Configuration.SSL_PROTOCOL, type, bundle.getString(Configuration.SSL_PROTOCOL+DESC), ModelType.BOOLEAN, false, "SSLv3"); //$NON-NLS-1$
+ addAttribute(node, Configuration.KEY_MANAGEMENT_ALG, type, bundle.getString(Configuration.KEY_MANAGEMENT_ALG+DESC), ModelType.STRING, false, "false"); //$NON-NLS-1$
+ addAttribute(node, Configuration.TRUST_FILE, type, bundle.getString(Configuration.TRUST_FILE+DESC), ModelType.STRING, false, null);
+ addAttribute(node, Configuration.TRUST_PASSWD, type, bundle.getString(Configuration.TRUST_PASSWD+DESC), ModelType.STRING, false, null);
+ addAttribute(node, Configuration.AUTH_MODE, type, bundle.getString(Configuration.AUTH_MODE+DESC), ModelType.STRING, false, "anonymous"); //$NON-NLS-1$
+ }
+
+ private void populateQueryEngine(ModelNode operation, ModelNode model) {
+ model.get(Configuration.ENGINE_NAME).set(operation.require(Configuration.ENGINE_NAME).asString());
+
+ if (operation.hasDefined(Configuration.MAX_THREADS)) {
+ model.get(Configuration.MAX_THREADS).set(operation.get(Configuration.MAX_THREADS).asInt());
+ }
+ if (operation.hasDefined(Configuration.MAX_ACTIVE_PLANS)) {
+ model.get(Configuration.MAX_ACTIVE_PLANS).set(operation.get(Configuration.MAX_ACTIVE_PLANS).asInt());
+ }
+ if (operation.hasDefined(Configuration.USER_REQUEST_SOURCE_CONCURRENCY)) {
+ model.get(Configuration.USER_REQUEST_SOURCE_CONCURRENCY).set(operation.get(Configuration.USER_REQUEST_SOURCE_CONCURRENCY).asInt());
+ }
+ if (operation.hasDefined(Configuration.TIME_SLICE_IN_MILLI)) {
+ model.get(Configuration.TIME_SLICE_IN_MILLI).set(operation.get(Configuration.TIME_SLICE_IN_MILLI).asInt());
+ }
+ if (operation.hasDefined(Configuration.MAX_ROWS_FETCH_SIZE)) {
+ model.get(Configuration.MAX_ROWS_FETCH_SIZE).set(operation.get(Configuration.MAX_ROWS_FETCH_SIZE).asInt());
+ }
+ if (operation.hasDefined(Configuration.LOB_CHUNK_SIZE_IN_KB)) {
+ model.get(Configuration.LOB_CHUNK_SIZE_IN_KB).set(operation.get(Configuration.LOB_CHUNK_SIZE_IN_KB).asInt());
+ }
+ if (operation.hasDefined(Configuration.QUERY_THRESHOLD_IN_SECS)) {
+ model.get(Configuration.QUERY_THRESHOLD_IN_SECS).set(operation.get(Configuration.QUERY_THRESHOLD_IN_SECS).asInt());
+ }
+ if (operation.hasDefined(Configuration.MAX_SOURCE_ROWS)) {
+ model.get(Configuration.MAX_SOURCE_ROWS).set(operation.get(Configuration.MAX_SOURCE_ROWS).asInt());
+ }
+ if (operation.hasDefined(Configuration.EXCEPTION_ON_MAX_SOURCE_ROWS)) {
+ model.get(Configuration.EXCEPTION_ON_MAX_SOURCE_ROWS).set(operation.get(Configuration.EXCEPTION_ON_MAX_SOURCE_ROWS).asBoolean());
+ }
+ if (operation.hasDefined(Configuration.MAX_ODBC_LOB_SIZE_ALLOWED)) {
+ model.get(Configuration.MAX_ODBC_LOB_SIZE_ALLOWED).set(operation.get(Configuration.MAX_ODBC_LOB_SIZE_ALLOWED).asInt());
+ }
+ if (operation.hasDefined(Configuration.EVENT_DISTRIBUTOR_NAME)) {
+ model.get(Configuration.EVENT_DISTRIBUTOR_NAME).set(operation.get(Configuration.EVENT_DISTRIBUTOR_NAME).asString());
+ }
+ if (operation.hasDefined(Configuration.DETECTING_CHANGE_EVENTS)) {
+ model.get(Configuration.DETECTING_CHANGE_EVENTS).set(operation.get(Configuration.DETECTING_CHANGE_EVENTS).asBoolean());
+ }
+ if (operation.hasDefined(Configuration.SESSION_EXPIRATION_TIME_LIMIT)) {
+ model.get(Configuration.SESSION_EXPIRATION_TIME_LIMIT).set(operation.get(Configuration.SESSION_EXPIRATION_TIME_LIMIT).asInt());
+ }
+ if (operation.hasDefined(Configuration.MAX_SESSIONS_ALLOWED)) {
+ model.get(Configuration.MAX_SESSIONS_ALLOWED).set(operation.get(Configuration.MAX_SESSIONS_ALLOWED).asInt());
+ }
+
+ if (operation.hasDefined(Configuration.JDBC)) {
+ populateSocketConfiguration(operation.get(Configuration.JDBC), model.get(Configuration.JDBC));
+ }
+
+ if (operation.hasDefined(Configuration.ODBC)) {
+ populateSocketConfiguration(operation.get(Configuration.ODBC), model.get(Configuration.ODBC));
+ }
+ }
+
+ private void populateSocketConfiguration(ModelNode operation, ModelNode model) {
+ if (operation.hasDefined(Configuration.SOCKET_BINDING)) {
+ model.get(Configuration.SOCKET_BINDING).set(operation.get(Configuration.SOCKET_BINDING).asString());
+ }
+ if (operation.hasDefined(Configuration.MAX_SOCKET_THREAD_SIZE)) {
+ model.get(Configuration.MAX_SOCKET_THREAD_SIZE).set(operation.get(Configuration.MAX_SOCKET_THREAD_SIZE).asInt());
+ }
+ if (operation.hasDefined(Configuration.IN_BUFFER_SIZE)) {
+ model.get(Configuration.IN_BUFFER_SIZE).set(operation.get(Configuration.IN_BUFFER_SIZE).asInt());
+ }
+ if (operation.hasDefined(Configuration.OUT_BUFFER_SIZE)) {
+ model.get(Configuration.OUT_BUFFER_SIZE).set(operation.get(Configuration.OUT_BUFFER_SIZE).asInt());
+ }
+
+
+ if (operation.hasDefined(Configuration.SSL)) {
+ operation = operation.get(Configuration.SSL);
+ model = model.get(Configuration.SSL);
+
+ if (operation.hasDefined(Configuration.SSL_MODE)) {
+ model.get(Configuration.SSL_MODE).set(operation.get(Configuration.SSL_MODE).asString());
+ }
+
+ if (operation.hasDefined(Configuration.KEY_STORE_FILE)) {
+ model.get(Configuration.KEY_STORE_FILE).set(operation.get(Configuration.KEY_STORE_FILE).asString());
+ }
+
+ if (operation.hasDefined(Configuration.KEY_STORE_PASSWD)) {
+ model.get(Configuration.KEY_STORE_PASSWD).set(operation.get(Configuration.KEY_STORE_PASSWD).asString());
+ }
+
+ if (operation.hasDefined(Configuration.KEY_STORE_TYPE)) {
+ model.get(Configuration.KEY_STORE_TYPE).set(operation.get(Configuration.KEY_STORE_TYPE).asString());
+ }
+
+ if (operation.hasDefined(Configuration.SSL_PROTOCOL)) {
+ model.get(Configuration.SSL_PROTOCOL).set(operation.get(Configuration.SSL_PROTOCOL).asString());
+ }
+ if (operation.hasDefined(Configuration.KEY_MANAGEMENT_ALG)) {
+ model.get(Configuration.KEY_MANAGEMENT_ALG).set(operation.get(Configuration.KEY_MANAGEMENT_ALG).asString());
+ }
+ if (operation.hasDefined(Configuration.TRUST_FILE)) {
+ model.get(Configuration.TRUST_FILE).set(operation.get(Configuration.TRUST_FILE).asString());
+ }
+ if (operation.hasDefined(Configuration.TRUST_PASSWD)) {
+ model.get(Configuration.TRUST_PASSWD).set(operation.get(Configuration.TRUST_PASSWD).asString());
+ }
+ if (operation.hasDefined(Configuration.AUTH_MODE)) {
+ model.get(Configuration.AUTH_MODE).set(operation.get(Configuration.AUTH_MODE).asString());
+ }
+ }
+ }
}
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-08-22 14:36:06 UTC (rev 3422)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidBootServicesAdd.java 2011-08-24 17:35:13 UTC (rev 3423)
@@ -30,9 +30,11 @@
import java.util.Locale;
import java.util.ResourceBundle;
import java.util.ServiceLoader;
-import java.util.concurrent.Executor;
-import org.jboss.as.controller.*;
+import org.jboss.as.controller.AbstractAddStepHandler;
+import org.jboss.as.controller.OperationContext;
+import org.jboss.as.controller.OperationFailedException;
+import org.jboss.as.controller.ServiceVerificationHandler;
import org.jboss.as.controller.descriptions.DescriptionProvider;
import org.jboss.as.server.AbstractDeploymentChainStep;
import org.jboss.as.server.DeploymentProcessorTarget;
@@ -44,12 +46,12 @@
import org.jboss.modules.ModuleIdentifier;
import org.jboss.modules.ModuleLoadException;
import org.jboss.msc.service.*;
-import org.jboss.msc.value.InjectedValue;
import org.teiid.PolicyDecider;
import org.teiid.cache.CacheConfiguration;
import org.teiid.cache.CacheFactory;
import org.teiid.cache.DefaultCacheFactory;
-import org.teiid.deployers.*;
+import org.teiid.deployers.SystemVDBDeployer;
+import org.teiid.deployers.VDBRepository;
import org.teiid.dqp.internal.datamgr.TranslatorRepository;
import org.teiid.dqp.internal.process.AuthorizationValidator;
import org.teiid.dqp.internal.process.DataRolePolicyDecider;
@@ -58,7 +60,6 @@
import org.teiid.services.BufferServiceImpl;
public class TeiidBootServicesAdd extends AbstractAddStepHandler implements DescriptionProvider {
-
@Override
public ModelNode getModelDescription(Locale locale) {
final ResourceBundle bundle = IntegrationPlugin.getResourceBundle(locale);
@@ -66,40 +67,44 @@
node.get(OPERATION_NAME).set(ADD);
node.get(DESCRIPTION).set(bundle.getString("teiid-boot.add")); //$NON-NLS-1$
- addAttribute(node, Configuration.ALLOW_ENV_FUNCTION, REQUEST_PROPERTIES, bundle.getString(Configuration.ALLOW_ENV_FUNCTION+DESC), ModelType.BOOLEAN, false, "false"); //$NON-NLS-1$
- addAttribute(node, Configuration.ASYNC_THREAD_GROUP, REQUEST_PROPERTIES, bundle.getString(Configuration.ASYNC_THREAD_GROUP+DESC), ModelType.STRING, false, "teiid-async-threads"); //$NON-NLS-1$
+ describeTeiidRoot(bundle, REQUEST_PROPERTIES, node);
+
+ return node;
+ }
- addAttribute(node, Configuration.AUTHORIZATION_VALIDATOR_MODULE, REQUEST_PROPERTIES, bundle.getString(Configuration.AUTHORIZATION_VALIDATOR_MODULE+DESC), ModelType.BOOLEAN, false, "false"); //$NON-NLS-1$
- addAttribute(node, Configuration.POLICY_DECIDER_MODULE, REQUEST_PROPERTIES, bundle.getString(Configuration.POLICY_DECIDER_MODULE+DESC), ModelType.STRING, false, "teiid-async-threads"); //$NON-NLS-1$
+ 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.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$
ModelNode bufferNode = node.get(CHILDREN, Configuration.BUFFER_SERVICE);
bufferNode.get(TYPE).set(ModelType.OBJECT);
bufferNode.get(DESCRIPTION).set(bundle.getString(Configuration.BUFFER_SERVICE+DESC));
bufferNode.get(REQUIRED).set(false);
- getBufferManagerDesciption(bufferNode, ATTRIBUTES, bundle);
+ describeBufferManager(bufferNode, ATTRIBUTES, bundle);
// result-set-cache
ModelNode rsCacheNode = node.get(CHILDREN, Configuration.RESULTSET_CACHE);
rsCacheNode.get(TYPE).set(ModelType.OBJECT);
rsCacheNode.get(DESCRIPTION).set(bundle.getString(Configuration.RESULTSET_CACHE+DESC));
rsCacheNode.get(REQUIRED).set(false);
- getResultsetCacheDescription(rsCacheNode, ATTRIBUTES, bundle);
+ describeResultsetcache(rsCacheNode, ATTRIBUTES, bundle);
// preparedplan-set-cache
ModelNode preparedPlanCacheNode = node.get(CHILDREN, Configuration.PREPAREDPLAN_CACHE);
preparedPlanCacheNode.get(TYPE).set(ModelType.OBJECT);
preparedPlanCacheNode.get(DESCRIPTION).set(bundle.getString(Configuration.PREPAREDPLAN_CACHE+DESC));
preparedPlanCacheNode.get(REQUIRED).set(false);
- getResultsetCacheDescription(preparedPlanCacheNode, ATTRIBUTES, bundle);
+ describePreparedPlanCache(preparedPlanCacheNode, ATTRIBUTES, bundle);
//distributed-cache
ModelNode distributedCacheNode = node.get(CHILDREN, Configuration.CACHE_FACORY);
distributedCacheNode.get(TYPE).set(ModelType.OBJECT);
distributedCacheNode.get(DESCRIPTION).set(bundle.getString(Configuration.CACHE_FACORY+DESC));
distributedCacheNode.get(REQUIRED).set(false);
- getDistributedCacheDescription(preparedPlanCacheNode, ATTRIBUTES, bundle);
-
- return node;
+ describeDistributedCache(preparedPlanCacheNode, ATTRIBUTES, bundle);
}
@Override
@@ -111,7 +116,7 @@
model.get(Configuration.ASYNC_THREAD_GROUP).set(operation.get(Configuration.ASYNC_THREAD_GROUP).asString());
}
populateBufferManager(operation, model);
-
+ //TODO: add cache model descriptions
}
@Override
@@ -119,12 +124,18 @@
final ServiceVerificationHandler verificationHandler, final List<ServiceController<?>> newControllers) throws OperationFailedException {
ServiceTarget target = context.getServiceTarget();
+ final String asyncThreadPoolName = operation.require(Configuration.ASYNC_THREAD_GROUP).asString();
+
// translator repository
final TranslatorRepository translatorRepo = new TranslatorRepository();
- TranslatorRepositoryService translatorService = new TranslatorRepositoryService(translatorRepo);
+ ValueService<TranslatorRepository> translatorService = new ValueService<TranslatorRepository>(new org.jboss.msc.value.Value<TranslatorRepository>() {
+ @Override
+ public TranslatorRepository getValue() throws IllegalStateException, IllegalArgumentException {
+ return translatorRepo;
+ }
+ });
ServiceController<TranslatorRepository> service = target.addService(TeiidServiceNames.TRANSLATOR_REPO, translatorService).install();
newControllers.add(service);
- ServiceContainer serviceContainer = service.getServiceContainer();
// system function tree
SystemFunctionManager systemFunctionManager = new SystemFunctionManager();
@@ -149,7 +160,9 @@
newControllers.add(RelativePathService.addService(TeiidServiceNames.DATA_DIR, "teiid-data", "jboss.server.data.dir", target)); //$NON-NLS-1$ //$NON-NLS-2$
final ObjectsSerializerService serializer = new ObjectsSerializerService();
- newControllers.add(target.addService(TeiidServiceNames.OBJECT_SERIALIZER, serializer).install());
+ ServiceBuilder<ObjectSerializer> objectSerializerService = target.addService(TeiidServiceNames.OBJECT_SERIALIZER, serializer);
+ objectSerializerService.addDependency(TeiidServiceNames.DATA_DIR, String.class, serializer.getPathInjector());
+ newControllers.add(objectSerializerService.install());
// TODO: remove verbose service by moving the buffer service from runtime project
newControllers.add(RelativePathService.addService(TeiidServiceNames.BUFFER_DIR, "teiid-buffer", "jboss.server.temp.dir", target)); //$NON-NLS-1$ //$NON-NLS-2$
@@ -170,7 +183,7 @@
policyDecider = drpd;
}
- AuthorizationValidator authValidator;
+ final AuthorizationValidator authValidator;
if (operation.hasDefined(Configuration.AUTHORIZATION_VALIDATOR_MODULE)) {
authValidator = buildService(AuthorizationValidator.class, operation.get(Configuration.AUTHORIZATION_VALIDATOR_MODULE).asString());
authValidator.setEnabled(true);
@@ -181,24 +194,38 @@
dap.setEnabled(true);
authValidator = dap;
}
- target.addService(TeiidServiceNames.AUTHORIZATION_VALIDATOR, new AuthorizationValidatorService(authValidator));
- CacheFactory cacheFactory = getCacheFactory(operation.get(Configuration.CACHE_FACORY));
+ ValueService<AuthorizationValidator> authValidatorService = new ValueService<AuthorizationValidator>(new org.jboss.msc.value.Value<AuthorizationValidator>() {
+ @Override
+ public AuthorizationValidator getValue() throws IllegalStateException, IllegalArgumentException {
+ return authValidator;
+ }
+ });
+ newControllers.add(target.addService(TeiidServiceNames.AUTHORIZATION_VALIDATOR, authValidatorService).install());
+
+ //cache factory
+ final CacheFactory cacheFactory = getCacheFactory(operation.get(Configuration.CACHE_FACORY));
+ ValueService<CacheFactory> cacheFactoryService = new ValueService<CacheFactory>(new org.jboss.msc.value.Value<CacheFactory>() {
+ @Override
+ public CacheFactory getValue() throws IllegalStateException, IllegalArgumentException {
+ return cacheFactory;
+ }
+ });
+ newControllers.add(target.addService(TeiidServiceNames.CACHE_FACTORY, cacheFactoryService).install());
+
CacheConfiguration resultsetCache = buildCacheConfig(operation.get(Configuration.RESULTSET_CACHE));
CacheConfiguration preparePlanCache = buildCacheConfig(operation.get(Configuration.PREPAREDPLAN_CACHE));
- final JBossLifeCycleListener shutdownListener = new JBossLifeCycleListener();
- serviceContainer.addTerminateListener(shutdownListener);
-
- serviceBuilder.addDependency(ServiceName.JBOSS.append("thread", "executor", asyncExecutor), Executor.class, engine.threadPoolInjector); //$NON-NLS-1$ //$NON-NLS-2$
-
+ // add translators
+
+
// Register VDB deployer
context.addStep(new AbstractDeploymentChainStep() {
@Override
public void execute(DeploymentProcessorTarget processorTarget) {
processorTarget.addDeploymentProcessor(Phase.STRUCTURE, Phase.STRUCTURE_WAR_DEPLOYMENT_INIT|0x0001,new VDBStructure());
- processorTarget.addDeploymentProcessor(Phase.PARSE, Phase.PARSE_WEB_DEPLOYMENT|0x0001, new VDBParserDeployer(vdbRepository, serializer));
+ processorTarget.addDeploymentProcessor(Phase.PARSE, Phase.PARSE_WEB_DEPLOYMENT|0x0001, new VDBParserDeployer());
processorTarget.addDeploymentProcessor(Phase.DEPENDENCIES, Phase.DEPENDENCIES_WAR_MODULE|0x0001, new VDBDependencyProcessor());
processorTarget.addDeploymentProcessor(Phase.INSTALL, Phase.INSTALL_WAR_DEPLOYMENT|0x0001, new VDBDeployer(translatorRepo, asyncThreadPoolName));
}
@@ -220,7 +247,7 @@
}
- static void getBufferManagerDesciption(ModelNode node, String type, ResourceBundle bundle) {
+ static void describeBufferManager(ModelNode node, String type, ResourceBundle bundle) {
addAttribute(node, Configuration.USE_DISK, type, bundle.getString(Configuration.USE_DISK+DESC), ModelType.BOOLEAN, false, "true"); //$NON-NLS-1$
addAttribute(node, Configuration.PROCESSOR_BATCH_SIZE, type, bundle.getString(Configuration.PROCESSOR_BATCH_SIZE+DESC), ModelType.INT, false, "512"); //$NON-NLS-1$
addAttribute(node, Configuration.CONNECTOR_BATCH_SIZE, type, bundle.getString(Configuration.CONNECTOR_BATCH_SIZE+DESC), ModelType.INT, false, "1024"); //$NON-NLS-1$
@@ -301,12 +328,12 @@
}
}
- private static void getDistributedCacheDescription(ModelNode node, String type, ResourceBundle bundle) {
+ private static void describeDistributedCache(ModelNode node, String type, ResourceBundle bundle) {
addAttribute(node, Configuration.CACHE_SERVICE_JNDI_NAME, type, bundle.getString(Configuration.CACHE_SERVICE_JNDI_NAME+DESC), ModelType.STRING, false, "java:TeiidCacheManager"); //$NON-NLS-1$
addAttribute(node, Configuration.RESULTSET_CACHE_NAME, type, bundle.getString(Configuration.RESULTSET_CACHE_NAME+DESC), ModelType.STRING, false, "teiid-resultset-cache"); //$NON-NLS-1$
}
- private static void getResultsetCacheDescription(ModelNode node, String type, ResourceBundle bundle) {
+ private static void describeResultsetcache(ModelNode node, String type, ResourceBundle bundle) {
addAttribute(node, Configuration.MAX_ENTRIES, type, bundle.getString(Configuration.MAX_ENTRIES+DESC), ModelType.INT, false, "1024"); //$NON-NLS-1$
addAttribute(node, Configuration.MAX_AGE_IN_SECS, type, bundle.getString(Configuration.MAX_AGE_IN_SECS+DESC), ModelType.INT, false, "7200");//$NON-NLS-1$
addAttribute(node, Configuration.MAX_STALENESS, type, bundle.getString(Configuration.MAX_STALENESS+DESC), ModelType.INT, false, "60");//$NON-NLS-1$
@@ -314,13 +341,14 @@
addAttribute(node, Configuration.CACHE_LOCATION, type, bundle.getString(Configuration.CACHE_LOCATION+DESC), ModelType.STRING, false, "resultset"); //$NON-NLS-1$
}
- private static void getPreparedPalnCacheDescription(ModelNode node, String type, ResourceBundle bundle) {
+ private static void describePreparedPlanCache(ModelNode node, String type, ResourceBundle bundle) {
addAttribute(node, Configuration.MAX_ENTRIES, type, bundle.getString(Configuration.MAX_ENTRIES+DESC), ModelType.INT, false, "512"); //$NON-NLS-1$
addAttribute(node, Configuration.MAX_AGE_IN_SECS, type, bundle.getString(Configuration.MAX_AGE_IN_SECS+DESC), ModelType.INT, false, "28800");//$NON-NLS-1$
addAttribute(node, Configuration.MAX_STALENESS, type, bundle.getString(Configuration.MAX_STALENESS+DESC), ModelType.INT, false, "0");//$NON-NLS-1$
addAttribute(node, Configuration.CACHE_TYPE, type, bundle.getString(Configuration.CACHE_TYPE+DESC), ModelType.STRING, false, "LRU"); //$NON-NLS-1$
addAttribute(node, Configuration.CACHE_LOCATION, type, bundle.getString(Configuration.CACHE_LOCATION+DESC), ModelType.STRING, false, "preparedplan"); //$NON-NLS-1$
}
+
private CacheFactory getCacheFactory(ModelNode node) {
CacheFactory cacheFactory = new DefaultCacheFactory();
/*
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidExtension.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidExtension.java 2011-08-22 14:36:06 UTC (rev 3422)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidExtension.java 2011-08-24 17:35:13 UTC (rev 3423)
@@ -68,6 +68,7 @@
private static QueryEngineRemove ENGINE_REMOVE = new QueryEngineRemove();
private static TranslatorAdd TRANSLATOR_ADD = new TranslatorAdd();
private static TranslatorRemove TRANSLATOR_REMOVE = new TranslatorRemove();
+ private static TeiidBootServicesAdd TEIID_BOOT_ADD = new TeiidBootServicesAdd();
@Override
public void initialize(ExtensionContext context) {
@@ -89,17 +90,18 @@
node.get(ModelDescriptionConstants.TAIL_COMMENT_ALLOWED).set(true);
node.get(ModelDescriptionConstants.NAMESPACE).set(Namespace.CURRENT.getUri());
- node.get(CHILDREN, Configuration.QUERY_ENGINE, DESCRIPTION).set(bundle.getString(Configuration.QUERY_ENGINE));
+ TeiidBootServicesAdd.describeTeiidRoot(bundle, ATTRIBUTES, node);
+ node.get(CHILDREN, Configuration.QUERY_ENGINE, DESCRIPTION).set(bundle.getString(Configuration.QUERY_ENGINE+Configuration.DESC));
node.get(CHILDREN, Configuration.QUERY_ENGINE, REQUIRED).set(false);
- node.get(CHILDREN, Configuration.TRANSLATOR, DESCRIPTION).set(bundle.getString(Configuration.TRANSLATOR));
+ node.get(CHILDREN, Configuration.TRANSLATOR, DESCRIPTION).set(bundle.getString(Configuration.TRANSLATOR+Configuration.DESC));
node.get(CHILDREN, Configuration.TRANSLATOR, REQUIRED).set(false);
return node;
}
});
- teiidSubsystem.registerOperationHandler(ADD, ENGINE_ADD, ENGINE_ADD, false);
- teiidSubsystem.registerOperationHandler(REMOVE, ENGINE_REMOVE, ENGINE_REMOVE, false);
+ teiidSubsystem.registerOperationHandler(ADD, TEIID_BOOT_ADD, TEIID_BOOT_ADD, false);
+ //teiidSubsystem.registerOperationHandler(REMOVE, ENGINE_REMOVE, ENGINE_REMOVE, false);
// Translator Subsystem
final ManagementResourceRegistration translatorSubsystem = teiidSubsystem.registerSubModel(PathElement.pathElement(Configuration.TRANSLATOR), new DescriptionProvider() {
@@ -108,7 +110,7 @@
final ResourceBundle bundle = IntegrationPlugin.getResourceBundle(locale);
final ModelNode node = new ModelNode();
- node.get(DESCRIPTION).set(bundle.getString(Configuration.TRANSLATOR));
+ node.get(DESCRIPTION).set(bundle.getString(Configuration.TRANSLATOR+Configuration.DESC));
node.get(HEAD_COMMENT_ALLOWED).set(true);
node.get(TAIL_COMMENT_ALLOWED).set(true);
@@ -128,10 +130,10 @@
final ResourceBundle bundle = IntegrationPlugin.getResourceBundle(locale);
final ModelNode node = new ModelNode();
- node.get(DESCRIPTION).set(bundle.getString(Configuration.QUERY_ENGINE));
+ node.get(DESCRIPTION).set(bundle.getString(Configuration.QUERY_ENGINE+Configuration.DESC));
node.get(HEAD_COMMENT_ALLOWED).set(true);
node.get(TAIL_COMMENT_ALLOWED).set(true);
- TeiidModelDescription.getQueryEngineDescription(node, ATTRIBUTES, bundle);
+ QueryEngineAdd.describeQueryEngine(node, ATTRIBUTES, bundle);
return node;
}
});
Deleted: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidModelDescription.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidModelDescription.java 2011-08-22 14:36:06 UTC (rev 3422)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidModelDescription.java 2011-08-24 17:35:13 UTC (rev 3423)
@@ -1,98 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.jboss;
-
-import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.*;
-import static org.teiid.jboss.Configuration.DESC;
-import static org.teiid.jboss.Configuration.addAttribute;
-
-import java.util.ResourceBundle;
-
-import org.jboss.dmr.ModelNode;
-import org.jboss.dmr.ModelType;
-
-class TeiidModelDescription {
-
- static void getQueryEngineDescription(ModelNode node, String type, ResourceBundle bundle) {
- addAttribute(node, Configuration.ENGINE_NAME, type, bundle.getString(Configuration.ENGINE_NAME+Configuration.DESC), ModelType.STRING, true, null);
- addAttribute(node, Configuration.MAX_THREADS, type, bundle.getString(Configuration.MAX_THREADS+DESC), ModelType.INT, false, "64"); //$NON-NLS-1$
- addAttribute(node, Configuration.MAX_ACTIVE_PLANS, type, bundle.getString(Configuration.MAX_ACTIVE_PLANS+DESC), ModelType.INT, false, "20"); //$NON-NLS-1$
- addAttribute(node, Configuration.USER_REQUEST_SOURCE_CONCURRENCY, type, bundle.getString(Configuration.USER_REQUEST_SOURCE_CONCURRENCY+DESC), ModelType.INT, false, "0"); //$NON-NLS-1$
- addAttribute(node, Configuration.TIME_SLICE_IN_MILLI, type, bundle.getString(Configuration.TIME_SLICE_IN_MILLI+DESC), ModelType.INT, false, "2000"); //$NON-NLS-1$
- addAttribute(node, Configuration.MAX_ROWS_FETCH_SIZE, type, bundle.getString(Configuration.MAX_ROWS_FETCH_SIZE+DESC), ModelType.INT, false, "20480"); //$NON-NLS-1$
- addAttribute(node, Configuration.LOB_CHUNK_SIZE_IN_KB, type, bundle.getString(Configuration.LOB_CHUNK_SIZE_IN_KB+DESC), ModelType.INT, false, "100"); //$NON-NLS-1$
- addAttribute(node, Configuration.QUERY_THRESHOLD_IN_SECS, type, bundle.getString(Configuration.QUERY_THRESHOLD_IN_SECS+DESC), ModelType.INT, false, "600"); //$NON-NLS-1$
- addAttribute(node, Configuration.MAX_SOURCE_ROWS, type, bundle.getString(Configuration.MAX_SOURCE_ROWS+DESC), ModelType.INT, false, "-1"); //$NON-NLS-1$
- addAttribute(node, Configuration.EXCEPTION_ON_MAX_SOURCE_ROWS, type, bundle.getString(Configuration.EXCEPTION_ON_MAX_SOURCE_ROWS+DESC), ModelType.BOOLEAN, false, "true"); //$NON-NLS-1$
- addAttribute(node, Configuration.MAX_ODBC_LOB_SIZE_ALLOWED, type, bundle.getString(Configuration.MAX_ODBC_LOB_SIZE_ALLOWED+DESC), ModelType.INT, false, "5242880"); //$NON-NLS-1$
- addAttribute(node, Configuration.EVENT_DISTRIBUTOR_NAME, type, bundle.getString(Configuration.EVENT_DISTRIBUTOR_NAME+DESC), ModelType.STRING, false, "teiid/event-distributor"); //$NON-NLS-1$
- addAttribute(node, Configuration.DETECTING_CHANGE_EVENTS, type, bundle.getString(Configuration.DETECTING_CHANGE_EVENTS+DESC), ModelType.BOOLEAN, false, "true"); //$NON-NLS-1$
-
- //session stuff
- addAttribute(node, Configuration.SECURITY_DOMAIN, type, bundle.getString(Configuration.SECURITY_DOMAIN+DESC), ModelType.STRING, false, null);
- addAttribute(node, Configuration.MAX_SESSIONS_ALLOWED, type, bundle.getString(Configuration.MAX_SESSIONS_ALLOWED+DESC), ModelType.INT, false, "5000"); //$NON-NLS-1$
- addAttribute(node, Configuration.SESSION_EXPIRATION_TIME_LIMIT, type, bundle.getString(Configuration.SESSION_EXPIRATION_TIME_LIMIT+DESC), ModelType.INT, false, "0"); //$NON-NLS-1$
-
- //jdbc
- ModelNode jdbcSocketNode = node.get(CHILDREN, Configuration.JDBC);
- jdbcSocketNode.get(TYPE).set(ModelType.OBJECT);
- jdbcSocketNode.get(DESCRIPTION).set(bundle.getString(Configuration.JDBC+DESC));
- jdbcSocketNode.get(REQUIRED).set(false);
- jdbcSocketNode.get(MAX_OCCURS).set(1);
- jdbcSocketNode.get(MIN_OCCURS).set(1);
- getSocketConfig(jdbcSocketNode, type, bundle);
-
- //odbc
- ModelNode odbcSocketNode = node.get(CHILDREN, Configuration.ODBC);
- odbcSocketNode.get(TYPE).set(ModelType.OBJECT);
- odbcSocketNode.get(DESCRIPTION).set(bundle.getString(Configuration.ODBC+DESC));
- odbcSocketNode.get(REQUIRED).set(false);
- odbcSocketNode.get(MAX_OCCURS).set(1);
- odbcSocketNode.get(MIN_OCCURS).set(1);
- getSocketConfig(odbcSocketNode, type, bundle);
- }
-
-
- private static void getSocketConfig(ModelNode node, String type, ResourceBundle bundle) {
- addAttribute(node, Configuration.SOCKET_ENABLED, type, bundle.getString(Configuration.SOCKET_ENABLED+DESC), ModelType.BOOLEAN, false, "true"); //$NON-NLS-1$
- addAttribute(node, Configuration.MAX_SOCKET_THREAD_SIZE, type, bundle.getString(Configuration.MAX_SOCKET_THREAD_SIZE+DESC), ModelType.INT, false, "0"); //$NON-NLS-1$
- addAttribute(node, Configuration.IN_BUFFER_SIZE, type, bundle.getString(Configuration.IN_BUFFER_SIZE+DESC), ModelType.INT, false, "0"); //$NON-NLS-1$
- addAttribute(node, Configuration.OUT_BUFFER_SIZE, type, bundle.getString(Configuration.OUT_BUFFER_SIZE+DESC), ModelType.INT, false, "0"); //$NON-NLS-1$
- addAttribute(node, Configuration.SOCKET_BINDING, type, bundle.getString(Configuration.SOCKET_BINDING+DESC), ModelType.INT, true, null);
-
- ModelNode sslNode = node.get(CHILDREN, Configuration.SSL);
- sslNode.get(TYPE).set(ModelType.OBJECT);
- sslNode.get(DESCRIPTION).set(bundle.getString(Configuration.SSL+DESC));
- sslNode.get(REQUIRED).set(false);
- sslNode.get(MAX_OCCURS).set(1);
- sslNode.get(MIN_OCCURS).set(0);
- addAttribute(node, Configuration.SSL_MODE, type, bundle.getString(Configuration.SSL_MODE+DESC), ModelType.STRING, false, "login"); //$NON-NLS-1$
- addAttribute(node, Configuration.KEY_STORE_FILE, type, bundle.getString(Configuration.KEY_STORE_FILE+DESC), ModelType.STRING, false, null);
- addAttribute(node, Configuration.KEY_STORE_PASSWD, type, bundle.getString(Configuration.KEY_STORE_PASSWD+DESC), ModelType.STRING, false, null);
- addAttribute(node, Configuration.KEY_STORE_TYPE, type, bundle.getString(Configuration.KEY_STORE_TYPE+DESC), ModelType.STRING, false, "JKS"); //$NON-NLS-1$
- addAttribute(node, Configuration.SSL_PROTOCOL, type, bundle.getString(Configuration.SSL_PROTOCOL+DESC), ModelType.BOOLEAN, false, "SSLv3"); //$NON-NLS-1$
- addAttribute(node, Configuration.KEY_MANAGEMENT_ALG, type, bundle.getString(Configuration.KEY_MANAGEMENT_ALG+DESC), ModelType.STRING, false, "false"); //$NON-NLS-1$
- addAttribute(node, Configuration.TRUST_FILE, type, bundle.getString(Configuration.TRUST_FILE+DESC), ModelType.STRING, false, null);
- addAttribute(node, Configuration.TRUST_PASSWD, type, bundle.getString(Configuration.TRUST_PASSWD+DESC), ModelType.STRING, false, null);
- addAttribute(node, Configuration.AUTH_MODE, type, bundle.getString(Configuration.AUTH_MODE+DESC), ModelType.STRING, false, "anonymous"); //$NON-NLS-1$
- }
-}
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidServiceNames.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidServiceNames.java 2011-08-22 14:36:06 UTC (rev 3422)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidServiceNames.java 2011-08-24 17:35:13 UTC (rev 3423)
@@ -35,7 +35,9 @@
public static ServiceName AUTHORIZATION_VALIDATOR = ServiceName.JBOSS.append("teiid", "authorization-validator");//$NON-NLS-1$ //$NON-NLS-2$
private static ServiceName VDB_SVC_BASE = ServiceName.JBOSS.append("teiid", "vdb"); //$NON-NLS-1$ //$NON-NLS-2$
public static ServiceName OBJECT_SERIALIZER = ServiceName.JBOSS.append("teiid", "object-serializer"); //$NON-NLS-1$ //$NON-NLS-2$
+ public static ServiceName CACHE_FACTORY = ServiceName.JBOSS.append("teiid", "cache-factory"); //$NON-NLS-1$ //$NON-NLS-2$
+
public static ServiceName translatorServiceName(String name) {
return TRANSLATOR_BASE.append(name);
}
@@ -49,6 +51,6 @@
}
public static ServiceName executorServiceName(String poolName) {
- return ServiceName.JBOSS.append("thread", "executor", poolName);
+ return ServiceName.JBOSS.append("thread", "executor", poolName); //$NON-NLS-1$ //$NON-NLS-2$
}
}
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidSubsystemParser.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidSubsystemParser.java 2011-08-22 14:36:06 UTC (rev 3422)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidSubsystemParser.java 2011-08-24 17:35:13 UTC (rev 3423)
@@ -21,13 +21,14 @@
*/
package org.teiid.jboss;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.ADD;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP_ADDR;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.SUBSYSTEM;
-import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.ADD;
import static org.jboss.as.controller.parsing.ParseUtils.requireNoAttributes;
import java.util.List;
+import java.util.Set;
import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamException;
@@ -49,35 +50,12 @@
if (!node.isDefined()) {
return;
}
- writer.writeStartElement(Element.QUERY_ENGINE_ELEMENT.getLocalName());
- writeQueryEngine(writer, node);
- writer.writeEndElement();
- writer.writeEndElement(); // End of subsystem element
- }
-
- // write the elements according to the schema defined.
- private void writeQueryEngine( XMLExtendedStreamWriter writer, ModelNode node) throws XMLStreamException {
- writeAttribute(writer, Element.ENGINE_NAME_ATTRIBUTE, node);
- writeElement(writer, Element.ASYNC_THREAD_GROUP_ELEMENT, node);
- writeElement(writer, Element.MAX_THREADS_ELEMENT, node);
- writeElement(writer, Element.MAX_ACTIVE_PLANS_ELEMENT, node);
- 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.AUTHORIZATION_VALIDATOR_MODULE_ELEMENT, node);
- writeElement(writer, Element.POLICY_DECIDER_MODULE_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);
-
+
+ writeElement(writer, Element.ASYNC_THREAD_GROUP_ELEMENT, node);
+ writeElement(writer, Element.ALLOW_ENV_FUNCTION_ELEMENT, node);
+ writeElement(writer, Element.AUTHORIZATION_VALIDATOR_MODULE_ELEMENT, node);
+ writeElement(writer, Element.POLICY_DECIDER_MODULE_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()));
@@ -102,6 +80,53 @@
writer.writeEndElement();
}
+ Set<String> engines = node.get(Element.QUERY_ENGINE_ELEMENT.getLocalName()).keys();
+ if (engines != null && !engines.isEmpty()) {
+ for (String engine:engines) {
+ writer.writeStartElement(Element.QUERY_ENGINE_ELEMENT.getLocalName());
+ writeQueryEngine(writer, node.get(Element.QUERY_ENGINE_ELEMENT.getLocalName(), engine));
+ writer.writeEndElement();
+ }
+ }
+
+ Set<String> translators = node.get(Element.TRANSLATOR_ELEMENT.getLocalName()).keys();
+ if (translators != null && !translators.isEmpty()) {
+ for (String translator:translators) {
+ writer.writeStartElement(Element.TRANSLATOR_ELEMENT.getLocalName());
+ writeTranslator(writer, node.get(Element.TRANSLATOR_ELEMENT.getLocalName(), translator));
+ writer.writeEndElement();
+ }
+ }
+ writer.writeEndElement(); // End of subsystem element
+ }
+
+ private void writeTranslator(XMLExtendedStreamWriter writer, ModelNode node) throws XMLStreamException {
+ writeAttribute(writer, Element.TRANSLATOR_NAME_ATTRIBUTE, node);
+ writeAttribute(writer, Element.TRANSLATOR_MODULE_ATTRIBUTE, node);
+ }
+
+ // write the elements according to the schema defined.
+ private void writeQueryEngine( XMLExtendedStreamWriter writer, ModelNode node) throws XMLStreamException {
+ writeAttribute(writer, Element.ENGINE_NAME_ATTRIBUTE, node);
+
+ writeElement(writer, Element.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.AUTHORIZATION_VALIDATOR_MODULE_ELEMENT, node);
+ writeElement(writer, Element.POLICY_DECIDER_MODULE_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);
+
//jdbc
if (has(node, Element.JDBC_ELEMENT.getLocalName())){
writer.writeStartElement(Element.JDBC_ELEMENT.getLocalName());
@@ -204,33 +229,57 @@
case TEIID_1_0: {
Element element = Element.forName(reader.getLocalName());
switch (element) {
- case QUERY_ENGINE_ELEMENT:
- ModelNode engineNode = parseQueryEngine(reader, new ModelNode());
-
- final ModelNode engineAddress = address.clone();
- engineAddress.add(Configuration.QUERY_ENGINE, engineNode.require(Configuration.ENGINE_NAME).asString());
- engineAddress.protect();
- engineNode.get(OP).set(ADD);
- engineNode.get(OP_ADDR).set(engineAddress);
-
- list.add(engineNode);
- break;
-
- case TRANSLATOR_ELEMENT:
- ModelNode translatorNode = parseTranslator(reader, new ModelNode());
+ case ALLOW_ENV_FUNCTION_ELEMENT:
+ bootServices.get(reader.getLocalName()).set(Boolean.parseBoolean(reader.getElementText()));
+ break;
- final ModelNode translatorAddress = address.clone();
- translatorAddress.add(Configuration.QUERY_ENGINE, translatorNode.require(Configuration.TRANSLATOR_NAME).asString());
- translatorAddress.protect();
+ case AUTHORIZATION_VALIDATOR_MODULE_ELEMENT:
+ case POLICY_DECIDER_MODULE_ELEMENT:
+ case ASYNC_THREAD_GROUP_ELEMENT:
+ bootServices.get(reader.getLocalName()).set(reader.getElementText());
+ break;
+
+ // complex types
+ case BUFFER_SERVICE_ELEMENT:
+ bootServices.get(reader.getLocalName()).set(parseBufferConfiguration(reader));
+ break;
+ case RESULTSET_CACHE_ELEMENT:
+ bootServices.get(reader.getLocalName()).set(parseCacheConfiguration(reader));
+ break;
+ case PREPAREDPLAN_CACHE_ELEMENT:
+ bootServices.get(reader.getLocalName()).set(parseCacheConfiguration(reader));
+ break;
+ case CACHE_FACORY_ELEMENT:
+ bootServices.get(reader.getLocalName()).set(parseCacheFacoryConfiguration(reader));
+ break;
+
+ case QUERY_ENGINE_ELEMENT:
+ ModelNode engineNode = parseQueryEngine(reader, new ModelNode());
+
+ final ModelNode engineAddress = address.clone();
+ engineAddress.add(Configuration.QUERY_ENGINE, engineNode.require(Configuration.ENGINE_NAME).asString());
+ engineAddress.protect();
+ engineNode.get(OP).set(ADD);
+ engineNode.get(OP_ADDR).set(engineAddress);
+
+ list.add(engineNode);
+ break;
+
+ case TRANSLATOR_ELEMENT:
+ ModelNode translatorNode = parseTranslator(reader, new ModelNode());
+
+ final ModelNode translatorAddress = address.clone();
+ translatorAddress.add(Configuration.TRANSLATOR, translatorNode.require(Configuration.TRANSLATOR_NAME).asString());
+ translatorAddress.protect();
+
+ translatorNode.get(OP).set(ADD);
+ translatorNode.get(OP_ADDR).set(translatorAddress);
+
+ list.add(translatorNode);
+ break;
- translatorNode.get(OP).set(ADD);
- translatorNode.get(OP_ADDR).set(translatorAddress);
-
- list.add(translatorNode);
- break;
-
- default:
- throw ParseUtils.unexpectedElement(reader);
+ default:
+ throw ParseUtils.unexpectedElement(reader);
}
break;
}
@@ -279,25 +328,9 @@
//Strings
case EVENT_DISTRIBUTOR_NAME_ELEMENT:
case JDBC_SECURITY_DOMAIN_ELEMENT:
- case ASYNC_THREAD_GROUP_ELEMENT:
- case AUTHORIZATION_VALIDATOR_MODULE_ELEMENT:
- case POLICY_DECIDER_MODULE_ELEMENT:
node.get(reader.getLocalName()).set(reader.getElementText());
break;
- // complex types
- case BUFFER_SERVICE_ELEMENT:
- node.get(reader.getLocalName()).set(parseBufferConfiguration(reader));
- break;
- case RESULTSET_CACHE_ELEMENT:
- node.get(reader.getLocalName()).set(parseCacheConfiguration(reader));
- break;
- case PREPAREDPLAN_CACHE_ELEMENT:
- node.get(reader.getLocalName()).set(parseCacheConfiguration(reader));
- break;
- case CACHE_FACORY_ELEMENT:
- node.get(reader.getLocalName()).set(parseCacheFacoryConfiguration(reader));
- break;
case JDBC_ELEMENT:
node.get(reader.getLocalName()).set(parseSocketConfiguration(reader));
break;
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorAdd.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorAdd.java 2011-08-22 14:36:06 UTC (rev 3422)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorAdd.java 2011-08-24 17:35:13 UTC (rev 3423)
@@ -55,9 +55,8 @@
operation.get(OPERATION_NAME).set(ADD);
operation.get(DESCRIPTION).set(bundle.getString("translator.add")); //$NON-NLS-1$
- ModelNode translator = operation.get(REQUEST_PROPERTIES, Configuration.TRANSLATOR);
- addAttribute(translator, Configuration.TRANSLATOR_NAME, ATTRIBUTES, bundle.getString(Configuration.TRANSLATOR_NAME+Configuration.DESC), ModelType.STRING, true, null);
- addAttribute(translator, Configuration.TRANSLATOR_MODULE, ATTRIBUTES, bundle.getString(Configuration.TRANSLATOR_MODULE+Configuration.DESC), ModelType.STRING, true, null);
+ addAttribute(operation, Configuration.TRANSLATOR_NAME, ATTRIBUTES, bundle.getString(Configuration.TRANSLATOR_NAME+Configuration.DESC), ModelType.STRING, true, null);
+ addAttribute(operation, Configuration.TRANSLATOR_MODULE, ATTRIBUTES, bundle.getString(Configuration.TRANSLATOR_MODULE+Configuration.DESC), ModelType.STRING, true, null);
return operation;
}
@@ -66,8 +65,7 @@
final ModelNode address = operation.require(OP_ADDR);
final PathAddress pathAddress = PathAddress.pathAddress(address);
- ModelNode translator = operation.require(Configuration.TRANSLATOR);
- final String moduleName = translator.require(Configuration.TRANSLATOR_MODULE).asString();
+ final String moduleName = operation.require(Configuration.TRANSLATOR_MODULE).asString();
model.get(NAME).set(pathAddress.getLastElement().getValue());
model.get(Configuration.TRANSLATOR_MODULE).set(moduleName);
@@ -77,9 +75,8 @@
protected void performRuntime(final OperationContext context, final ModelNode operation, final ModelNode model,
final ServiceVerificationHandler verificationHandler, final List<ServiceController<?>> newControllers) throws OperationFailedException {
- ModelNode translator = operation.require(Configuration.TRANSLATOR);
- final String name = translator.require(Configuration.TRANSLATOR_NAME).asString();
- final String moduleName = translator.require(Configuration.TRANSLATOR_MODULE).asString();
+ final String name = operation.require(Configuration.TRANSLATOR_NAME).asString();
+ final String moduleName = operation.require(Configuration.TRANSLATOR_MODULE).asString();
final ServiceTarget target = context.getServiceTarget();
Deleted: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorRepositoryService.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorRepositoryService.java 2011-08-22 14:36:06 UTC (rev 3422)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorRepositoryService.java 2011-08-24 17:35:13 UTC (rev 3423)
@@ -1,50 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.jboss;
-
-import org.jboss.msc.service.Service;
-import org.jboss.msc.service.StartContext;
-import org.jboss.msc.service.StartException;
-import org.jboss.msc.service.StopContext;
-import org.teiid.dqp.internal.datamgr.TranslatorRepository;
-
-public class TranslatorRepositoryService implements Service<TranslatorRepository> {
- private TranslatorRepository repo;
-
- public TranslatorRepositoryService(TranslatorRepository repo) {
- this.repo = repo;
- }
-
- @Override
- public void start(StartContext context) throws StartException {
- }
-
- @Override
- public void stop(StopContext context) {
- }
-
- @Override
- public TranslatorRepository getValue() throws IllegalStateException, IllegalArgumentException {
- return repo;
- }
-
-}
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-08-22 14:36:06 UTC (rev 3422)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBDeployer.java 2011-08-24 17:35:13 UTC (rev 3423)
@@ -33,7 +33,6 @@
import org.teiid.adminapi.impl.ModelMetaData;
import org.teiid.adminapi.impl.VDBMetaData;
import org.teiid.adminapi.impl.VDBTranslatorMetaData;
-import org.teiid.deployers.MetadataStoreGroup;
import org.teiid.deployers.TeiidAttachments;
import org.teiid.deployers.UDFMetaData;
import org.teiid.deployers.VDBRepository;
@@ -94,21 +93,14 @@
deployment.addAttchment(UDFMetaData.class, udf);
}
- // get the metadata store of the VDB (this is build in parse stage)
- MetadataStoreGroup store = deploymentUnit.getAttachment(TeiidAttachments.METADATA_STORE);
- if (store != null) {
- deployment.addAttchment(MetadataStoreGroup.class, store);
- }
-
IndexMetadataFactory indexFactory = deploymentUnit.getAttachment(TeiidAttachments.INDEX_METADATA);
if (indexFactory != null) {
deployment.addAttchment(IndexMetadataFactory.class, indexFactory);
}
- // removethe metadata objects as attachments
+ // remove the metadata objects as attachments
deploymentUnit.removeAttachment(TeiidAttachments.INDEX_METADATA);
deploymentUnit.removeAttachment(TeiidAttachments.UDF_METADATA);
- deploymentUnit.removeAttachment(TeiidAttachments.METADATA_STORE);
// build a VDB service
VDBService vdb = new VDBService(deployment);
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-08-22 14:36:06 UTC (rev 3422)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBParserDeployer.java 2011-08-24 17:35:13 UTC (rev 3423)
@@ -21,7 +21,6 @@
*/
package org.teiid.jboss;
-import java.io.File;
import java.io.IOException;
import java.util.List;
@@ -37,7 +36,8 @@
import org.teiid.adminapi.Model;
import org.teiid.adminapi.impl.ModelMetaData;
import org.teiid.adminapi.impl.VDBMetaData;
-import org.teiid.deployers.*;
+import org.teiid.deployers.TeiidAttachments;
+import org.teiid.deployers.UDFMetaData;
import org.teiid.logging.LogConstants;
import org.teiid.logging.LogManager;
import org.teiid.metadata.VdbConstants;
@@ -50,12 +50,8 @@
* This file loads the "vdb.xml" file inside a ".vdb" file, along with all the metadata in the .INDEX files
*/
public class VDBParserDeployer implements DeploymentUnitProcessor {
- private ObjectSerializer serializer;
- private VDBRepository vdbRepository;
- public VDBParserDeployer(VDBRepository repo, ObjectSerializer serializer) {
- this.vdbRepository = repo;
- this.serializer = serializer;
+ public VDBParserDeployer() {
}
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
@@ -157,24 +153,9 @@
// build the metadata store
if (imf != null) {
imf.addEntriesPlusVisibilities(file, vdb);
-
- // add the cached store.
- File cacheFile = VDBDeployer.buildCachedVDBFileName(this.serializer, file, vdb);
- // check to see if the vdb has been modified when server is down; if it is then clear the old files
- if (this.serializer.isStale(cacheFile, file.getLastModified())) {
- this.serializer.removeAttachments(file);
- LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB", file.getName(), "old cached metadata has been removed"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- MetadataStoreGroup stores = this.serializer.loadSafe(cacheFile, MetadataStoreGroup.class);
- if (stores == null) {
- // start to build the new metadata
- stores = new MetadataStoreGroup();
- stores.addStore(imf.getMetadataStore(vdbRepository.getSystemStore().getDatatypes()));
- }
- else {
- LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB", file.getName(), "was loaded from cached metadata"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- deploymentUnit.putAttachment(TeiidAttachments.METADATA_STORE, stores);
+
+ // This time stamp is used to check if the VDB is modified after the metadata is written to disk
+ vdb.addProperty(VDBService.VDB_LASTMODIFIED_TIME, String.valueOf(file.getLastModified()));
}
if (udf != null) {
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-08-22 14:36:06 UTC (rev 3422)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBService.java 2011-08-24 17:35:13 UTC (rev 3423)
@@ -1,3 +1,24 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
package org.teiid.jboss;
import java.io.File;
@@ -6,16 +27,9 @@
import java.util.*;
import java.util.concurrent.Executor;
-import javax.resource.spi.work.WorkManager;
-
-import org.jboss.as.server.deployment.Attachments;
-import org.jboss.as.server.deployment.DeploymentUnitProcessingException;
-import org.jboss.msc.service.Service;
-import org.jboss.msc.service.StartContext;
-import org.jboss.msc.service.StartException;
-import org.jboss.msc.service.StopContext;
+import org.jboss.msc.service.*;
+import org.jboss.msc.service.ServiceContainer.TerminateListener;
import org.jboss.msc.value.InjectedValue;
-import org.jboss.vfs.VirtualFile;
import org.teiid.adminapi.Model;
import org.teiid.adminapi.Translator;
import org.teiid.adminapi.VDB;
@@ -39,6 +53,7 @@
import org.teiid.translator.TranslatorException;
public class VDBService implements Service<VDBMetaData> {
+ public static final String VDB_LASTMODIFIED_TIME = "VDB_LASTMODIFIED_TIME"; //$NON-NLS-1$
private VDBMetaData vdb;
private final InjectedValue<VDBRepository> vdbRepositoryInjector = new InjectedValue<VDBRepository>();
private final InjectedValue<TranslatorRepository> translatorRepositoryInjector = new InjectedValue<TranslatorRepository>();
@@ -53,9 +68,14 @@
public void start(StartContext context) throws StartException {
ConnectorManagerRepository cmr = new ConnectorManagerRepository();
TranslatorRepository repo = new TranslatorRepository();
+
+ // check if this is a VDB with index files, if there are then build the TransformationMetadata
+ UDFMetaData udf = this.vdb.getAttachment(UDFMetaData.class);
+ IndexMetadataFactory indexFactory = this.vdb.getAttachment(IndexMetadataFactory.class);
+ long vdbModifiedTime = Long.parseLong(vdb.getPropertyValue(VDBService.VDB_LASTMODIFIED_TIME));
// add required connector managers; if they are not already there
- for (Translator t: vdb.getOverrideTranslators()) {
+ for (Translator t: this.vdb.getOverrideTranslators()) {
VDBTranslatorMetaData data = (VDBTranslatorMetaData)t;
String type = data.getType();
@@ -70,20 +90,37 @@
repo.addTranslatorMetadata(data.getName(), data);
}
- createConnectorManagers(cmr, repo, vdb);
-
- // check if this is a VDB with index files, if there are then build the TransformationMetadata
- UDFMetaData udf = vdb.getAttachment(UDFMetaData.class);
- MetadataStoreGroup store = vdb.getAttachment(MetadataStoreGroup.class);
-
+ createConnectorManagers(cmr, repo, this.vdb);
+
+ // check to see if the vdb has been modified when server is down; if it is then clear the old files
+ if (getSerializer().isStale(this.vdb, vdbModifiedTime)) {
+ getSerializer().removeAttachments(this.vdb);
+ LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB ", vdb.getName(), " old cached metadata has been removed"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
boolean asynchLoad = false;
- boolean preview = vdb.isPreview();
+ boolean preview = this.vdb.isPreview();
// if store is null and vdb dynamic vdb then try to get the metadata
- if (store == null && vdb.isDynamic()) {
+ MetadataStoreGroup store = null;
+ if (this.vdb.isDynamic()) {
store = new MetadataStoreGroup();
- asynchLoad = buildDynamicMetadataStore(vdb, store, cmr);
+ asynchLoad = buildDynamicMetadataStore(this.vdb, store, cmr);
}
+ else if (indexFactory != null){
+ store = getSerializer().loadSafe(getSerializer().buildVDBFile(this.vdb), MetadataStoreGroup.class);
+ if (store == null) {
+ store = new MetadataStoreGroup();
+ try {
+ store.addStore(indexFactory.getMetadataStore(getVDBRepository().getSystemStore().getDatatypes()));
+ } catch (IOException e) {
+ throw new StartException(e);
+ }
+ }
+ else {
+ LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB ", vdb.getName(), " was loaded from cached metadata"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
// allow empty vdbs for enabling the preview functionality
if (preview && store == null) {
@@ -91,27 +128,29 @@
}
if (store == null) {
- LogManager.logError(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("failed_matadata_load", vdb.getName(), vdb.getVersion())); //$NON-NLS-1$
+ LogManager.logError(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("failed_matadata_load", this.vdb.getName(), vdb.getVersion())); //$NON-NLS-1$
}
LinkedHashMap<String, Resource> visibilityMap = null;
- IndexMetadataFactory indexFactory = vdb.getAttachment(IndexMetadataFactory.class);
+
if (indexFactory != null) {
visibilityMap = indexFactory.getEntriesPlusVisibilities();
}
try {
// add transformation metadata to the repository.
- getVDBRepository().addVDB(vdb, store, visibilityMap, udf, cmr);
+ getVDBRepository().addVDB(this.vdb, store, visibilityMap, udf, cmr);
} catch (VirtualDatabaseException e) {
throw new StartException(e);
}
boolean valid = true;
- synchronized (vdb) {
+ synchronized (this.vdb) {
if (indexFactory != null) {
try {
- saveMetadataStore(vdb, store);
+ if (getSerializer().saveAttachment(getSerializer().buildVDBFile(this.vdb),store, false)) {
+ LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB ", vdb.getName(), " metadata has been cached to data folder"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
} catch (IOException e1) {
LogManager.logWarning(LogConstants.CTX_RUNTIME, e1, RuntimePlugin.Util.getString("vdb_save_failed", vdb.getName()+"."+vdb.getVersion())); //$NON-NLS-1$ //$NON-NLS-2$
}
@@ -142,13 +181,19 @@
@Override
public void stop(StopContext context) {
- getVDBRepository().removeVDB(vdb.getName(), vdb.getVersion());
- vdb.setRemoved(true);
-
- deleteMetadataStore(vdb);
+ getVDBRepository().removeVDB(this.vdb.getName(), this.vdb.getVersion());
+ this.vdb.setRemoved(true);
- LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("vdb_undeployed", vdb)); //$NON-NLS-1$
-
+ context.getController().getServiceContainer().addTerminateListener(new TerminateListener() {
+ @Override
+ public void handleTermination(Info info) {
+ if (info.getShutdownInitiated() < 0) {
+ getSerializer().removeAttachments(vdb);
+ LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB "+vdb.getName()+" metadata removed"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+ });
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("vdb_undeployed", this.vdb)); //$NON-NLS-1$
}
@Override
@@ -239,7 +284,7 @@
}
final boolean cache = "cached".equalsIgnoreCase(vdb.getPropertyValue("UseConnectorMetadata")); //$NON-NLS-1$ //$NON-NLS-2$
- final File cacheFile = buildCachedModelFileName(vdb, model.getName());
+ final File cacheFile = getSerializer().buildModelFile(this.vdb, model.getName());
boolean loaded = false;
if (cache) {
MetadataStore store = getSerializer().loadSafe(cacheFile, MetadataStore.class);
@@ -297,7 +342,7 @@
try {
MetadataStore store = cm.getMetadata(model.getName(), getVDBRepository().getBuiltinDatatypes(), model.getProperties());
if (cache) {
- getSerializer().saveAttachment(cacheFile, store);
+ getSerializer().saveAttachment(cacheFile, store, false);
}
vdbStore.addStore(store);
loaded = true;
@@ -336,31 +381,7 @@
return loaded;
}
-
- private void saveMetadataStore(VDBMetaData vdb, MetadataStoreGroup store) throws IOException {
- File cacheFileName = buildCachedVDBFileName(getSerializer(), vdb);
- if (!cacheFileName.exists()) {
- getSerializer().saveAttachment(cacheFileName,store);
- LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB "+vdb.getName()+" metadata has been cached to "+ cacheFileName); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- private void deleteMetadataStore(VDBMetaData vdb) {
- if (!unit.exists() || !shutdownListener.isShutdownInProgress()) {
- getSerializer().removeAttachments(vdb.getName()+"_"+vdb.getVersion()); //$NON-NLS-1$
- LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB "+vdb.getName()+" metadata removed"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
-
- private File buildCachedModelFileName(VDBMetaData vdb, String modelName) {
- return getSerializer().getAttachmentPath(vdb.getName()+"_"+vdb.getVersion(), vdb.getName()+"_"+vdb.getVersion()+"_"+modelName); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
-
- static File buildCachedVDBFileName(ObjectSerializer serializer, VDBMetaData vdb) {
- return serializer.getAttachmentPath(vdb.getName()+"_"+vdb.getVersion(), vdb.getName()+"_"+vdb.getVersion()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
+
public InjectedValue<VDBRepository> getVDBRepositoryInjector(){
return this.vdbRepositoryInjector;
}
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2011-08-22 14:36:06 UTC (rev 3422)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2011-08-24 17:35:13 UTC (rev 3423)
@@ -107,7 +107,6 @@
private transient ILogon logon;
private transient ClientServiceRegistryImpl csr = new ClientServiceRegistryImpl();
private transient VDBRepository vdbRepository;
- private transient TranslatorRepository translatorRepository;
private long sessionMaxLimit = SessionService.DEFAULT_MAX_SESSIONS;
private long sessionExpirationTimeLimit = SessionService.DEFAULT_SESSION_EXPIRATION;
@@ -117,18 +116,17 @@
private transient EventDistributor eventDistributorProxy;
private transient ContainerLifeCycleListener lifecycleListener;
- // TODO: remove public?
- public final InjectedValue<WorkManager> workManagerInjector = new InjectedValue<WorkManager>();
- public final InjectedValue<XATerminator> xaTerminatorInjector = new InjectedValue<XATerminator>();
- public final InjectedValue<TransactionManager> txnManagerInjector = new InjectedValue<TransactionManager>();
- public final InjectedValue<SocketBinding> jdbcSocketBindingInjector = new InjectedValue<SocketBinding>();
- public final InjectedValue<BufferServiceImpl> bufferServiceInjector = new InjectedValue<BufferServiceImpl>();
- public final InjectedValue<SocketBinding> odbcSocketBindingInjector = new InjectedValue<SocketBinding>();
- public final InjectedValue<TranslatorRepository> translatorRepositoryInjector = new InjectedValue<TranslatorRepository>();
- public final InjectedValue<VDBRepository> vdbRepositoryInjector = new InjectedValue<VDBRepository>();
- public final InjectedValue<AuthorizationValidator> authorizationValidatorInjector = new InjectedValue<AuthorizationValidator>();
+ private final InjectedValue<WorkManager> workManagerInjector = new InjectedValue<WorkManager>();
+ private final InjectedValue<XATerminator> xaTerminatorInjector = new InjectedValue<XATerminator>();
+ private final InjectedValue<TransactionManager> txnManagerInjector = new InjectedValue<TransactionManager>();
+ private final InjectedValue<SocketBinding> jdbcSocketBindingInjector = new InjectedValue<SocketBinding>();
+ private final InjectedValue<BufferServiceImpl> bufferServiceInjector = new InjectedValue<BufferServiceImpl>();
+ private final InjectedValue<SocketBinding> odbcSocketBindingInjector = new InjectedValue<SocketBinding>();
+ private final InjectedValue<TranslatorRepository> translatorRepositoryInjector = new InjectedValue<TranslatorRepository>();
+ private final InjectedValue<VDBRepository> vdbRepositoryInjector = new InjectedValue<VDBRepository>();
+ private final InjectedValue<AuthorizationValidator> authorizationValidatorInjector = new InjectedValue<AuthorizationValidator>();
+ private final InjectedValue<CacheFactory> cachefactoryInjector = new InjectedValue<CacheFactory>();
-
public final ConcurrentMap<String, SecurityDomainContext> securityDomains = new ConcurrentHashMap<String, SecurityDomainContext>();
private LinkedList<String> securityDomainNames = new LinkedList<String>();
private String instanceName;
@@ -154,12 +152,12 @@
@Override
public void start(StartContext context) {
- setWorkManager(this.workManagerInjector.getValue());
- setXATerminator(xaTerminatorInjector.getValue());
- setTransactionManager(txnManagerInjector.getValue());
- setTranslatorRepository(translatorRepositoryInjector.getValue());
+ this.transactionServerImpl.setWorkManager(getWorkManagerInjector().getValue());
+ this.transactionServerImpl.setXaTerminator(getXaTerminatorInjector().getValue());
+ this.transactionServerImpl.setTransactionManager(getTxnManagerInjector().getValue());
+
setVDBRepository(vdbRepositoryInjector.getValue());
- setAuthorizationValidator(authorizationValidatorInjector.getValue());
+ setAuthorizationValidator(getAuthorizationValidatorInjector().getValue());
this.sessionService = new SessionServiceImpl();
if (!this.securityDomainNames.isEmpty()) {
@@ -196,6 +194,7 @@
}
this.dqpCore.setMetadataRepository(this.vdbRepository.getMetadataRepository());
this.dqpCore.setEventDistributor(this.eventDistributor);
+ this.dqpCore.setCacheFactory(getCachefactoryInjector().getValue());
this.dqpCore.start(this);
this.eventDistributorProxy = (EventDistributor)Proxy.newProxyInstance(Module.getCallerModule().getClassLoader(), new Class[] {EventDistributor.class}, new InvocationHandler() {
@@ -353,18 +352,7 @@
this.odbcSocketConfiguration = socketConfig;
}
- public void setXATerminator(XATerminator xaTerminator){
- this.transactionServerImpl.setXaTerminator(xaTerminator);
- }
- public void setTransactionManager(TransactionManager transactionManager) {
- this.transactionServerImpl.setTransactionManager(transactionManager);
- }
-
- public void setWorkManager(WorkManager mgr) {
- this.transactionServerImpl.setWorkManager(mgr);
- }
-
public void setBufferService(BufferService service) {
this.dqpCore.setBufferService(service);
}
@@ -482,10 +470,6 @@
this.vdbRepository.mergeVDBs(sourceVDBName, sourceVDBVersion, targetVDBName, targetVDBVersion);
}
- public void setCacheFactory(CacheFactory factory) {
- this.dqpCore.setCacheFactory(factory);
- }
-
@Override
public List<List> executeQuery(final String vdbName, final int version, final String command, final long timoutInMilli) throws AdminException {
@@ -620,12 +604,12 @@
@Override
public void updateMatViewRow(String vdbName, int vdbVersion, String schema,
String viewName, List<?> tuple, boolean delete) {
- this.dqpCore.updateMatViewRow(getcontextProvider(), vdbName, vdbVersion, schema, viewName, tuple, delete);
+ this.dqpCore.updateMatViewRow(getContextProvider(), vdbName, vdbVersion, schema, viewName, tuple, delete);
}
@Override
public void refreshMatView(final String vdbName, final int vdbVersion, final String viewName) {
- this.dqpCore.refreshMatView(getcontextProvider(), vdbName, vdbVersion, viewName);
+ this.dqpCore.refreshMatView(getContextProvider(), vdbName, vdbVersion, viewName);
}
@Override
@@ -764,7 +748,7 @@
this.lifecycleListener.addListener(new ContainerLifeCycleListener.LifeCycleEventListener() {
@Override
public void onStartupFinish() {
- dqpCore.synchronizeInternalMaterializedViews(getcontextProvider());
+ dqpCore.synchronizeInternalMaterializedViews(getContextProvider());
}
@Override
public void onShutdownStart() {
@@ -797,18 +781,14 @@
}
public List<VDBTranslatorMetaData> getTranslators(){
- return this.translatorRepository.getTranslators();
+ return getTranslatorRepositoryInjector().getValue().getTranslators();
}
public VDBTranslatorMetaData getTranslator(String translatorName) {
- return this.translatorRepository.getTranslatorMetaData(translatorName);
+ return getTranslatorRepositoryInjector().getValue().getTranslatorMetaData(translatorName);
}
- public void setTranslatorRepository(TranslatorRepository translatorRepo) {
- this.translatorRepository = translatorRepo;
- }
-
- private DQPCore.ContextProvider getcontextProvider() {
+ private DQPCore.ContextProvider getContextProvider() {
return new DQPCore.ContextProvider() {
@Override
public DQPWorkContext getContext(final String vdbName, final int vdbVersion) {
@@ -830,4 +810,44 @@
public void setContainerLifeCycleListener(ContainerLifeCycleListener listener) {
this.lifecycleListener = listener;
}
+
+ public InjectedValue<CacheFactory> getCachefactoryInjector() {
+ return cachefactoryInjector;
+ }
+
+ public InjectedValue<TranslatorRepository> getTranslatorRepositoryInjector() {
+ return translatorRepositoryInjector;
+ }
+
+ public InjectedValue<VDBRepository> getVdbRepositoryInjector() {
+ return vdbRepositoryInjector;
+ }
+
+ public InjectedValue<AuthorizationValidator> getAuthorizationValidatorInjector() {
+ return authorizationValidatorInjector;
+ }
+
+ public InjectedValue<BufferServiceImpl> getBufferServiceInjector() {
+ return bufferServiceInjector;
+ }
+
+ public InjectedValue<SocketBinding> getJdbcSocketBindingInjector() {
+ return jdbcSocketBindingInjector;
+ }
+
+ public InjectedValue<TransactionManager> getTxnManagerInjector() {
+ return txnManagerInjector;
+ }
+
+ public InjectedValue<XATerminator> getXaTerminatorInjector() {
+ return xaTerminatorInjector;
+ }
+
+ public InjectedValue<WorkManager> getWorkManagerInjector() {
+ return workManagerInjector;
+ }
+
+ public InjectedValue<SocketBinding> getOdbcSocketBindingInjector() {
+ return odbcSocketBindingInjector;
+ }
}
Modified: branches/as7/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties
===================================================================
--- branches/as7/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties 2011-08-22 14:36:06 UTC (rev 3422)
+++ branches/as7/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties 2011-08-24 17:35:13 UTC (rev 3423)
@@ -47,7 +47,7 @@
template_not_found=Template not found for {0}
admin_executing=JOPR admin {0} is executing command {1}
error_adding_translator=Error loading the Translator {0}. Execution Factory class is not valid class or not defined.
-failed_load_module=Failed to load module {0} for translator {1}
+failed_load_module=Failed to load module "{0}"
translator.add=Add Translator
translator.remove=Remove Translator
@@ -63,6 +63,8 @@
jdbc.describe=Remote JDBC Access Configuration
admin.describe=Remote Admin Access Configuration
odbc.describe=ODBC Access Configuration
+authorization-validator-module.describe=Authorization Module; Implementation of org.teiid.dqp.internal.process.AuthorizationValidator class.
+policy-decider-module.describe=Policy Module; Implementation of org.teiid.PolicyDecider class
#Query-ENGINE
jndi-name.describe=JNDI name of the Teiid Query Engine
@@ -184,8 +186,10 @@
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
engine.add = Add Teiid query engine
+translator.describe = Teiid Translators
translator.add = Add Teiid translator
translator.remove = Remove Teiid translator
teiid-boot.add = Teiid boot services
\ No newline at end of file
Modified: branches/as7/jboss-integration/src/main/resources/schema/jboss-teiid.xsd
===================================================================
--- branches/as7/jboss-integration/src/main/resources/schema/jboss-teiid.xsd 2011-08-22 14:36:06 UTC (rev 3422)
+++ branches/as7/jboss-integration/src/main/resources/schema/jboss-teiid.xsd 2011-08-24 17:35:13 UTC (rev 3423)
@@ -83,7 +83,7 @@
</xs:annotation>
</xs:element>
- <xs:element name="query-engine" type="runtime-engine-type" maxOccurs="1" minOccurs="1">
+ <xs:element name="query-engine" type="runtime-engine-type" maxOccurs="2" minOccurs="1">
<xs:annotation>
<xs:documentation>Main Teiid runtime engine configuration</xs:documentation>
</xs:annotation>
@@ -240,7 +240,7 @@
<xs:documentation>Maximum size of lob allowed through ODBC connection in bytes (default 5MB)</xs:documentation>
</xs:annotation>
</xs:element>
- <xs:element name="event-distributor-name" type="xs:string" minOccurs="1" maxOccurs="1">
+ <xs:element name="event-distributor-name" type="xs:string" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation>The JNDI name of the Teiid Event Distributor</xs:documentation>
</xs:annotation>
@@ -276,6 +276,7 @@
</xs:annotation>
</xs:element>
</xs:sequence>
+ <xs:attribute name="name" type="xs:string" use="required"/>
</xs:complexType>
<xs:complexType name="authorization-validator-type">
Added: branches/as7/jboss-integration/src/test/java/org/teiid/jboss/MockXMLExtendedWriter.java
===================================================================
--- branches/as7/jboss-integration/src/test/java/org/teiid/jboss/MockXMLExtendedWriter.java (rev 0)
+++ branches/as7/jboss-integration/src/test/java/org/teiid/jboss/MockXMLExtendedWriter.java 2011-08-24 17:35:13 UTC (rev 3423)
@@ -0,0 +1,227 @@
+package org.teiid.jboss;
+
+import java.util.Iterator;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.jboss.staxmapper.XMLExtendedStreamWriter;
+
+public class MockXMLExtendedWriter implements XMLExtendedStreamWriter {
+ private XMLStreamWriter writer;
+
+ public MockXMLExtendedWriter(XMLStreamWriter writer) {
+ this.writer = writer;
+ }
+
+ public void writeStartElement(String localName) throws XMLStreamException {
+ writer.writeStartElement(localName);
+ }
+
+ public void writeStartElement(String namespaceURI, String localName)
+ throws XMLStreamException {
+ writer.writeStartElement(namespaceURI, localName);
+ }
+
+ public void writeStartElement(String prefix, String localName,
+ String namespaceURI) throws XMLStreamException {
+ writer.writeStartElement(prefix, localName, namespaceURI);
+ }
+
+ public void writeEmptyElement(String namespaceURI, String localName)
+ throws XMLStreamException {
+ writer.writeEmptyElement(namespaceURI, localName);
+ }
+
+ public void writeEmptyElement(String prefix, String localName,
+ String namespaceURI) throws XMLStreamException {
+ writer.writeEmptyElement(prefix, localName, namespaceURI);
+ }
+
+ public void writeEmptyElement(String localName) throws XMLStreamException {
+ writer.writeEmptyElement(localName);
+ }
+
+ public void writeEndElement() throws XMLStreamException {
+ writer.writeEndElement();
+ }
+
+ public void writeEndDocument() throws XMLStreamException {
+ writer.writeEndDocument();
+ }
+
+ public void close() throws XMLStreamException {
+ writer.close();
+ }
+
+ public void flush() throws XMLStreamException {
+ writer.flush();
+ }
+
+ public void writeAttribute(String localName, String value)
+ throws XMLStreamException {
+ writer.writeAttribute(localName, value);
+ }
+
+ public void writeAttribute(String prefix, String namespaceURI,
+ String localName, String value) throws XMLStreamException {
+ writer.writeAttribute(prefix, namespaceURI, localName, value);
+ }
+
+ public void writeAttribute(String namespaceURI, String localName,
+ String value) throws XMLStreamException {
+ writer.writeAttribute(namespaceURI, localName, value);
+ }
+
+ public void writeNamespace(String prefix, String namespaceURI)
+ throws XMLStreamException {
+ writer.writeNamespace(prefix, namespaceURI);
+ }
+
+ public void writeDefaultNamespace(String namespaceURI)
+ throws XMLStreamException {
+ writer.writeDefaultNamespace(namespaceURI);
+ }
+
+ public void writeComment(String data) throws XMLStreamException {
+ writer.writeComment(data);
+ }
+
+ public void writeProcessingInstruction(String target)
+ throws XMLStreamException {
+ writer.writeProcessingInstruction(target);
+ }
+
+ public void writeProcessingInstruction(String target, String data)
+ throws XMLStreamException {
+ writer.writeProcessingInstruction(target, data);
+ }
+
+ public void writeCData(String data) throws XMLStreamException {
+ writer.writeCData(data);
+ }
+
+ public void writeDTD(String dtd) throws XMLStreamException {
+ writer.writeDTD(dtd);
+ }
+
+ public void writeEntityRef(String name) throws XMLStreamException {
+ writer.writeEntityRef(name);
+ }
+
+ public void writeStartDocument() throws XMLStreamException {
+ writer.writeStartDocument();
+ }
+
+ public void writeStartDocument(String version) throws XMLStreamException {
+ writer.writeStartDocument(version);
+ }
+
+ public void writeStartDocument(String encoding, String version)
+ throws XMLStreamException {
+ writer.writeStartDocument(encoding, version);
+ }
+
+ public void writeCharacters(String text) throws XMLStreamException {
+ writer.writeCharacters(text);
+ }
+
+ public void writeCharacters(char[] text, int start, int len)
+ throws XMLStreamException {
+ writer.writeCharacters(text, start, len);
+ }
+
+ public String getPrefix(String uri) throws XMLStreamException {
+ return writer.getPrefix(uri);
+ }
+
+ public void setPrefix(String prefix, String uri) throws XMLStreamException {
+ writer.setPrefix(prefix, uri);
+ }
+
+ public void setDefaultNamespace(String uri) throws XMLStreamException {
+ writer.setDefaultNamespace(uri);
+ }
+
+ public void setNamespaceContext(NamespaceContext context)
+ throws XMLStreamException {
+ writer.setNamespaceContext(context);
+ }
+
+ public NamespaceContext getNamespaceContext() {
+ return writer.getNamespaceContext();
+ }
+
+ public Object getProperty(String name) throws IllegalArgumentException {
+ return writer.getProperty(name);
+ }
+
+ @Override
+ public void writeAttribute(String localName, String[] values) throws XMLStreamException {
+ this.writer.writeAttribute(localName, join(values));
+
+ }
+
+ private static String join(final String[] values) {
+ final StringBuilder b = new StringBuilder();
+ for (int i = 0, valuesLength = values.length; i < valuesLength; i++) {
+ final String s = values[i];
+ if (s != null) {
+ if (i > 0) {
+ b.append(' ');
+ }
+ b.append(s);
+ }
+ }
+ return b.toString();
+ }
+
+ private static String join(final Iterable<String> values) {
+ final StringBuilder b = new StringBuilder();
+ Iterator<String> iterator = values.iterator();
+ while (iterator.hasNext()) {
+ final String s = iterator.next();
+ if (s != null) {
+ b.append(s);
+ if (iterator.hasNext()) b.append(' ');
+ }
+ }
+ return b.toString();
+ }
+
+ @Override
+ public void writeAttribute(String prefix, String namespaceURI, String localName, String[] values) throws XMLStreamException {
+ this.writer.writeAttribute(prefix, namespaceURI, localName, join(values));
+
+ }
+
+ @Override
+ public void writeAttribute(String namespaceURI, String localName, String[] values) throws XMLStreamException {
+ this.writer.writeAttribute(namespaceURI, localName, join(values));
+ }
+
+ @Override
+ public void writeAttribute(String localName, Iterable<String> value)
+ throws XMLStreamException {
+ this.writer.writeAttribute(localName, join(value));
+
+ }
+
+ @Override
+ public void writeAttribute(String prefix, String namespaceURI,
+ String localName, Iterable<String> value) throws XMLStreamException {
+ this.writer.writeAttribute(prefix, namespaceURI, localName, join(value));
+
+ }
+
+ @Override
+ public void writeAttribute(String namespaceURI, String localName,
+ Iterable<String> value) throws XMLStreamException {
+ this.writer.writeAttribute(namespaceURI, localName, join(value));
+ }
+
+ @Override
+ public void setUnspecifiedElementNamespace(String namespace) {
+ }
+}
Property changes on: branches/as7/jboss-integration/src/test/java/org/teiid/jboss/MockXMLExtendedWriter.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Copied: branches/as7/jboss-integration/src/test/java/org/teiid/jboss/TestObjectSerializer.java (from rev 3422, branches/as7/runtime/src/test/java/org/teiid/deployers/TestObjectSerializer.java)
===================================================================
--- branches/as7/jboss-integration/src/test/java/org/teiid/jboss/TestObjectSerializer.java (rev 0)
+++ branches/as7/jboss-integration/src/test/java/org/teiid/jboss/TestObjectSerializer.java 2011-08-24 17:35:13 UTC (rev 3423)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.jboss;
+
+import static org.junit.Assert.*;
+
+import java.io.File;
+
+import org.junit.Test;
+import org.teiid.core.util.UnitTestUtil;
+import org.teiid.jboss.ObjectSerializer;
+
+
+@SuppressWarnings("nls")
+public class TestObjectSerializer {
+
+ @Test public void testLoadSafe() throws Exception {
+ ObjectSerializer os = new ObjectSerializer(System.getProperty("java.io.tmpdir"));
+ File f = UnitTestUtil.getTestScratchFile("foo");
+ os.saveAttachment(f, new Long(2), false);
+ assertNotNull(os.loadAttachment(f, Long.class));
+ assertNull(os.loadSafe(f, Integer.class));
+ }
+
+}
Property changes on: branches/as7/jboss-integration/src/test/java/org/teiid/jboss/TestObjectSerializer.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: branches/as7/jboss-integration/src/test/java/org/teiid/jboss/TestTeiidConfiguration.java
===================================================================
--- branches/as7/jboss-integration/src/test/java/org/teiid/jboss/TestTeiidConfiguration.java 2011-08-22 14:36:06 UTC (rev 3422)
+++ branches/as7/jboss-integration/src/test/java/org/teiid/jboss/TestTeiidConfiguration.java 2011-08-24 17:35:13 UTC (rev 3423)
@@ -31,10 +31,9 @@
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
+import javax.xml.namespace.NamespaceContext;
import javax.xml.namespace.QName;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.*;
import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamSource;
import javax.xml.validation.Schema;
@@ -50,6 +49,7 @@
import org.jboss.as.controller.operations.global.GlobalOperationHandlers;
import org.jboss.as.controller.persistence.ConfigurationPersistenceException;
import org.jboss.as.controller.persistence.ConfigurationPersister;
+import org.jboss.as.controller.persistence.ModelMarshallingContext;
import org.jboss.as.controller.persistence.SubsystemMarshallingContext;
import org.jboss.as.controller.registry.ManagementResourceRegistration;
import org.jboss.as.controller.registry.Resource;
@@ -58,10 +58,12 @@
import org.jboss.dmr.Property;
import org.jboss.msc.service.*;
import org.jboss.staxmapper.XMLElementWriter;
+import org.jboss.staxmapper.XMLExtendedStreamWriter;
import org.jboss.staxmapper.XMLMapper;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
+import org.mockito.Mockito;
import org.teiid.core.util.ObjectConverterUtil;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
@@ -115,7 +117,7 @@
@Test
public void testTeiidConfiguration() throws Exception {
List<ModelNode> updates = createSubSystem(ObjectConverterUtil.convertToString(new FileReader("src/test/resources/teiid-sample-config.xml")));
- assertEquals(1, updates.size());
+ assertEquals(3, updates.size());
for (ModelNode update : updates) {
try {
executeForResult(update);
@@ -125,18 +127,23 @@
}
ModelNode subsystem = model.require("profile").require("test").require("subsystem").require("teiid");
- ModelNode bufferService = subsystem.require("buffer-service");
- assertEquals(8, bufferService.keys().size());
- assertEquals("true", bufferService.require("use-disk").asString());
+ ModelNode engine = subsystem.require("query-engine");
+ assertEquals(2, engine.keys().size());
+ ModelNode defaultEngine = engine.get("default");
+ assertEquals("default", defaultEngine.require("name").asString());
+
+ ModelNode alternateEngine = engine.get("alternate");
+ assertEquals("alternate", alternateEngine.require("name").asString());
}
@Test
public void testSimpleTeiidConfiguration() throws Exception {
List<ModelNode> updates = createSubSystem("<subsystem xmlns=\"urn:jboss:domain:teiid:1.0\">" +
- " <query-engine jndi-name=\"teiid/engine-deployer\">" +
+ "<async-thread-group>async</async-thread-group>"+
+ " <query-engine name=\"default\">" +
" </query-engine>" +
"</subsystem>");
- assertEquals(1, updates.size());
+ assertEquals(2, updates.size());
for (ModelNode update : updates) {
try {
executeForResult(update);
@@ -194,7 +201,7 @@
List<ModelNode> updates = new ArrayList<ModelNode>();
xmlMapper.parseDocument(updates, xmlReader);
-
+
// Process subsystems
for(final ModelNode update : updates) {
// Process relative subsystem path address
@@ -366,10 +373,26 @@
return rsp.get(RESULT);
}
+ public void susbsytemParserDeparser(String xmlContent) throws Exception {
+ XMLMapper xmlMapper = XMLMapper.Factory.create();
+ List<ModelNode> updates = createSubSystem(xmlContent);
+
+ StringWriter sw = new StringWriter();
+ XMLStreamWriter streamWriter = XMLOutputFactory.newInstance().createXMLStreamWriter(sw);
+ xmlMapper.deparseDocument(new TeiidSubsystemParser(), new SubsystemMarshallingContext(updates.get(1), new MockXMLExtendedWriter(streamWriter)), streamWriter);
+
+ System.out.println(sw.toString());
+ }
+
+ //@Test
+ public void testXMLPersistence() throws Exception {
+ susbsytemParserDeparser(ObjectConverterUtil.convertToString(new FileReader("src/test/resources/teiid-sample-config.xml")));
+ }
+
@Test
public void testSubSystemDescription() throws IOException {
ModelNode node = new ModelNode();
- TeiidModelDescription.getQueryEngineDescription(node, ATTRIBUTES, IntegrationPlugin.getResourceBundle(null));
+ QueryEngineAdd.describeQueryEngine(node, ATTRIBUTES, IntegrationPlugin.getResourceBundle(null));
assertEquals(ObjectConverterUtil.convertToString(new FileReader("src/test/resources/teiid-model-config.txt")), node.toString());
}
}
Modified: branches/as7/jboss-integration/src/test/resources/teiid-model-config.txt
===================================================================
--- branches/as7/jboss-integration/src/test/resources/teiid-model-config.txt 2011-08-22 14:36:06 UTC (rev 3422)
+++ branches/as7/jboss-integration/src/test/resources/teiid-model-config.txt 2011-08-24 17:35:13 UTC (rev 3423)
@@ -1,11 +1,10 @@
{
"attributes" => {
- "async-thread-group" => {
+ "name" => {
"type" => STRING,
- "description" => "Thread Pool to be used with Asynchronous operations in Teiid",
- "required" => false,
- "max-occurs" => 1,
- "default" => "teiid-async"
+ "description" => "Name of the subsystem",
+ "required" => true,
+ "max-occurs" => 1
},
"max-threads" => {
"type" => INT,
@@ -110,190 +109,9 @@
"required" => false,
"max-occurs" => 1,
"default" => 0
- },
- "allow-env-function" => {
- "type" => BOOLEAN,
- "description" => "Allow the execution of ENV function. (default false)",
- "required" => false,
- "max-occurs" => 1,
- "default" => false
}
},
"children" => {
- "buffer-service" => {
- "type" => OBJECT,
- "description" => "Buffer Manager Configuration",
- "required" => false,
- "max-occurs" => 1,
- "min-occurs" => 1,
- "attributes" => {
- "use-disk" => {
- "type" => BOOLEAN,
- "description" => "Use disk for buffer management",
- "required" => false,
- "max-occurs" => 1,
- "default" => true
- },
- "processor-batch-size" => {
- "type" => INT,
- "description" => "The max row count of a batch sent internally within the query processor. Should be <= the connectorBatchSize. (default 512)",
- "required" => false,
- "max-occurs" => 1,
- "default" => 512
- },
- "connector-batch-size" => {
- "type" => INT,
- "description" => "The max row count of a batch from a connector. Should be even multiple of processorBatchSize. (default 1024)",
- "required" => false,
- "max-occurs" => 1,
- "default" => 1024
- },
- "max-processing-kb" => {
- "type" => INT,
- "description" => "The approximate amount of buffer memory in kilobytes allowable for a single processing operation (sort, grouping, etc.) regardless of existing memory commitments. -1 means to automatically calculate a value (default -1)",
- "required" => false,
- "max-occurs" => 1,
- "default" => -1
- },
- "max-reserve-kb" => {
- "type" => INT,
- "description" => "The approximate amount of memory in kilobytes allowed to be held by the buffer manager. -1 means to automatically calculate a value (default -1)",
- "required" => false,
- "max-occurs" => 1,
- "default" => -1
- },
- "max-file-size" => {
- "type" => LONG,
- "description" => "Max File size in MB (default 2GB)",
- "required" => false,
- "max-occurs" => 1,
- "default" => 2048L
- },
- "max-buffer-space" => {
- "type" => LONG,
- "description" => "Max storage space, in MB, to be used for buffer files (default 50G)",
- "required" => false,
- "max-occurs" => 1,
- "default" => 51200L
- },
- "max-open-files" => {
- "type" => INT,
- "description" => "Max open buffer files (default 64)",
- "required" => false,
- "max-occurs" => 1,
- "default" => 64
- }
- }
- },
- "resultset-cache" => {
- "type" => OBJECT,
- "description" => "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",
- "required" => false,
- "max-occurs" => 1,
- "min-occurs" => 1,
- "attributes" => {
- "maxEntries" => {
- "type" => INT,
- "description" => "Max Entries allowed",
- "required" => false,
- "max-occurs" => 1,
- "default" => 1024
- },
- "maxAgeInSeconds" => {
- "type" => INT,
- "description" => "Max age in seconds",
- "required" => false,
- "max-occurs" => 1,
- "default" => 7200
- },
- "maxStaleness" => {
- "type" => INT,
- "description" => "Max staleness in seconds. Modifications are based upon data updates -1 indicates no max. (default 60 - 1 minute)",
- "required" => false,
- "max-occurs" => 1,
- "default" => 60
- },
- "type" => {
- "type" => STRING,
- "description" => "Allowed values are LRU, EXPIRATION. ",
- "required" => false,
- "max-occurs" => 1,
- "default" => "EXPIRATION"
- },
- "location" => {
- "type" => STRING,
- "description" => "location",
- "required" => false,
- "max-occurs" => 1,
- "default" => "resultset"
- }
- }
- },
- "preparedplan-cache" => {
- "type" => OBJECT,
- "description" => "PreparedPlan Cache Configuration",
- "required" => false,
- "max-occurs" => 1,
- "min-occurs" => 1,
- "attributes" => {
- "maxEntries" => {
- "type" => INT,
- "description" => "Max Entries allowed",
- "required" => false,
- "max-occurs" => 1,
- "default" => 1024
- },
- "maxAgeInSeconds" => {
- "type" => INT,
- "description" => "Max age in seconds",
- "required" => false,
- "max-occurs" => 1,
- "default" => 7200
- },
- "maxStaleness" => {
- "type" => INT,
- "description" => "Max staleness in seconds. Modifications are based upon data updates -1 indicates no max. (default 60 - 1 minute)",
- "required" => false,
- "max-occurs" => 1,
- "default" => 60
- },
- "type" => {
- "type" => STRING,
- "description" => "Allowed values are LRU, EXPIRATION. ",
- "required" => false,
- "max-occurs" => 1,
- "default" => "EXPIRATION"
- },
- "location" => {
- "type" => STRING,
- "description" => "location",
- "required" => false,
- "max-occurs" => 1,
- "default" => "resultset"
- },
- "cache-service-jndi-name" => {
- "type" => STRING,
- "description" => "cache service for the distributed cache",
- "required" => false,
- "max-occurs" => 1,
- "default" => "java:TeiidCacheManager"
- },
- "resultsetCacheName" => {
- "type" => STRING,
- "description" => "resultset cache node name",
- "required" => false,
- "max-occurs" => 1,
- "default" => "teiid-resultset-cache"
- }
- }
- },
- "distributed-cache-factory" => {
- "type" => OBJECT,
- "description" => "Distributed Cache Configuration",
- "required" => false,
- "max-occurs" => 1,
- "min-occurs" => 1
- },
"jdbc" => {
"type" => OBJECT,
"description" => "Remote JDBC Access Configuration ",
Modified: branches/as7/jboss-integration/src/test/resources/teiid-sample-config.xml
===================================================================
--- branches/as7/jboss-integration/src/test/resources/teiid-sample-config.xml 2011-08-22 14:36:06 UTC (rev 3422)
+++ branches/as7/jboss-integration/src/test/resources/teiid-sample-config.xml 2011-08-24 17:35:13 UTC (rev 3423)
@@ -1,24 +1,6 @@
<subsystem xmlns="urn:jboss:domain:teiid:1.0">
- <async-thread-group>teiid-async</async-thread-group>
- <allow-env-function>false</allow-env-function>
-
- <query-engine>
- <max-threads>64</max-threads>
- <max-active-plans>20</max-active-plans>
- <thread-count-for-source-concurrency>0</thread-count-for-source-concurrency>
- <time-slice-in-millseconds>2000</time-slice-in-millseconds>
- <max-row-fetch-size>20480</max-row-fetch-size>
- <lob-chunk-size-in-kb>100</lob-chunk-size-in-kb>
- <query-threshold-in-seconds>600</query-threshold-in-seconds>
- <max-source-rows-allowed>-1</max-source-rows-allowed>
- <exception-on-max-source-rows>true</exception-on-max-source-rows>
- <max-odbc-lob-size-allowed>5242880</max-odbc-lob-size-allowed>
- <event-distributor-name>teiid/event-distributor</event-distributor-name>
- <detect-change-events>true</detect-change-events>
- <security-domain>teiid-security</security-domain>
- <max-sessions-allowed>5000</max-sessions-allowed>
- <sessions-expiration-timelimit>0</sessions-expiration-timelimit>
-
+ <allow-env-function>false</allow-env-function>
+ <async-thread-group>teiid-async</async-thread-group>
<buffer-service>
<use-disk>true</use-disk>
@@ -30,7 +12,10 @@
<max-buffer-space>51200</max-buffer-space>
<max-open-files>64</max-open-files>
</buffer-service>
-
+ <!--
+ <authorization-validator-module>javax.api</authorization-validator-module>
+ <policy-decider-module>javax.api</policy-decider-module>
+ -->
<distributed-cache-factory>
<cache-service-jndi-name>java:TeiidCacheManager</cache-service-jndi-name>
<resultsetCacheName>teiid-resultset-cache</resultsetCacheName>
@@ -48,8 +33,25 @@
<maxEntries>512</maxEntries>
<maxAgeInSeconds>28800</maxAgeInSeconds>
<maxStaleness>0</maxStaleness>
- </preparedplan-cache>
-
+ </preparedplan-cache>
+
+ <query-engine name="default">
+ <max-threads>64</max-threads>
+ <max-active-plans>20</max-active-plans>
+ <thread-count-for-source-concurrency>0</thread-count-for-source-concurrency>
+ <time-slice-in-millseconds>2000</time-slice-in-millseconds>
+ <max-row-fetch-size>20480</max-row-fetch-size>
+ <lob-chunk-size-in-kb>100</lob-chunk-size-in-kb>
+ <query-threshold-in-seconds>600</query-threshold-in-seconds>
+ <max-source-rows-allowed>-1</max-source-rows-allowed>
+ <exception-on-max-source-rows>true</exception-on-max-source-rows>
+ <max-odbc-lob-size-allowed>5242880</max-odbc-lob-size-allowed>
+ <event-distributor-name>teiid/event-distributor</event-distributor-name>
+ <detect-change-events>true</detect-change-events>
+ <security-domain>teiid-security</security-domain>
+ <max-sessions-allowed>5000</max-sessions-allowed>
+ <sessions-expiration-timelimit>0</sessions-expiration-timelimit>
+
<jdbc>
<maxSocketThreads>0</maxSocketThreads>
<inputBufferSize>0</inputBufferSize>
@@ -64,5 +66,7 @@
<socket-binding>teiid-odbc</socket-binding>
</odbc>
</query-engine>
+
+ <query-engine name="alternate"/>
</subsystem>
\ No newline at end of file
Modified: branches/as7/runtime/src/main/java/org/teiid/deployers/TeiidAttachments.java
===================================================================
--- branches/as7/runtime/src/main/java/org/teiid/deployers/TeiidAttachments.java 2011-08-22 14:36:06 UTC (rev 3422)
+++ branches/as7/runtime/src/main/java/org/teiid/deployers/TeiidAttachments.java 2011-08-24 17:35:13 UTC (rev 3423)
@@ -34,7 +34,6 @@
public static final AttachmentKey<VDBMetaData> VDB_METADATA = AttachmentKey.create(VDBMetaData.class);
public static final AttachmentKey<UDFMetaData> UDF_METADATA = AttachmentKey.create(UDFMetaData.class);
public static final AttachmentKey<IndexMetadataFactory> INDEX_METADATA = AttachmentKey.create(IndexMetadataFactory.class);
- public static final AttachmentKey<MetadataStoreGroup> METADATA_STORE = AttachmentKey.create(MetadataStoreGroup.class);
public static final AttachmentKey<DeploymentType> DEPLOYMENT_TYPE = AttachmentKey.create(DeploymentType.class);
@@ -53,5 +52,4 @@
public static void setAsDynamicVDBDeployment(final DeploymentUnit deploymentUnit) {
deploymentUnit.putAttachment(DEPLOYMENT_TYPE, DeploymentType.DYNAMIC_VDB);
}
-
}
Modified: branches/as7/runtime/src/main/java/org/teiid/deployers/UDFMetaData.java
===================================================================
--- branches/as7/runtime/src/main/java/org/teiid/deployers/UDFMetaData.java 2011-08-22 14:36:06 UTC (rev 3422)
+++ branches/as7/runtime/src/main/java/org/teiid/deployers/UDFMetaData.java 2011-08-24 17:35:13 UTC (rev 3423)
@@ -45,7 +45,7 @@
}
- void buildFunctionModelFile(String name, String path) throws IOException, JAXBException {
+ public void buildFunctionModelFile(String name, String path) throws IOException, JAXBException {
for (String f:files.keySet()) {
if (f.endsWith(path)) {
path = f;
Modified: branches/as7/runtime/src/main/java/org/teiid/transport/LocalServerConnection.java
===================================================================
--- branches/as7/runtime/src/main/java/org/teiid/transport/LocalServerConnection.java 2011-08-22 14:36:06 UTC (rev 3422)
+++ branches/as7/runtime/src/main/java/org/teiid/transport/LocalServerConnection.java 2011-08-24 17:35:13 UTC (rev 3423)
@@ -49,7 +49,7 @@
public class LocalServerConnection implements ServerConnection {
- public static final String TEIID_RUNTIME = "teiid/engine-deployer"; //$NON-NLS-1$
+ private static final String TEIID_RUNTIME_CONTEXT = "teiid/"; //$NON-NLS-1$
private LogonResult result;
private boolean shutdown;
@@ -69,8 +69,9 @@
protected ClientServiceRegistry getClientServiceRegistry() {
try {
+ String engineName = this.connectionProperties.getProperty(TeiidURL.CONNECTION.ENGINE_NAME, "default"); //$NON-NLS-1$
InitialContext ic = new InitialContext();
- return (ClientServiceRegistry)ic.lookup(TEIID_RUNTIME);
+ return (ClientServiceRegistry)ic.lookup(TEIID_RUNTIME_CONTEXT+engineName);
} catch (NamingException e) {
throw new TeiidRuntimeException(e);
}
Deleted: branches/as7/runtime/src/test/java/org/teiid/deployers/TestObjectSerializer.java
===================================================================
--- branches/as7/runtime/src/test/java/org/teiid/deployers/TestObjectSerializer.java 2011-08-22 14:36:06 UTC (rev 3422)
+++ branches/as7/runtime/src/test/java/org/teiid/deployers/TestObjectSerializer.java 2011-08-24 17:35:13 UTC (rev 3423)
@@ -1,45 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.deployers;
-
-import static org.junit.Assert.*;
-
-import java.io.File;
-
-import org.junit.Test;
-import org.teiid.core.util.UnitTestUtil;
-import org.teiid.jboss.ObjectSerializer;
-
-
-@SuppressWarnings("nls")
-public class TestObjectSerializer {
-
- @Test public void testLoadSafe() throws Exception {
- ObjectSerializer os = new ObjectSerializer(System.getProperty("java.io.tmpdir"));
- File f = UnitTestUtil.getTestScratchFile("foo");
- os.saveAttachment(f, new Long(2));
- assertNotNull(os.loadAttachment(f, Long.class));
- assertNull(os.loadSafe(f, Integer.class));
- }
-
-}
13 years, 4 months
teiid SVN: r3422 - in branches/as7: build and 26 other directories.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2011-08-22 10:36:06 -0400 (Mon, 22 Aug 2011)
New Revision: 3422
Added:
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/AuthorizationValidatorService.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/ObjectSerializer.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/ObjectsSerializerService.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineRemove.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidBootServicesAdd.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidModelDescription.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBDependencyProcessor.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBDeployer.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBParserDeployer.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBRepositoryService.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBService.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBStructure.java
Removed:
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineDescription.java
branches/as7/runtime/src/main/java/org/teiid/deployers/ObjectSerializer.java
branches/as7/runtime/src/main/java/org/teiid/deployers/VDBDependencyProcessor.java
branches/as7/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java
branches/as7/runtime/src/main/java/org/teiid/deployers/VDBParserDeployer.java
branches/as7/runtime/src/main/java/org/teiid/deployers/VDBService.java
branches/as7/runtime/src/main/java/org/teiid/deployers/VDBStructure.java
Modified:
branches/as7/build/assembly/adminshell/adminshell-dist.xml
branches/as7/build/assembly/jboss-as7/dist.xml
branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/api/main/module.xml
branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/client/main/module.xml
branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/common-core/main/module.xml
branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/main/module.xml
branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/file/main/module.xml
branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/jdbc/main/module.xml
branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/ldap/main/module.xml
branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/loopback/main/module.xml
branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/olap/main/module.xml
branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/salesforce/api/main/module.xml
branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/salesforce/main/module.xml
branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/ws/main/module.xml
branches/as7/build/kits/jboss-as7/standalone/configuration/standalone-teiid.xml
branches/as7/build/pom.xml
branches/as7/engine/src/main/java/org/teiid/dqp/internal/datamgr/TranslatorRepository.java
branches/as7/engine/src/main/java/org/teiid/dqp/internal/process/DQPConfiguration.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/Configuration.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/Element.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/JBossLifeCycleListener.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineAdd.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineOperationHandler.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidExtension.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidServiceNames.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidSubsystemParser.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorAdd.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorRemove.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
branches/as7/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties
branches/as7/jboss-integration/src/main/resources/schema/jboss-teiid.xsd
branches/as7/jboss-integration/src/test/java/org/teiid/jboss/TestTeiidConfiguration.java
branches/as7/jboss-integration/src/test/resources/teiid-sample-config.xml
branches/as7/pom.xml
branches/as7/runtime/src/main/java/org/teiid/deployers/TranslatorUtil.java
branches/as7/runtime/src/main/resources/org/teiid/runtime/i18n.properties
branches/as7/runtime/src/test/java/org/teiid/deployers/TestObjectSerializer.java
Log:
TEIID-1720: 1) More service changes, more for vdb deployment. machine unstable; savepoint
Modified: branches/as7/build/assembly/adminshell/adminshell-dist.xml
===================================================================
--- branches/as7/build/assembly/adminshell/adminshell-dist.xml 2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/build/assembly/adminshell/adminshell-dist.xml 2011-08-22 14:36:06 UTC (rev 3422)
@@ -7,7 +7,7 @@
</formats>
<includeBaseDirectory>true</includeBaseDirectory>
- <baseDirectory>teiid-adminshell-${version}</baseDirectory>
+ <baseDirectory>teiid-adminshell-${project.version}</baseDirectory>
<moduleSets>
<moduleSet>
@@ -60,7 +60,7 @@
<fileSet>
<directory>target</directory>
<includes>
- <include>teiid-${version}-client.jar</include>
+ <include>teiid-${project.version}-client.jar</include>
</includes>
<outputDirectory>lib</outputDirectory>
<fileMode>0644</fileMode>
@@ -70,7 +70,7 @@
<files>
<file>
- <source>target/teiid-${version}-docs/admin-guide/en-US/pdf/teiid_admin_guide.pdf</source>
+ <source>target/teiid-${project.version}-docs/admin-guide/en-US/pdf/teiid_admin_guide.pdf</source>
<fileMode>0644</fileMode>
</file>
</files>
Modified: branches/as7/build/assembly/jboss-as7/dist.xml
===================================================================
--- branches/as7/build/assembly/jboss-as7/dist.xml 2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/build/assembly/jboss-as7/dist.xml 2011-08-22 14:36:06 UTC (rev 3422)
@@ -8,7 +8,7 @@
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
- <baseDirectory>teiid-${version}</baseDirectory>
+ <baseDirectory>teiid-${project.version}</baseDirectory>
<fileSets>
@@ -59,32 +59,32 @@
<files>
<file>
- <source>target/teiid-${version}-docs/admin-guide/en-US/pdf/teiid_admin_guide.pdf</source>
+ <source>target/teiid-${project.version}-docs/admin-guide/en-US/pdf/teiid_admin_guide.pdf</source>
<outputDirectory>docs/teiid</outputDirectory>
<fileMode>0644</fileMode>
</file>
<file>
- <source>target/teiid-${version}-docs/reference/en-US/pdf/teiid_reference.pdf</source>
+ <source>target/teiid-${project.version}-docs/reference/en-US/pdf/teiid_reference.pdf</source>
<outputDirectory>docs/teiid</outputDirectory>
<fileMode>0644</fileMode>
</file>
<file>
- <source>target/teiid-${version}-docs/quick-start-example/en-US/pdf/teiid_quick_start_example.pdf</source>
+ <source>target/teiid-${project.version}-docs/quick-start-example/en-US/pdf/teiid_quick_start_example.pdf</source>
<outputDirectory>docs/teiid</outputDirectory>
<fileMode>0644</fileMode>
</file>
<file>
- <source>target/teiid-${version}-docs/developer-guide/en-US/pdf/teiid_developer_guide.pdf</source>
+ <source>target/teiid-${project.version}-docs/developer-guide/en-US/pdf/teiid_developer_guide.pdf</source>
<outputDirectory>docs/teiid</outputDirectory>
<fileMode>0644</fileMode>
</file>
<file>
- <source>target/teiid-${version}-docs/client-developers-guide/en-US/pdf/teiid_client_developers_guide.pdf</source>
+ <source>target/teiid-${project.version}-docs/client-developers-guide/en-US/pdf/teiid_client_developers_guide.pdf</source>
<outputDirectory>docs/teiid</outputDirectory>
<fileMode>0644</fileMode>
</file>
<file>
- <source>target/teiid-${version}-docs/caching-guide/en-US/pdf/teiid_caching_guide.pdf</source>
+ <source>target/teiid-${project.version}-docs/caching-guide/en-US/pdf/teiid_caching_guide.pdf</source>
<outputDirectory>docs/teiid</outputDirectory>
<fileMode>0644</fileMode>
</file>
Modified: branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/api/main/module.xml
===================================================================
--- branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/api/main/module.xml 2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/api/main/module.xml 2011-08-22 14:36:06 UTC (rev 3422)
@@ -1,30 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- ~ JBoss, Home of Professional Open Source.
- ~ Copyright 2010, Red Hat, Inc., and individual contributors
- ~ as indicated by the @author tags. See the copyright.txt file in the
- ~ distribution for a full listing of individual contributors.
- ~
- ~ This is free software; you can redistribute it and/or modify it
- ~ under the terms of the GNU Lesser General Public License as
- ~ published by the Free Software Foundation; either version 2.1 of
- ~ the License, or (at your option) any later version.
- ~
- ~ This software is distributed in the hope that it will be useful,
- ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
- ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- ~ Lesser General Public License for more details.
- ~
- ~ You should have received a copy of the GNU Lesser General Public
- ~ License along with this software; if not, write to the Free
- ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- -->
-
<module xmlns="urn:jboss:module:1.0" name="org.jboss.teiid.api">
<resources>
- <resource-root path="teiid-api-${version}.jar" />
+ <resource-root path="teiid-api-${project.version}.jar" />
<!-- Insert resources here -->
</resources>
Modified: branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/client/main/module.xml
===================================================================
--- branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/client/main/module.xml 2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/client/main/module.xml 2011-08-22 14:36:06 UTC (rev 3422)
@@ -1,31 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- ~ JBoss, Home of Professional Open Source.
- ~ Copyright 2010, Red Hat, Inc., and individual contributors
- ~ as indicated by the @author tags. See the copyright.txt file in the
- ~ distribution for a full listing of individual contributors.
- ~
- ~ This is free software; you can redistribute it and/or modify it
- ~ under the terms of the GNU Lesser General Public License as
- ~ published by the Free Software Foundation; either version 2.1 of
- ~ the License, or (at your option) any later version.
- ~
- ~ This software is distributed in the hope that it will be useful,
- ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
- ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- ~ Lesser General Public License for more details.
- ~
- ~ You should have received a copy of the GNU Lesser General Public
- ~ License along with this software; if not, write to the Free
- ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- -->
-
<module xmlns="urn:jboss:module:1.0" name="org.jboss.teiid.client">
<resources>
- <resource-root path="teiid-client-${version}.jar" />
- <resource-root path="teiid-hibernate-dialect-${version}.jar"/>
+ <resource-root path="teiid-client-${project.version}.jar" />
+ <resource-root path="teiid-hibernate-dialect-${project.version}.jar"/>
<!-- Insert resources here -->
</resources>
Modified: branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/common-core/main/module.xml
===================================================================
--- branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/common-core/main/module.xml 2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/common-core/main/module.xml 2011-08-22 14:36:06 UTC (rev 3422)
@@ -1,30 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- ~ JBoss, Home of Professional Open Source.
- ~ Copyright 2010, Red Hat, Inc., and individual contributors
- ~ as indicated by the @author tags. See the copyright.txt file in the
- ~ distribution for a full listing of individual contributors.
- ~
- ~ This is free software; you can redistribute it and/or modify it
- ~ under the terms of the GNU Lesser General Public License as
- ~ published by the Free Software Foundation; either version 2.1 of
- ~ the License, or (at your option) any later version.
- ~
- ~ This software is distributed in the hope that it will be useful,
- ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
- ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- ~ Lesser General Public License for more details.
- ~
- ~ You should have received a copy of the GNU Lesser General Public
- ~ License along with this software; if not, write to the Free
- ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- -->
-
<module xmlns="urn:jboss:module:1.0" name="org.jboss.teiid.common-core">
<resources>
- <resource-root path="teiid-common-core-${version}.jar" />
+ <resource-root path="teiid-common-core-${project.version}.jar" />
<!-- Insert resources here -->
</resources>
Modified: branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/main/module.xml
===================================================================
--- branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/main/module.xml 2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/main/module.xml 2011-08-22 14:36:06 UTC (rev 3422)
@@ -1,39 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- ~ JBoss, Home of Professional Open Source.
- ~ Copyright 2010, Red Hat, Inc., and individual contributors
- ~ as indicated by the @author tags. See the copyright.txt file in the
- ~ distribution for a full listing of individual contributors.
- ~
- ~ This is free software; you can redistribute it and/or modify it
- ~ under the terms of the GNU Lesser General Public License as
- ~ published by the Free Software Foundation; either version 2.1 of
- ~ the License, or (at your option) any later version.
- ~
- ~ This software is distributed in the hope that it will be useful,
- ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
- ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- ~ Lesser General Public License for more details.
- ~
- ~ You should have received a copy of the GNU Lesser General Public
- ~ License along with this software; if not, write to the Free
- ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- -->
-
<module xmlns="urn:jboss:module:1.0" name="org.jboss.teiid">
<resources>
- <resource-root path="teiid-engine-${version}.jar" />
+ <resource-root path="teiid-engine-${project.version}.jar" />
<!--
- <resource-root path="teiid-cache-jbosscache-${version}.jar" />
+ <resource-root path="teiid-cache-jbosscache-${project.version}.jar" />
-->
- <resource-root path="teiid-jboss-integration-${version}.jar" />
- <resource-root path="teiid-metadata-${version}.jar" />
- <resource-root path="teiid-runtime-${version}.jar" />
- <resource-root path="teiid-engine-${version}.jar" />
- <resource-root path="saxon-9.1.0.8.jar" />
- <resource-root path="saxon-9.1.0.8-dom.jar" />
+ <resource-root path="teiid-jboss-integration-${project.version}.jar" />
+ <resource-root path="teiid-metadata-${project.version}.jar" />
+ <resource-root path="teiid-runtime-${project.version}.jar" />
+ <resource-root path="teiid-engine-${project.version}.jar" />
+ <resource-root path="saxonhe-9.2.1.5.jar" />
<resource-root path="json-simple-1.1.jar" />
<!-- Insert resources here -->
</resources>
Modified: branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/file/main/module.xml
===================================================================
--- branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/file/main/module.xml 2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/file/main/module.xml 2011-08-22 14:36:06 UTC (rev 3422)
@@ -1,27 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- ~ JBoss, Home of Professional Open Source.
- ~ Copyright 2010, Red Hat, Inc., and individual contributors
- ~ as indicated by the @author tags. See the copyright.txt file in the
- ~ distribution for a full listing of individual contributors.
- ~
- ~ This is free software; you can redistribute it and/or modify it
- ~ under the terms of the GNU Lesser General Public License as
- ~ published by the Free Software Foundation; either version 2.1 of
- ~ the License, or (at your option) any later version.
- ~
- ~ This software is distributed in the hope that it will be useful,
- ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
- ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- ~ Lesser General Public License for more details.
- ~
- ~ You should have received a copy of the GNU Lesser General Public
- ~ License along with this software; if not, write to the Free
- ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- -->
-
<module xmlns="urn:jboss:module:1.0" name="org.jboss.teiid.translator.file">
<resources>
<resource-root path="translator-file-${project.version}.jar" />
Modified: branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/jdbc/main/module.xml
===================================================================
--- branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/jdbc/main/module.xml 2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/jdbc/main/module.xml 2011-08-22 14:36:06 UTC (rev 3422)
@@ -1,27 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- ~ JBoss, Home of Professional Open Source.
- ~ Copyright 2010, Red Hat, Inc., and individual contributors
- ~ as indicated by the @author tags. See the copyright.txt file in the
- ~ distribution for a full listing of individual contributors.
- ~
- ~ This is free software; you can redistribute it and/or modify it
- ~ under the terms of the GNU Lesser General Public License as
- ~ published by the Free Software Foundation; either version 2.1 of
- ~ the License, or (at your option) any later version.
- ~
- ~ This software is distributed in the hope that it will be useful,
- ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
- ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- ~ Lesser General Public License for more details.
- ~
- ~ You should have received a copy of the GNU Lesser General Public
- ~ License along with this software; if not, write to the Free
- ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- -->
-
<module xmlns="urn:jboss:module:1.0" name="org.jboss.teiid.translator.jdbc">
<resources>
<resource-root path="translator-jdbc-${project.version}.jar" />
@@ -31,6 +8,7 @@
<dependencies>
<module name="javax.resource.api"/>
+ <module name="javax.api"/>
<module name="org.apache.commons.logging" />
<module name="org.apache.log4j"/>
<module name="org.jboss.teiid.common-core" />
Modified: branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/ldap/main/module.xml
===================================================================
--- branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/ldap/main/module.xml 2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/ldap/main/module.xml 2011-08-22 14:36:06 UTC (rev 3422)
@@ -1,27 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- ~ JBoss, Home of Professional Open Source.
- ~ Copyright 2010, Red Hat, Inc., and individual contributors
- ~ as indicated by the @author tags. See the copyright.txt file in the
- ~ distribution for a full listing of individual contributors.
- ~
- ~ This is free software; you can redistribute it and/or modify it
- ~ under the terms of the GNU Lesser General Public License as
- ~ published by the Free Software Foundation; either version 2.1 of
- ~ the License, or (at your option) any later version.
- ~
- ~ This software is distributed in the hope that it will be useful,
- ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
- ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- ~ Lesser General Public License for more details.
- ~
- ~ You should have received a copy of the GNU Lesser General Public
- ~ License along with this software; if not, write to the Free
- ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- -->
-
<module xmlns="urn:jboss:module:1.0" name="org.jboss.teiid.translator.file">
<resources>
<resource-root path="translator-file-${project.version}.jar" />
Modified: branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/loopback/main/module.xml
===================================================================
--- branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/loopback/main/module.xml 2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/loopback/main/module.xml 2011-08-22 14:36:06 UTC (rev 3422)
@@ -1,27 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- ~ JBoss, Home of Professional Open Source.
- ~ Copyright 2010, Red Hat, Inc., and individual contributors
- ~ as indicated by the @author tags. See the copyright.txt file in the
- ~ distribution for a full listing of individual contributors.
- ~
- ~ This is free software; you can redistribute it and/or modify it
- ~ under the terms of the GNU Lesser General Public License as
- ~ published by the Free Software Foundation; either version 2.1 of
- ~ the License, or (at your option) any later version.
- ~
- ~ This software is distributed in the hope that it will be useful,
- ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
- ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- ~ Lesser General Public License for more details.
- ~
- ~ You should have received a copy of the GNU Lesser General Public
- ~ License along with this software; if not, write to the Free
- ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- -->
-
<module xmlns="urn:jboss:module:1.0" name="org.jboss.teiid.translator.loopback">
<resources>
<resource-root path="translator-loopback-${project.version}.jar" />
Modified: branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/olap/main/module.xml
===================================================================
--- branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/olap/main/module.xml 2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/olap/main/module.xml 2011-08-22 14:36:06 UTC (rev 3422)
@@ -1,27 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- ~ JBoss, Home of Professional Open Source.
- ~ Copyright 2010, Red Hat, Inc., and individual contributors
- ~ as indicated by the @author tags. See the copyright.txt file in the
- ~ distribution for a full listing of individual contributors.
- ~
- ~ This is free software; you can redistribute it and/or modify it
- ~ under the terms of the GNU Lesser General Public License as
- ~ published by the Free Software Foundation; either version 2.1 of
- ~ the License, or (at your option) any later version.
- ~
- ~ This software is distributed in the hope that it will be useful,
- ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
- ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- ~ Lesser General Public License for more details.
- ~
- ~ You should have received a copy of the GNU Lesser General Public
- ~ License along with this software; if not, write to the Free
- ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- -->
-
<module xmlns="urn:jboss:module:1.0" name="org.jboss.teiid.translator.file">
<resources>
<resource-root path="translator-loopback-${project.version}.jar" />
Modified: branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/salesforce/api/main/module.xml
===================================================================
--- branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/salesforce/api/main/module.xml 2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/salesforce/api/main/module.xml 2011-08-22 14:36:06 UTC (rev 3422)
@@ -1,27 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- ~ JBoss, Home of Professional Open Source.
- ~ Copyright 2010, Red Hat, Inc., and individual contributors
- ~ as indicated by the @author tags. See the copyright.txt file in the
- ~ distribution for a full listing of individual contributors.
- ~
- ~ This is free software; you can redistribute it and/or modify it
- ~ under the terms of the GNU Lesser General Public License as
- ~ published by the Free Software Foundation; either version 2.1 of
- ~ the License, or (at your option) any later version.
- ~
- ~ This software is distributed in the hope that it will be useful,
- ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
- ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- ~ Lesser General Public License for more details.
- ~
- ~ You should have received a copy of the GNU Lesser General Public
- ~ License along with this software; if not, write to the Free
- ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- -->
-
<module xmlns="urn:jboss:module:1.0" name="org.jboss.teiid.transalator.salesforce.api">
<resources>
<resource-root path="salesforce-api-${project.version}.jar" />
Modified: branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/salesforce/main/module.xml
===================================================================
--- branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/salesforce/main/module.xml 2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/salesforce/main/module.xml 2011-08-22 14:36:06 UTC (rev 3422)
@@ -1,27 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- ~ JBoss, Home of Professional Open Source.
- ~ Copyright 2010, Red Hat, Inc., and individual contributors
- ~ as indicated by the @author tags. See the copyright.txt file in the
- ~ distribution for a full listing of individual contributors.
- ~
- ~ This is free software; you can redistribute it and/or modify it
- ~ under the terms of the GNU Lesser General Public License as
- ~ published by the Free Software Foundation; either version 2.1 of
- ~ the License, or (at your option) any later version.
- ~
- ~ This software is distributed in the hope that it will be useful,
- ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
- ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- ~ Lesser General Public License for more details.
- ~
- ~ You should have received a copy of the GNU Lesser General Public
- ~ License along with this software; if not, write to the Free
- ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- -->
-
<module xmlns="urn:jboss:module:1.0" name="org.jboss.teiid.translator.salesforce">
<resources>
<resource-root path="translator-salesforce-${project.version}.jar" />
Modified: branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/ws/main/module.xml
===================================================================
--- branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/ws/main/module.xml 2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/ws/main/module.xml 2011-08-22 14:36:06 UTC (rev 3422)
@@ -1,30 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- ~ JBoss, Home of Professional Open Source.
- ~ Copyright 2010, Red Hat, Inc., and individual contributors
- ~ as indicated by the @author tags. See the copyright.txt file in the
- ~ distribution for a full listing of individual contributors.
- ~
- ~ This is free software; you can redistribute it and/or modify it
- ~ under the terms of the GNU Lesser General Public License as
- ~ published by the Free Software Foundation; either version 2.1 of
- ~ the License, or (at your option) any later version.
- ~
- ~ This software is distributed in the hope that it will be useful,
- ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
- ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- ~ Lesser General Public License for more details.
- ~
- ~ You should have received a copy of the GNU Lesser General Public
- ~ License along with this software; if not, write to the Free
- ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- -->
-
<module xmlns="urn:jboss:module:1.0" name="org.jboss.teiid.translator.ws">
<resources>
- <resource-root path="translator-ws-${project.version}.jar" />
+ <resource-root path="translator-ws-${project.name}.jar" />
<!-- Insert resources here -->
</resources>
@@ -35,4 +12,4 @@
<module name="org.jboss.teiid.common-core" />
<module name="org.jboss.teiid.api" />
</dependencies>
-</module>
\ No newline at end of file
+</module>
Modified: branches/as7/build/kits/jboss-as7/standalone/configuration/standalone-teiid.xml
===================================================================
--- branches/as7/build/kits/jboss-as7/standalone/configuration/standalone-teiid.xml 2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/build/kits/jboss-as7/standalone/configuration/standalone-teiid.xml 2011-08-22 14:36:06 UTC (rev 3422)
@@ -257,7 +257,7 @@
</security-domains>
</subsystem>
<subsystem xmlns="urn:jboss:domain:teiid:1.0">
- <query-engine>
+ <query-engine name = "default">
<async-thread-group>teiid-async</async-thread-group>
<event-distributor-name>teiid/event-distributor</event-distributor-name>
<security-domain>teiid-security</security-domain>
@@ -268,6 +268,7 @@
<socket-binding>teiid-odbc</socket-binding>
</odbc>
</query-engine>
+ <translator name="oracle" module="org.jboss.teiid.translator.jdbc"/>
</subsystem>
<subsystem xmlns="urn:jboss:domain:threads:1.0">
<queueless-thread-pool name="teiid-async">
Modified: branches/as7/build/pom.xml
===================================================================
--- branches/as7/build/pom.xml 2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/build/pom.xml 2011-08-22 14:36:06 UTC (rev 3422)
@@ -12,7 +12,7 @@
<dependency>
<groupId>org.jboss.teiid</groupId>
<artifactId>teiid-client-jdk15</artifactId>
- <version>${version}</version>
+ <version>${project.version}</version>
</dependency>
<dependency>
<groupId>net.sf.retrotranslator</groupId>
@@ -119,9 +119,9 @@
<mainClass>net.sf.retrotranslator.transformer.Retrotranslator</mainClass>
<arguments>
<argument>-srcjar</argument>
- <argument>${pom.basedir}/target/teiid-${pom.version}-client.jar</argument>
+ <argument>${pom.basedir}/target/teiid-${project.version}-client.jar</argument>
<argument>-destjar</argument>
- <argument>${pom.basedir}/target/teiid-${pom.version}-client-jdk15.jar</argument>
+ <argument>${pom.basedir}/target/teiid-${project.version}-client-jdk15.jar</argument>
<argument>-embed</argument>
<argument>org.teiid.retroruntime</argument>
</arguments>
Modified: branches/as7/engine/src/main/java/org/teiid/dqp/internal/datamgr/TranslatorRepository.java
===================================================================
--- branches/as7/engine/src/main/java/org/teiid/dqp/internal/datamgr/TranslatorRepository.java 2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/engine/src/main/java/org/teiid/dqp/internal/datamgr/TranslatorRepository.java 2011-08-22 14:36:06 UTC (rev 3422)
@@ -28,7 +28,6 @@
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
-import org.teiid.adminapi.Translator;
import org.teiid.adminapi.impl.VDBTranslatorMetaData;
@@ -41,8 +40,8 @@
this.translatorRepo.put(name, factory);
}
- public Translator getTranslatorMetaData(String name) {
- Translator factory = this.translatorRepo.get(name);
+ public VDBTranslatorMetaData getTranslatorMetaData(String name) {
+ VDBTranslatorMetaData factory = this.translatorRepo.get(name);
return factory;
}
Modified: branches/as7/engine/src/main/java/org/teiid/dqp/internal/process/DQPConfiguration.java
===================================================================
--- branches/as7/engine/src/main/java/org/teiid/dqp/internal/process/DQPConfiguration.java 2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/engine/src/main/java/org/teiid/dqp/internal/process/DQPConfiguration.java 2011-08-22 14:36:06 UTC (rev 3422)
@@ -42,8 +42,6 @@
private int timeSliceInMilli = DEFAULT_PROCESSOR_TIMESLICE;
private int maxRowsFetchSize = DEFAULT_FETCH_SIZE;
private int lobChunkSizeInKB = 100;
- private boolean useDataRoles = true;
- private boolean allowCreateTemporaryTablesByDefault = true;
private int queryThresholdInSecs = DEFAULT_QUERY_THRESHOLD;
private boolean exceptionOnMaxSourceRows = true;
private int maxSourceRows = -1;
@@ -55,7 +53,6 @@
private boolean detectingChangeEvents = true;
private transient AuthorizationValidator authorizationValidator;
- private boolean allowFunctionCallsByDefault;
public int getMaxActivePlans() {
return maxActivePlans;
Added: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/AuthorizationValidatorService.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/AuthorizationValidatorService.java (rev 0)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/AuthorizationValidatorService.java 2011-08-22 14:36:06 UTC (rev 3422)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.jboss;
+
+import org.jboss.msc.service.Service;
+import org.jboss.msc.service.StartContext;
+import org.jboss.msc.service.StartException;
+import org.jboss.msc.service.StopContext;
+import org.teiid.dqp.internal.process.AuthorizationValidator;
+
+public class AuthorizationValidatorService implements Service<AuthorizationValidator> {
+ private AuthorizationValidator validator;
+
+ public AuthorizationValidatorService(AuthorizationValidator value){
+ this.validator = value;
+ }
+
+ @Override
+ public void start(StartContext context) throws StartException {
+ }
+
+ @Override
+ public void stop(StopContext context) {
+ }
+
+ @Override
+ public AuthorizationValidator getValue() throws IllegalStateException, IllegalArgumentException {
+ return validator;
+ }
+
+}
Property changes on: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/AuthorizationValidatorService.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/Configuration.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/Configuration.java 2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/Configuration.java 2011-08-22 14:36:06 UTC (rev 3422)
@@ -100,6 +100,8 @@
public static final String TRANSLATOR_NAME = "name";//$NON-NLS-1$
public static final String TRANSLATOR_MODULE = "module";//$NON-NLS-1$
+ public static final String ENGINE_NAME = "name";//$NON-NLS-1$
+
public static final String DESC = ".describe"; //$NON-NLS-1$
static void addAttribute(ModelNode node, String name, String type, String description, ModelType dataType, boolean required, String defaultValue) {
node.get(type, name, TYPE).set(dataType);
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/Element.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/Element.java 2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/Element.java 2011-08-22 14:36:06 UTC (rev 3422)
@@ -32,6 +32,7 @@
QUERY_ENGINE_ELEMENT(QUERY_ENGINE),
// Query-ENGINE
+ ENGINE_NAME_ATTRIBUTE(ENGINE_NAME),
ASYNC_THREAD_GROUP_ELEMENT(ASYNC_THREAD_GROUP),
MAX_THREADS_ELEMENT(MAX_THREADS),
MAX_ACTIVE_PLANS_ELEMENT(MAX_ACTIVE_PLANS),
@@ -96,8 +97,13 @@
TRUST_FILE_ELEMENT(TRUST_FILE),
TRUST_PASSWD_ELEMENT(TRUST_PASSWD),
AUTH_MODE_ELEMENT(AUTH_MODE),
- SSL_ELEMENT(SSL);
+ SSL_ELEMENT(SSL),
+ // Translator
+ TRANSLATOR_ELEMENT(TRANSLATOR),
+ TRANSLATOR_NAME_ATTRIBUTE(TRANSLATOR_NAME),
+ TRANSLATOR_MODULE_ATTRIBUTE(TRANSLATOR_MODULE);
+
private final String name;
Element(final String name) {
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/JBossLifeCycleListener.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/JBossLifeCycleListener.java 2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/JBossLifeCycleListener.java 2011-08-22 14:36:06 UTC (rev 3422)
@@ -28,7 +28,7 @@
import org.jboss.msc.service.ServiceContainer.TerminateListener;
import org.teiid.deployers.ContainerLifeCycleListener;
-class JBossLifeCycleListener implements TerminateListener, ContainerLifeCycleListener{
+class JBossLifeCycleListener implements TerminateListener, ContainerLifeCycleListener {
private boolean shutdownInProgress = false;
private List<ContainerLifeCycleListener.LifeCycleEventListener> listeners = Collections.synchronizedList(new ArrayList<ContainerLifeCycleListener.LifeCycleEventListener>());
Copied: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/ObjectSerializer.java (from rev 3382, branches/as7/runtime/src/main/java/org/teiid/deployers/ObjectSerializer.java)
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/ObjectSerializer.java (rev 0)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/ObjectSerializer.java 2011-08-22 14:36:06 UTC (rev 3422)
@@ -0,0 +1,115 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.jboss;
+
+import java.io.*;
+
+import org.jboss.logging.Logger;
+import org.teiid.core.util.FileUtils;
+import org.teiid.logging.LogConstants;
+import org.teiid.logging.LogManager;
+import org.teiid.runtime.RuntimePlugin;
+
+
+public class ObjectSerializer {
+
+ private static final Logger log = Logger.getLogger(ObjectSerializer.class);
+
+ private static final String ATTACHMENT_SUFFIX = ".ser"; //$NON-NLS-1$
+
+ private String storagePath;
+
+ public ObjectSerializer(String path) {
+ this.storagePath = path;
+ }
+
+ public <T> T loadAttachment(File attachmentsStore, Class<T> expected) throws IOException, ClassNotFoundException {
+ if (log.isTraceEnabled()) {
+ log.trace("loadAttachment, attachmentsStore=" + attachmentsStore); //$NON-NLS-1$
+ }
+
+ ObjectInputStream ois = null;
+ try {
+ ois = new ObjectInputStream(new FileInputStream(attachmentsStore));
+ return expected.cast(ois.readObject());
+ } finally {
+ if (ois != null) {
+ ois.close();
+ }
+ }
+ }
+
+ public void saveAttachment(File attachmentsStore, Object attachment) throws IOException {
+ if (log.isTraceEnabled()) {
+ log.trace("saveAttachment, attachmentsStore=" + attachmentsStore + ", attachment=" + attachment); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ ObjectOutputStream oos = null;
+ try {
+ oos = new ObjectOutputStream(new FileOutputStream(attachmentsStore));
+ oos.writeObject(attachment);
+ } finally {
+ if (oos != null) {
+ oos.close();
+ }
+ }
+ }
+
+ public boolean isStale(File cacheFile, long timeAfter) {
+ return (cacheFile.exists() && timeAfter > cacheFile.lastModified());
+ }
+
+ public void removeAttachments(String fileName) {
+ String dirName = baseDirectory(fileName);
+ FileUtils.removeDirectoryAndChildren(new File(dirName));
+ }
+
+ public File getAttachmentPath(String fileName, String baseName) {
+
+ String dirName = baseDirectory(fileName);
+
+ final String vfsPath = baseName + ATTACHMENT_SUFFIX;
+ File f = new File(dirName, vfsPath);
+ if (!f.getParentFile().exists()) {
+ f.getParentFile().mkdirs();
+ }
+ return f;
+ }
+
+ private String baseDirectory(String fileName) {
+ String dirName = this.storagePath + File.separator + fileName + File.separator;
+ return dirName;
+ }
+
+ public <T> T loadSafe(File cacheFile, Class<T> clazz) {
+ try {
+ if (cacheFile.exists()) {
+ return clazz.cast(loadAttachment(cacheFile, clazz));
+ }
+ return null;
+ } catch (Exception e) {
+ LogManager.logWarning(LogConstants.CTX_RUNTIME, e, RuntimePlugin.Util.getString("invalid_metadata_file", cacheFile.getAbsolutePath())); //$NON-NLS-1$
+ }
+ cacheFile.delete();
+ return null;
+ }
+}
Added: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/ObjectsSerializerService.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/ObjectsSerializerService.java (rev 0)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/ObjectsSerializerService.java 2011-08-22 14:36:06 UTC (rev 3422)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.jboss;
+
+import org.jboss.msc.service.Service;
+import org.jboss.msc.service.StartContext;
+import org.jboss.msc.service.StartException;
+import org.jboss.msc.service.StopContext;
+import org.jboss.msc.value.InjectedValue;
+
+public class ObjectsSerializerService implements Service<ObjectSerializer> {
+ private InjectedValue<String> pathInjector = new InjectedValue<String>();
+ private ObjectSerializer serializer;
+
+ public ObjectsSerializerService(){
+ }
+
+ @Override
+ public void start(StartContext context) throws StartException {
+ this.serializer = new ObjectSerializer(pathInjector.getValue());
+ }
+
+ @Override
+ public void stop(StopContext context) {
+ }
+
+ @Override
+ public ObjectSerializer getValue() throws IllegalStateException, IllegalArgumentException {
+ return serializer;
+ }
+
+ public InjectedValue<String> getPathInjector() {
+ return pathInjector;
+ }
+}
Property changes on: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/ObjectsSerializerService.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineAdd.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineAdd.java 2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineAdd.java 2011-08-22 14:36:06 UTC (rev 3422)
@@ -21,9 +21,11 @@
*/
package org.teiid.jboss;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.*;
+
import java.util.List;
-import java.util.ServiceLoader;
-import java.util.concurrent.Executor;
+import java.util.Locale;
+import java.util.ResourceBundle;
import javax.resource.spi.XATerminator;
import javax.resource.spi.work.WorkManager;
@@ -33,56 +35,46 @@
import org.jboss.as.controller.OperationContext;
import org.jboss.as.controller.OperationFailedException;
import org.jboss.as.controller.ServiceVerificationHandler;
+import org.jboss.as.controller.descriptions.DescriptionProvider;
import org.jboss.as.naming.ManagedReferenceFactory;
import org.jboss.as.naming.ManagedReferenceInjector;
import org.jboss.as.naming.NamingStore;
import org.jboss.as.naming.service.BinderService;
import org.jboss.as.network.SocketBinding;
import org.jboss.as.security.plugins.SecurityDomainContext;
-import org.jboss.as.server.AbstractDeploymentChainStep;
-import org.jboss.as.server.DeploymentProcessorTarget;
-import org.jboss.as.server.deployment.Phase;
-import org.jboss.as.server.services.path.RelativePathService;
import org.jboss.dmr.ModelNode;
-import org.jboss.modules.Module;
-import org.jboss.modules.ModuleIdentifier;
-import org.jboss.modules.ModuleLoadException;
import org.jboss.msc.inject.ConcurrentMapInjector;
-import org.jboss.msc.service.AbstractServiceListener;
-import org.jboss.msc.service.ServiceBuilder;
-import org.jboss.msc.service.ServiceContainer;
-import org.jboss.msc.service.ServiceController;
-import org.jboss.msc.service.ServiceName;
-import org.jboss.msc.service.ServiceTarget;
+import org.jboss.msc.service.*;
import org.jboss.msc.value.InjectedValue;
-import org.teiid.PolicyDecider;
-import org.teiid.cache.CacheConfiguration;
-import org.teiid.cache.CacheFactory;
-import org.teiid.cache.DefaultCacheFactory;
-import org.teiid.deployers.ObjectSerializer;
import org.teiid.deployers.SystemVDBDeployer;
-import org.teiid.deployers.VDBDependencyProcessor;
-import org.teiid.deployers.VDBDeployer;
-import org.teiid.deployers.VDBParserDeployer;
import org.teiid.deployers.VDBRepository;
-import org.teiid.deployers.VDBStructure;
import org.teiid.dqp.internal.datamgr.TranslatorRepository;
import org.teiid.dqp.internal.process.AuthorizationValidator;
-import org.teiid.dqp.internal.process.DataRolePolicyDecider;
-import org.teiid.dqp.internal.process.DefaultAuthorizationValidator;
import org.teiid.jboss.deployers.RuntimeEngineDeployer;
import org.teiid.logging.LogConstants;
import org.teiid.logging.LogManager;
-import org.teiid.query.function.SystemFunctionManager;
import org.teiid.services.BufferServiceImpl;
import org.teiid.transport.ClientServiceRegistry;
import org.teiid.transport.LocalServerConnection;
import org.teiid.transport.SSLConfiguration;
import org.teiid.transport.SocketConfiguration;
-class QueryEngineAdd extends AbstractBoottimeAddStepHandler {
+class QueryEngineAdd extends AbstractBoottimeAddStepHandler implements DescriptionProvider {
@Override
+ public ModelNode getModelDescription(Locale locale) {
+ final ResourceBundle bundle = IntegrationPlugin.getResourceBundle(locale);
+
+ final ModelNode node = new ModelNode();
+ node.get(OPERATION_NAME).set(ADD);
+ node.get(DESCRIPTION).set("engine.add"); //$NON-NLS-1$
+
+ ModelNode engine = node.get(REQUEST_PROPERTIES, Configuration.QUERY_ENGINE);
+ TeiidModelDescription.getQueryEngineDescription(engine, ATTRIBUTES, bundle);
+ return node;
+ }
+
+ @Override
protected void populateModel(ModelNode operation, ModelNode model) {
final ModelNode queryEngineNode = operation.require(Configuration.QUERY_ENGINE);
model.set(Configuration.QUERY_ENGINE).set(queryEngineNode.clone());
@@ -95,58 +87,8 @@
final ModelNode queryEngineNode = operation.require(Configuration.QUERY_ENGINE);
ServiceTarget target = context.getServiceTarget();
- final VDBRepository vdbRepo = buildVDBRepository(queryEngineNode);
final JBossLifeCycleListener shutdownListener = new JBossLifeCycleListener();
-
- SystemVDBDeployer systemVDB = new SystemVDBDeployer();
- systemVDB.setVDBRepository(vdbRepo);
- SystemVDBService systemVDBService = new SystemVDBService(systemVDB);
- newControllers.add(target.addService(TeiidServiceNames.SYSTEM_VDB, systemVDBService).install());
-
- //FIXME *******************
- final ObjectSerializer serializer = new ObjectSerializer("/tmp");
- //FIXME *******************
-
- final TranslatorRepository translatorRepo = new TranslatorRepository();
- TranslatorRepositoryService translatorService = new TranslatorRepositoryService(translatorRepo);
- newControllers.add(target.addService(TeiidServiceNames.TRANSLATOR_REPO, translatorService).install());
-
- newControllers.add(RelativePathService.addService(TeiidServiceNames.BUFFER_DIR, "teiid-buffer", "jboss.server.temp.dir", target)); //$NON-NLS-1$ //$NON-NLS-2$
-
- // TODO: remove verbose service by moving the buffer service from runtime project
- final BufferServiceImpl bufferManager = buildBufferManager(queryEngineNode.get(Configuration.BUFFER_SERVICE));
- BufferManagerService bufferService = new BufferManagerService(bufferManager);
- ServiceBuilder<BufferServiceImpl> bufferServiceBuilder = target.addService(TeiidServiceNames.BUFFER_MGR, bufferService);
- bufferServiceBuilder.addDependency(TeiidServiceNames.BUFFER_DIR, String.class, bufferService.pathInjector);
- newControllers.add(bufferServiceBuilder.install());
-
- PolicyDecider policyDecider;
- if (queryEngineNode.hasDefined(Configuration.POLICY_DECIDER_MODULE)) {
- policyDecider = buildService(PolicyDecider.class, queryEngineNode.get(Configuration.POLICY_DECIDER_MODULE).asString());
- }
- else {
- DataRolePolicyDecider drpd = new DataRolePolicyDecider();
- drpd.setAllowCreateTemporaryTablesByDefault(true);
- drpd.setAllowFunctionCallsByDefault(true);
- policyDecider = drpd;
- }
-
- AuthorizationValidator authValidator;
- if (queryEngineNode.hasDefined(Configuration.AUTHORIZATION_VALIDATOR_MODULE)) {
- authValidator = buildService(AuthorizationValidator.class, queryEngineNode.get(Configuration.AUTHORIZATION_VALIDATOR_MODULE).asString());
- authValidator.setEnabled(true);
- }
- else {
- DefaultAuthorizationValidator dap = new DefaultAuthorizationValidator();
- dap.setPolicyDecider(policyDecider);
- dap.setEnabled(true);
- authValidator = dap;
- }
-
- CacheFactory cacheFactory = getCacheFactory(queryEngineNode.get(Configuration.CACHE_FACORY));
- CacheConfiguration resultsetCache = buildCacheConfig(queryEngineNode.get(Configuration.RESULTSET_CACHE));
- CacheConfiguration preparePlanCache = buildCacheConfig(queryEngineNode.get(Configuration.PREPAREDPLAN_CACHE));
-
+
SocketConfiguration jdbc = null;
if (queryEngineNode.hasDefined(Configuration.JDBC)) {
jdbc = buildSocketConfiguration(queryEngineNode.get(Configuration.JDBC));
@@ -157,33 +99,25 @@
odbc = buildSocketConfiguration(queryEngineNode.get(Configuration.ODBC));
}
- String asyncExecutor = "teiid-async"; //$NON-NLS-1$
- if (queryEngineNode.hasDefined(Configuration.ASYNC_THREAD_GROUP)) {
- asyncExecutor = queryEngineNode.get(Configuration.ASYNC_THREAD_GROUP).asString();
- }
-
// now build the engine
final RuntimeEngineDeployer engine = buildQueryEngine(queryEngineNode);
engine.setJdbcSocketConfiguration(jdbc);
engine.setOdbcSocketConfiguration(odbc);
- engine.setVDBRepository(vdbRepo);
- engine.setCacheFactory(cacheFactory);
- engine.setResultsetCacheConfig(resultsetCache);
- engine.setPreparedPlanCacheConfig(preparePlanCache);
engine.setSecurityHelper(new JBossSecurityHelper());
- engine.setTranslatorRepository(translatorRepo);
- engine.setAuthorizationValidator(authValidator);
engine.setContainerLifeCycleListener(shutdownListener);
+ // TODO: none of the caching is configured..
- ServiceBuilder<ClientServiceRegistry> serviceBuilder = target.addService(TeiidServiceNames.ENGINE, engine);
+ ServiceBuilder<ClientServiceRegistry> serviceBuilder = target.addService(TeiidServiceNames.engineServiceName(engine.getName()), engine);
serviceBuilder.addDependency(ServiceName.JBOSS.append("connector", "workmanager"), WorkManager.class, engine.workManagerInjector); //$NON-NLS-1$ //$NON-NLS-2$
serviceBuilder.addDependency(ServiceName.JBOSS.append("txn", "XATerminator"), XATerminator.class, engine.xaTerminatorInjector); //$NON-NLS-1$ //$NON-NLS-2$
serviceBuilder.addDependency(ServiceName.JBOSS.append("txn", "TransactionManager"), TransactionManager.class, engine.txnManagerInjector); //$NON-NLS-1$ //$NON-NLS-2$
- serviceBuilder.addDependency(ServiceName.JBOSS.append("thread", "executor", asyncExecutor), Executor.class, engine.threadPoolInjector); //$NON-NLS-1$ //$NON-NLS-2$
serviceBuilder.addDependency(TeiidServiceNames.BUFFER_MGR, BufferServiceImpl.class, engine.bufferServiceInjector);
serviceBuilder.addDependency(TeiidServiceNames.SYSTEM_VDB, SystemVDBDeployer.class, new InjectedValue<SystemVDBDeployer>());
+ serviceBuilder.addDependency(TeiidServiceNames.TRANSLATOR_REPO, TranslatorRepository.class, engine.translatorRepositoryInjector);
+ serviceBuilder.addDependency(TeiidServiceNames.VDB_REPO, VDBRepository.class, engine.vdbRepositoryInjector);
+ serviceBuilder.addDependency(TeiidServiceNames.AUTHORIZATION_VALIDATOR, AuthorizationValidator.class, engine.authorizationValidatorInjector);
if (jdbc != null) {
serviceBuilder.addDependency(ServiceName.JBOSS.append("binding", jdbc.getSocketBinding()), SocketBinding.class, engine.jdbcSocketBindingInjector); //$NON-NLS-1$
@@ -198,7 +132,7 @@
BinderService binder = new BinderService(LocalServerConnection.TEIID_RUNTIME);
ServiceBuilder<ManagedReferenceFactory> namingBuilder = target.addService(javaContext.append(LocalServerConnection.TEIID_RUNTIME), binder);
namingBuilder.addDependency(javaContext, NamingStore.class, binder.getNamingStoreInjector());
- namingBuilder.addDependency(TeiidServiceNames.ENGINE, RuntimeEngineDeployer.class, new ManagedReferenceInjector<RuntimeEngineDeployer>(binder.getManagedObjectInjector()));
+ namingBuilder.addDependency(TeiidServiceNames.engineServiceName(engine.getName()), RuntimeEngineDeployer.class, new ManagedReferenceInjector<RuntimeEngineDeployer>(binder.getManagedObjectInjector()));
namingBuilder.setInitialMode(ServiceController.Mode.ON_DEMAND);
newControllers.add(namingBuilder.install());
@@ -215,49 +149,18 @@
}
}
}
-
- serviceBuilder.addListener(new AbstractServiceListener<Object>() {
- @Override
- public void transition(ServiceController<?> serviceController, ServiceController.Transition transition) {
-
- if (transition.equals(ServiceController.Transition.START_INITIATING_to_STARTING)) {
- vdbRepo.start();
- bufferManager.start();
- }
-
- if (transition.equals(ServiceController.Transition.STOPPING_to_DOWN)) {
- bufferManager.stop();
- }
- }
-
- @Override
- public void serviceRemoveRequested(ServiceController<?> serviceController) {
- serviceController.removeListener(this);
- }
- });
serviceBuilder.setInitialMode(ServiceController.Mode.ACTIVE);
ServiceController<ClientServiceRegistry> controller = serviceBuilder.install();
newControllers.add(controller);
ServiceContainer container = controller.getServiceContainer();
container.addTerminateListener(shutdownListener);
-
- context.addStep(new AbstractDeploymentChainStep() {
- @Override
- public void execute(DeploymentProcessorTarget processorTarget) {
- processorTarget.addDeploymentProcessor(Phase.STRUCTURE, Phase.STRUCTURE_WAR_DEPLOYMENT_INIT|0x0001,new VDBStructure());
- processorTarget.addDeploymentProcessor(Phase.PARSE, Phase.PARSE_WEB_DEPLOYMENT|0x0001, new VDBParserDeployer(vdbRepo, serializer));
- processorTarget.addDeploymentProcessor(Phase.DEPENDENCIES, Phase.DEPENDENCIES_WAR_MODULE|0x0001, new VDBDependencyProcessor());
- processorTarget.addDeploymentProcessor(Phase.INSTALL, Phase.INSTALL_WAR_DEPLOYMENT|0x0001, new VDBDeployer(vdbRepo, engine.threadPoolInjector, translatorRepo, serializer, shutdownListener));
- }
-
- }, OperationContext.Stage.RUNTIME);
}
private RuntimeEngineDeployer buildQueryEngine(ModelNode node) {
- RuntimeEngineDeployer engine = new RuntimeEngineDeployer();
-
+ RuntimeEngineDeployer engine = new RuntimeEngineDeployer(node.require(Configuration.ENGINE_NAME).asString());
+
if (node.hasDefined(Configuration.MAX_THREADS)) {
engine.setMaxThreads(node.get(Configuration.MAX_THREADS).asInt());
}
@@ -303,113 +206,8 @@
return engine;
}
-
-
- private VDBRepository buildVDBRepository(ModelNode node) {
- SystemFunctionManager systemFunctionManager = new SystemFunctionManager();
- if (node.hasDefined(Configuration.ALLOW_ENV_FUNCTION)) {
- systemFunctionManager.setAllowEnvFunction(node.get(Configuration.ALLOW_ENV_FUNCTION).asBoolean());
- }
- else {
- systemFunctionManager.setAllowEnvFunction(false);
- }
-
- VDBRepository vdbRepository = new VDBRepository();
- vdbRepository.setSystemFunctionManager(systemFunctionManager);
- return vdbRepository;
- }
+
- private BufferServiceImpl buildBufferManager(ModelNode node) {
- BufferServiceImpl bufferManger = new BufferServiceImpl();
-
- if (node == null) {
- return bufferManger;
- }
-
- if (node.hasDefined(Configuration.USE_DISK)) {
- bufferManger.setUseDisk(node.get(Configuration.USE_DISK).asBoolean());
- }
- if (node.hasDefined(Configuration.PROCESSOR_BATCH_SIZE)) {
- bufferManger.setProcessorBatchSize(node.get(Configuration.PROCESSOR_BATCH_SIZE).asInt());
- }
- if (node.hasDefined(Configuration.CONNECTOR_BATCH_SIZE)) {
- bufferManger.setConnectorBatchSize(node.get(Configuration.CONNECTOR_BATCH_SIZE).asInt());
- }
- if (node.hasDefined(Configuration.MAX_PROCESSING_KB)) {
- bufferManger.setMaxProcessingKb(node.get(Configuration.MAX_PROCESSING_KB).asInt());
- }
- if (node.hasDefined(Configuration.MAX_RESERVED_KB)) {
- bufferManger.setMaxReserveKb(node.get(Configuration.MAX_RESERVED_KB).asInt());
- }
- if (node.hasDefined(Configuration.MAX_FILE_SIZE)) {
- bufferManger.setMaxFileSize(node.get(Configuration.MAX_FILE_SIZE).asLong());
- }
- if (node.hasDefined(Configuration.MAX_BUFFER_SPACE)) {
- bufferManger.setMaxBufferSpace(node.get(Configuration.MAX_BUFFER_SPACE).asLong());
- }
- if (node.hasDefined(Configuration.MAX_OPEN_FILES)) {
- bufferManger.setMaxOpenFiles(node.get(Configuration.MAX_OPEN_FILES).asInt());
- }
- return bufferManger;
- }
-
- private <T> T buildService(Class<T> type, String moduleName) throws OperationFailedException {
- final ModuleIdentifier moduleId;
- final Module module;
- try {
- moduleId = ModuleIdentifier.create(moduleName);
- module = Module.getCallerModuleLoader().loadModule(moduleId);
- } catch (ModuleLoadException e) {
- throw new OperationFailedException(e, new ModelNode().set(IntegrationPlugin.Util.getString("failed_load_module", moduleName))); //$NON-NLS-1$
- }
- ServiceLoader<T> services = module.loadService(type);
- return services.iterator().next();
- }
-
- private CacheFactory getCacheFactory(ModelNode node) {
- CacheFactory cacheFactory = new DefaultCacheFactory();
- /*
- if (node.hasDefined(Configuration.CLASS)) {
- String className = node.get(Configuration.CLASS).asString();
- }
-
- if (node.hasDefined(Configuration.ENABLED)) {
- cacheFactory.setEnabled(node.get(Configuration.ENABLED).asBoolean());
- }
- else {
- cacheFactory.setEnabled(true);
- }
- if (node.hasDefined(Configuration.CACHE_SERVICE_JNDI_NAME)) {
- cacheFactory.setCacheManager(node.get(Configuration.CACHE_SERVICE_JNDI_NAME).asString());
- }
- if (node.hasDefined(Configuration.RESULTSET_CACHE_NAME)) {
- cacheFactory.setResultsetCacheName(node.get(Configuration.RESULTSET_CACHE_NAME).asString());
- }
- */
- return cacheFactory;
- }
-
- private CacheConfiguration buildCacheConfig(ModelNode node) {
- CacheConfiguration cacheConfig = new CacheConfiguration();
-
- if (node.hasDefined(Configuration.MAX_ENTRIES)) {
- cacheConfig.setMaxEntries(node.get(Configuration.MAX_ENTRIES).asInt());
- }
- if (node.hasDefined(Configuration.MAX_AGE_IN_SECS)) {
- cacheConfig.setMaxAgeInSeconds(node.get(Configuration.MAX_AGE_IN_SECS).asInt());
- }
- if (node.hasDefined(Configuration.MAX_STALENESS)) {
- cacheConfig.setMaxStaleness(node.get(Configuration.MAX_STALENESS).asInt());
- }
- if (node.hasDefined(Configuration.CACHE_TYPE)) {
- cacheConfig.setType(node.get(Configuration.CACHE_TYPE).asString());
- }
- if (node.hasDefined(Configuration.CACHE_LOCATION)) {
- cacheConfig.setLocation(node.get(Configuration.CACHE_LOCATION).asString());
- }
- return cacheConfig;
- }
-
private SocketConfiguration buildSocketConfiguration(ModelNode node) {
SocketConfiguration socket = new SocketConfiguration();
Deleted: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineDescription.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineDescription.java 2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineDescription.java 2011-08-22 14:36:06 UTC (rev 3422)
@@ -1,181 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.jboss;
-
-import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.*;
-import static org.teiid.jboss.Configuration.*;
-
-import java.util.Locale;
-import java.util.ResourceBundle;
-
-import org.jboss.as.controller.descriptions.DescriptionProvider;
-import org.jboss.dmr.ModelNode;
-import org.jboss.dmr.ModelType;
-
-class QueryEngineDescription implements DescriptionProvider {
-
-
- @Override
- public ModelNode getModelDescription(Locale locale) {
- final ResourceBundle bundle = IntegrationPlugin.getResourceBundle(locale);
-
- final ModelNode node = new ModelNode();
- node.get(OPERATION_NAME).set(ADD);
- node.get(DESCRIPTION).set("susbsystem.add"); //$NON-NLS-1$
-
- getQueryEngineDescription(node.get(CHILDREN, Configuration.QUERY_ENGINE), REQUEST_PROPERTIES, bundle);
- return node;
- }
-
- static void getQueryEngineDescription(ModelNode node, String type, ResourceBundle bundle) {
- addAttribute(node, Configuration.ASYNC_THREAD_GROUP, type, bundle.getString(Configuration.ASYNC_THREAD_GROUP+DESC), ModelType.STRING, false, "teiid-async"); //$NON-NLS-1$
- addAttribute(node, Configuration.MAX_THREADS, type, bundle.getString(Configuration.MAX_THREADS+DESC), ModelType.INT, false, "64"); //$NON-NLS-1$
- addAttribute(node, Configuration.MAX_ACTIVE_PLANS, type, bundle.getString(Configuration.MAX_ACTIVE_PLANS+DESC), ModelType.INT, false, "20"); //$NON-NLS-1$
- addAttribute(node, Configuration.USER_REQUEST_SOURCE_CONCURRENCY, type, bundle.getString(Configuration.USER_REQUEST_SOURCE_CONCURRENCY+DESC), ModelType.INT, false, "0"); //$NON-NLS-1$
- addAttribute(node, Configuration.TIME_SLICE_IN_MILLI, type, bundle.getString(Configuration.TIME_SLICE_IN_MILLI+DESC), ModelType.INT, false, "2000"); //$NON-NLS-1$
- addAttribute(node, Configuration.MAX_ROWS_FETCH_SIZE, type, bundle.getString(Configuration.MAX_ROWS_FETCH_SIZE+DESC), ModelType.INT, false, "20480"); //$NON-NLS-1$
- addAttribute(node, Configuration.LOB_CHUNK_SIZE_IN_KB, type, bundle.getString(Configuration.LOB_CHUNK_SIZE_IN_KB+DESC), ModelType.INT, false, "100"); //$NON-NLS-1$
- addAttribute(node, Configuration.QUERY_THRESHOLD_IN_SECS, type, bundle.getString(Configuration.QUERY_THRESHOLD_IN_SECS+DESC), ModelType.INT, false, "600"); //$NON-NLS-1$
- addAttribute(node, Configuration.MAX_SOURCE_ROWS, type, bundle.getString(Configuration.MAX_SOURCE_ROWS+DESC), ModelType.INT, false, "-1"); //$NON-NLS-1$
- addAttribute(node, Configuration.EXCEPTION_ON_MAX_SOURCE_ROWS, type, bundle.getString(Configuration.EXCEPTION_ON_MAX_SOURCE_ROWS+DESC), ModelType.BOOLEAN, false, "true"); //$NON-NLS-1$
- addAttribute(node, Configuration.MAX_ODBC_LOB_SIZE_ALLOWED, type, bundle.getString(Configuration.MAX_ODBC_LOB_SIZE_ALLOWED+DESC), ModelType.INT, false, "5242880"); //$NON-NLS-1$
- addAttribute(node, Configuration.EVENT_DISTRIBUTOR_NAME, type, bundle.getString(Configuration.EVENT_DISTRIBUTOR_NAME+DESC), ModelType.STRING, false, "teiid/event-distributor"); //$NON-NLS-1$
- addAttribute(node, Configuration.DETECTING_CHANGE_EVENTS, type, bundle.getString(Configuration.DETECTING_CHANGE_EVENTS+DESC), ModelType.BOOLEAN, false, "true"); //$NON-NLS-1$
-
- //session stuff
- addAttribute(node, Configuration.SECURITY_DOMAIN, type, bundle.getString(Configuration.SECURITY_DOMAIN+DESC), ModelType.STRING, false, null);
- addAttribute(node, Configuration.MAX_SESSIONS_ALLOWED, type, bundle.getString(Configuration.MAX_SESSIONS_ALLOWED+DESC), ModelType.INT, false, "5000"); //$NON-NLS-1$
- addAttribute(node, Configuration.SESSION_EXPIRATION_TIME_LIMIT, type, bundle.getString(Configuration.SESSION_EXPIRATION_TIME_LIMIT+DESC), ModelType.INT, false, "0"); //$NON-NLS-1$
-
- addAttribute(node, Configuration.ALLOW_ENV_FUNCTION, type, bundle.getString(Configuration.ALLOW_ENV_FUNCTION+DESC), ModelType.BOOLEAN, false, "false"); //$NON-NLS-1$
-
- //Buffer Manager stuff
- ModelNode bufferNode = node.get(CHILDREN, Configuration.BUFFER_SERVICE);
- bufferNode.get(TYPE).set(ModelType.OBJECT);
- bufferNode.get(DESCRIPTION).set(bundle.getString(Configuration.BUFFER_SERVICE+DESC));
- bufferNode.get(REQUIRED).set(false);
- bufferNode.get(MAX_OCCURS).set(1);
- bufferNode.get(MIN_OCCURS).set(1);
- getBufferDescription(bufferNode, type, bundle);
-
- // result-set-cache
- ModelNode rsCacheNode = node.get(CHILDREN, Configuration.RESULTSET_CACHE);
- rsCacheNode.get(TYPE).set(ModelType.OBJECT);
- rsCacheNode.get(DESCRIPTION).set(bundle.getString(Configuration.RESULTSET_CACHE+DESC));
- rsCacheNode.get(REQUIRED).set(false);
- rsCacheNode.get(MAX_OCCURS).set(1);
- rsCacheNode.get(MIN_OCCURS).set(1);
- getResultsetCacheDescription(rsCacheNode, type, bundle);
-
- // preparedplan-set-cache
- ModelNode preparedPlanCacheNode = node.get(CHILDREN, Configuration.PREPAREDPLAN_CACHE);
- preparedPlanCacheNode.get(TYPE).set(ModelType.OBJECT);
- preparedPlanCacheNode.get(DESCRIPTION).set(bundle.getString(Configuration.PREPAREDPLAN_CACHE+DESC));
- preparedPlanCacheNode.get(REQUIRED).set(false);
- preparedPlanCacheNode.get(MAX_OCCURS).set(1);
- preparedPlanCacheNode.get(MIN_OCCURS).set(1);
- getResultsetCacheDescription(preparedPlanCacheNode, type, bundle);
-
- //distributed-cache
- ModelNode distributedCacheNode = node.get(CHILDREN, Configuration.CACHE_FACORY);
- distributedCacheNode.get(TYPE).set(ModelType.OBJECT);
- distributedCacheNode.get(DESCRIPTION).set(bundle.getString(Configuration.CACHE_FACORY+DESC));
- distributedCacheNode.get(REQUIRED).set(false);
- distributedCacheNode.get(MAX_OCCURS).set(1);
- distributedCacheNode.get(MIN_OCCURS).set(1);
- getDistributedCacheDescription(preparedPlanCacheNode, type, bundle);
-
- //jdbc
- ModelNode jdbcSocketNode = node.get(CHILDREN, Configuration.JDBC);
- jdbcSocketNode.get(TYPE).set(ModelType.OBJECT);
- jdbcSocketNode.get(DESCRIPTION).set(bundle.getString(Configuration.JDBC+DESC));
- jdbcSocketNode.get(REQUIRED).set(false);
- jdbcSocketNode.get(MAX_OCCURS).set(1);
- jdbcSocketNode.get(MIN_OCCURS).set(1);
- getSocketConfig(jdbcSocketNode, type, bundle);
-
- //odbc
- ModelNode odbcSocketNode = node.get(CHILDREN, Configuration.ODBC);
- odbcSocketNode.get(TYPE).set(ModelType.OBJECT);
- odbcSocketNode.get(DESCRIPTION).set(bundle.getString(Configuration.ODBC+DESC));
- odbcSocketNode.get(REQUIRED).set(false);
- odbcSocketNode.get(MAX_OCCURS).set(1);
- odbcSocketNode.get(MIN_OCCURS).set(1);
- getSocketConfig(odbcSocketNode, type, bundle);
- }
-
- private static void getDistributedCacheDescription(ModelNode node, String type, ResourceBundle bundle) {
- addAttribute(node, Configuration.CACHE_SERVICE_JNDI_NAME, type, bundle.getString(Configuration.CACHE_SERVICE_JNDI_NAME+DESC), ModelType.STRING, false, "java:TeiidCacheManager"); //$NON-NLS-1$
- addAttribute(node, Configuration.RESULTSET_CACHE_NAME, type, bundle.getString(Configuration.RESULTSET_CACHE_NAME+DESC), ModelType.STRING, false, "teiid-resultset-cache"); //$NON-NLS-1$
- }
-
- private static void getBufferDescription(ModelNode node, String type, ResourceBundle bundle) {
- addAttribute(node, Configuration.USE_DISK, type, bundle.getString(Configuration.USE_DISK+DESC), ModelType.BOOLEAN, false, "true"); //$NON-NLS-1$
- addAttribute(node, Configuration.PROCESSOR_BATCH_SIZE, type, bundle.getString(Configuration.PROCESSOR_BATCH_SIZE+DESC), ModelType.INT, false, "512"); //$NON-NLS-1$
- addAttribute(node, Configuration.CONNECTOR_BATCH_SIZE, type, bundle.getString(Configuration.CONNECTOR_BATCH_SIZE+DESC), ModelType.INT, false, "1024"); //$NON-NLS-1$
- addAttribute(node, Configuration.MAX_PROCESSING_KB, type, bundle.getString(Configuration.MAX_PROCESSING_KB+DESC), ModelType.INT, false, "-1"); //$NON-NLS-1$
- addAttribute(node, Configuration.MAX_RESERVED_KB, type, bundle.getString(Configuration.MAX_RESERVED_KB+DESC), ModelType.INT, false, "-1"); //$NON-NLS-1$
- addAttribute(node, Configuration.MAX_FILE_SIZE, type, bundle.getString(Configuration.MAX_FILE_SIZE+DESC), ModelType.LONG, false, "2048"); //$NON-NLS-1$
- addAttribute(node, Configuration.MAX_BUFFER_SPACE, type, bundle.getString(Configuration.MAX_BUFFER_SPACE+DESC), ModelType.LONG, false, "51200"); //$NON-NLS-1$
- addAttribute(node, Configuration.MAX_OPEN_FILES, type, bundle.getString(Configuration.MAX_OPEN_FILES+DESC), ModelType.INT, false, "64"); //$NON-NLS-1$
- }
-
- static void getResultsetCacheDescription(ModelNode node, String type, ResourceBundle bundle) {
- addAttribute(node, Configuration.MAX_ENTRIES, type, bundle.getString(Configuration.MAX_ENTRIES+DESC), ModelType.INT, false, "1024"); //$NON-NLS-1$
- addAttribute(node, Configuration.MAX_AGE_IN_SECS, type, bundle.getString(Configuration.MAX_AGE_IN_SECS+DESC), ModelType.INT, false, "7200");//$NON-NLS-1$
- addAttribute(node, Configuration.MAX_STALENESS, type, bundle.getString(Configuration.MAX_STALENESS+DESC), ModelType.INT, false, "60");//$NON-NLS-1$
- addAttribute(node, Configuration.CACHE_TYPE, type, bundle.getString(Configuration.CACHE_TYPE+DESC), ModelType.STRING, false, "EXPIRATION"); //$NON-NLS-1$
- addAttribute(node, Configuration.CACHE_LOCATION, type, bundle.getString(Configuration.CACHE_LOCATION+DESC), ModelType.STRING, false, "resultset"); //$NON-NLS-1$
- }
-
- static void getPreparedPalnCacheDescription(ModelNode node, String type, ResourceBundle bundle) {
- addAttribute(node, Configuration.MAX_ENTRIES, type, bundle.getString(Configuration.MAX_ENTRIES+DESC), ModelType.INT, false, "512"); //$NON-NLS-1$
- addAttribute(node, Configuration.MAX_AGE_IN_SECS, type, bundle.getString(Configuration.MAX_AGE_IN_SECS+DESC), ModelType.INT, false, "28800");//$NON-NLS-1$
- addAttribute(node, Configuration.MAX_STALENESS, type, bundle.getString(Configuration.MAX_STALENESS+DESC), ModelType.INT, false, "0");//$NON-NLS-1$
- addAttribute(node, Configuration.CACHE_TYPE, type, bundle.getString(Configuration.CACHE_TYPE+DESC), ModelType.STRING, false, "LRU"); //$NON-NLS-1$
- addAttribute(node, Configuration.CACHE_LOCATION, type, bundle.getString(Configuration.CACHE_LOCATION+DESC), ModelType.STRING, false, "preparedplan"); //$NON-NLS-1$
- }
-
- static void getSocketConfig(ModelNode node, String type, ResourceBundle bundle) {
- addAttribute(node, Configuration.SOCKET_ENABLED, type, bundle.getString(Configuration.SOCKET_ENABLED+DESC), ModelType.BOOLEAN, false, "true"); //$NON-NLS-1$
- addAttribute(node, Configuration.MAX_SOCKET_THREAD_SIZE, type, bundle.getString(Configuration.MAX_SOCKET_THREAD_SIZE+DESC), ModelType.INT, false, "0"); //$NON-NLS-1$
- addAttribute(node, Configuration.IN_BUFFER_SIZE, type, bundle.getString(Configuration.IN_BUFFER_SIZE+DESC), ModelType.INT, false, "0"); //$NON-NLS-1$
- addAttribute(node, Configuration.OUT_BUFFER_SIZE, type, bundle.getString(Configuration.OUT_BUFFER_SIZE+DESC), ModelType.INT, false, "0"); //$NON-NLS-1$
- addAttribute(node, Configuration.SOCKET_BINDING, type, bundle.getString(Configuration.SOCKET_BINDING+DESC), ModelType.INT, true, null);
-
- ModelNode sslNode = node.get(CHILDREN, Configuration.SSL);
- sslNode.get(TYPE).set(ModelType.OBJECT);
- sslNode.get(DESCRIPTION).set(bundle.getString(Configuration.SSL+DESC));
- sslNode.get(REQUIRED).set(false);
- sslNode.get(MAX_OCCURS).set(1);
- sslNode.get(MIN_OCCURS).set(0);
- addAttribute(node, Configuration.SSL_MODE, type, bundle.getString(Configuration.SSL_MODE+DESC), ModelType.STRING, false, "login"); //$NON-NLS-1$
- addAttribute(node, Configuration.KEY_STORE_FILE, type, bundle.getString(Configuration.KEY_STORE_FILE+DESC), ModelType.STRING, false, null);
- addAttribute(node, Configuration.KEY_STORE_PASSWD, type, bundle.getString(Configuration.KEY_STORE_PASSWD+DESC), ModelType.STRING, false, null);
- addAttribute(node, Configuration.KEY_STORE_TYPE, type, bundle.getString(Configuration.KEY_STORE_TYPE+DESC), ModelType.STRING, false, "JKS"); //$NON-NLS-1$
- addAttribute(node, Configuration.SSL_PROTOCOL, type, bundle.getString(Configuration.SSL_PROTOCOL+DESC), ModelType.BOOLEAN, false, "SSLv3"); //$NON-NLS-1$
- addAttribute(node, Configuration.KEY_MANAGEMENT_ALG, type, bundle.getString(Configuration.KEY_MANAGEMENT_ALG+DESC), ModelType.STRING, false, "false"); //$NON-NLS-1$
- addAttribute(node, Configuration.TRUST_FILE, type, bundle.getString(Configuration.TRUST_FILE+DESC), ModelType.STRING, false, null);
- addAttribute(node, Configuration.TRUST_PASSWD, type, bundle.getString(Configuration.TRUST_PASSWD+DESC), ModelType.STRING, false, null);
- addAttribute(node, Configuration.AUTH_MODE, type, bundle.getString(Configuration.AUTH_MODE+DESC), ModelType.STRING, false, "anonymous"); //$NON-NLS-1$
- }
-}
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineOperationHandler.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineOperationHandler.java 2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineOperationHandler.java 2011-08-22 14:36:06 UTC (rev 3422)
@@ -22,6 +22,7 @@
package org.teiid.jboss;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.*;
+import static org.teiid.jboss.Configuration.addAttribute;
import java.util.Collection;
import java.util.List;
@@ -56,7 +57,7 @@
protected void performRuntime(final OperationContext context, final ModelNode operation, final ModelNode model,
final ServiceVerificationHandler verificationHandler, final List<ServiceController<?>> newControllers) throws OperationFailedException {
- ServiceController<?> sc = context.getServiceRegistry(false).getRequiredService(TeiidServiceNames.ENGINE);
+ ServiceController<?> sc = context.getServiceRegistry(false).getRequiredService(TeiidServiceNames.engineServiceName(operation.require(Configuration.ENGINE_NAME).asString()));
RuntimeEngineDeployer engine = RuntimeEngineDeployer.class.cast(sc.getValue());
executeOperation(engine, operation, model);
}
@@ -68,6 +69,7 @@
final ModelNode operation = new ModelNode();
operation.get(OPERATION_NAME).set(this.operationName);
operation.get(DESCRIPTION).set(bundle.getString(getBundleOperationName()+DESCRIBE));
+ addAttribute(operation, Configuration.ENGINE_NAME, REQUEST_PROPERTIES, bundle.getString(Configuration.ENGINE_NAME+Configuration.DESC), ModelType.STRING, true, null);
describeParameters(operation, bundle);
return operation;
}
Added: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineRemove.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineRemove.java (rev 0)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineRemove.java 2011-08-22 14:36:06 UTC (rev 3422)
@@ -0,0 +1,73 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.jboss;
+
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.DESCRIPTION;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OPERATION_NAME;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.REMOVE;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.REQUEST_PROPERTIES;
+import static org.teiid.jboss.Configuration.addAttribute;
+
+import java.util.List;
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+import org.jboss.as.controller.AbstractAddStepHandler;
+import org.jboss.as.controller.OperationContext;
+import org.jboss.as.controller.OperationFailedException;
+import org.jboss.as.controller.ServiceVerificationHandler;
+import org.jboss.as.controller.descriptions.DescriptionProvider;
+import org.jboss.dmr.ModelNode;
+import org.jboss.dmr.ModelType;
+import org.jboss.msc.service.ServiceController;
+import org.jboss.msc.service.ServiceRegistry;
+
+public class QueryEngineRemove extends AbstractAddStepHandler implements DescriptionProvider {
+
+ @Override
+ public ModelNode getModelDescription(Locale locale) {
+ final ResourceBundle bundle = IntegrationPlugin.getResourceBundle(locale);
+ final ModelNode operation = new ModelNode();
+ operation.get(OPERATION_NAME).set(REMOVE);
+ operation.get(DESCRIPTION).set(bundle.getString("engine.remove")); //$NON-NLS-1$
+ addAttribute(operation, Configuration.ENGINE_NAME, REQUEST_PROPERTIES, bundle.getString(Configuration.ENGINE_NAME+Configuration.DESC), ModelType.STRING, true, null);
+ return operation;
+ }
+
+ @Override
+ protected void populateModel(final ModelNode operation, final ModelNode model) throws OperationFailedException {
+ final String name = model.require(Configuration.ENGINE_NAME).asString();
+ model.get(Configuration.ENGINE_NAME).set(name);
+ }
+
+ @Override
+ protected void performRuntime(final OperationContext context, final ModelNode operation, final ModelNode model,
+ final ServiceVerificationHandler verificationHandler, final List<ServiceController<?>> newControllers) throws OperationFailedException {
+
+ final String engineName = model.require(Configuration.ENGINE_NAME).asString();
+ final ServiceRegistry registry = context.getServiceRegistry(true);
+ final ServiceController<?> controller = registry.getService(TeiidServiceNames.translatorServiceName(engineName));
+ if (controller != null) {
+ controller.setMode(ServiceController.Mode.REMOVE);
+ }
+ }
+}
Property changes on: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineRemove.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidBootServicesAdd.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidBootServicesAdd.java (rev 0)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidBootServicesAdd.java 2011-08-22 14:36:06 UTC (rev 3422)
@@ -0,0 +1,368 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.jboss;
+
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.*;
+import static org.teiid.jboss.Configuration.DESC;
+import static org.teiid.jboss.Configuration.addAttribute;
+
+import java.util.List;
+import java.util.Locale;
+import java.util.ResourceBundle;
+import java.util.ServiceLoader;
+import java.util.concurrent.Executor;
+
+import org.jboss.as.controller.*;
+import org.jboss.as.controller.descriptions.DescriptionProvider;
+import org.jboss.as.server.AbstractDeploymentChainStep;
+import org.jboss.as.server.DeploymentProcessorTarget;
+import org.jboss.as.server.deployment.Phase;
+import org.jboss.as.server.services.path.RelativePathService;
+import org.jboss.dmr.ModelNode;
+import org.jboss.dmr.ModelType;
+import org.jboss.modules.Module;
+import org.jboss.modules.ModuleIdentifier;
+import org.jboss.modules.ModuleLoadException;
+import org.jboss.msc.service.*;
+import org.jboss.msc.value.InjectedValue;
+import org.teiid.PolicyDecider;
+import org.teiid.cache.CacheConfiguration;
+import org.teiid.cache.CacheFactory;
+import org.teiid.cache.DefaultCacheFactory;
+import org.teiid.deployers.*;
+import org.teiid.dqp.internal.datamgr.TranslatorRepository;
+import org.teiid.dqp.internal.process.AuthorizationValidator;
+import org.teiid.dqp.internal.process.DataRolePolicyDecider;
+import org.teiid.dqp.internal.process.DefaultAuthorizationValidator;
+import org.teiid.query.function.SystemFunctionManager;
+import org.teiid.services.BufferServiceImpl;
+
+public class TeiidBootServicesAdd extends AbstractAddStepHandler implements DescriptionProvider {
+
+ @Override
+ public ModelNode getModelDescription(Locale locale) {
+ final ResourceBundle bundle = IntegrationPlugin.getResourceBundle(locale);
+ final ModelNode node = new ModelNode();
+ node.get(OPERATION_NAME).set(ADD);
+ node.get(DESCRIPTION).set(bundle.getString("teiid-boot.add")); //$NON-NLS-1$
+
+ addAttribute(node, Configuration.ALLOW_ENV_FUNCTION, REQUEST_PROPERTIES, bundle.getString(Configuration.ALLOW_ENV_FUNCTION+DESC), ModelType.BOOLEAN, false, "false"); //$NON-NLS-1$
+ addAttribute(node, Configuration.ASYNC_THREAD_GROUP, REQUEST_PROPERTIES, bundle.getString(Configuration.ASYNC_THREAD_GROUP+DESC), ModelType.STRING, false, "teiid-async-threads"); //$NON-NLS-1$
+
+ addAttribute(node, Configuration.AUTHORIZATION_VALIDATOR_MODULE, REQUEST_PROPERTIES, bundle.getString(Configuration.AUTHORIZATION_VALIDATOR_MODULE+DESC), ModelType.BOOLEAN, false, "false"); //$NON-NLS-1$
+ addAttribute(node, Configuration.POLICY_DECIDER_MODULE, REQUEST_PROPERTIES, bundle.getString(Configuration.POLICY_DECIDER_MODULE+DESC), ModelType.STRING, false, "teiid-async-threads"); //$NON-NLS-1$
+
+ ModelNode bufferNode = node.get(CHILDREN, Configuration.BUFFER_SERVICE);
+ bufferNode.get(TYPE).set(ModelType.OBJECT);
+ bufferNode.get(DESCRIPTION).set(bundle.getString(Configuration.BUFFER_SERVICE+DESC));
+ bufferNode.get(REQUIRED).set(false);
+ getBufferManagerDesciption(bufferNode, ATTRIBUTES, bundle);
+
+ // result-set-cache
+ ModelNode rsCacheNode = node.get(CHILDREN, Configuration.RESULTSET_CACHE);
+ rsCacheNode.get(TYPE).set(ModelType.OBJECT);
+ rsCacheNode.get(DESCRIPTION).set(bundle.getString(Configuration.RESULTSET_CACHE+DESC));
+ rsCacheNode.get(REQUIRED).set(false);
+ getResultsetCacheDescription(rsCacheNode, ATTRIBUTES, bundle);
+
+ // preparedplan-set-cache
+ ModelNode preparedPlanCacheNode = node.get(CHILDREN, Configuration.PREPAREDPLAN_CACHE);
+ preparedPlanCacheNode.get(TYPE).set(ModelType.OBJECT);
+ preparedPlanCacheNode.get(DESCRIPTION).set(bundle.getString(Configuration.PREPAREDPLAN_CACHE+DESC));
+ preparedPlanCacheNode.get(REQUIRED).set(false);
+ getResultsetCacheDescription(preparedPlanCacheNode, ATTRIBUTES, bundle);
+
+ //distributed-cache
+ ModelNode distributedCacheNode = node.get(CHILDREN, Configuration.CACHE_FACORY);
+ distributedCacheNode.get(TYPE).set(ModelType.OBJECT);
+ distributedCacheNode.get(DESCRIPTION).set(bundle.getString(Configuration.CACHE_FACORY+DESC));
+ distributedCacheNode.get(REQUIRED).set(false);
+ getDistributedCacheDescription(preparedPlanCacheNode, ATTRIBUTES, bundle);
+
+ return node;
+ }
+
+ @Override
+ protected void populateModel(ModelNode operation, ModelNode model) throws OperationFailedException {
+ if (operation.hasDefined(Configuration.ALLOW_ENV_FUNCTION)) {
+ model.get(Configuration.ALLOW_ENV_FUNCTION).set(operation.get(Configuration.ALLOW_ENV_FUNCTION).asString());
+ }
+ if (operation.hasDefined(Configuration.ASYNC_THREAD_GROUP)) {
+ model.get(Configuration.ASYNC_THREAD_GROUP).set(operation.get(Configuration.ASYNC_THREAD_GROUP).asString());
+ }
+ populateBufferManager(operation, model);
+
+ }
+
+ @Override
+ protected void performRuntime(final OperationContext context, final ModelNode operation, final ModelNode model,
+ final ServiceVerificationHandler verificationHandler, final List<ServiceController<?>> newControllers) throws OperationFailedException {
+ ServiceTarget target = context.getServiceTarget();
+
+ // translator repository
+ final TranslatorRepository translatorRepo = new TranslatorRepository();
+ TranslatorRepositoryService translatorService = new TranslatorRepositoryService(translatorRepo);
+ ServiceController<TranslatorRepository> service = target.addService(TeiidServiceNames.TRANSLATOR_REPO, translatorService).install();
+ newControllers.add(service);
+ ServiceContainer serviceContainer = service.getServiceContainer();
+
+ // system function tree
+ SystemFunctionManager systemFunctionManager = new SystemFunctionManager();
+ if (operation.hasDefined(Configuration.ALLOW_ENV_FUNCTION)) {
+ systemFunctionManager.setAllowEnvFunction(operation.get(Configuration.ALLOW_ENV_FUNCTION).asBoolean());
+ }
+ else {
+ systemFunctionManager.setAllowEnvFunction(false);
+ }
+
+ // VDB repository
+ final VDBRepository vdbRepository = new VDBRepository();
+ vdbRepository.setSystemFunctionManager(systemFunctionManager);
+ VDBRepositoryService vdbRepositoryService = new VDBRepositoryService(vdbRepository);
+ newControllers.add(target.addService(TeiidServiceNames.VDB_REPO, vdbRepositoryService).install());
+
+ // System VDB Service
+ SystemVDBDeployer systemVDB = new SystemVDBDeployer();
+ systemVDB.setVDBRepository(vdbRepository);
+ SystemVDBService systemVDBService = new SystemVDBService(systemVDB);
+ newControllers.add(target.addService(TeiidServiceNames.SYSTEM_VDB, systemVDBService).install());
+
+ newControllers.add(RelativePathService.addService(TeiidServiceNames.DATA_DIR, "teiid-data", "jboss.server.data.dir", target)); //$NON-NLS-1$ //$NON-NLS-2$
+ final ObjectsSerializerService serializer = new ObjectsSerializerService();
+ newControllers.add(target.addService(TeiidServiceNames.OBJECT_SERIALIZER, serializer).install());
+
+ // TODO: remove verbose service by moving the buffer service from runtime project
+ newControllers.add(RelativePathService.addService(TeiidServiceNames.BUFFER_DIR, "teiid-buffer", "jboss.server.temp.dir", target)); //$NON-NLS-1$ //$NON-NLS-2$
+ final BufferServiceImpl bufferManager = buildBufferManager(operation.get(Configuration.BUFFER_SERVICE));
+ BufferManagerService bufferService = new BufferManagerService(bufferManager);
+ ServiceBuilder<BufferServiceImpl> bufferServiceBuilder = target.addService(TeiidServiceNames.BUFFER_MGR, bufferService);
+ bufferServiceBuilder.addDependency(TeiidServiceNames.BUFFER_DIR, String.class, bufferService.pathInjector);
+ newControllers.add(bufferServiceBuilder.install());
+
+ PolicyDecider policyDecider;
+ if (operation.hasDefined(Configuration.POLICY_DECIDER_MODULE)) {
+ policyDecider = buildService(PolicyDecider.class, operation.get(Configuration.POLICY_DECIDER_MODULE).asString());
+ }
+ else {
+ DataRolePolicyDecider drpd = new DataRolePolicyDecider();
+ drpd.setAllowCreateTemporaryTablesByDefault(true);
+ drpd.setAllowFunctionCallsByDefault(true);
+ policyDecider = drpd;
+ }
+
+ AuthorizationValidator authValidator;
+ if (operation.hasDefined(Configuration.AUTHORIZATION_VALIDATOR_MODULE)) {
+ authValidator = buildService(AuthorizationValidator.class, operation.get(Configuration.AUTHORIZATION_VALIDATOR_MODULE).asString());
+ authValidator.setEnabled(true);
+ }
+ else {
+ DefaultAuthorizationValidator dap = new DefaultAuthorizationValidator();
+ dap.setPolicyDecider(policyDecider);
+ dap.setEnabled(true);
+ authValidator = dap;
+ }
+ target.addService(TeiidServiceNames.AUTHORIZATION_VALIDATOR, new AuthorizationValidatorService(authValidator));
+
+ CacheFactory cacheFactory = getCacheFactory(operation.get(Configuration.CACHE_FACORY));
+ CacheConfiguration resultsetCache = buildCacheConfig(operation.get(Configuration.RESULTSET_CACHE));
+ CacheConfiguration preparePlanCache = buildCacheConfig(operation.get(Configuration.PREPAREDPLAN_CACHE));
+
+
+ final JBossLifeCycleListener shutdownListener = new JBossLifeCycleListener();
+ serviceContainer.addTerminateListener(shutdownListener);
+
+ serviceBuilder.addDependency(ServiceName.JBOSS.append("thread", "executor", asyncExecutor), Executor.class, engine.threadPoolInjector); //$NON-NLS-1$ //$NON-NLS-2$
+
+ // Register VDB deployer
+ context.addStep(new AbstractDeploymentChainStep() {
+ @Override
+ public void execute(DeploymentProcessorTarget processorTarget) {
+ processorTarget.addDeploymentProcessor(Phase.STRUCTURE, Phase.STRUCTURE_WAR_DEPLOYMENT_INIT|0x0001,new VDBStructure());
+ processorTarget.addDeploymentProcessor(Phase.PARSE, Phase.PARSE_WEB_DEPLOYMENT|0x0001, new VDBParserDeployer(vdbRepository, serializer));
+ processorTarget.addDeploymentProcessor(Phase.DEPENDENCIES, Phase.DEPENDENCIES_WAR_MODULE|0x0001, new VDBDependencyProcessor());
+ processorTarget.addDeploymentProcessor(Phase.INSTALL, Phase.INSTALL_WAR_DEPLOYMENT|0x0001, new VDBDeployer(translatorRepo, asyncThreadPoolName));
+ }
+
+ }, OperationContext.Stage.RUNTIME);
+ }
+
+ private <T> T buildService(Class<T> type, String moduleName) throws OperationFailedException {
+ final ModuleIdentifier moduleId;
+ final Module module;
+ try {
+ moduleId = ModuleIdentifier.create(moduleName);
+ module = Module.getCallerModuleLoader().loadModule(moduleId);
+ } catch (ModuleLoadException e) {
+ throw new OperationFailedException(e, new ModelNode().set(IntegrationPlugin.Util.getString("failed_load_module", moduleName))); //$NON-NLS-1$
+ }
+ ServiceLoader<T> services = module.loadService(type);
+ return services.iterator().next();
+ }
+
+
+ static void getBufferManagerDesciption(ModelNode node, String type, ResourceBundle bundle) {
+ addAttribute(node, Configuration.USE_DISK, type, bundle.getString(Configuration.USE_DISK+DESC), ModelType.BOOLEAN, false, "true"); //$NON-NLS-1$
+ addAttribute(node, Configuration.PROCESSOR_BATCH_SIZE, type, bundle.getString(Configuration.PROCESSOR_BATCH_SIZE+DESC), ModelType.INT, false, "512"); //$NON-NLS-1$
+ addAttribute(node, Configuration.CONNECTOR_BATCH_SIZE, type, bundle.getString(Configuration.CONNECTOR_BATCH_SIZE+DESC), ModelType.INT, false, "1024"); //$NON-NLS-1$
+ addAttribute(node, Configuration.MAX_PROCESSING_KB, type, bundle.getString(Configuration.MAX_PROCESSING_KB+DESC), ModelType.INT, false, "-1"); //$NON-NLS-1$
+ addAttribute(node, Configuration.MAX_RESERVED_KB, type, bundle.getString(Configuration.MAX_RESERVED_KB+DESC), ModelType.INT, false, "-1"); //$NON-NLS-1$
+ addAttribute(node, Configuration.MAX_FILE_SIZE, type, bundle.getString(Configuration.MAX_FILE_SIZE+DESC), ModelType.LONG, false, "2048"); //$NON-NLS-1$
+ addAttribute(node, Configuration.MAX_BUFFER_SPACE, type, bundle.getString(Configuration.MAX_BUFFER_SPACE+DESC), ModelType.LONG, false, "51200"); //$NON-NLS-1$
+ addAttribute(node, Configuration.MAX_OPEN_FILES, type, bundle.getString(Configuration.MAX_OPEN_FILES+DESC), ModelType.INT, false, "64"); //$NON-NLS-1$
+ }
+
+ private BufferServiceImpl buildBufferManager(ModelNode node) {
+ BufferServiceImpl bufferManger = new BufferServiceImpl();
+
+ if (node == null) {
+ return bufferManger;
+ }
+
+ if (node.hasDefined(Configuration.USE_DISK)) {
+ bufferManger.setUseDisk(node.get(Configuration.USE_DISK).asBoolean());
+ }
+ if (node.hasDefined(Configuration.PROCESSOR_BATCH_SIZE)) {
+ bufferManger.setProcessorBatchSize(node.get(Configuration.PROCESSOR_BATCH_SIZE).asInt());
+ }
+ if (node.hasDefined(Configuration.CONNECTOR_BATCH_SIZE)) {
+ bufferManger.setConnectorBatchSize(node.get(Configuration.CONNECTOR_BATCH_SIZE).asInt());
+ }
+ if (node.hasDefined(Configuration.MAX_PROCESSING_KB)) {
+ bufferManger.setMaxProcessingKb(node.get(Configuration.MAX_PROCESSING_KB).asInt());
+ }
+ if (node.hasDefined(Configuration.MAX_RESERVED_KB)) {
+ bufferManger.setMaxReserveKb(node.get(Configuration.MAX_RESERVED_KB).asInt());
+ }
+ if (node.hasDefined(Configuration.MAX_FILE_SIZE)) {
+ bufferManger.setMaxFileSize(node.get(Configuration.MAX_FILE_SIZE).asLong());
+ }
+ if (node.hasDefined(Configuration.MAX_BUFFER_SPACE)) {
+ bufferManger.setMaxBufferSpace(node.get(Configuration.MAX_BUFFER_SPACE).asLong());
+ }
+ if (node.hasDefined(Configuration.MAX_OPEN_FILES)) {
+ bufferManger.setMaxOpenFiles(node.get(Configuration.MAX_OPEN_FILES).asInt());
+ }
+ return bufferManger;
+ }
+
+ private void populateBufferManager(ModelNode operation, ModelNode model) {
+
+ ModelNode childNode = operation.get(CHILDREN, Configuration.BUFFER_SERVICE);
+ if (!childNode.isDefined()) {
+ return;
+ }
+ if (operation.hasDefined(Configuration.USE_DISK)) {
+ model.get(Configuration.USE_DISK).set(operation.get(Configuration.USE_DISK).asString());
+ }
+
+ if (operation.hasDefined(Configuration.PROCESSOR_BATCH_SIZE)) {
+ model.get(Configuration.PROCESSOR_BATCH_SIZE).set(operation.get(Configuration.PROCESSOR_BATCH_SIZE).asString());
+ }
+ if (operation.hasDefined(Configuration.CONNECTOR_BATCH_SIZE)) {
+ model.get(Configuration.CONNECTOR_BATCH_SIZE).set(operation.get(Configuration.CONNECTOR_BATCH_SIZE).asString());
+ }
+ if (operation.hasDefined(Configuration.MAX_PROCESSING_KB)) {
+ model.get(Configuration.MAX_PROCESSING_KB).set(operation.get(Configuration.MAX_PROCESSING_KB).asString());
+ }
+ if (operation.hasDefined(Configuration.MAX_RESERVED_KB)) {
+ model.get(Configuration.MAX_RESERVED_KB).set(operation.get(Configuration.MAX_RESERVED_KB).asString());
+ }
+ if (operation.hasDefined(Configuration.MAX_FILE_SIZE)) {
+ model.get(Configuration.MAX_FILE_SIZE).set(operation.get(Configuration.MAX_FILE_SIZE).asString());
+ }
+ if (operation.hasDefined(Configuration.MAX_BUFFER_SPACE)) {
+ model.get(Configuration.MAX_BUFFER_SPACE).set(operation.get(Configuration.MAX_BUFFER_SPACE).asString());
+ }
+ if (operation.hasDefined(Configuration.MAX_BUFFER_SPACE)) {
+ model.get(Configuration.MAX_BUFFER_SPACE).set(operation.get(Configuration.MAX_BUFFER_SPACE).asString());
+ }
+ if (operation.hasDefined(Configuration.MAX_OPEN_FILES)) {
+ model.get(Configuration.MAX_OPEN_FILES).set(operation.get(Configuration.MAX_OPEN_FILES).asString());
+ }
+ }
+
+ private static void getDistributedCacheDescription(ModelNode node, String type, ResourceBundle bundle) {
+ addAttribute(node, Configuration.CACHE_SERVICE_JNDI_NAME, type, bundle.getString(Configuration.CACHE_SERVICE_JNDI_NAME+DESC), ModelType.STRING, false, "java:TeiidCacheManager"); //$NON-NLS-1$
+ addAttribute(node, Configuration.RESULTSET_CACHE_NAME, type, bundle.getString(Configuration.RESULTSET_CACHE_NAME+DESC), ModelType.STRING, false, "teiid-resultset-cache"); //$NON-NLS-1$
+ }
+
+ private static void getResultsetCacheDescription(ModelNode node, String type, ResourceBundle bundle) {
+ addAttribute(node, Configuration.MAX_ENTRIES, type, bundle.getString(Configuration.MAX_ENTRIES+DESC), ModelType.INT, false, "1024"); //$NON-NLS-1$
+ addAttribute(node, Configuration.MAX_AGE_IN_SECS, type, bundle.getString(Configuration.MAX_AGE_IN_SECS+DESC), ModelType.INT, false, "7200");//$NON-NLS-1$
+ addAttribute(node, Configuration.MAX_STALENESS, type, bundle.getString(Configuration.MAX_STALENESS+DESC), ModelType.INT, false, "60");//$NON-NLS-1$
+ addAttribute(node, Configuration.CACHE_TYPE, type, bundle.getString(Configuration.CACHE_TYPE+DESC), ModelType.STRING, false, "EXPIRATION"); //$NON-NLS-1$
+ addAttribute(node, Configuration.CACHE_LOCATION, type, bundle.getString(Configuration.CACHE_LOCATION+DESC), ModelType.STRING, false, "resultset"); //$NON-NLS-1$
+ }
+
+ private static void getPreparedPalnCacheDescription(ModelNode node, String type, ResourceBundle bundle) {
+ addAttribute(node, Configuration.MAX_ENTRIES, type, bundle.getString(Configuration.MAX_ENTRIES+DESC), ModelType.INT, false, "512"); //$NON-NLS-1$
+ addAttribute(node, Configuration.MAX_AGE_IN_SECS, type, bundle.getString(Configuration.MAX_AGE_IN_SECS+DESC), ModelType.INT, false, "28800");//$NON-NLS-1$
+ addAttribute(node, Configuration.MAX_STALENESS, type, bundle.getString(Configuration.MAX_STALENESS+DESC), ModelType.INT, false, "0");//$NON-NLS-1$
+ addAttribute(node, Configuration.CACHE_TYPE, type, bundle.getString(Configuration.CACHE_TYPE+DESC), ModelType.STRING, false, "LRU"); //$NON-NLS-1$
+ addAttribute(node, Configuration.CACHE_LOCATION, type, bundle.getString(Configuration.CACHE_LOCATION+DESC), ModelType.STRING, false, "preparedplan"); //$NON-NLS-1$
+ }
+ private CacheFactory getCacheFactory(ModelNode node) {
+ CacheFactory cacheFactory = new DefaultCacheFactory();
+ /*
+ if (node.hasDefined(Configuration.CLASS)) {
+ String className = node.get(Configuration.CLASS).asString();
+ }
+
+ if (node.hasDefined(Configuration.ENABLED)) {
+ cacheFactory.setEnabled(node.get(Configuration.ENABLED).asBoolean());
+ }
+ else {
+ cacheFactory.setEnabled(true);
+ }
+ if (node.hasDefined(Configuration.CACHE_SERVICE_JNDI_NAME)) {
+ cacheFactory.setCacheManager(node.get(Configuration.CACHE_SERVICE_JNDI_NAME).asString());
+ }
+ if (node.hasDefined(Configuration.RESULTSET_CACHE_NAME)) {
+ cacheFactory.setResultsetCacheName(node.get(Configuration.RESULTSET_CACHE_NAME).asString());
+ }
+ */
+ return cacheFactory;
+ }
+
+ private CacheConfiguration buildCacheConfig(ModelNode node) {
+ CacheConfiguration cacheConfig = new CacheConfiguration();
+
+ if (node.hasDefined(Configuration.MAX_ENTRIES)) {
+ cacheConfig.setMaxEntries(node.get(Configuration.MAX_ENTRIES).asInt());
+ }
+ if (node.hasDefined(Configuration.MAX_AGE_IN_SECS)) {
+ cacheConfig.setMaxAgeInSeconds(node.get(Configuration.MAX_AGE_IN_SECS).asInt());
+ }
+ if (node.hasDefined(Configuration.MAX_STALENESS)) {
+ cacheConfig.setMaxStaleness(node.get(Configuration.MAX_STALENESS).asInt());
+ }
+ if (node.hasDefined(Configuration.CACHE_TYPE)) {
+ cacheConfig.setType(node.get(Configuration.CACHE_TYPE).asString());
+ }
+ if (node.hasDefined(Configuration.CACHE_LOCATION)) {
+ cacheConfig.setLocation(node.get(Configuration.CACHE_LOCATION).asString());
+ }
+ return cacheConfig;
+ }
+
+}
Property changes on: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidBootServicesAdd.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidExtension.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidExtension.java 2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidExtension.java 2011-08-22 14:36:06 UTC (rev 3422)
@@ -38,43 +38,47 @@
import org.jboss.as.controller.registry.AttributeAccess.Storage;
import org.jboss.dmr.ModelNode;
import org.jboss.dmr.ModelType;
+import org.teiid.logging.Log4jListener;
+import org.teiid.logging.LogManager;
public class TeiidExtension implements Extension {
- private static final String ACTIVE_SESSION_COUNT = "active-session-count";
- private static final String RUNTIME_VERSION = "runtime-version";
- private static final String REQUESTS_PER_SESSION = "requests-per-session";
- private static final String ACTIVE_SESSIONS = "active-sessions";
- private static final String REQUESTS_PER_VDB = "requests-per-vdb";
- private static final String LONG_RUNNING_QUERIES = "long-running-queries";
- private static final String TERMINATE_SESSION = "terminate-session";
- private static final String CANCEL_QUERY = "cancel-query";
- private static final String CACHE_TYPES = "cache-types";
- private static final String CLEAR_CACHE = "clear-cache";
- private static final String CACHE_STATISTICS = "cache-statistics";
- private static final String WORKERPOOL_STATISTICS = "workerpool-statistics";
- private static final String ACTIVE_TRANSACTIONS = "active-transactions";
- private static final String TERMINATE_TRANSACTION = "terminate-transaction";
- private static final String MERGE_VDBS = "merge-vdbs";
- private static final String EXECUTE_QUERY = "execute-query";
- private static final String GETVDBS = "getVDBs";
- private static final String GETVDB = "getVDB";
+ private static final String ACTIVE_SESSION_COUNT = "active-session-count"; //$NON-NLS-1$
+ private static final String RUNTIME_VERSION = "runtime-version"; //$NON-NLS-1$
+ private static final String REQUESTS_PER_SESSION = "requests-per-session"; //$NON-NLS-1$
+ private static final String ACTIVE_SESSIONS = "active-sessions"; //$NON-NLS-1$
+ private static final String REQUESTS_PER_VDB = "requests-per-vdb"; //$NON-NLS-1$
+ private static final String LONG_RUNNING_QUERIES = "long-running-queries"; //$NON-NLS-1$
+ private static final String TERMINATE_SESSION = "terminate-session";//$NON-NLS-1$
+ private static final String CANCEL_QUERY = "cancel-query";//$NON-NLS-1$
+ private static final String CACHE_TYPES = "cache-types";//$NON-NLS-1$
+ private static final String CLEAR_CACHE = "clear-cache";//$NON-NLS-1$
+ private static final String CACHE_STATISTICS = "cache-statistics";//$NON-NLS-1$
+ private static final String WORKERPOOL_STATISTICS = "workerpool-statistics";//$NON-NLS-1$
+ private static final String ACTIVE_TRANSACTIONS = "active-transactions";//$NON-NLS-1$
+ private static final String TERMINATE_TRANSACTION = "terminate-transaction";//$NON-NLS-1$
+ private static final String MERGE_VDBS = "merge-vdbs";//$NON-NLS-1$
+ private static final String EXECUTE_QUERY = "execute-query";//$NON-NLS-1$
+ private static final String GETVDBS = "getVDBs";//$NON-NLS-1$
+ private static final String GETVDB = "getVDB";//$NON-NLS-1$
- public static final String SUBSYSTEM_NAME = "teiid"; //$NON-NLS-1$
+ public static final String TEIID_SUBSYSTEM = "teiid"; //$NON-NLS-1$
private static TeiidSubsystemParser parser = new TeiidSubsystemParser();
- private static QueryEngineDescription ENGINE_DESC = new QueryEngineDescription();
private static QueryEngineAdd ENGINE_ADD = new QueryEngineAdd();
+ private static QueryEngineRemove ENGINE_REMOVE = new QueryEngineRemove();
private static TranslatorAdd TRANSLATOR_ADD = new TranslatorAdd();
private static TranslatorRemove TRANSLATOR_REMOVE = new TranslatorRemove();
@Override
public void initialize(ExtensionContext context) {
- final SubsystemRegistration registration = context.registerSubsystem(SUBSYSTEM_NAME);
+ final SubsystemRegistration registration = context.registerSubsystem(TEIID_SUBSYSTEM);
+ LogManager.setLogListener(new Log4jListener());
+
registration.registerXMLElementWriter(parser);
-
- final ManagementResourceRegistration subsystem = registration.registerSubsystemModel(new DescriptionProvider() {
-
+
+ // Main Teiid system, with children query engine and translators.
+ final ManagementResourceRegistration teiidSubsystem = registration.registerSubsystemModel(new DescriptionProvider() {
@Override
public ModelNode getModelDescription(Locale locale) {
final ResourceBundle bundle = IntegrationPlugin.getResourceBundle(locale);
@@ -85,8 +89,6 @@
node.get(ModelDescriptionConstants.TAIL_COMMENT_ALLOWED).set(true);
node.get(ModelDescriptionConstants.NAMESPACE).set(Namespace.CURRENT.getUri());
- //getQueryEngineDescription(node.get(CHILDREN, Configuration.QUERY_ENGINE), ATTRIBUTES, bundle);
-
node.get(CHILDREN, Configuration.QUERY_ENGINE, DESCRIPTION).set(bundle.getString(Configuration.QUERY_ENGINE));
node.get(CHILDREN, Configuration.QUERY_ENGINE, REQUIRED).set(false);
@@ -96,10 +98,11 @@
return node;
}
});
- subsystem.registerOperationHandler(ModelDescriptionConstants.ADD, ENGINE_ADD, ENGINE_DESC);
- //subsystem.registerOperationHandler(ModelDescriptionConstants.DESCRIBE, describe, describe, false);
-
- final ManagementResourceRegistration translators = subsystem.registerSubModel(PathElement.pathElement(Configuration.TRANSLATOR), new DescriptionProvider() {
+ teiidSubsystem.registerOperationHandler(ADD, ENGINE_ADD, ENGINE_ADD, false);
+ teiidSubsystem.registerOperationHandler(REMOVE, ENGINE_REMOVE, ENGINE_REMOVE, false);
+
+ // Translator Subsystem
+ final ManagementResourceRegistration translatorSubsystem = teiidSubsystem.registerSubModel(PathElement.pathElement(Configuration.TRANSLATOR), new DescriptionProvider() {
@Override
public ModelNode getModelDescription(Locale locale) {
final ResourceBundle bundle = IntegrationPlugin.getResourceBundle(locale);
@@ -114,68 +117,83 @@
return node;
}
});
- translators.registerOperationHandler(ADD, TRANSLATOR_ADD, TRANSLATOR_ADD, false);
- translators.registerOperationHandler(REMOVE, TRANSLATOR_REMOVE, TRANSLATOR_REMOVE, false);
+ translatorSubsystem.registerOperationHandler(ADD, TRANSLATOR_ADD, TRANSLATOR_ADD, false);
+ translatorSubsystem.registerOperationHandler(REMOVE, TRANSLATOR_REMOVE, TRANSLATOR_REMOVE, false);
+
+
+ // Query engine subsystem
+ final ManagementResourceRegistration engineSubsystem = teiidSubsystem.registerSubModel(PathElement.pathElement(Configuration.QUERY_ENGINE), new DescriptionProvider() {
+ @Override
+ public ModelNode getModelDescription(Locale locale) {
+ final ResourceBundle bundle = IntegrationPlugin.getResourceBundle(locale);
+
+ final ModelNode node = new ModelNode();
+ node.get(DESCRIPTION).set(bundle.getString(Configuration.QUERY_ENGINE));
+ node.get(HEAD_COMMENT_ALLOWED).set(true);
+ node.get(TAIL_COMMENT_ALLOWED).set(true);
+ TeiidModelDescription.getQueryEngineDescription(node, ATTRIBUTES, bundle);
+ return node;
+ }
+ });
+ engineSubsystem.registerOperationHandler(ADD, ENGINE_ADD, ENGINE_ADD, false);
+ engineSubsystem.registerOperationHandler(REMOVE, ENGINE_REMOVE, ENGINE_REMOVE, false);
+
QueryEngineOperationHandler op;
- subsystem.registerReadOnlyAttribute(RUNTIME_VERSION, new GetRuntimeVersion(RUNTIME_VERSION), Storage.RUNTIME);
- subsystem.registerReadOnlyAttribute(ACTIVE_SESSION_COUNT, new GetActiveSessionsCount(ACTIVE_SESSION_COUNT), Storage.RUNTIME);
+ engineSubsystem.registerReadOnlyAttribute(RUNTIME_VERSION, new GetRuntimeVersion(RUNTIME_VERSION), Storage.RUNTIME);
+ engineSubsystem.registerReadOnlyAttribute(ACTIVE_SESSION_COUNT, new GetActiveSessionsCount(ACTIVE_SESSION_COUNT), Storage.RUNTIME);
op = new GetActiveSessions(ACTIVE_SESSIONS);
- subsystem.registerOperationHandler(ACTIVE_SESSIONS, op, op);
+ engineSubsystem.registerOperationHandler(ACTIVE_SESSIONS, op, op);
op = new GetRequestsPerSession(REQUESTS_PER_SESSION);
- subsystem.registerOperationHandler(REQUESTS_PER_SESSION, op, op);
+ engineSubsystem.registerOperationHandler(REQUESTS_PER_SESSION, op, op);
op = new GetRequestsPerVDB(REQUESTS_PER_VDB);
- subsystem.registerOperationHandler(REQUESTS_PER_VDB, op, op);
+ engineSubsystem.registerOperationHandler(REQUESTS_PER_VDB, op, op);
op = new GetLongRunningQueries(LONG_RUNNING_QUERIES);
- subsystem.registerOperationHandler(LONG_RUNNING_QUERIES, op, op);
+ engineSubsystem.registerOperationHandler(LONG_RUNNING_QUERIES, op, op);
op = new TerminateSession(TERMINATE_SESSION);
- subsystem.registerOperationHandler(TERMINATE_SESSION, op, op);
+ engineSubsystem.registerOperationHandler(TERMINATE_SESSION, op, op);
op = new CancelQuery(CANCEL_QUERY);
- subsystem.registerOperationHandler(CANCEL_QUERY, op, op);
+ engineSubsystem.registerOperationHandler(CANCEL_QUERY, op, op);
op = new CacheTypes(CACHE_TYPES);
- subsystem.registerOperationHandler(CACHE_TYPES, op, op);
+ engineSubsystem.registerOperationHandler(CACHE_TYPES, op, op);
op = new ClearCache(CLEAR_CACHE);
- subsystem.registerOperationHandler(CLEAR_CACHE, op, op);
+ engineSubsystem.registerOperationHandler(CLEAR_CACHE, op, op);
op = new CacheStatistics(CACHE_STATISTICS);
- subsystem.registerOperationHandler(CACHE_STATISTICS, op, op);
+ engineSubsystem.registerOperationHandler(CACHE_STATISTICS, op, op);
op = new WorkerPoolStatistics(WORKERPOOL_STATISTICS);
- subsystem.registerOperationHandler(WORKERPOOL_STATISTICS, op, op);
+ engineSubsystem.registerOperationHandler(WORKERPOOL_STATISTICS, op, op);
op = new ActiveTransactions(ACTIVE_TRANSACTIONS);
- subsystem.registerOperationHandler(ACTIVE_TRANSACTIONS, op, op);
+ engineSubsystem.registerOperationHandler(ACTIVE_TRANSACTIONS, op, op);
op = new TerminateTransaction(TERMINATE_TRANSACTION);
- subsystem.registerOperationHandler(TERMINATE_TRANSACTION, op, op);
+ engineSubsystem.registerOperationHandler(TERMINATE_TRANSACTION, op, op);
op = new MergeVDBs(MERGE_VDBS);
- subsystem.registerOperationHandler(MERGE_VDBS, op, op);
+ engineSubsystem.registerOperationHandler(MERGE_VDBS, op, op);
op = new ExecuteQuery(EXECUTE_QUERY);
- subsystem.registerOperationHandler(EXECUTE_QUERY, op, op);
+ engineSubsystem.registerOperationHandler(EXECUTE_QUERY, op, op);
op = new GetVDBs(GETVDBS);
- subsystem.registerOperationHandler(GETVDBS, op, op);
+ engineSubsystem.registerOperationHandler(GETVDBS, op, op);
op = new GetVDB(GETVDB);
- subsystem.registerOperationHandler(GETVDB, op, op);
+ engineSubsystem.registerOperationHandler(GETVDB, op, op);
}
@Override
public void initializeParsers(ExtensionParsingContext context) {
context.setSubsystemXmlMapping(Namespace.CURRENT.getUri(), parser);
}
-
-
-
-
}
Copied: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidModelDescription.java (from rev 3394, branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineDescription.java)
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidModelDescription.java (rev 0)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidModelDescription.java 2011-08-22 14:36:06 UTC (rev 3422)
@@ -0,0 +1,98 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.jboss;
+
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.*;
+import static org.teiid.jboss.Configuration.DESC;
+import static org.teiid.jboss.Configuration.addAttribute;
+
+import java.util.ResourceBundle;
+
+import org.jboss.dmr.ModelNode;
+import org.jboss.dmr.ModelType;
+
+class TeiidModelDescription {
+
+ static void getQueryEngineDescription(ModelNode node, String type, ResourceBundle bundle) {
+ addAttribute(node, Configuration.ENGINE_NAME, type, bundle.getString(Configuration.ENGINE_NAME+Configuration.DESC), ModelType.STRING, true, null);
+ addAttribute(node, Configuration.MAX_THREADS, type, bundle.getString(Configuration.MAX_THREADS+DESC), ModelType.INT, false, "64"); //$NON-NLS-1$
+ addAttribute(node, Configuration.MAX_ACTIVE_PLANS, type, bundle.getString(Configuration.MAX_ACTIVE_PLANS+DESC), ModelType.INT, false, "20"); //$NON-NLS-1$
+ addAttribute(node, Configuration.USER_REQUEST_SOURCE_CONCURRENCY, type, bundle.getString(Configuration.USER_REQUEST_SOURCE_CONCURRENCY+DESC), ModelType.INT, false, "0"); //$NON-NLS-1$
+ addAttribute(node, Configuration.TIME_SLICE_IN_MILLI, type, bundle.getString(Configuration.TIME_SLICE_IN_MILLI+DESC), ModelType.INT, false, "2000"); //$NON-NLS-1$
+ addAttribute(node, Configuration.MAX_ROWS_FETCH_SIZE, type, bundle.getString(Configuration.MAX_ROWS_FETCH_SIZE+DESC), ModelType.INT, false, "20480"); //$NON-NLS-1$
+ addAttribute(node, Configuration.LOB_CHUNK_SIZE_IN_KB, type, bundle.getString(Configuration.LOB_CHUNK_SIZE_IN_KB+DESC), ModelType.INT, false, "100"); //$NON-NLS-1$
+ addAttribute(node, Configuration.QUERY_THRESHOLD_IN_SECS, type, bundle.getString(Configuration.QUERY_THRESHOLD_IN_SECS+DESC), ModelType.INT, false, "600"); //$NON-NLS-1$
+ addAttribute(node, Configuration.MAX_SOURCE_ROWS, type, bundle.getString(Configuration.MAX_SOURCE_ROWS+DESC), ModelType.INT, false, "-1"); //$NON-NLS-1$
+ addAttribute(node, Configuration.EXCEPTION_ON_MAX_SOURCE_ROWS, type, bundle.getString(Configuration.EXCEPTION_ON_MAX_SOURCE_ROWS+DESC), ModelType.BOOLEAN, false, "true"); //$NON-NLS-1$
+ addAttribute(node, Configuration.MAX_ODBC_LOB_SIZE_ALLOWED, type, bundle.getString(Configuration.MAX_ODBC_LOB_SIZE_ALLOWED+DESC), ModelType.INT, false, "5242880"); //$NON-NLS-1$
+ addAttribute(node, Configuration.EVENT_DISTRIBUTOR_NAME, type, bundle.getString(Configuration.EVENT_DISTRIBUTOR_NAME+DESC), ModelType.STRING, false, "teiid/event-distributor"); //$NON-NLS-1$
+ addAttribute(node, Configuration.DETECTING_CHANGE_EVENTS, type, bundle.getString(Configuration.DETECTING_CHANGE_EVENTS+DESC), ModelType.BOOLEAN, false, "true"); //$NON-NLS-1$
+
+ //session stuff
+ addAttribute(node, Configuration.SECURITY_DOMAIN, type, bundle.getString(Configuration.SECURITY_DOMAIN+DESC), ModelType.STRING, false, null);
+ addAttribute(node, Configuration.MAX_SESSIONS_ALLOWED, type, bundle.getString(Configuration.MAX_SESSIONS_ALLOWED+DESC), ModelType.INT, false, "5000"); //$NON-NLS-1$
+ addAttribute(node, Configuration.SESSION_EXPIRATION_TIME_LIMIT, type, bundle.getString(Configuration.SESSION_EXPIRATION_TIME_LIMIT+DESC), ModelType.INT, false, "0"); //$NON-NLS-1$
+
+ //jdbc
+ ModelNode jdbcSocketNode = node.get(CHILDREN, Configuration.JDBC);
+ jdbcSocketNode.get(TYPE).set(ModelType.OBJECT);
+ jdbcSocketNode.get(DESCRIPTION).set(bundle.getString(Configuration.JDBC+DESC));
+ jdbcSocketNode.get(REQUIRED).set(false);
+ jdbcSocketNode.get(MAX_OCCURS).set(1);
+ jdbcSocketNode.get(MIN_OCCURS).set(1);
+ getSocketConfig(jdbcSocketNode, type, bundle);
+
+ //odbc
+ ModelNode odbcSocketNode = node.get(CHILDREN, Configuration.ODBC);
+ odbcSocketNode.get(TYPE).set(ModelType.OBJECT);
+ odbcSocketNode.get(DESCRIPTION).set(bundle.getString(Configuration.ODBC+DESC));
+ odbcSocketNode.get(REQUIRED).set(false);
+ odbcSocketNode.get(MAX_OCCURS).set(1);
+ odbcSocketNode.get(MIN_OCCURS).set(1);
+ getSocketConfig(odbcSocketNode, type, bundle);
+ }
+
+
+ private static void getSocketConfig(ModelNode node, String type, ResourceBundle bundle) {
+ addAttribute(node, Configuration.SOCKET_ENABLED, type, bundle.getString(Configuration.SOCKET_ENABLED+DESC), ModelType.BOOLEAN, false, "true"); //$NON-NLS-1$
+ addAttribute(node, Configuration.MAX_SOCKET_THREAD_SIZE, type, bundle.getString(Configuration.MAX_SOCKET_THREAD_SIZE+DESC), ModelType.INT, false, "0"); //$NON-NLS-1$
+ addAttribute(node, Configuration.IN_BUFFER_SIZE, type, bundle.getString(Configuration.IN_BUFFER_SIZE+DESC), ModelType.INT, false, "0"); //$NON-NLS-1$
+ addAttribute(node, Configuration.OUT_BUFFER_SIZE, type, bundle.getString(Configuration.OUT_BUFFER_SIZE+DESC), ModelType.INT, false, "0"); //$NON-NLS-1$
+ addAttribute(node, Configuration.SOCKET_BINDING, type, bundle.getString(Configuration.SOCKET_BINDING+DESC), ModelType.INT, true, null);
+
+ ModelNode sslNode = node.get(CHILDREN, Configuration.SSL);
+ sslNode.get(TYPE).set(ModelType.OBJECT);
+ sslNode.get(DESCRIPTION).set(bundle.getString(Configuration.SSL+DESC));
+ sslNode.get(REQUIRED).set(false);
+ sslNode.get(MAX_OCCURS).set(1);
+ sslNode.get(MIN_OCCURS).set(0);
+ addAttribute(node, Configuration.SSL_MODE, type, bundle.getString(Configuration.SSL_MODE+DESC), ModelType.STRING, false, "login"); //$NON-NLS-1$
+ addAttribute(node, Configuration.KEY_STORE_FILE, type, bundle.getString(Configuration.KEY_STORE_FILE+DESC), ModelType.STRING, false, null);
+ addAttribute(node, Configuration.KEY_STORE_PASSWD, type, bundle.getString(Configuration.KEY_STORE_PASSWD+DESC), ModelType.STRING, false, null);
+ addAttribute(node, Configuration.KEY_STORE_TYPE, type, bundle.getString(Configuration.KEY_STORE_TYPE+DESC), ModelType.STRING, false, "JKS"); //$NON-NLS-1$
+ addAttribute(node, Configuration.SSL_PROTOCOL, type, bundle.getString(Configuration.SSL_PROTOCOL+DESC), ModelType.BOOLEAN, false, "SSLv3"); //$NON-NLS-1$
+ addAttribute(node, Configuration.KEY_MANAGEMENT_ALG, type, bundle.getString(Configuration.KEY_MANAGEMENT_ALG+DESC), ModelType.STRING, false, "false"); //$NON-NLS-1$
+ addAttribute(node, Configuration.TRUST_FILE, type, bundle.getString(Configuration.TRUST_FILE+DESC), ModelType.STRING, false, null);
+ addAttribute(node, Configuration.TRUST_PASSWD, type, bundle.getString(Configuration.TRUST_PASSWD+DESC), ModelType.STRING, false, null);
+ addAttribute(node, Configuration.AUTH_MODE, type, bundle.getString(Configuration.AUTH_MODE+DESC), ModelType.STRING, false, "anonymous"); //$NON-NLS-1$
+ }
+}
Property changes on: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidModelDescription.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidServiceNames.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidServiceNames.java 2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidServiceNames.java 2011-08-22 14:36:06 UTC (rev 3422)
@@ -24,14 +24,31 @@
import org.jboss.msc.service.ServiceName;
public class TeiidServiceNames {
- public static ServiceName ENGINE = ServiceName.JBOSS.append("teiid", "query-engine");
- public static ServiceName TRANSLATOR_REPO = ServiceName.JBOSS.append("teiid", "translator-repository");
- static ServiceName TRANSLATOR_BASE = ServiceName.JBOSS.append("teiid", "translator");
- public static ServiceName BUFFER_DIR = ServiceName.JBOSS.append("teiid", "buffer.dir");
- public static ServiceName BUFFER_MGR = ServiceName.JBOSS.append("teiid", "buffer-mgr");
- public static ServiceName SYSTEM_VDB = ServiceName.JBOSS.append("teiid", "system.vdb");
+ private static ServiceName ENGINE = ServiceName.JBOSS.append("teiid", "query-engine"); //$NON-NLS-1$ //$NON-NLS-2$
+ public static ServiceName TRANSLATOR_REPO = ServiceName.JBOSS.append("teiid", "translator-repository");//$NON-NLS-1$ //$NON-NLS-2$
+ public static ServiceName VDB_REPO = ServiceName.JBOSS.append("teiid", "vdb-repository");//$NON-NLS-1$ //$NON-NLS-2$
+ private static ServiceName TRANSLATOR_BASE = ServiceName.JBOSS.append("teiid", "translator");//$NON-NLS-1$ //$NON-NLS-2$
+ public static ServiceName BUFFER_DIR = ServiceName.JBOSS.append("teiid", "buffer.dir");//$NON-NLS-1$ //$NON-NLS-2$
+ public static ServiceName DATA_DIR = ServiceName.JBOSS.append("teiid", "data.dir");//$NON-NLS-1$ //$NON-NLS-2$
+ public static ServiceName BUFFER_MGR = ServiceName.JBOSS.append("teiid", "buffer-mgr");//$NON-NLS-1$ //$NON-NLS-2$
+ public static ServiceName SYSTEM_VDB = ServiceName.JBOSS.append("teiid", "system.vdb");//$NON-NLS-1$ //$NON-NLS-2$
+ public static ServiceName AUTHORIZATION_VALIDATOR = ServiceName.JBOSS.append("teiid", "authorization-validator");//$NON-NLS-1$ //$NON-NLS-2$
+ private static ServiceName VDB_SVC_BASE = ServiceName.JBOSS.append("teiid", "vdb"); //$NON-NLS-1$ //$NON-NLS-2$
+ public static ServiceName OBJECT_SERIALIZER = ServiceName.JBOSS.append("teiid", "object-serializer"); //$NON-NLS-1$ //$NON-NLS-2$
public static ServiceName translatorServiceName(String name) {
return TRANSLATOR_BASE.append(name);
}
+
+ public static ServiceName engineServiceName(String name) {
+ return ENGINE.append(name);
+ }
+
+ public static ServiceName vdbServiceName(String vdbName, int version) {
+ return VDB_SVC_BASE.append(vdbName, ".", String.valueOf(version)); //$NON-NLS-1$
+ }
+
+ public static ServiceName executorServiceName(String poolName) {
+ return ServiceName.JBOSS.append("thread", "executor", poolName);
+ }
}
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidSubsystemParser.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidSubsystemParser.java 2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidSubsystemParser.java 2011-08-22 14:36:06 UTC (rev 3422)
@@ -21,10 +21,10 @@
*/
package org.teiid.jboss;
-import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.ADD;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP_ADDR;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.SUBSYSTEM;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.ADD;
import static org.jboss.as.controller.parsing.ParseUtils.requireNoAttributes;
import java.util.List;
@@ -57,6 +57,7 @@
// write the elements according to the schema defined.
private void writeQueryEngine( XMLExtendedStreamWriter writer, ModelNode node) throws XMLStreamException {
+ writeAttribute(writer, Element.ENGINE_NAME_ATTRIBUTE, node);
writeElement(writer, Element.ASYNC_THREAD_GROUP_ELEMENT, node);
writeElement(writer, Element.MAX_THREADS_ELEMENT, node);
writeElement(writer, Element.MAX_ACTIVE_PLANS_ELEMENT, node);
@@ -176,18 +177,24 @@
writer.writeEndElement();
}
}
+
+ private void writeAttribute(final XMLExtendedStreamWriter writer, final Element element, final ModelNode node) throws XMLStreamException {
+ if (has(node, element.getLocalName())) {
+ writer.writeAttribute(element.getLocalName(), node.get(element.getLocalName()).asString());
+ }
+ }
@Override
public void readElement(final XMLExtendedStreamReader reader, final List<ModelNode> list) throws XMLStreamException {
final ModelNode address = new ModelNode();
- address.add(SUBSYSTEM, TeiidExtension.SUBSYSTEM_NAME);
+ address.add(SUBSYSTEM, TeiidExtension.TEIID_SUBSYSTEM);
address.protect();
-
- final ModelNode subsystem = new ModelNode();
- subsystem.get(OP).set(ADD);
- subsystem.get(OP_ADDR).set(address);
- list.add(subsystem);
+ final ModelNode bootServices = new ModelNode();
+ bootServices.get(OP).set(ADD);
+ bootServices.get(OP_ADDR).set(address);
+ list.add(bootServices);
+
// no attributes
requireNoAttributes(reader);
@@ -198,9 +205,30 @@
Element element = Element.forName(reader.getLocalName());
switch (element) {
case QUERY_ENGINE_ELEMENT:
- ModelNode node = parseQueryEngine(reader);
- subsystem.get(Configuration.QUERY_ENGINE).set(node);
+ ModelNode engineNode = parseQueryEngine(reader, new ModelNode());
+
+ final ModelNode engineAddress = address.clone();
+ engineAddress.add(Configuration.QUERY_ENGINE, engineNode.require(Configuration.ENGINE_NAME).asString());
+ engineAddress.protect();
+ engineNode.get(OP).set(ADD);
+ engineNode.get(OP_ADDR).set(engineAddress);
+
+ list.add(engineNode);
+ break;
+
+ case TRANSLATOR_ELEMENT:
+ ModelNode translatorNode = parseTranslator(reader, new ModelNode());
+
+ final ModelNode translatorAddress = address.clone();
+ translatorAddress.add(Configuration.QUERY_ENGINE, translatorNode.require(Configuration.TRANSLATOR_NAME).asString());
+ translatorAddress.protect();
+
+ translatorNode.get(OP).set(ADD);
+ translatorNode.get(OP_ADDR).set(translatorAddress);
+
+ list.add(translatorNode);
break;
+
default:
throw ParseUtils.unexpectedElement(reader);
}
@@ -211,12 +239,9 @@
}
}
}
-
-
}
- private ModelNode parseQueryEngine(XMLExtendedStreamReader reader) throws XMLStreamException {
- ModelNode node = new ModelNode();
+ private ModelNode parseQueryEngine(XMLExtendedStreamReader reader, ModelNode node) throws XMLStreamException {
if (reader.getAttributeCount() > 0) {
for(int i=0; i<reader.getAttributeCount(); i++) {
@@ -414,5 +439,28 @@
}
}
return node;
- }
+ }
+
+ private ModelNode parseTranslator(XMLExtendedStreamReader reader, ModelNode node) throws XMLStreamException {
+ if (reader.getAttributeCount() > 0) {
+ for(int i=0; i<reader.getAttributeCount(); i++) {
+ String attrName = reader.getAttributeLocalName(i);
+ String attrValue = reader.getAttributeValue(i);
+
+ Element element = Element.forName(attrName);
+ switch(element) {
+ case TRANSLATOR_NAME_ATTRIBUTE:
+ case TRANSLATOR_MODULE_ATTRIBUTE:
+ node.get(attrName).set(attrValue);
+ break;
+ default:
+ throw ParseUtils.unexpectedElement(reader);
+ }
+ }
+ }
+ while (reader.hasNext() && (reader.nextTag() != XMLStreamConstants.END_ELEMENT)) {
+ throw ParseUtils.unexpectedElement(reader);
+ }
+ return node;
+ }
}
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorAdd.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorAdd.java 2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorAdd.java 2011-08-22 14:36:06 UTC (rev 3422)
@@ -54,8 +54,10 @@
final ModelNode operation = new ModelNode();
operation.get(OPERATION_NAME).set(ADD);
operation.get(DESCRIPTION).set(bundle.getString("translator.add")); //$NON-NLS-1$
- addAttribute(operation, Configuration.TRANSLATOR_NAME, REQUEST_PROPERTIES, bundle.getString(Configuration.TRANSLATOR_NAME+Configuration.DESC), ModelType.STRING, true, null);
- addAttribute(operation, Configuration.TRANSLATOR_MODULE, REQUEST_PROPERTIES, bundle.getString(Configuration.TRANSLATOR_MODULE+Configuration.DESC), ModelType.STRING, true, null);
+
+ ModelNode translator = operation.get(REQUEST_PROPERTIES, Configuration.TRANSLATOR);
+ addAttribute(translator, Configuration.TRANSLATOR_NAME, ATTRIBUTES, bundle.getString(Configuration.TRANSLATOR_NAME+Configuration.DESC), ModelType.STRING, true, null);
+ addAttribute(translator, Configuration.TRANSLATOR_MODULE, ATTRIBUTES, bundle.getString(Configuration.TRANSLATOR_MODULE+Configuration.DESC), ModelType.STRING, true, null);
return operation;
}
@@ -64,11 +66,10 @@
final ModelNode address = operation.require(OP_ADDR);
final PathAddress pathAddress = PathAddress.pathAddress(address);
- final String name = operation.require(Configuration.TRANSLATOR_NAME).asString();
- final String moduleName = operation.require(Configuration.TRANSLATOR_MODULE).asString();
+ ModelNode translator = operation.require(Configuration.TRANSLATOR);
+ final String moduleName = translator.require(Configuration.TRANSLATOR_MODULE).asString();
model.get(NAME).set(pathAddress.getLastElement().getValue());
- model.get(Configuration.TRANSLATOR_NAME).set(name);
model.get(Configuration.TRANSLATOR_MODULE).set(moduleName);
}
@@ -76,8 +77,9 @@
protected void performRuntime(final OperationContext context, final ModelNode operation, final ModelNode model,
final ServiceVerificationHandler verificationHandler, final List<ServiceController<?>> newControllers) throws OperationFailedException {
- final String name = operation.require(Configuration.TRANSLATOR_NAME).asString();
- final String moduleName = operation.require(Configuration.TRANSLATOR_MODULE).asString();
+ ModelNode translator = operation.require(Configuration.TRANSLATOR);
+ final String name = translator.require(Configuration.TRANSLATOR_NAME).asString();
+ final String moduleName = translator.require(Configuration.TRANSLATOR_MODULE).asString();
final ServiceTarget target = context.getServiceTarget();
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorRemove.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorRemove.java 2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorRemove.java 2011-08-22 14:36:06 UTC (rev 3422)
@@ -24,6 +24,8 @@
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.DESCRIPTION;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OPERATION_NAME;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.REMOVE;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.REQUEST_PROPERTIES;
+import static org.teiid.jboss.Configuration.addAttribute;
import java.util.List;
import java.util.Locale;
@@ -35,6 +37,7 @@
import org.jboss.as.controller.ServiceVerificationHandler;
import org.jboss.as.controller.descriptions.DescriptionProvider;
import org.jboss.dmr.ModelNode;
+import org.jboss.dmr.ModelType;
import org.jboss.msc.service.ServiceController;
import org.jboss.msc.service.ServiceRegistry;
@@ -45,7 +48,8 @@
final ResourceBundle bundle = IntegrationPlugin.getResourceBundle(locale);
final ModelNode operation = new ModelNode();
operation.get(OPERATION_NAME).set(REMOVE);
- operation.get(DESCRIPTION).set(bundle.getString("translator.remove")); //$NON-NLS-1$
+ operation.get(DESCRIPTION).set(bundle.getString("translator.remove")); //$NON-NLS-1$
+ addAttribute(operation, Configuration.TRANSLATOR_NAME, REQUEST_PROPERTIES, bundle.getString(Configuration.TRANSLATOR_NAME+Configuration.DESC), ModelType.STRING, true, null);
return operation;
}
Copied: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBDependencyProcessor.java (from rev 3382, branches/as7/runtime/src/main/java/org/teiid/deployers/VDBDependencyProcessor.java)
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBDependencyProcessor.java (rev 0)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBDependencyProcessor.java 2011-08-22 14:36:06 UTC (rev 3422)
@@ -0,0 +1,100 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.jboss;
+
+import java.io.Closeable;
+import java.io.IOException;
+import java.util.List;
+
+import org.jboss.as.server.deployment.*;
+import org.jboss.as.server.deployment.module.*;
+import org.jboss.modules.Module;
+import org.jboss.modules.ModuleIdentifier;
+import org.jboss.modules.ModuleLoadException;
+import org.jboss.modules.ModuleLoader;
+import org.jboss.vfs.VFS;
+import org.jboss.vfs.VirtualFile;
+import org.jboss.vfs.VirtualFileFilter;
+import org.jboss.vfs.VisitorAttributes;
+import org.jboss.vfs.util.SuffixMatchFilter;
+import org.teiid.adminapi.impl.ModelMetaData;
+import org.teiid.adminapi.impl.VDBMetaData;
+import org.teiid.deployers.TeiidAttachments;
+
+public class VDBDependencyProcessor implements DeploymentUnitProcessor {
+ public static final String LIB = "/lib"; //$NON-NLS-1$
+ private static final VirtualFileFilter DEFAULT_JAR_LIB_FILTER = new SuffixMatchFilter(".jar", VisitorAttributes.DEFAULT); //$NON-NLS-1$
+
+ @Override
+ public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
+ DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
+ if (!TeiidAttachments.isVDBDeployment(deploymentUnit)) {
+ return;
+ }
+
+ if (!TeiidAttachments.isDynamicVDB(deploymentUnit)) {
+ final ResourceRoot deploymentResourceRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT);
+ final VirtualFile deploymentRoot = deploymentResourceRoot.getRoot();
+ if(deploymentRoot == null) {
+ return;
+ }
+
+ try {
+ final VirtualFile libDir = deploymentRoot.getChild(LIB);
+ if (libDir.exists()) {
+ final List<VirtualFile> archives = libDir.getChildren(DEFAULT_JAR_LIB_FILTER);
+ for (final VirtualFile archive : archives) {
+ try {
+ final Closeable closable = VFS.mountZip(archive, archive,TempFileProviderService.provider());
+ final ResourceRoot jarArchiveRoot = new ResourceRoot(archive.getName(), archive, new MountHandle(closable));
+ ModuleRootMarker.mark(jarArchiveRoot);
+ deploymentUnit.addToAttachmentList(Attachments.RESOURCE_ROOTS, jarArchiveRoot);
+ } catch (IOException e) {
+ throw new DeploymentUnitProcessingException("failed to process " + archive, e); //$NON-NLS-1$
+ }
+ }
+ }
+ } catch(IOException e) {
+ throw new DeploymentUnitProcessingException(e);
+ }
+ }
+
+ // add translators as dependent modules to this VDB.
+ try {
+ final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
+ final ModuleLoader moduleLoader = Module.getCallerModule().getModule(ModuleIdentifier.create("org.jboss.teiid")).getModuleLoader(); //$NON-NLS-1$
+ VDBMetaData vdb = deploymentUnit.getAttachment(TeiidAttachments.VDB_METADATA);
+
+ for (ModelMetaData model: vdb.getModelMetaDatas().values()) {
+ for (String source:model.getSourceNames()) {
+ moduleSpecification.addLocalDependency(new ModuleDependency(moduleLoader, ModuleIdentifier.create(model.getSourceTranslatorName(source)), false, false, false));
+ }
+ }
+ } catch (ModuleLoadException e) {
+ throw new DeploymentUnitProcessingException(e);
+ }
+ }
+
+ @Override
+ public void undeploy(DeploymentUnit context) {
+ }
+}
Property changes on: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBDependencyProcessor.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Copied: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBDeployer.java (from rev 3382, branches/as7/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java)
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBDeployer.java (rev 0)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBDeployer.java 2011-08-22 14:36:06 UTC (rev 3422)
@@ -0,0 +1,142 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.jboss;
+
+import java.util.List;
+
+import org.jboss.as.server.deployment.*;
+import org.jboss.msc.service.ServiceBuilder;
+import org.jboss.msc.service.ServiceController;
+import org.jboss.msc.service.ServiceController.Mode;
+import org.jboss.msc.service.ServiceName;
+import org.jboss.vfs.VirtualFile;
+import org.teiid.adminapi.Translator;
+import org.teiid.adminapi.impl.ModelMetaData;
+import org.teiid.adminapi.impl.VDBMetaData;
+import org.teiid.adminapi.impl.VDBTranslatorMetaData;
+import org.teiid.deployers.MetadataStoreGroup;
+import org.teiid.deployers.TeiidAttachments;
+import org.teiid.deployers.UDFMetaData;
+import org.teiid.deployers.VDBRepository;
+import org.teiid.dqp.internal.datamgr.TranslatorRepository;
+import org.teiid.logging.LogConstants;
+import org.teiid.logging.LogManager;
+import org.teiid.metadata.index.IndexMetadataFactory;
+import org.teiid.runtime.RuntimePlugin;
+
+
+public class VDBDeployer implements DeploymentUnitProcessor {
+
+ private TranslatorRepository translatorRepository;
+ private String asyncThreadPoolName;
+
+ public VDBDeployer (TranslatorRepository translatorRepo, String poolName) {
+ this.translatorRepository = translatorRepo;
+ this.asyncThreadPoolName = poolName;
+ }
+
+ public void deploy(final DeploymentPhaseContext context) throws DeploymentUnitProcessingException {
+ DeploymentUnit deploymentUnit = context.getDeploymentUnit();
+ if (!TeiidAttachments.isVDBDeployment(deploymentUnit)) {
+ return;
+ }
+ VirtualFile file = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT).getRoot();
+ VDBMetaData deployment = deploymentUnit.getAttachment(TeiidAttachments.VDB_METADATA);
+
+ // check to see if there is old vdb already deployed.
+ final ServiceController<?> controller = context.getServiceRegistry().getService(TeiidServiceNames.vdbServiceName(deployment.getName(), deployment.getVersion()));
+ if (controller != null) {
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("redeploying_vdb", deployment)); //$NON-NLS-1$
+ controller.setMode(ServiceController.Mode.REMOVE);
+ }
+
+ boolean preview = deployment.isPreview();
+ if (!preview) {
+ List<String> errors = deployment.getValidityErrors();
+ if (errors != null && !errors.isEmpty()) {
+ throw new DeploymentUnitProcessingException(RuntimePlugin.Util.getString("validity_errors_in_vdb", deployment)); //$NON-NLS-1$
+ }
+ }
+
+ // add required connector managers; if they are not already there
+ for (Translator t: deployment.getOverrideTranslators()) {
+ VDBTranslatorMetaData data = (VDBTranslatorMetaData)t;
+
+ String type = data.getType();
+ Translator parent = this.translatorRepository.getTranslatorMetaData(type);
+ if ( parent == null) {
+ throw new DeploymentUnitProcessingException(RuntimePlugin.Util.getString("translator_type_not_found", file.getName())); //$NON-NLS-1$
+ }
+ }
+
+ // check if this is a VDB with index files, if there are then build the TransformationMetadata
+ UDFMetaData udf = deploymentUnit.getAttachment(TeiidAttachments.UDF_METADATA);
+ if (udf != null) {
+ deployment.addAttchment(UDFMetaData.class, udf);
+ }
+
+ // get the metadata store of the VDB (this is build in parse stage)
+ MetadataStoreGroup store = deploymentUnit.getAttachment(TeiidAttachments.METADATA_STORE);
+ if (store != null) {
+ deployment.addAttchment(MetadataStoreGroup.class, store);
+ }
+
+ IndexMetadataFactory indexFactory = deploymentUnit.getAttachment(TeiidAttachments.INDEX_METADATA);
+ if (indexFactory != null) {
+ deployment.addAttchment(IndexMetadataFactory.class, indexFactory);
+ }
+
+ // removethe metadata objects as attachments
+ deploymentUnit.removeAttachment(TeiidAttachments.INDEX_METADATA);
+ deploymentUnit.removeAttachment(TeiidAttachments.UDF_METADATA);
+ deploymentUnit.removeAttachment(TeiidAttachments.METADATA_STORE);
+
+ // build a VDB service
+ VDBService vdb = new VDBService(deployment);
+ ServiceBuilder<VDBMetaData> vdbService = context.getServiceTarget().addService(TeiidServiceNames.vdbServiceName(deployment.getName(), deployment.getVersion()), vdb);
+ for (ModelMetaData model:deployment.getModelMetaDatas().values()) {
+ for (String sourceName:model.getSourceNames()) {
+ vdbService.addDependency(ServiceName.JBOSS.append("data-source", model.getSourceConnectionJndiName(sourceName))); //$NON-NLS-1$
+ }
+ }
+ vdbService.addDependency(TeiidServiceNames.VDB_REPO, VDBRepository.class, vdb.getVDBRepositoryInjector());
+ vdbService.addDependency(TeiidServiceNames.TRANSLATOR_REPO, TranslatorRepository.class, vdb.getTranslatorRepositoryInjector());
+ vdbService.addDependency(TeiidServiceNames.executorServiceName(this.asyncThreadPoolName), TranslatorRepository.class, vdb.getTranslatorRepositoryInjector());
+ vdbService.addDependency(TeiidServiceNames.OBJECT_SERIALIZER, ObjectSerializer.class, vdb.getSerializerInjector());
+ vdbService.setInitialMode(Mode.ACTIVE).install();
+ }
+
+
+ @Override
+ public void undeploy(final DeploymentUnit deploymentUnit) {
+ if (!TeiidAttachments.isVDBDeployment(deploymentUnit)) {
+ return;
+ }
+
+ VDBMetaData deployment = deploymentUnit.getAttachment(TeiidAttachments.VDB_METADATA);
+ final ServiceController<?> controller = deploymentUnit.getServiceRegistry().getService(TeiidServiceNames.vdbServiceName(deployment.getName(), deployment.getVersion()));
+ if (controller != null) {
+ controller.setMode(ServiceController.Mode.REMOVE);
+ }
+ }
+
+}
Property changes on: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBDeployer.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Copied: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBParserDeployer.java (from rev 3382, branches/as7/runtime/src/main/java/org/teiid/deployers/VDBParserDeployer.java)
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBParserDeployer.java (rev 0)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBParserDeployer.java 2011-08-22 14:36:06 UTC (rev 3422)
@@ -0,0 +1,201 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.jboss;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+
+import javax.xml.XMLConstants;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+
+import org.jboss.as.server.deployment.*;
+import org.jboss.vfs.VirtualFile;
+import org.teiid.adminapi.Model;
+import org.teiid.adminapi.impl.ModelMetaData;
+import org.teiid.adminapi.impl.VDBMetaData;
+import org.teiid.deployers.*;
+import org.teiid.logging.LogConstants;
+import org.teiid.logging.LogManager;
+import org.teiid.metadata.VdbConstants;
+import org.teiid.metadata.index.IndexMetadataFactory;
+import org.teiid.runtime.RuntimePlugin;
+import org.xml.sax.SAXException;
+
+
+/**
+ * This file loads the "vdb.xml" file inside a ".vdb" file, along with all the metadata in the .INDEX files
+ */
+public class VDBParserDeployer implements DeploymentUnitProcessor {
+ private ObjectSerializer serializer;
+ private VDBRepository vdbRepository;
+
+ public VDBParserDeployer(VDBRepository repo, ObjectSerializer serializer) {
+ this.vdbRepository = repo;
+ this.serializer = serializer;
+ }
+
+ public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
+ DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
+ if (!TeiidAttachments.isVDBDeployment(deploymentUnit)) {
+ return;
+ }
+
+ VirtualFile file = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT).getRoot();
+
+ if (TeiidAttachments.isDynamicVDB(deploymentUnit)) {
+ parseVDBXML(file, deploymentUnit);
+ }
+ else {
+ // scan for different files
+ List<VirtualFile> childFiles = file.getChildren();
+ for (VirtualFile childFile:childFiles) {
+ scanVDB(childFile, deploymentUnit);
+ }
+
+ mergeMetaData(deploymentUnit);
+ }
+ }
+
+ private void scanVDB(VirtualFile file, DeploymentUnit deploymentUnit) throws DeploymentUnitProcessingException {
+ if (file.isDirectory()) {
+ List<VirtualFile> childFiles = file.getChildren();
+ for (VirtualFile childFile:childFiles) {
+ scanVDB(childFile, deploymentUnit);
+ }
+ }
+ else {
+ if (file.getLowerCaseName().equals(VdbConstants.DEPLOYMENT_FILE)) {
+ parseVDBXML(file, deploymentUnit);
+ }
+ else if (file.getLowerCaseName().endsWith(VdbConstants.INDEX_EXT)) {
+ IndexMetadataFactory imf = deploymentUnit.getAttachment(TeiidAttachments.INDEX_METADATA);
+ if (imf == null) {
+ imf = new IndexMetadataFactory();
+ deploymentUnit.putAttachment(TeiidAttachments.INDEX_METADATA, imf);
+ }
+ imf.addIndexFile(file);
+ }
+ else if (file.getLowerCaseName().endsWith(VdbConstants.MODEL_EXT)) {
+ UDFMetaData udf = deploymentUnit.getAttachment(TeiidAttachments.UDF_METADATA);
+ if (udf == null) {
+ udf = new UDFMetaData();
+ deploymentUnit.putAttachment(TeiidAttachments.UDF_METADATA, udf);
+ }
+ udf.addModelFile(file);
+ }
+
+ }
+ }
+
+ private void parseVDBXML(VirtualFile file, DeploymentUnit deploymentUnit)
+ throws DeploymentUnitProcessingException {
+ try {
+ Unmarshaller un = getUnMarsheller();
+ VDBMetaData vdb = (VDBMetaData)un.unmarshal(file.openStream());
+ deploymentUnit.putAttachment(TeiidAttachments.VDB_METADATA, vdb);
+ LogManager.logDetail(LogConstants.CTX_RUNTIME,"VDB "+file.getName()+" has been parsed."); //$NON-NLS-1$ //$NON-NLS-2$
+ } catch (JAXBException e) {
+ throw new DeploymentUnitProcessingException(e);
+ } catch (SAXException e) {
+ throw new DeploymentUnitProcessingException(e);
+ } catch (IOException e) {
+ throw new DeploymentUnitProcessingException(e);
+ }
+ }
+
+ public void undeploy(final DeploymentUnit context) {
+ }
+
+
+ static Unmarshaller getUnMarsheller() throws JAXBException, SAXException {
+ JAXBContext jc = JAXBContext.newInstance(new Class<?>[] {VDBMetaData.class});
+ SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ Schema schema = schemaFactory.newSchema(VDBMetaData.class.getResource("/vdb-deployer.xsd")); //$NON-NLS-1$
+ Unmarshaller un = jc.createUnmarshaller();
+ un.setSchema(schema);
+ return un;
+ }
+
+ protected VDBMetaData mergeMetaData(DeploymentUnit deploymentUnit) throws DeploymentUnitProcessingException {
+ VDBMetaData vdb = deploymentUnit.getAttachment(TeiidAttachments.VDB_METADATA);
+ UDFMetaData udf = deploymentUnit.getAttachment(TeiidAttachments.UDF_METADATA);
+ IndexMetadataFactory imf = deploymentUnit.getAttachment(TeiidAttachments.INDEX_METADATA);
+
+ VirtualFile file = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT).getRoot();
+ if (vdb == null) {
+ LogManager.logError(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("invlaid_vdb_file",file.getName())); //$NON-NLS-1$
+ return null;
+ }
+
+ try {
+ vdb.setUrl(file.toURL());
+
+ // build the metadata store
+ if (imf != null) {
+ imf.addEntriesPlusVisibilities(file, vdb);
+
+ // add the cached store.
+ File cacheFile = VDBDeployer.buildCachedVDBFileName(this.serializer, file, vdb);
+ // check to see if the vdb has been modified when server is down; if it is then clear the old files
+ if (this.serializer.isStale(cacheFile, file.getLastModified())) {
+ this.serializer.removeAttachments(file);
+ LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB", file.getName(), "old cached metadata has been removed"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ MetadataStoreGroup stores = this.serializer.loadSafe(cacheFile, MetadataStoreGroup.class);
+ if (stores == null) {
+ // start to build the new metadata
+ stores = new MetadataStoreGroup();
+ stores.addStore(imf.getMetadataStore(vdbRepository.getSystemStore().getDatatypes()));
+ }
+ else {
+ LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB", file.getName(), "was loaded from cached metadata"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ deploymentUnit.putAttachment(TeiidAttachments.METADATA_STORE, stores);
+ }
+
+ if (udf != null) {
+ // load the UDF
+ for(Model model:vdb.getModels()) {
+ if (model.getModelType().equals(Model.Type.FUNCTION)) {
+ String path = ((ModelMetaData)model).getPath();
+ if (path == null) {
+ throw new DeploymentUnitProcessingException(RuntimePlugin.Util.getString("invalid_udf_file", model.getName())); //$NON-NLS-1$
+ }
+ udf.buildFunctionModelFile(model.getName(), path);
+ }
+ }
+ }
+ } catch(IOException e) {
+ throw new DeploymentUnitProcessingException(e);
+ } catch (JAXBException e) {
+ throw new DeploymentUnitProcessingException(e);
+ }
+
+ LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB", file.getName(), "has been parsed."); //$NON-NLS-1$ //$NON-NLS-2$
+ return vdb;
+ }
+}
Property changes on: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBParserDeployer.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBRepositoryService.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBRepositoryService.java (rev 0)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBRepositoryService.java 2011-08-22 14:36:06 UTC (rev 3422)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.jboss;
+
+import org.jboss.msc.service.Service;
+import org.jboss.msc.service.StartContext;
+import org.jboss.msc.service.StartException;
+import org.jboss.msc.service.StopContext;
+import org.teiid.deployers.VDBRepository;
+
+public class VDBRepositoryService implements Service<VDBRepository> {
+ private VDBRepository repo;
+
+ public VDBRepositoryService(VDBRepository repo) {
+ this.repo = repo;
+ }
+
+ @Override
+ public void start(StartContext context) throws StartException {
+ repo.start();
+ }
+
+ @Override
+ public void stop(StopContext context) {
+ }
+
+ @Override
+ public VDBRepository getValue() throws IllegalStateException, IllegalArgumentException {
+ return repo;
+ }
+}
Property changes on: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBRepositoryService.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Copied: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBService.java (from rev 3382, branches/as7/runtime/src/main/java/org/teiid/deployers/VDBService.java)
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBService.java (rev 0)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBService.java 2011-08-22 14:36:06 UTC (rev 3422)
@@ -0,0 +1,395 @@
+package org.teiid.jboss;
+
+import java.io.File;
+import java.io.IOException;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.util.concurrent.Executor;
+
+import javax.resource.spi.work.WorkManager;
+
+import org.jboss.as.server.deployment.Attachments;
+import org.jboss.as.server.deployment.DeploymentUnitProcessingException;
+import org.jboss.msc.service.Service;
+import org.jboss.msc.service.StartContext;
+import org.jboss.msc.service.StartException;
+import org.jboss.msc.service.StopContext;
+import org.jboss.msc.value.InjectedValue;
+import org.jboss.vfs.VirtualFile;
+import org.teiid.adminapi.Model;
+import org.teiid.adminapi.Translator;
+import org.teiid.adminapi.VDB;
+import org.teiid.adminapi.impl.ModelMetaData;
+import org.teiid.adminapi.impl.SourceMappingMetadata;
+import org.teiid.adminapi.impl.VDBMetaData;
+import org.teiid.adminapi.impl.VDBTranslatorMetaData;
+import org.teiid.core.TeiidException;
+import org.teiid.deployers.*;
+import org.teiid.dqp.internal.datamgr.ConnectorManager;
+import org.teiid.dqp.internal.datamgr.ConnectorManagerRepository;
+import org.teiid.dqp.internal.datamgr.TranslatorRepository;
+import org.teiid.logging.LogConstants;
+import org.teiid.logging.LogManager;
+import org.teiid.metadata.MetadataStore;
+import org.teiid.metadata.index.IndexMetadataFactory;
+import org.teiid.query.metadata.TransformationMetadata.Resource;
+import org.teiid.runtime.RuntimePlugin;
+import org.teiid.translator.DelegatingExecutionFactory;
+import org.teiid.translator.ExecutionFactory;
+import org.teiid.translator.TranslatorException;
+
+public class VDBService implements Service<VDBMetaData> {
+ private VDBMetaData vdb;
+ private final InjectedValue<VDBRepository> vdbRepositoryInjector = new InjectedValue<VDBRepository>();
+ private final InjectedValue<TranslatorRepository> translatorRepositoryInjector = new InjectedValue<TranslatorRepository>();
+ private final InjectedValue<Executor> executorInjector = new InjectedValue<Executor>();
+ private final InjectedValue<ObjectSerializer> serializerInjector = new InjectedValue<ObjectSerializer>();
+
+ public VDBService(VDBMetaData metadata) {
+ this.vdb = metadata;
+ }
+
+ @Override
+ public void start(StartContext context) throws StartException {
+ ConnectorManagerRepository cmr = new ConnectorManagerRepository();
+ TranslatorRepository repo = new TranslatorRepository();
+
+ // add required connector managers; if they are not already there
+ for (Translator t: vdb.getOverrideTranslators()) {
+ VDBTranslatorMetaData data = (VDBTranslatorMetaData)t;
+
+ String type = data.getType();
+ Translator parent = getTranslatorRepository().getTranslatorMetaData(type);
+
+ Set<String> keys = parent.getProperties().stringPropertyNames();
+ for (String key:keys) {
+ if (data.getPropertyValue(key) == null && parent.getPropertyValue(key) != null) {
+ data.addProperty(key, parent.getPropertyValue(key));
+ }
+ }
+ repo.addTranslatorMetadata(data.getName(), data);
+ }
+
+ createConnectorManagers(cmr, repo, vdb);
+
+ // check if this is a VDB with index files, if there are then build the TransformationMetadata
+ UDFMetaData udf = vdb.getAttachment(UDFMetaData.class);
+ MetadataStoreGroup store = vdb.getAttachment(MetadataStoreGroup.class);
+
+ boolean asynchLoad = false;
+ boolean preview = vdb.isPreview();
+
+ // if store is null and vdb dynamic vdb then try to get the metadata
+ if (store == null && vdb.isDynamic()) {
+ store = new MetadataStoreGroup();
+ asynchLoad = buildDynamicMetadataStore(vdb, store, cmr);
+ }
+
+ // allow empty vdbs for enabling the preview functionality
+ if (preview && store == null) {
+ store = new MetadataStoreGroup();
+ }
+
+ if (store == null) {
+ LogManager.logError(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("failed_matadata_load", vdb.getName(), vdb.getVersion())); //$NON-NLS-1$
+ }
+
+ LinkedHashMap<String, Resource> visibilityMap = null;
+ IndexMetadataFactory indexFactory = vdb.getAttachment(IndexMetadataFactory.class);
+ if (indexFactory != null) {
+ visibilityMap = indexFactory.getEntriesPlusVisibilities();
+ }
+
+ try {
+ // add transformation metadata to the repository.
+ getVDBRepository().addVDB(vdb, store, visibilityMap, udf, cmr);
+ } catch (VirtualDatabaseException e) {
+ throw new StartException(e);
+ }
+
+ boolean valid = true;
+ synchronized (vdb) {
+ if (indexFactory != null) {
+ try {
+ saveMetadataStore(vdb, store);
+ } catch (IOException e1) {
+ LogManager.logWarning(LogConstants.CTX_RUNTIME, e1, RuntimePlugin.Util.getString("vdb_save_failed", vdb.getName()+"."+vdb.getVersion())); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+ if (!preview) {
+ valid = validateSources(cmr, vdb);
+
+ // Check if the VDB is fully configured.
+ if (!valid) {
+ vdb.setStatus(VDB.Status.INACTIVE);
+ } else if (!asynchLoad) {
+ //if asynch this will be set by the loading thread
+ getVDBRepository().finishDeployment(vdb.getName(), vdb.getVersion());
+ vdb.setStatus(VDB.Status.ACTIVE);
+ }
+ }
+ else {
+ vdb.setStatus(VDB.Status.ACTIVE);
+ }
+ }
+ this.vdb.removeAttachment(UDFMetaData.class);
+ this.vdb.removeAttachment(MetadataStoreGroup.class);
+ this.vdb.removeAttachment(IndexMetadataFactory.class);
+
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("vdb_deployed",vdb, valid?"active":"inactive")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+
+ @Override
+ public void stop(StopContext context) {
+
+ getVDBRepository().removeVDB(vdb.getName(), vdb.getVersion());
+ vdb.setRemoved(true);
+
+ deleteMetadataStore(vdb);
+
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("vdb_undeployed", vdb)); //$NON-NLS-1$
+
+ }
+
+ @Override
+ public VDBMetaData getValue() throws IllegalStateException,IllegalArgumentException {
+ return this.vdb;
+ }
+
+ private void createConnectorManagers(ConnectorManagerRepository cmr, TranslatorRepository repo, final VDBMetaData deployment) throws StartException {
+ IdentityHashMap<Translator, ExecutionFactory<Object, Object>> map = new IdentityHashMap<Translator, ExecutionFactory<Object, Object>>();
+
+ for (Model model:deployment.getModels()) {
+ for (String source:model.getSourceNames()) {
+ if (cmr.getConnectorManager(source) != null) {
+ continue;
+ }
+
+ String name = model.getSourceTranslatorName(source);
+ ConnectorManager cm = new ConnectorManager(name, model.getSourceConnectionJndiName(source));
+ ExecutionFactory<Object, Object> ef = getExecutionFactory(name, repo, deployment, map, new HashSet<String>());
+ cm.setExecutionFactory(ef);
+ cm.setModelName(model.getName());
+ cmr.addConnectorManager(source, cm);
+ }
+ }
+ }
+
+ private ExecutionFactory<Object, Object> getExecutionFactory(String name, TranslatorRepository repo, VDBMetaData deployment, IdentityHashMap<Translator, ExecutionFactory<Object, Object>> map, HashSet<String> building) throws StartException {
+ if (!building.add(name)) {
+ throw new StartException(RuntimePlugin.Util.getString("recursive_delegation", deployment.getName(), deployment.getVersion(), building)); //$NON-NLS-1$
+ }
+ VDBTranslatorMetaData translator = repo.getTranslatorMetaData(name);
+ if (translator == null) {
+ translator = getTranslatorRepository().getTranslatorMetaData(name);
+ }
+ if (translator == null) {
+ throw new StartException(RuntimePlugin.Util.getString("translator_not_found", deployment.getName(), deployment.getVersion(), name)); //$NON-NLS-1$
+ }
+ try {
+ ExecutionFactory<Object, Object> ef = map.get(translator);
+ if ( ef == null) {
+ ef = TranslatorUtil.buildExecutionFactory(translator);
+ if (ef instanceof DelegatingExecutionFactory) {
+ DelegatingExecutionFactory delegator = (DelegatingExecutionFactory)ef;
+ String delegateName = delegator.getDelegateName();
+ if (delegateName != null) {
+ ExecutionFactory<Object, Object> delegate = getExecutionFactory(delegateName, repo, deployment, map, building);
+ ((DelegatingExecutionFactory) ef).setDelegate(delegate);
+ }
+ }
+ map.put(translator, ef);
+ }
+ return ef;
+ } catch(TeiidException e) {
+ throw new StartException(e);
+ }
+ }
+
+
+ private boolean validateSources(ConnectorManagerRepository cmr, VDBMetaData deployment) {
+ boolean valid = true;
+ for(Model m:deployment.getModels()) {
+ ModelMetaData model = (ModelMetaData)m;
+ List<SourceMappingMetadata> mappings = model.getSourceMappings();
+ for (SourceMappingMetadata mapping:mappings) {
+ ConnectorManager cm = cmr.getConnectorManager(mapping.getName());
+ String msg = cm.getStausMessage();
+ if (msg != null && msg.length() > 0) {
+ valid = false;
+ model.addError(ModelMetaData.ValidationError.Severity.ERROR.name(), cm.getStausMessage());
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, cm.getStausMessage());
+ }
+ }
+
+ // in the dynamic case the metadata may be still loading.
+ if (!model.getErrors().isEmpty()) {
+ valid = false;
+ }
+ }
+ return valid;
+ }
+
+ private boolean buildDynamicMetadataStore(final VDBMetaData vdb, final MetadataStoreGroup vdbStore, final ConnectorManagerRepository cmr) throws StartException {
+ boolean asynch = false;
+ // make sure we are configured correctly first
+ for (final ModelMetaData model:vdb.getModelMetaDatas().values()) {
+ if (model.getSourceNames().isEmpty()) {
+ throw new StartException(RuntimePlugin.Util.getString("fail_to_deploy", vdb.getName()+"-"+vdb.getVersion(), model.getName())); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ final boolean cache = "cached".equalsIgnoreCase(vdb.getPropertyValue("UseConnectorMetadata")); //$NON-NLS-1$ //$NON-NLS-2$
+ final File cacheFile = buildCachedModelFileName(vdb, model.getName());
+ boolean loaded = false;
+ if (cache) {
+ MetadataStore store = getSerializer().loadSafe(cacheFile, MetadataStore.class);
+ if (store != null) {
+ vdbStore.addStore(store);
+ loaded = true;
+ }
+ }
+
+ if (!loaded) {
+ Runnable job = new Runnable() {
+ @Override
+ public void run() {
+ Boolean loadStatus = loadMetadata(vdb, model, cache, cacheFile, vdbStore, cmr);
+ //if (loadStatus == null) {
+ //TODO: a source is up, but we failed. should we retry or poll?
+ //}
+ if (loadStatus == null || !loadStatus) {
+ //defer the load to the status checker if/when a source is available/redeployed
+ model.addAttchment(Runnable.class, this);
+ }
+ }
+ };
+ Executor executor = getExecutor();
+ if (executor == null) {
+ job.run();
+ }
+ else {
+ asynch = true;
+ executor.execute(job);
+ }
+ }
+ }
+ return asynch;
+ }
+
+ /**
+ * @return true if loaded, null if not loaded - but a cm is available, else false
+ */
+ private Boolean loadMetadata(VDBMetaData vdb, ModelMetaData model, boolean cache, File cacheFile, MetadataStoreGroup vdbStore, ConnectorManagerRepository cmr) {
+ String msg = RuntimePlugin.Util.getString("model_metadata_loading", vdb.getName(), vdb.getVersion(), model.getName(), SimpleDateFormat.getInstance().format(new Date())); //$NON-NLS-1$
+ model.addError(ModelMetaData.ValidationError.Severity.ERROR.toString(), msg);
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, msg);
+
+ String exceptionMessage = null;
+ Boolean loaded = false;
+ for (String sourceName: model.getSourceNames()) {
+ ConnectorManager cm = cmr.getConnectorManager(sourceName);
+ String status = cm.getStausMessage();
+ if (status != null && status.length() > 0) {
+ exceptionMessage = status;
+ continue;
+ }
+ loaded = null;
+ try {
+ MetadataStore store = cm.getMetadata(model.getName(), getVDBRepository().getBuiltinDatatypes(), model.getProperties());
+ if (cache) {
+ getSerializer().saveAttachment(cacheFile, store);
+ }
+ vdbStore.addStore(store);
+ loaded = true;
+ break;
+ } catch (TranslatorException e) {
+ //TODO: we aren't effectively differentiating the type of load error - connectivity vs. metadata
+ if (exceptionMessage == null) {
+ exceptionMessage = e.getMessage();
+ }
+ } catch (IOException e) {
+ if (exceptionMessage == null) {
+ exceptionMessage = e.getMessage();
+ }
+ }
+ }
+
+ synchronized (vdb) {
+ if (loaded == null || !loaded) {
+ vdb.setStatus(VDB.Status.INACTIVE);
+ String failed_msg = RuntimePlugin.Util.getString(loaded==null?"failed_to_retrive_metadata":"nosources_to_retrive_metadata", vdb.getName(), vdb.getVersion(), model.getName()); //$NON-NLS-1$ //$NON-NLS-2$
+ model.addError(ModelMetaData.ValidationError.Severity.ERROR.toString(), failed_msg);
+ if (exceptionMessage != null) {
+ model.addError(ModelMetaData.ValidationError.Severity.ERROR.toString(), exceptionMessage);
+ }
+ LogManager.logWarning(LogConstants.CTX_RUNTIME, failed_msg);
+ } else {
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("metadata_loaded",vdb.getName(), vdb.getVersion(), model.getName())); //$NON-NLS-1$
+ model.clearErrors();
+ if (vdb.isValid()) {
+ getVDBRepository().finishDeployment(vdb.getName(), vdb.getVersion());
+ vdb.setStatus(VDB.Status.ACTIVE);
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("vdb_activated",vdb.getName(), vdb.getVersion())); //$NON-NLS-1$
+ }
+ }
+ }
+
+ return loaded;
+ }
+
+ private void saveMetadataStore(VDBMetaData vdb, MetadataStoreGroup store) throws IOException {
+ File cacheFileName = buildCachedVDBFileName(getSerializer(), vdb);
+ if (!cacheFileName.exists()) {
+ getSerializer().saveAttachment(cacheFileName,store);
+ LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB "+vdb.getName()+" metadata has been cached to "+ cacheFileName); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+
+ private void deleteMetadataStore(VDBMetaData vdb) {
+ if (!unit.exists() || !shutdownListener.isShutdownInProgress()) {
+ getSerializer().removeAttachments(vdb.getName()+"_"+vdb.getVersion()); //$NON-NLS-1$
+ LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB "+vdb.getName()+" metadata removed"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+
+
+ private File buildCachedModelFileName(VDBMetaData vdb, String modelName) {
+ return getSerializer().getAttachmentPath(vdb.getName()+"_"+vdb.getVersion(), vdb.getName()+"_"+vdb.getVersion()+"_"+modelName); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+
+ static File buildCachedVDBFileName(ObjectSerializer serializer, VDBMetaData vdb) {
+ return serializer.getAttachmentPath(vdb.getName()+"_"+vdb.getVersion(), vdb.getName()+"_"+vdb.getVersion()); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ public InjectedValue<VDBRepository> getVDBRepositoryInjector(){
+ return this.vdbRepositoryInjector;
+ }
+
+ private VDBRepository getVDBRepository() {
+ return vdbRepositoryInjector.getValue();
+ }
+
+ public InjectedValue<TranslatorRepository> getTranslatorRepositoryInjector(){
+ return this.translatorRepositoryInjector;
+ }
+
+ private TranslatorRepository getTranslatorRepository() {
+ return this.translatorRepositoryInjector.getValue();
+ }
+
+ public InjectedValue<Executor> getExecutorInjector(){
+ return this.executorInjector;
+ }
+
+ private Executor getExecutor() {
+ return this.executorInjector.getValue();
+ }
+
+ public InjectedValue<ObjectSerializer> getSerializerInjector() {
+ return serializerInjector;
+ }
+
+ private ObjectSerializer getSerializer() {
+ return serializerInjector.getValue();
+ }
+}
Property changes on: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBService.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Copied: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBStructure.java (from rev 3382, branches/as7/runtime/src/main/java/org/teiid/deployers/VDBStructure.java)
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBStructure.java (rev 0)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBStructure.java 2011-08-22 14:36:06 UTC (rev 3422)
@@ -0,0 +1,85 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.jboss;
+
+import java.io.Closeable;
+import java.io.IOException;
+
+import org.jboss.as.server.deployment.*;
+import org.jboss.as.server.deployment.module.ModuleRootMarker;
+import org.jboss.as.server.deployment.module.MountHandle;
+import org.jboss.as.server.deployment.module.ResourceRoot;
+import org.jboss.as.server.deployment.module.TempFileProviderService;
+import org.jboss.vfs.VFS;
+import org.jboss.vfs.VirtualFile;
+import org.teiid.deployers.TeiidAttachments;
+import org.teiid.metadata.VdbConstants;
+
+
+
+public class VDBStructure implements DeploymentUnitProcessor {
+ private static final String VDB_EXTENSION = ".vdb"; //$NON-NLS-1$
+ private static final String DYNAMIC_VDB_STRUCTURE = "-vdb.xml"; //$NON-NLS-1$
+
+ @Override
+ public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
+
+ DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
+
+ VirtualFile file = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT).getRoot();
+ if (file == null) {
+ return;
+ }
+
+ if(file.getLowerCaseName().endsWith(VDB_EXTENSION)) {
+
+ try {
+ final Closeable closable = VFS.mountZip(file, file, TempFileProviderService.provider());
+ final ResourceRoot vdbArchiveRoot = new ResourceRoot(file.getName(), file, new MountHandle(closable));
+ ModuleRootMarker.mark(vdbArchiveRoot);
+
+ VirtualFile metainf = file.getChild("META-INF"); //$NON-NLS-1$
+ if (metainf == null) {
+ return;
+ }
+
+ if (metainf.getChild(VdbConstants.DEPLOYMENT_FILE) == null) {
+ return;
+ }
+ // adds a TYPE attachment.
+ TeiidAttachments.setAsVDBDeployment(deploymentUnit);
+ } catch (IOException e) {
+ throw new DeploymentUnitProcessingException("failed to process " + file, e); //$NON-NLS-1$
+ }
+ }
+ else if (file.getLowerCaseName().endsWith(DYNAMIC_VDB_STRUCTURE)) {
+ TeiidAttachments.setAsDynamicVDBDeployment(deploymentUnit);
+ }
+ }
+
+
+ @Override
+ public void undeploy(final DeploymentUnit context) {
+
+ }
+
+}
Property changes on: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBStructure.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2011-08-22 14:36:06 UTC (rev 3422)
@@ -30,20 +30,8 @@
import java.sql.Clob;
import java.sql.SQLException;
import java.sql.SQLXML;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Date;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Properties;
-import java.util.Set;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.Executor;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
+import java.util.*;
+import java.util.concurrent.*;
import javax.naming.InitialContext;
import javax.naming.NamingException;
@@ -64,14 +52,7 @@
import org.teiid.adminapi.AdminComponentException;
import org.teiid.adminapi.AdminException;
import org.teiid.adminapi.AdminProcessingException;
-import org.teiid.adminapi.impl.CacheStatisticsMetadata;
-import org.teiid.adminapi.impl.DQPManagement;
-import org.teiid.adminapi.impl.RequestMetadata;
-import org.teiid.adminapi.impl.SessionMetadata;
-import org.teiid.adminapi.impl.TransactionMetadata;
-import org.teiid.adminapi.impl.VDBMetaData;
-import org.teiid.adminapi.impl.VDBTranslatorMetaData;
-import org.teiid.adminapi.impl.WorkerPoolStatisticsMetadata;
+import org.teiid.adminapi.impl.*;
import org.teiid.cache.CacheFactory;
import org.teiid.client.DQP;
import org.teiid.client.RequestMessage;
@@ -89,11 +70,7 @@
import org.teiid.deployers.VDBLifeCycleListener;
import org.teiid.deployers.VDBRepository;
import org.teiid.dqp.internal.datamgr.TranslatorRepository;
-import org.teiid.dqp.internal.process.DQPConfiguration;
-import org.teiid.dqp.internal.process.DQPCore;
-import org.teiid.dqp.internal.process.DQPWorkContext;
-import org.teiid.dqp.internal.process.DataTierManagerImpl;
-import org.teiid.dqp.internal.process.TransactionServerImpl;
+import org.teiid.dqp.internal.process.*;
import org.teiid.dqp.service.BufferService;
import org.teiid.dqp.service.SessionService;
import org.teiid.dqp.service.SessionServiceException;
@@ -101,30 +78,18 @@
import org.teiid.events.EventDistributor;
import org.teiid.events.EventDistributorFactory;
import org.teiid.jboss.IntegrationPlugin;
-import org.teiid.logging.Log4jListener;
import org.teiid.logging.LogConstants;
import org.teiid.logging.LogManager;
import org.teiid.logging.MessageLevel;
-import org.teiid.metadata.AbstractMetadataRecord;
-import org.teiid.metadata.Column;
-import org.teiid.metadata.ColumnStats;
-import org.teiid.metadata.Procedure;
-import org.teiid.metadata.Schema;
-import org.teiid.metadata.Table;
+import org.teiid.metadata.*;
import org.teiid.metadata.Table.TriggerEvent;
-import org.teiid.metadata.TableStats;
import org.teiid.net.TeiidURL;
import org.teiid.query.metadata.TransformationMetadata;
import org.teiid.query.processor.DdlPlan;
import org.teiid.security.SecurityHelper;
import org.teiid.services.BufferServiceImpl;
import org.teiid.services.SessionServiceImpl;
-import org.teiid.transport.ClientServiceRegistry;
-import org.teiid.transport.ClientServiceRegistryImpl;
-import org.teiid.transport.LogonImpl;
-import org.teiid.transport.ODBCSocketListener;
-import org.teiid.transport.SocketConfiguration;
-import org.teiid.transport.SocketListener;
+import org.teiid.transport.*;
import org.teiid.vdb.runtime.VDBKey;
@@ -156,18 +121,25 @@
public final InjectedValue<WorkManager> workManagerInjector = new InjectedValue<WorkManager>();
public final InjectedValue<XATerminator> xaTerminatorInjector = new InjectedValue<XATerminator>();
public final InjectedValue<TransactionManager> txnManagerInjector = new InjectedValue<TransactionManager>();
- public final InjectedValue<Executor> threadPoolInjector = new InjectedValue<Executor>();
public final InjectedValue<SocketBinding> jdbcSocketBindingInjector = new InjectedValue<SocketBinding>();
public final InjectedValue<BufferServiceImpl> bufferServiceInjector = new InjectedValue<BufferServiceImpl>();
public final InjectedValue<SocketBinding> odbcSocketBindingInjector = new InjectedValue<SocketBinding>();
+ public final InjectedValue<TranslatorRepository> translatorRepositoryInjector = new InjectedValue<TranslatorRepository>();
+ public final InjectedValue<VDBRepository> vdbRepositoryInjector = new InjectedValue<VDBRepository>();
+ public final InjectedValue<AuthorizationValidator> authorizationValidatorInjector = new InjectedValue<AuthorizationValidator>();
+
+
public final ConcurrentMap<String, SecurityDomainContext> securityDomains = new ConcurrentHashMap<String, SecurityDomainContext>();
private LinkedList<String> securityDomainNames = new LinkedList<String>();
-
+ private String instanceName;
- public RuntimeEngineDeployer() {
- // TODO: this does not belong here
- LogManager.setLogListener(new Log4jListener());
+ public RuntimeEngineDeployer(String name) {
+ this.instanceName = name;
}
+
+ public String getName() {
+ return this.instanceName;
+ }
@Override
public <T> T getClientService(Class<T> iface)
@@ -185,6 +157,9 @@
setWorkManager(this.workManagerInjector.getValue());
setXATerminator(xaTerminatorInjector.getValue());
setTransactionManager(txnManagerInjector.getValue());
+ setTranslatorRepository(translatorRepositoryInjector.getValue());
+ setVDBRepository(vdbRepositoryInjector.getValue());
+ setAuthorizationValidator(authorizationValidatorInjector.getValue());
this.sessionService = new SessionServiceImpl();
if (!this.securityDomainNames.isEmpty()) {
@@ -222,7 +197,7 @@
this.dqpCore.setMetadataRepository(this.vdbRepository.getMetadataRepository());
this.dqpCore.setEventDistributor(this.eventDistributor);
this.dqpCore.start(this);
- this.eventDistributorProxy = (EventDistributor)Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class[] {EventDistributor.class}, new InvocationHandler() {
+ this.eventDistributorProxy = (EventDistributor)Proxy.newProxyInstance(Module.getCallerModule().getClassLoader(), new Class[] {EventDistributor.class}, new InvocationHandler() {
@Override
public Object invoke(Object proxy, Method method, Object[] args)
@@ -826,7 +801,7 @@
}
public VDBTranslatorMetaData getTranslator(String translatorName) {
- return (VDBTranslatorMetaData)this.translatorRepository.getTranslatorMetaData(translatorName);
+ return this.translatorRepository.getTranslatorMetaData(translatorName);
}
public void setTranslatorRepository(TranslatorRepository translatorRepo) {
Modified: branches/as7/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties
===================================================================
--- branches/as7/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties 2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties 2011-08-22 14:36:06 UTC (rev 3422)
@@ -182,3 +182,10 @@
RuntimeEngineDeployer.execute-query.timeout-in-milli.describe=timeout
socket-binding.not_defined=Teiid socket binding not defined for JDBC or ODBC port.
+
+name.describe = Name of the subsystem
+engine.remove = Remove Teiid query engine
+engine.add = Add Teiid query engine
+translator.add = Add Teiid translator
+translator.remove = Remove Teiid translator
+teiid-boot.add = Teiid boot services
\ No newline at end of file
Modified: branches/as7/jboss-integration/src/main/resources/schema/jboss-teiid.xsd
===================================================================
--- branches/as7/jboss-integration/src/main/resources/schema/jboss-teiid.xsd 2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/jboss-integration/src/main/resources/schema/jboss-teiid.xsd 2011-08-22 14:36:06 UTC (rev 3422)
@@ -32,6 +32,57 @@
<xs:complexType name="teiidType">
<xs:sequence>
+ <xs:element name="allow-env-function" type="xs:boolean" minOccurs="0" maxOccurs="1" default="false">
+ <xs:annotation>
+ <xs:documentation>Allow execution of ENV function (default false)</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:element name="async-thread-group" type="xs:string" minOccurs="0" maxOccurs="1" default="teiid-async">
+ <xs:annotation>
+ <xs:documentation>Thread group to use for Async Processing</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="buffer-service" type="buffer-service-type" maxOccurs="1" minOccurs="1">
+ <xs:annotation>
+ <xs:documentation>Buffer manager information</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:element name="authorization-validator-module" type="xs:string" minOccurs="0" maxOccurs="1">
+ <xs:annotation>
+ <xs:documentation>An authorization validator that by default uses data role information stored in VDBs. Provide module name.</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:element name="policy-decider-module" type="xs:string" minOccurs="0" maxOccurs="1">
+ <xs:annotation>
+ <xs:documentation>A policy decider that uses data role information stored in VDBs, Provide module name.</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+
+
+ <xs:element name="distributed-cache-factory" type="cache-factory-type" maxOccurs="1" minOccurs="1">
+ <xs:annotation>
+ <xs:documentation>Cache Factory</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:element name="resultset-cache" type="cache-config" maxOccurs="1" minOccurs="0">
+ <xs:annotation>
+ <xs:documentation>Configuration for result set caching.
+ There will be 2 caches with these settings.
+ One cache holds results that are specific to sessions.
+ The other cache holds vdb scoped results and can
+ be replicated.</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="preparedplan-cache" type="cache-config" maxOccurs="1" minOccurs="0">
+ <xs:annotation>
+ <xs:documentation>Configuration for prepared plan caching. (local memory only)</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+
<xs:element name="query-engine" type="runtime-engine-type" maxOccurs="1" minOccurs="1">
<xs:annotation>
<xs:documentation>Main Teiid runtime engine configuration</xs:documentation>
@@ -136,11 +187,6 @@
</xs:complexType>
<xs:complexType name="runtime-engine-type">
<xs:sequence>
- <xs:element name="async-thread-group" type="xs:string" minOccurs="0" maxOccurs="1" default="teiid-async">
- <xs:annotation>
- <xs:documentation>Thread group to use for Async Processing</xs:documentation>
- </xs:annotation>
- </xs:element>
<xs:element name="max-threads" type="xs:int" minOccurs="0" maxOccurs="1" default="64">
<xs:annotation>
<xs:documentation>Process pool maximum thread count. (default 64)</xs:documentation>
@@ -219,51 +265,6 @@
<xs:documentation>Max allowed time before the session is terminated by the system, 0 indicates unlimited (default 0)</xs:documentation>
</xs:annotation>
</xs:element>
- <xs:element name="allow-env-function" type="xs:boolean" minOccurs="0" maxOccurs="1" default="false">
- <xs:annotation>
- <xs:documentation>Allow execution of ENV function (default false)</xs:documentation>
- </xs:annotation>
- </xs:element>
-
- <xs:element name="buffer-service" type="buffer-service-type" maxOccurs="1" minOccurs="1">
- <xs:annotation>
- <xs:documentation>Buffer manager information</xs:documentation>
- </xs:annotation>
- </xs:element>
-
- <xs:element name="authorization-validator-module" type="xs:string" minOccurs="0" maxOccurs="1">
- <xs:annotation>
- <xs:documentation>An authorization validator that by default uses data role information stored in VDBs. Provide module name.</xs:documentation>
- </xs:annotation>
- </xs:element>
-
- <xs:element name="policy-decider-module" type="xs:string" minOccurs="0" maxOccurs="1">
- <xs:annotation>
- <xs:documentation>A policy decider that uses data role information stored in VDBs, Provide module name.</xs:documentation>
- </xs:annotation>
- </xs:element>
-
-
- <xs:element name="distributed-cache-factory" type="cache-factory-type" maxOccurs="1" minOccurs="1">
- <xs:annotation>
- <xs:documentation>Cache Factory</xs:documentation>
- </xs:annotation>
- </xs:element>
-
- <xs:element name="resultset-cache" type="cache-config" maxOccurs="1" minOccurs="0">
- <xs:annotation>
- <xs:documentation>Configuration for result set caching.
- There will be 2 caches with these settings.
- One cache holds results that are specific to sessions.
- The other cache holds vdb scoped results and can
- be replicated.</xs:documentation>
- </xs:annotation>
- </xs:element>
- <xs:element name="preparedplan-cache" type="cache-config" maxOccurs="1" minOccurs="0">
- <xs:annotation>
- <xs:documentation>Configuration for prepared plan caching. (local memory only)</xs:documentation>
- </xs:annotation>
- </xs:element>
<xs:element name="jdbc" type="socket-config" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation>jdbc port confguration</xs:documentation>
Modified: branches/as7/jboss-integration/src/test/java/org/teiid/jboss/TestTeiidConfiguration.java
===================================================================
--- branches/as7/jboss-integration/src/test/java/org/teiid/jboss/TestTeiidConfiguration.java 2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/jboss-integration/src/test/java/org/teiid/jboss/TestTeiidConfiguration.java 2011-08-22 14:36:06 UTC (rev 3422)
@@ -369,7 +369,7 @@
@Test
public void testSubSystemDescription() throws IOException {
ModelNode node = new ModelNode();
- QueryEngineDescription.getQueryEngineDescription(node, ATTRIBUTES, IntegrationPlugin.getResourceBundle(null));
+ TeiidModelDescription.getQueryEngineDescription(node, ATTRIBUTES, IntegrationPlugin.getResourceBundle(null));
assertEquals(ObjectConverterUtil.convertToString(new FileReader("src/test/resources/teiid-model-config.txt")), node.toString());
}
}
Modified: branches/as7/jboss-integration/src/test/resources/teiid-sample-config.xml
===================================================================
--- branches/as7/jboss-integration/src/test/resources/teiid-sample-config.xml 2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/jboss-integration/src/test/resources/teiid-sample-config.xml 2011-08-22 14:36:06 UTC (rev 3422)
@@ -1,6 +1,8 @@
<subsystem xmlns="urn:jboss:domain:teiid:1.0">
+ <async-thread-group>teiid-async</async-thread-group>
+ <allow-env-function>false</allow-env-function>
+
<query-engine>
- <async-thread-group>teiid-async</async-thread-group>
<max-threads>64</max-threads>
<max-active-plans>20</max-active-plans>
<thread-count-for-source-concurrency>0</thread-count-for-source-concurrency>
@@ -13,11 +15,10 @@
<max-odbc-lob-size-allowed>5242880</max-odbc-lob-size-allowed>
<event-distributor-name>teiid/event-distributor</event-distributor-name>
<detect-change-events>true</detect-change-events>
-
<security-domain>teiid-security</security-domain>
<max-sessions-allowed>5000</max-sessions-allowed>
<sessions-expiration-timelimit>0</sessions-expiration-timelimit>
- <allow-env-function>false</allow-env-function>
+
<buffer-service>
<use-disk>true</use-disk>
Modified: branches/as7/pom.xml
===================================================================
--- branches/as7/pom.xml 2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/pom.xml 2011-08-22 14:36:06 UTC (rev 3422)
@@ -109,6 +109,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
+ <version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
@@ -118,6 +119,7 @@
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
+ <version>2.9</version>
<configuration>
<includes>
<include>**/*TestCase.java</include>
@@ -162,7 +164,7 @@
<addDefaultImplementationEntries> true</addDefaultImplementationEntries>
</manifest>
<manifestEntries>
- <Implementation-URL>${pom.url}</Implementation-URL>
+ <Implementation-URL>${project.url}</Implementation-URL>
</manifestEntries>
</archive>
</configuration>
@@ -170,6 +172,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
+ <version>2.1.2</version>
<executions>
<execution>
<id>attach-sources</id>
@@ -191,6 +194,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
+ <version>2.8</version>
<configuration>
<aggregate>true</aggregate>
<maxmemory>512m</maxmemory>
Deleted: branches/as7/runtime/src/main/java/org/teiid/deployers/ObjectSerializer.java
===================================================================
--- branches/as7/runtime/src/main/java/org/teiid/deployers/ObjectSerializer.java 2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/runtime/src/main/java/org/teiid/deployers/ObjectSerializer.java 2011-08-22 14:36:06 UTC (rev 3422)
@@ -1,117 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.deployers;
-
-import java.io.*;
-
-import org.jboss.logging.Logger;
-import org.jboss.vfs.VirtualFile;
-import org.teiid.core.util.FileUtils;
-import org.teiid.logging.LogConstants;
-import org.teiid.logging.LogManager;
-import org.teiid.runtime.RuntimePlugin;
-
-
-public class ObjectSerializer {
-
- private static final Logger log = Logger.getLogger(ObjectSerializer.class);
-
- private static final String ATTACHMENT_SUFFIX = ".ser"; //$NON-NLS-1$
-
- private String storagePath;
-
- public ObjectSerializer(String path) {
- this.storagePath = path;
- }
-
- public <T> T loadAttachment(File attachmentsStore, Class<T> expected) throws IOException, ClassNotFoundException {
- if (log.isTraceEnabled()) {
- log.trace("loadAttachment, attachmentsStore=" + attachmentsStore); //$NON-NLS-1$
- }
-
- ObjectInputStream ois = null;
- try {
- ois = new ObjectInputStream(new FileInputStream(attachmentsStore));
- return expected.cast(ois.readObject());
- } finally {
- if (ois != null) {
- ois.close();
- }
- }
- }
-
- public void saveAttachment(File attachmentsStore, Object attachment) throws IOException {
- if (log.isTraceEnabled()) {
- log.trace("saveAttachment, attachmentsStore=" + attachmentsStore + ", attachment=" + attachment); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- ObjectOutputStream oos = null;
- try {
- oos = new ObjectOutputStream(new FileOutputStream(attachmentsStore));
- oos.writeObject(attachment);
- } finally {
- if (oos != null) {
- oos.close();
- }
- }
- }
-
- public boolean isStale(File cacheFile, long timeAfter) {
- return (cacheFile.exists() && timeAfter > cacheFile.lastModified());
- }
-
- public void removeAttachments(VirtualFile vf) {
- String dirName = baseDirectory(vf);
- FileUtils.removeDirectoryAndChildren(new File(dirName));
- }
-
- public File getAttachmentPath(VirtualFile vf, String baseName) {
-
- String dirName = baseDirectory(vf);
-
- final String vfsPath = baseName + ATTACHMENT_SUFFIX;
- File f = new File(dirName, vfsPath);
- if (!f.getParentFile().exists()) {
- f.getParentFile().mkdirs();
- }
- return f;
- }
-
- private String baseDirectory(VirtualFile vf) {
- String fileName = vf.getName();
- String dirName = this.storagePath + File.separator + fileName + File.separator;
- return dirName;
- }
-
- public <T> T loadSafe(File cacheFile, Class<T> clazz) {
- try {
- if (cacheFile.exists()) {
- return clazz.cast(loadAttachment(cacheFile, clazz));
- }
- return null;
- } catch (Exception e) {
- LogManager.logWarning(LogConstants.CTX_RUNTIME, e, RuntimePlugin.Util.getString("invalid_metadata_file", cacheFile.getAbsolutePath())); //$NON-NLS-1$
- }
- cacheFile.delete();
- return null;
- }
-}
Modified: branches/as7/runtime/src/main/java/org/teiid/deployers/TranslatorUtil.java
===================================================================
--- branches/as7/runtime/src/main/java/org/teiid/deployers/TranslatorUtil.java 2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/runtime/src/main/java/org/teiid/deployers/TranslatorUtil.java 2011-08-22 14:36:06 UTC (rev 3422)
@@ -29,7 +29,9 @@
import java.util.Properties;
import java.util.TreeMap;
-import org.jboss.as.server.deployment.DeploymentUnitProcessingException;
+import org.jboss.modules.Module;
+import org.jboss.modules.ModuleIdentifier;
+import org.jboss.modules.ModuleLoadException;
import org.teiid.adminapi.Translator;
import org.teiid.adminapi.impl.VDBTranslatorMetaData;
import org.teiid.core.TeiidException;
@@ -88,29 +90,36 @@
}
}
- public static ExecutionFactory buildExecutionFactory(Translator data) throws DeploymentUnitProcessingException {
+ public static ExecutionFactory buildExecutionFactory(VDBTranslatorMetaData data) throws TeiidException {
ExecutionFactory executionFactory;
+
+ final ModuleIdentifier moduleId;
+ final Module module;
+ try {
+ moduleId = ModuleIdentifier.create(data.getModuleName());
+ module = Module.getCallerModuleLoader().loadModule(moduleId);
+ } catch (ModuleLoadException e) {
+ throw new TeiidException(e, RuntimePlugin.Util.getString("failed_load_module", data.getModuleName(), data.getName())); //$NON-NLS-1$
+ }
+
try {
String executionClass = data.getPropertyValue(VDBTranslatorMetaData.EXECUTION_FACTORY_CLASS);
- Object o = ReflectionHelper.create(executionClass, null, Thread.currentThread().getContextClassLoader());
+ Object o = ReflectionHelper.create(executionClass, null, module.getClassLoader());
if(!(o instanceof ExecutionFactory)) {
- throw new DeploymentUnitProcessingException(RuntimePlugin.Util.getString("invalid_class", executionClass));//$NON-NLS-1$
+ throw new TeiidException(RuntimePlugin.Util.getString("invalid_class", executionClass));//$NON-NLS-1$
}
-
executionFactory = (ExecutionFactory)o;
injectProperties(executionFactory, data);
executionFactory.start();
return executionFactory;
- } catch (TeiidException e) {
- throw new DeploymentUnitProcessingException(e);
} catch (InvocationTargetException e) {
- throw new DeploymentUnitProcessingException(e);
+ throw new TeiidException(e);
} catch (IllegalAccessException e) {
- throw new DeploymentUnitProcessingException(e);
+ throw new TeiidException(e);
}
}
- private static void injectProperties(ExecutionFactory ef, final Translator data) throws InvocationTargetException, IllegalAccessException, DeploymentUnitProcessingException{
+ private static void injectProperties(ExecutionFactory ef, final Translator data) throws InvocationTargetException, IllegalAccessException, TeiidException{
Map<Method, TranslatorProperty> props = TranslatorUtil.getTranslatorProperties(ef.getClass());
Map p = data.getProperties();
TreeMap<String, String> caseInsensitivProps = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
@@ -124,7 +133,7 @@
Method setterMethod = getSetter(ef.getClass(), method);
setterMethod.invoke(ef, convert(value, method.getReturnType()));
} else if (tp.required()) {
- throw new DeploymentUnitProcessingException(RuntimePlugin.Util.getString("required_property_not_exists", tp.display())); //$NON-NLS-1$
+ throw new TeiidException(RuntimePlugin.Util.getString("required_property_not_exists", tp.display())); //$NON-NLS-1$
}
}
caseInsensitivProps.remove(Translator.EXECUTION_FACTORY_CLASS);
@@ -144,7 +153,7 @@
return result;
}
- public static Method getSetter(Class<?> clazz, Method method) throws SecurityException, DeploymentUnitProcessingException {
+ public static Method getSetter(Class<?> clazz, Method method) throws SecurityException, TeiidException {
String setter = method.getName();
if (method.getName().startsWith("get")) { //$NON-NLS-1$
setter = "set"+setter.substring(3);//$NON-NLS-1$
@@ -161,7 +170,7 @@
try {
return clazz.getMethod(method.getName(), method.getReturnType());
} catch (NoSuchMethodException e1) {
- throw new DeploymentUnitProcessingException(RuntimePlugin.Util.getString("no_set_method", setter, method.getName())); //$NON-NLS-1$
+ throw new TeiidException(RuntimePlugin.Util.getString("no_set_method", setter, method.getName())); //$NON-NLS-1$
}
}
}
Deleted: branches/as7/runtime/src/main/java/org/teiid/deployers/VDBDependencyProcessor.java
===================================================================
--- branches/as7/runtime/src/main/java/org/teiid/deployers/VDBDependencyProcessor.java 2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/runtime/src/main/java/org/teiid/deployers/VDBDependencyProcessor.java 2011-08-22 14:36:06 UTC (rev 3422)
@@ -1,99 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.deployers;
-
-import java.io.Closeable;
-import java.io.IOException;
-import java.util.List;
-
-import org.jboss.as.server.deployment.*;
-import org.jboss.as.server.deployment.module.*;
-import org.jboss.modules.Module;
-import org.jboss.modules.ModuleIdentifier;
-import org.jboss.modules.ModuleLoadException;
-import org.jboss.modules.ModuleLoader;
-import org.jboss.vfs.VFS;
-import org.jboss.vfs.VirtualFile;
-import org.jboss.vfs.VirtualFileFilter;
-import org.jboss.vfs.VisitorAttributes;
-import org.jboss.vfs.util.SuffixMatchFilter;
-import org.teiid.adminapi.impl.ModelMetaData;
-import org.teiid.adminapi.impl.VDBMetaData;
-
-public class VDBDependencyProcessor implements DeploymentUnitProcessor {
- public static final String LIB = "/lib"; //$NON-NLS-1$
- private static final VirtualFileFilter DEFAULT_JAR_LIB_FILTER = new SuffixMatchFilter(".jar", VisitorAttributes.DEFAULT); //$NON-NLS-1$
-
- @Override
- public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
- DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
- if (!TeiidAttachments.isVDBDeployment(deploymentUnit)) {
- return;
- }
-
- if (!TeiidAttachments.isDynamicVDB(deploymentUnit)) {
- final ResourceRoot deploymentResourceRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT);
- final VirtualFile deploymentRoot = deploymentResourceRoot.getRoot();
- if(deploymentRoot == null) {
- return;
- }
-
- try {
- final VirtualFile libDir = deploymentRoot.getChild(LIB);
- if (libDir.exists()) {
- final List<VirtualFile> archives = libDir.getChildren(DEFAULT_JAR_LIB_FILTER);
- for (final VirtualFile archive : archives) {
- try {
- final Closeable closable = VFS.mountZip(archive, archive,TempFileProviderService.provider());
- final ResourceRoot jarArchiveRoot = new ResourceRoot(archive.getName(), archive, new MountHandle(closable));
- ModuleRootMarker.mark(jarArchiveRoot);
- deploymentUnit.addToAttachmentList(Attachments.RESOURCE_ROOTS, jarArchiveRoot);
- } catch (IOException e) {
- throw new DeploymentUnitProcessingException("failed to process " + archive, e); //$NON-NLS-1$
- }
- }
- }
- } catch(IOException e) {
- throw new DeploymentUnitProcessingException(e);
- }
- }
-
- // add translators as dependent modules to this VDB.
- try {
- final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
- final ModuleLoader moduleLoader = Module.getCallerModule().getModule(ModuleIdentifier.create("org.jboss.teiid")).getModuleLoader(); //$NON-NLS-1$
- VDBMetaData vdb = deploymentUnit.getAttachment(TeiidAttachments.VDB_METADATA);
-
- for (ModelMetaData model: vdb.getModelMetaDatas().values()) {
- for (String source:model.getSourceNames()) {
- moduleSpecification.addLocalDependency(new ModuleDependency(moduleLoader, ModuleIdentifier.create(model.getSourceTranslatorName(source)), false, false, false));
- }
- }
- } catch (ModuleLoadException e) {
- throw new DeploymentUnitProcessingException(e);
- }
- }
-
- @Override
- public void undeploy(DeploymentUnit context) {
- }
-}
Deleted: branches/as7/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java
===================================================================
--- branches/as7/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java 2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java 2011-08-22 14:36:06 UTC (rev 3422)
@@ -1,411 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.deployers;
-
-import java.io.File;
-import java.io.IOException;
-import java.text.SimpleDateFormat;
-import java.util.*;
-import java.util.concurrent.Executor;
-
-import org.jboss.as.server.deployment.*;
-import org.jboss.msc.service.ServiceBuilder;
-import org.jboss.msc.service.ServiceName;
-import org.jboss.msc.value.InjectedValue;
-import org.jboss.vfs.VirtualFile;
-import org.teiid.adminapi.Model;
-import org.teiid.adminapi.Translator;
-import org.teiid.adminapi.VDB;
-import org.teiid.adminapi.impl.ModelMetaData;
-import org.teiid.adminapi.impl.SourceMappingMetadata;
-import org.teiid.adminapi.impl.VDBMetaData;
-import org.teiid.adminapi.impl.VDBTranslatorMetaData;
-import org.teiid.dqp.internal.datamgr.ConnectorManager;
-import org.teiid.dqp.internal.datamgr.ConnectorManagerRepository;
-import org.teiid.dqp.internal.datamgr.TranslatorRepository;
-import org.teiid.logging.LogConstants;
-import org.teiid.logging.LogManager;
-import org.teiid.metadata.MetadataStore;
-import org.teiid.metadata.index.IndexMetadataFactory;
-import org.teiid.query.metadata.TransformationMetadata.Resource;
-import org.teiid.runtime.RuntimePlugin;
-import org.teiid.translator.DelegatingExecutionFactory;
-import org.teiid.translator.ExecutionFactory;
-import org.teiid.translator.TranslatorException;
-
-
-public class VDBDeployer implements DeploymentUnitProcessor {
- public ServiceName VDB_SVC_BASE = ServiceName.JBOSS.append("teiid", "vdb"); //$NON-NLS-1$ //$NON-NLS-2$
-
- private VDBRepository vdbRepository;
- private TranslatorRepository translatorRepository;
- private ObjectSerializer serializer;
- private ContainerLifeCycleListener shutdownListener;
- private InjectedValue<Executor> threadPoolInjector;
-
- public VDBDeployer (VDBRepository repo, InjectedValue<Executor> threadPoolInjector, TranslatorRepository translatorRepo, ObjectSerializer serializer, ContainerLifeCycleListener listener) {
- this.vdbRepository = repo;
- this.threadPoolInjector = threadPoolInjector;
- this.translatorRepository = translatorRepo;
- this.serializer = serializer;
- this.shutdownListener = listener;
- }
-
- public void deploy(final DeploymentPhaseContext context) throws DeploymentUnitProcessingException {
- DeploymentUnit deploymentUnit = context.getDeploymentUnit();
- if (!TeiidAttachments.isVDBDeployment(deploymentUnit)) {
- return;
- }
- VirtualFile file = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT).getRoot();
- VDBMetaData deployment = deploymentUnit.getAttachment(TeiidAttachments.VDB_METADATA);
-
- if (this.vdbRepository.removeVDB(deployment.getName(), deployment.getVersion())) {
- LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("redeploying_vdb", deployment)); //$NON-NLS-1$
- }
-
- TranslatorRepository repo = new TranslatorRepository();
- ConnectorManagerRepository cmr = new ConnectorManagerRepository();
-
- boolean preview = deployment.isPreview();
-
- if (!preview) {
- List<String> errors = deployment.getValidityErrors();
- if (errors != null && !errors.isEmpty()) {
- throw new DeploymentUnitProcessingException(RuntimePlugin.Util.getString("validity_errors_in_vdb", deployment)); //$NON-NLS-1$
- }
- }
-
- // get the metadata store of the VDB (this is build in parse stage)
- MetadataStoreGroup store = deploymentUnit.getAttachment(TeiidAttachments.METADATA_STORE);
-
- // add required connector managers; if they are not already there
- for (Translator t: deployment.getOverrideTranslators()) {
- VDBTranslatorMetaData data = (VDBTranslatorMetaData)t;
-
- String type = data.getType();
- Translator parent = this.translatorRepository.getTranslatorMetaData(type);
- if ( parent == null) {
- throw new DeploymentUnitProcessingException(RuntimePlugin.Util.getString("translator_type_not_found", file.getName())); //$NON-NLS-1$
- }
-
- Set<String> keys = parent.getProperties().stringPropertyNames();
- for (String key:keys) {
- if (data.getPropertyValue(key) == null && parent.getPropertyValue(key) != null) {
- data.addProperty(key, parent.getPropertyValue(key));
- }
- }
- repo.addTranslatorMetadata(data.getName(), data);
- }
- createConnectorManagers(cmr, repo, deployment);
- boolean asynchLoad = false;
- // if store is null and vdb dynamic vdb then try to get the metadata
- if (store == null && deployment.isDynamic()) {
- store = new MetadataStoreGroup();
- asynchLoad = buildDynamicMetadataStore(file, deployment, store, cmr);
- }
-
- // allow empty vdbs for enabling the preview functionality
- if (preview && store == null) {
- store = new MetadataStoreGroup();
- }
-
- if (store == null) {
- LogManager.logError(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("failed_matadata_load", deployment.getName(), deployment.getVersion())); //$NON-NLS-1$
- }
-
- // check if this is a VDB with index files, if there are then build the TransformationMetadata
- UDFMetaData udf = deploymentUnit.getAttachment(TeiidAttachments.UDF_METADATA);
-
- LinkedHashMap<String, Resource> visibilityMap = null;
- IndexMetadataFactory indexFactory = deploymentUnit.getAttachment(TeiidAttachments.INDEX_METADATA);
- if (indexFactory != null) {
- visibilityMap = indexFactory.getEntriesPlusVisibilities();
- }
-
- // removethe metadata objects as attachments
- deploymentUnit.removeAttachment(TeiidAttachments.INDEX_METADATA);
- deploymentUnit.removeAttachment(TeiidAttachments.UDF_METADATA);
- deploymentUnit.removeAttachment(TeiidAttachments.METADATA_STORE);
-
- try {
- // add transformation metadata to the repository.
- this.vdbRepository.addVDB(deployment, store, visibilityMap, udf, cmr);
- } catch (VirtualDatabaseException e) {
- throw new DeploymentUnitProcessingException(e);
- }
-
- boolean valid = true;
- synchronized (deployment) {
- if (indexFactory != null) {
- try {
- saveMetadataStore(file, deployment, store);
- } catch (IOException e1) {
- LogManager.logWarning(LogConstants.CTX_RUNTIME, e1, RuntimePlugin.Util.getString("vdb_save_failed", deployment.getName()+"."+deployment.getVersion())); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- if (!preview) {
- valid = validateSources(cmr, deployment);
-
- // Check if the VDB is fully configured.
- if (!valid) {
- deployment.setStatus(VDB.Status.INACTIVE);
- } else if (!asynchLoad) {
- //if asynch this will be set by the loading thread
- this.vdbRepository.finishDeployment(deployment.getName(), deployment.getVersion());
- deployment.setStatus(VDB.Status.ACTIVE);
- }
- }
- else {
- deployment.setStatus(VDB.Status.ACTIVE);
- }
- }
-
- // build a VDB service
- ServiceBuilder<VDBMetaData> vdbService = context.getServiceTarget().addService(VDB_SVC_BASE.append(deployment.getName()+"."+deployment.getVersion()), new VDBService(deployment)); //$NON-NLS-1$
- for (ModelMetaData model:deployment.getModelMetaDatas().values()) {
- for (String sourceName:model.getSourceNames()) {
- vdbService.addDependency(ServiceName.JBOSS.append("data-source", model.getSourceConnectionJndiName(sourceName))); //$NON-NLS-1$
- }
- }
-
- LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("vdb_deployed",deployment, valid?"active":"inactive")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
-
- private void createConnectorManagers(ConnectorManagerRepository cmr, TranslatorRepository repo, final VDBMetaData deployment) throws DeploymentUnitProcessingException {
- IdentityHashMap<Translator, ExecutionFactory<Object, Object>> map = new IdentityHashMap<Translator, ExecutionFactory<Object, Object>>();
-
- for (Model model:deployment.getModels()) {
- for (String source:model.getSourceNames()) {
- if (cmr.getConnectorManager(source) != null) {
- continue;
- }
-
- String name = model.getSourceTranslatorName(source);
- ConnectorManager cm = new ConnectorManager(name, model.getSourceConnectionJndiName(source));
- ExecutionFactory<Object, Object> ef = getExecutionFactory(name, repo, deployment, map, new HashSet<String>());
- cm.setExecutionFactory(ef);
- cm.setModelName(model.getName());
- cmr.addConnectorManager(source, cm);
- }
- }
- }
-
- private ExecutionFactory<Object, Object> getExecutionFactory(String name, TranslatorRepository repo, VDBMetaData deployment, IdentityHashMap<Translator, ExecutionFactory<Object, Object>> map, HashSet<String> building) throws DeploymentUnitProcessingException {
- if (!building.add(name)) {
- throw new DeploymentUnitProcessingException(RuntimePlugin.Util.getString("recursive_delegation", deployment.getName(), deployment.getVersion(), building)); //$NON-NLS-1$
- }
- Translator translator = repo.getTranslatorMetaData(name);
- if (translator == null) {
- translator = this.translatorRepository.getTranslatorMetaData(name);
- }
- if (translator == null) {
- throw new DeploymentUnitProcessingException(RuntimePlugin.Util.getString("translator_not_found", deployment.getName(), deployment.getVersion(), name)); //$NON-NLS-1$
- }
- ExecutionFactory<Object, Object> ef = map.get(translator);
- if ( ef == null) {
- ef = TranslatorUtil.buildExecutionFactory(translator);
- if (ef instanceof DelegatingExecutionFactory) {
- DelegatingExecutionFactory delegator = (DelegatingExecutionFactory)ef;
- String delegateName = delegator.getDelegateName();
- if (delegateName != null) {
- ExecutionFactory<Object, Object> delegate = getExecutionFactory(delegateName, repo, deployment, map, building);
- ((DelegatingExecutionFactory) ef).setDelegate(delegate);
- }
- }
- map.put(translator, ef);
- }
- return ef;
- }
-
- private boolean validateSources(ConnectorManagerRepository cmr, VDBMetaData deployment) {
- boolean valid = true;
- for(Model m:deployment.getModels()) {
- ModelMetaData model = (ModelMetaData)m;
- List<SourceMappingMetadata> mappings = model.getSourceMappings();
- for (SourceMappingMetadata mapping:mappings) {
- ConnectorManager cm = cmr.getConnectorManager(mapping.getName());
- String msg = cm.getStausMessage();
- if (msg != null && msg.length() > 0) {
- valid = false;
- model.addError(ModelMetaData.ValidationError.Severity.ERROR.name(), cm.getStausMessage());
- LogManager.logInfo(LogConstants.CTX_RUNTIME, cm.getStausMessage());
- }
- }
-
- // in the dynamic case the metadata may be still loading.
- if (!model.getErrors().isEmpty()) {
- valid = false;
- }
- }
- return valid;
- }
-
- @Override
- public void undeploy(final DeploymentUnit deploymentUnit) {
- if (!TeiidAttachments.isVDBDeployment(deploymentUnit)) {
- return;
- }
- VDBMetaData deployment = deploymentUnit.getAttachment(TeiidAttachments.VDB_METADATA);
- VirtualFile file = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT).getRoot();
-
- if (this.vdbRepository != null && deployment != null) {
- this.vdbRepository.removeVDB(deployment.getName(), deployment.getVersion());
- deployment.setRemoved(true);
- }
-
- if (file != null) {
- deleteMetadataStore(file);
- }
-
- LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("vdb_undeployed", deployment)); //$NON-NLS-1$
- }
-
- private void saveMetadataStore(VirtualFile unit, VDBMetaData vdb, MetadataStoreGroup store) throws IOException {
- File cacheFileName = buildCachedVDBFileName(this.serializer, unit, vdb);
- if (!cacheFileName.exists()) {
- this.serializer.saveAttachment(cacheFileName,store);
- LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB "+unit.getName()+" metadata has been cached to "+ cacheFileName); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- private void deleteMetadataStore(VirtualFile unit) {
- if (!unit.exists() || !shutdownListener.isShutdownInProgress()) {
- this.serializer.removeAttachments(unit);
- LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB "+unit.getName()+" metadata removed"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- private boolean buildDynamicMetadataStore(final VirtualFile unit, final VDBMetaData vdb, final MetadataStoreGroup vdbStore, final ConnectorManagerRepository cmr) throws DeploymentUnitProcessingException {
- boolean asynch = false;
- // make sure we are configured correctly first
- for (final ModelMetaData model:vdb.getModelMetaDatas().values()) {
- if (model.getSourceNames().isEmpty()) {
- throw new DeploymentUnitProcessingException(RuntimePlugin.Util.getString("fail_to_deploy", vdb.getName()+"-"+vdb.getVersion(), model.getName())); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- final boolean cache = "cached".equalsIgnoreCase(vdb.getPropertyValue("UseConnectorMetadata")); //$NON-NLS-1$ //$NON-NLS-2$
- final File cacheFile = buildCachedModelFileName(unit, vdb, model.getName());
- boolean loaded = false;
- if (cache) {
- MetadataStore store = this.serializer.loadSafe(cacheFile, MetadataStore.class);
- if (store != null) {
- vdbStore.addStore(store);
- loaded = true;
- }
- }
-
- if (!loaded) {
- Runnable job = new Runnable() {
- @Override
- public void run() {
- Boolean loadStatus = loadMetadata(vdb, model, cache, cacheFile, vdbStore, cmr);
- //if (loadStatus == null) {
- //TODO: a source is up, but we failed. should we retry or poll?
- //}
- if (loadStatus == null || !loadStatus) {
- //defer the load to the status checker if/when a source is available/redeployed
- model.addAttchment(Runnable.class, this);
- }
- }
- };
- Executor executor = this.threadPoolInjector.getValue();
- if (executor == null) {
- job.run();
- }
- else {
- asynch = true;
- executor.execute(job);
- }
- }
- }
- return asynch;
- }
-
- /**
- * @return true if loaded, null if not loaded - but a cm is available, else false
- */
- private Boolean loadMetadata(VDBMetaData vdb, ModelMetaData model, boolean cache, File cacheFile, MetadataStoreGroup vdbStore, ConnectorManagerRepository cmr) {
- String msg = RuntimePlugin.Util.getString("model_metadata_loading", vdb.getName(), vdb.getVersion(), model.getName(), SimpleDateFormat.getInstance().format(new Date())); //$NON-NLS-1$
- model.addError(ModelMetaData.ValidationError.Severity.ERROR.toString(), msg);
- LogManager.logInfo(LogConstants.CTX_RUNTIME, msg);
-
- String exceptionMessage = null;
- Boolean loaded = false;
- for (String sourceName: model.getSourceNames()) {
- ConnectorManager cm = cmr.getConnectorManager(sourceName);
- String status = cm.getStausMessage();
- if (status != null && status.length() > 0) {
- exceptionMessage = status;
- continue;
- }
- loaded = null;
- try {
- MetadataStore store = cm.getMetadata(model.getName(), this.vdbRepository.getBuiltinDatatypes(), model.getProperties());
- if (cache) {
- this.serializer.saveAttachment(cacheFile, store);
- }
- vdbStore.addStore(store);
- loaded = true;
- break;
- } catch (TranslatorException e) {
- //TODO: we aren't effectively differentiating the type of load error - connectivity vs. metadata
- if (exceptionMessage == null) {
- exceptionMessage = e.getMessage();
- }
- } catch (IOException e) {
- if (exceptionMessage == null) {
- exceptionMessage = e.getMessage();
- }
- }
- }
-
- synchronized (vdb) {
- if (loaded == null || !loaded) {
- vdb.setStatus(VDB.Status.INACTIVE);
- String failed_msg = RuntimePlugin.Util.getString(loaded==null?"failed_to_retrive_metadata":"nosources_to_retrive_metadata", vdb.getName(), vdb.getVersion(), model.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- model.addError(ModelMetaData.ValidationError.Severity.ERROR.toString(), failed_msg);
- if (exceptionMessage != null) {
- model.addError(ModelMetaData.ValidationError.Severity.ERROR.toString(), exceptionMessage);
- }
- LogManager.logWarning(LogConstants.CTX_RUNTIME, failed_msg);
- } else {
- LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("metadata_loaded",vdb.getName(), vdb.getVersion(), model.getName())); //$NON-NLS-1$
- model.clearErrors();
- if (vdb.isValid()) {
- this.vdbRepository.finishDeployment(vdb.getName(), vdb.getVersion());
- vdb.setStatus(VDB.Status.ACTIVE);
- LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("vdb_activated",vdb.getName(), vdb.getVersion())); //$NON-NLS-1$
- }
- }
- }
-
- return loaded;
- }
-
- private File buildCachedModelFileName(VirtualFile unit, VDBMetaData vdb, String modelName) {
- return this.serializer.getAttachmentPath(unit, vdb.getName()+"_"+vdb.getVersion()+"_"+modelName); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- static File buildCachedVDBFileName(ObjectSerializer serializer, VirtualFile unit, VDBMetaData vdb) {
- return serializer.getAttachmentPath(unit, vdb.getName()+"_"+vdb.getVersion()); //$NON-NLS-1$
- }
-}
Deleted: branches/as7/runtime/src/main/java/org/teiid/deployers/VDBParserDeployer.java
===================================================================
--- branches/as7/runtime/src/main/java/org/teiid/deployers/VDBParserDeployer.java 2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/runtime/src/main/java/org/teiid/deployers/VDBParserDeployer.java 2011-08-22 14:36:06 UTC (rev 3422)
@@ -1,200 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.deployers;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.List;
-
-import javax.xml.XMLConstants;
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Unmarshaller;
-import javax.xml.validation.Schema;
-import javax.xml.validation.SchemaFactory;
-
-import org.jboss.as.server.deployment.*;
-import org.jboss.vfs.VirtualFile;
-import org.teiid.adminapi.Model;
-import org.teiid.adminapi.impl.ModelMetaData;
-import org.teiid.adminapi.impl.VDBMetaData;
-import org.teiid.logging.LogConstants;
-import org.teiid.logging.LogManager;
-import org.teiid.metadata.VdbConstants;
-import org.teiid.metadata.index.IndexMetadataFactory;
-import org.teiid.runtime.RuntimePlugin;
-import org.xml.sax.SAXException;
-
-
-/**
- * This file loads the "vdb.xml" file inside a ".vdb" file, along with all the metadata in the .INDEX files
- */
-public class VDBParserDeployer implements DeploymentUnitProcessor {
- private ObjectSerializer serializer;
- private VDBRepository vdbRepository;
-
- public VDBParserDeployer(VDBRepository repo, ObjectSerializer serializer) {
- this.vdbRepository = repo;
- this.serializer = serializer;
- }
-
- public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
- DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
- if (!TeiidAttachments.isVDBDeployment(deploymentUnit)) {
- return;
- }
-
- VirtualFile file = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT).getRoot();
-
- if (TeiidAttachments.isDynamicVDB(deploymentUnit)) {
- parseVDBXML(file, deploymentUnit);
- }
- else {
- // scan for different files
- List<VirtualFile> childFiles = file.getChildren();
- for (VirtualFile childFile:childFiles) {
- scanVDB(childFile, deploymentUnit);
- }
-
- mergeMetaData(deploymentUnit);
- }
- }
-
- private void scanVDB(VirtualFile file, DeploymentUnit deploymentUnit) throws DeploymentUnitProcessingException {
- if (file.isDirectory()) {
- List<VirtualFile> childFiles = file.getChildren();
- for (VirtualFile childFile:childFiles) {
- scanVDB(childFile, deploymentUnit);
- }
- }
- else {
- if (file.getLowerCaseName().equals(VdbConstants.DEPLOYMENT_FILE)) {
- parseVDBXML(file, deploymentUnit);
- }
- else if (file.getLowerCaseName().endsWith(VdbConstants.INDEX_EXT)) {
- IndexMetadataFactory imf = deploymentUnit.getAttachment(TeiidAttachments.INDEX_METADATA);
- if (imf == null) {
- imf = new IndexMetadataFactory();
- deploymentUnit.putAttachment(TeiidAttachments.INDEX_METADATA, imf);
- }
- imf.addIndexFile(file);
- }
- else if (file.getLowerCaseName().endsWith(VdbConstants.MODEL_EXT)) {
- UDFMetaData udf = deploymentUnit.getAttachment(TeiidAttachments.UDF_METADATA);
- if (udf == null) {
- udf = new UDFMetaData();
- deploymentUnit.putAttachment(TeiidAttachments.UDF_METADATA, udf);
- }
- udf.addModelFile(file);
- }
-
- }
- }
-
- private void parseVDBXML(VirtualFile file, DeploymentUnit deploymentUnit)
- throws DeploymentUnitProcessingException {
- try {
- Unmarshaller un = getUnMarsheller();
- VDBMetaData vdb = (VDBMetaData)un.unmarshal(file.openStream());
- deploymentUnit.putAttachment(TeiidAttachments.VDB_METADATA, vdb);
- LogManager.logDetail(LogConstants.CTX_RUNTIME,"VDB "+file.getName()+" has been parsed."); //$NON-NLS-1$ //$NON-NLS-2$
- } catch (JAXBException e) {
- throw new DeploymentUnitProcessingException(e);
- } catch (SAXException e) {
- throw new DeploymentUnitProcessingException(e);
- } catch (IOException e) {
- throw new DeploymentUnitProcessingException(e);
- }
- }
-
- public void undeploy(final DeploymentUnit context) {
- }
-
-
- static Unmarshaller getUnMarsheller() throws JAXBException, SAXException {
- JAXBContext jc = JAXBContext.newInstance(new Class<?>[] {VDBMetaData.class});
- SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
- Schema schema = schemaFactory.newSchema(VDBMetaData.class.getResource("/vdb-deployer.xsd")); //$NON-NLS-1$
- Unmarshaller un = jc.createUnmarshaller();
- un.setSchema(schema);
- return un;
- }
-
- protected VDBMetaData mergeMetaData(DeploymentUnit deploymentUnit) throws DeploymentUnitProcessingException {
- VDBMetaData vdb = deploymentUnit.getAttachment(TeiidAttachments.VDB_METADATA);
- UDFMetaData udf = deploymentUnit.getAttachment(TeiidAttachments.UDF_METADATA);
- IndexMetadataFactory imf = deploymentUnit.getAttachment(TeiidAttachments.INDEX_METADATA);
-
- VirtualFile file = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT).getRoot();
- if (vdb == null) {
- LogManager.logError(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("invlaid_vdb_file",file.getName())); //$NON-NLS-1$
- return null;
- }
-
- try {
- vdb.setUrl(file.toURL());
-
- // build the metadata store
- if (imf != null) {
- imf.addEntriesPlusVisibilities(file, vdb);
-
- // add the cached store.
- File cacheFile = VDBDeployer.buildCachedVDBFileName(this.serializer, file, vdb);
- // check to see if the vdb has been modified when server is down; if it is then clear the old files
- if (this.serializer.isStale(cacheFile, file.getLastModified())) {
- this.serializer.removeAttachments(file);
- LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB", file.getName(), "old cached metadata has been removed"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- MetadataStoreGroup stores = this.serializer.loadSafe(cacheFile, MetadataStoreGroup.class);
- if (stores == null) {
- // start to build the new metadata
- stores = new MetadataStoreGroup();
- stores.addStore(imf.getMetadataStore(vdbRepository.getSystemStore().getDatatypes()));
- }
- else {
- LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB", file.getName(), "was loaded from cached metadata"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- deploymentUnit.putAttachment(TeiidAttachments.METADATA_STORE, stores);
- }
-
- if (udf != null) {
- // load the UDF
- for(Model model:vdb.getModels()) {
- if (model.getModelType().equals(Model.Type.FUNCTION)) {
- String path = ((ModelMetaData)model).getPath();
- if (path == null) {
- throw new DeploymentUnitProcessingException(RuntimePlugin.Util.getString("invalid_udf_file", model.getName())); //$NON-NLS-1$
- }
- udf.buildFunctionModelFile(model.getName(), path);
- }
- }
- }
- } catch(IOException e) {
- throw new DeploymentUnitProcessingException(e);
- } catch (JAXBException e) {
- throw new DeploymentUnitProcessingException(e);
- }
-
- LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB", file.getName(), "has been parsed."); //$NON-NLS-1$ //$NON-NLS-2$
- return vdb;
- }
-}
Deleted: branches/as7/runtime/src/main/java/org/teiid/deployers/VDBService.java
===================================================================
--- branches/as7/runtime/src/main/java/org/teiid/deployers/VDBService.java 2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/runtime/src/main/java/org/teiid/deployers/VDBService.java 2011-08-22 14:36:06 UTC (rev 3422)
@@ -1,32 +0,0 @@
-package org.teiid.deployers;
-
-import org.jboss.msc.service.Service;
-import org.jboss.msc.service.StartContext;
-import org.jboss.msc.service.StartException;
-import org.jboss.msc.service.StopContext;
-import org.teiid.adminapi.impl.VDBMetaData;
-
-public class VDBService implements Service<VDBMetaData> {
- private VDBMetaData vdb;
-
- public VDBService(VDBMetaData metadata) {
- this.vdb = metadata;
- }
- @Override
- public void start(StartContext context) throws StartException {
- // rameshTODO Auto-generated method stub
-
- }
-
- @Override
- public void stop(StopContext context) {
- // rameshTODO Auto-generated method stub
-
- }
-
- @Override
- public VDBMetaData getValue() throws IllegalStateException,IllegalArgumentException {
- return this.vdb;
- }
-
-}
Deleted: branches/as7/runtime/src/main/java/org/teiid/deployers/VDBStructure.java
===================================================================
--- branches/as7/runtime/src/main/java/org/teiid/deployers/VDBStructure.java 2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/runtime/src/main/java/org/teiid/deployers/VDBStructure.java 2011-08-22 14:36:06 UTC (rev 3422)
@@ -1,84 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.deployers;
-
-import java.io.Closeable;
-import java.io.IOException;
-
-import org.jboss.as.server.deployment.*;
-import org.jboss.as.server.deployment.module.ModuleRootMarker;
-import org.jboss.as.server.deployment.module.MountHandle;
-import org.jboss.as.server.deployment.module.ResourceRoot;
-import org.jboss.as.server.deployment.module.TempFileProviderService;
-import org.jboss.vfs.VFS;
-import org.jboss.vfs.VirtualFile;
-import org.teiid.metadata.VdbConstants;
-
-
-
-public class VDBStructure implements DeploymentUnitProcessor {
- private static final String VDB_EXTENSION = ".vdb"; //$NON-NLS-1$
- private static final String DYNAMIC_VDB_STRUCTURE = "-vdb.xml"; //$NON-NLS-1$
-
- @Override
- public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
-
- DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
-
- VirtualFile file = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT).getRoot();
- if (file == null) {
- return;
- }
-
- if(file.getLowerCaseName().endsWith(VDB_EXTENSION)) {
-
- try {
- final Closeable closable = VFS.mountZip(file, file, TempFileProviderService.provider());
- final ResourceRoot vdbArchiveRoot = new ResourceRoot(file.getName(), file, new MountHandle(closable));
- ModuleRootMarker.mark(vdbArchiveRoot);
-
- VirtualFile metainf = file.getChild("META-INF"); //$NON-NLS-1$
- if (metainf == null) {
- return;
- }
-
- if (metainf.getChild(VdbConstants.DEPLOYMENT_FILE) == null) {
- return;
- }
- // adds a TYPE attachment.
- TeiidAttachments.setAsVDBDeployment(deploymentUnit);
- } catch (IOException e) {
- throw new DeploymentUnitProcessingException("failed to process " + file, e); //$NON-NLS-1$
- }
- }
- else if (file.getLowerCaseName().endsWith(DYNAMIC_VDB_STRUCTURE)) {
- TeiidAttachments.setAsDynamicVDBDeployment(deploymentUnit);
- }
- }
-
-
- @Override
- public void undeploy(final DeploymentUnit context) {
-
- }
-
-}
Modified: branches/as7/runtime/src/main/resources/org/teiid/runtime/i18n.properties
===================================================================
--- branches/as7/runtime/src/main/resources/org/teiid/runtime/i18n.properties 2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/runtime/src/main/resources/org/teiid/runtime/i18n.properties 2011-08-22 14:36:06 UTC (rev 3422)
@@ -98,4 +98,5 @@
wrong_logon_type_jaas = Wrong logon method is being used. Server is not set up for JAAS based authentication. Correct your client's 'AuthenticationType' property.
wrong_logon_type_krb5 = Wrong logon method is being used. Server is not set up for Kerberos based authentication. Correct your client's 'AuthenticationType' property.
krb5_login_failed=Kerberos context login failed
-no_security_domains=No security domain configured for Kerberos authentication. Can not authenticate.
\ No newline at end of file
+no_security_domains=No security domain configured for Kerberos authentication. Can not authenticate.
+failed_load_module=Failed to load module {0} for translator {1}
\ No newline at end of file
Modified: branches/as7/runtime/src/test/java/org/teiid/deployers/TestObjectSerializer.java
===================================================================
--- branches/as7/runtime/src/test/java/org/teiid/deployers/TestObjectSerializer.java 2011-08-19 18:19:47 UTC (rev 3421)
+++ branches/as7/runtime/src/test/java/org/teiid/deployers/TestObjectSerializer.java 2011-08-22 14:36:06 UTC (rev 3422)
@@ -28,6 +28,7 @@
import org.junit.Test;
import org.teiid.core.util.UnitTestUtil;
+import org.teiid.jboss.ObjectSerializer;
@SuppressWarnings("nls")
13 years, 4 months