Author: rareddy
Date: 2011-12-16 22:27:07 -0500 (Fri, 16 Dec 2011)
New Revision: 3749
Added:
trunk/jboss-integration/src/main/java/org/teiid/jboss/CacheFactoryService.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/DQPCoreService.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/PreparedPlanCacheService.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/TransportService.java
Removed:
trunk/cache-jbosscache/src/main/java/org/teiid/cache/jboss/ClusterableCacheFactory.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/Transport.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
Modified:
trunk/build/kits/jboss-as7/domain/configuration/domain-teiid.xml
trunk/build/kits/jboss-as7/modules/org/jboss/teiid/main/module.xml
trunk/build/kits/jboss-as7/standalone/configuration/standalone-teiid.xml
trunk/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCacheFactory.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/CacheService.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/Element.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/TeiidAdd.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/TeiidOperationHandler.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/TeiidSubsystemParser.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/TransportAdd.java
trunk/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties
trunk/jboss-integration/src/main/resources/schema/jboss-teiid.xsd
trunk/jboss-integration/src/test/resources/teiid-model-config.txt
trunk/jboss-integration/src/test/resources/teiid-model-json.txt
trunk/jboss-integration/src/test/resources/teiid-sample-config.xml
trunk/jboss-integration/src/test/resources/teiid-transport-config.txt
Log:
TEIID-1720: Correcting the service loading for result set cache and their dependency
chain.
Modified: trunk/build/kits/jboss-as7/domain/configuration/domain-teiid.xml
===================================================================
--- trunk/build/kits/jboss-as7/domain/configuration/domain-teiid.xml 2011-12-15 22:25:27
UTC (rev 3748)
+++ trunk/build/kits/jboss-as7/domain/configuration/domain-teiid.xml 2011-12-17 03:27:07
UTC (rev 3749)
@@ -386,7 +386,7 @@
<subsystem xmlns="urn:jboss:domain:teiid:1.0">
<async-thread-pool>teiid-async</async-thread-pool>
<distributed-cache jgroups-stack="udp"
channel="teiid-rep"/>
- <resultset-cache container-name="teiid"
name="resultset"/>
+ <resultset-cache infinispan-container="teiid"/>
<transport name="embedded"/>
<transport name="jdbc" protocol="teiid"
socket-binding="teiid-jdbc">
Modified: trunk/build/kits/jboss-as7/modules/org/jboss/teiid/main/module.xml
===================================================================
--- trunk/build/kits/jboss-as7/modules/org/jboss/teiid/main/module.xml 2011-12-15 22:25:27
UTC (rev 3748)
+++ trunk/build/kits/jboss-as7/modules/org/jboss/teiid/main/module.xml 2011-12-17 03:27:07
UTC (rev 3749)
@@ -41,6 +41,7 @@
<module name="javax.transaction.api"/>
<module name="javax.activation.api"/>
<module name="org.jboss.as.clustering.jgroups"/>
+ <module name="org.infinispan"/>
<!-- These dependencies here for ra.xml description -->
<module name="org.jboss.as.connector"/>
<module name="org.jboss.ironjacamar.api"/>
Modified: trunk/build/kits/jboss-as7/standalone/configuration/standalone-teiid.xml
===================================================================
--- trunk/build/kits/jboss-as7/standalone/configuration/standalone-teiid.xml 2011-12-15
22:25:27 UTC (rev 3748)
+++ trunk/build/kits/jboss-as7/standalone/configuration/standalone-teiid.xml 2011-12-17
03:27:07 UTC (rev 3749)
@@ -259,7 +259,7 @@
</subsystem>
<subsystem xmlns="urn:jboss:domain:teiid:1.0">
<async-thread-pool>teiid-async</async-thread-pool>
- <resultset-cache container-name="teiid"
name="resultset"/>
+ <resultset-cache infinispan-container="teiid"/>
<transport name="embedded"/>
<transport name="jdbc" protocol="teiid"
socket-binding="teiid-jdbc">
Deleted:
trunk/cache-jbosscache/src/main/java/org/teiid/cache/jboss/ClusterableCacheFactory.java
===================================================================
---
trunk/cache-jbosscache/src/main/java/org/teiid/cache/jboss/ClusterableCacheFactory.java 2011-12-15
22:25:27 UTC (rev 3748)
+++
trunk/cache-jbosscache/src/main/java/org/teiid/cache/jboss/ClusterableCacheFactory.java 2011-12-17
03:27:07 UTC (rev 3749)
@@ -1,100 +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.cache.jboss;
-
-import java.io.Serializable;
-
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-
-import org.infinispan.manager.CacheContainer;
-import org.teiid.cache.Cache;
-import org.teiid.cache.CacheConfiguration;
-import org.teiid.cache.CacheFactory;
-import org.teiid.cache.DefaultCacheFactory;
-import org.teiid.core.TeiidRuntimeException;
-
-public class ClusterableCacheFactory implements CacheFactory, Serializable {
- private static final long serialVersionUID = -1992994494154581234L;
- private CacheFactory delegate;
- private String resultsetCacheName;
- private boolean enabled = false;
- private String cacheManagerName;
-
- @Override
- public <K, V> Cache<K, V> get(String location, CacheConfiguration config) {
- if (this.delegate == null) {
- Object cacheManager = getClusteredCache();
- if (cacheManager == null) {
- this.delegate = new DefaultCacheFactory(config);
- }
- else {
- try {
- this.delegate = new JBossCacheFactory(this.resultsetCacheName, (CacheContainer)
cacheManager);
- } catch (Exception e) {
- throw new TeiidRuntimeException("Failed to obtain the clusted cache");
//$NON-NLS-1$
- }
- }
- }
- return delegate.get(location, config);
- }
-
- public void setResultsetCacheName(String name) {
- this.resultsetCacheName = name;
- }
-
- @Override
- public void destroy() {
- if (this.delegate != null) {
- this.delegate.destroy();
- }
- }
-
- private Object getClusteredCache() {
- if (this.enabled && this.cacheManagerName != null) {
- try {
- Context ctx = new InitialContext();
- return ctx.lookup(this.cacheManagerName);
- } catch (NamingException e) {
- return null;
- }
- }
- return null;
- }
-
- public void setEnabled(boolean value) {
- this.enabled = value;
- }
-
- public void setCacheManager(String mgrName) {
- this.cacheManagerName = mgrName;
- }
-
- @Override
- public boolean isReplicated() {
- if (delegate == null) {
- return false;
- }
- return delegate.isReplicated();
- }
-}
Modified:
trunk/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCacheFactory.java
===================================================================
---
trunk/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCacheFactory.java 2011-12-15
22:25:27 UTC (rev 3748)
+++
trunk/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCacheFactory.java 2011-12-17
03:27:07 UTC (rev 3749)
@@ -38,7 +38,12 @@
public JBossCacheFactory(String name, CacheContainer cm) {
- this.cacheStore = cm.getCache(name);
+ if (name != null) {
+ this.cacheStore = cm.getCache(name);
+ }
+ else {
+ this.cacheStore = cm.getCache();
+ }
}
/**
Added: trunk/jboss-integration/src/main/java/org/teiid/jboss/CacheFactoryService.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/CacheFactoryService.java
(rev 0)
+++
trunk/jboss-integration/src/main/java/org/teiid/jboss/CacheFactoryService.java 2011-12-17
03:27:07 UTC (rev 3749)
@@ -0,0 +1,64 @@
+/*
+ * 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.infinispan.manager.CacheContainer;
+import org.jboss.msc.service.Service;
+import org.jboss.msc.service.StartContext;
+import org.jboss.msc.service.StartException;
+import org.jboss.msc.service.StopContext;
+import org.jboss.msc.value.InjectedValue;
+import org.teiid.cache.CacheFactory;
+import org.teiid.cache.DefaultCacheFactory;
+import org.teiid.cache.jboss.JBossCacheFactory;
+
+class CacheFactoryService implements Service<CacheFactory> {
+ protected InjectedValue<CacheContainer> cacheContainerInjector = new
InjectedValue<CacheContainer>();
+ private String cacheName;
+ private CacheFactory cacheFactory;
+
+ public CacheFactoryService(String cacheName){
+ this.cacheName = cacheName;
+ }
+
+ @Override
+ public void start(StartContext context) throws StartException {
+ CacheContainer cc = cacheContainerInjector.getValue();
+ if (cc != null) {
+ this.cacheFactory = new JBossCacheFactory(this.cacheName, cc);
+ }
+ else {
+ this.cacheFactory = new DefaultCacheFactory();
+ }
+ }
+
+ @Override
+ public void stop(StopContext context) {
+ this.cacheFactory.destroy();
+ this.cacheFactory = null;
+ }
+
+ @Override
+ public CacheFactory getValue() throws IllegalStateException, IllegalArgumentException {
+ return this.cacheFactory;
+ }
+}
Property changes on:
trunk/jboss-integration/src/main/java/org/teiid/jboss/CacheFactoryService.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/CacheService.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/CacheService.java 2011-12-15
22:25:27 UTC (rev 3748)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/CacheService.java 2011-12-17
03:27:07 UTC (rev 3749)
@@ -26,24 +26,34 @@
import org.jboss.msc.service.StartException;
import org.jboss.msc.service.StopContext;
import org.jboss.msc.value.InjectedValue;
+import org.teiid.cache.CacheConfiguration;
+import org.teiid.cache.CacheFactory;
import org.teiid.dqp.internal.process.SessionAwareCache;
import org.teiid.dqp.service.BufferService;
class CacheService<T> implements Service<SessionAwareCache<T>> {
+
private SessionAwareCache<T> cache;
- public final InjectedValue<BufferService> bufferMgrInjector = new
InjectedValue<BufferService>();
+ protected InjectedValue<BufferService> bufferMgrInjector = new
InjectedValue<BufferService>();
+ protected InjectedValue<CacheFactory> cacheFactoryInjector = new
InjectedValue<CacheFactory>();
+
+ private SessionAwareCache.Type type;
+ private CacheConfiguration config;
- public CacheService(SessionAwareCache<T> t){
- this.cache = t;
+ public CacheService(SessionAwareCache.Type type, CacheConfiguration config){
+ this.type = type;
+ this.config = config;
}
@Override
public void start(StartContext context) throws StartException {
+ this.cache = new SessionAwareCache<T>(cacheFactoryInjector.getValue(), this.type,
this.config);
this.cache.setTupleBufferCache(this.bufferMgrInjector.getValue().getTupleBufferCache());
}
@Override
public void stop(StopContext context) {
+ this.cache = null;
}
@Override
Copied: trunk/jboss-integration/src/main/java/org/teiid/jboss/DQPCoreService.java (from
rev 3748,
trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java)
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/DQPCoreService.java
(rev 0)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/DQPCoreService.java 2011-12-17
03:27:07 UTC (rev 3749)
@@ -0,0 +1,205 @@
+/*
+ * 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.Serializable;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+import java.util.Set;
+
+import javax.resource.spi.XATerminator;
+import javax.resource.spi.work.WorkManager;
+import javax.transaction.TransactionManager;
+
+import org.jboss.msc.service.Service;
+import org.jboss.msc.service.ServiceController;
+import org.jboss.msc.service.ServiceName;
+import org.jboss.msc.service.StartContext;
+import org.jboss.msc.service.StopContext;
+import org.jboss.msc.value.InjectedValue;
+import org.teiid.adminapi.impl.SessionMetadata;
+import org.teiid.core.TeiidRuntimeException;
+import org.teiid.core.util.LRUCache;
+import org.teiid.deployers.CompositeVDB;
+import org.teiid.deployers.VDBLifeCycleListener;
+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.DQPConfiguration;
+import org.teiid.dqp.internal.process.DQPCore;
+import org.teiid.dqp.internal.process.SessionAwareCache;
+import org.teiid.dqp.internal.process.TransactionServerImpl;
+import org.teiid.dqp.service.BufferService;
+import org.teiid.dqp.service.TransactionService;
+import org.teiid.events.EventDistributorFactory;
+import org.teiid.logging.LogConstants;
+import org.teiid.logging.LogManager;
+import org.teiid.logging.MessageLevel;
+import org.teiid.services.BufferServiceImpl;
+import org.teiid.vdb.runtime.VDBKey;
+
+
+public class DQPCoreService extends DQPConfiguration implements Serializable,
Service<DQPCore> {
+ private static final long serialVersionUID = -4676205340262775388L;
+
+ private transient TransactionServerImpl transactionServerImpl = new
TransactionServerImpl();
+ private transient DQPCore dqpCore = new DQPCore();
+
+ 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<BufferServiceImpl> bufferServiceInjector = new
InjectedValue<BufferServiceImpl>();
+ 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<SessionAwareCache> preparedPlanCacheInjector = new
InjectedValue<SessionAwareCache>();
+ private final InjectedValue<SessionAwareCache> resultSetCacheInjector = new
InjectedValue<SessionAwareCache>();
+ private final InjectedValue<EventDistributorFactory>
eventDistributorFactoryInjector = new InjectedValue<EventDistributorFactory>();
+
+ @Override
+ public void start(final StartContext context) {
+ this.transactionServerImpl.setWorkManager(getWorkManagerInjector().getValue());
+ this.transactionServerImpl.setXaTerminator(getXaTerminatorInjector().getValue());
+ this.transactionServerImpl.setTransactionManager(getTxnManagerInjector().getValue());
+
+ setAuthorizationValidator(authorizationValidatorInjector.getValue());
+ setBufferService(bufferServiceInjector.getValue());
+
+ this.dqpCore.setTransactionService((TransactionService)LogManager.createLoggingProxy(LogConstants.CTX_TXN_LOG,
transactionServerImpl, new Class[] {TransactionService.class}, MessageLevel.DETAIL,
Thread.currentThread().getContextClassLoader()));
+ this.dqpCore.setMetadataRepository(getVdbRepository().getMetadataRepository());
+ this.dqpCore.setEventDistributor(getEventDistributorFactoryInjector().getValue().getEventDistributor());
+ this.dqpCore.setResultsetCache(getResultSetCacheInjector().getValue());
+ this.dqpCore.setPreparedPlanCache(getPreparedPlanCacheInjector().getValue());
+ this.dqpCore.start(this);
+
+
+ // add vdb life cycle listeners
+ getVdbRepository().addListener(new VDBLifeCycleListener() {
+
+ private Set<VDBKey> recentlyRemoved = Collections.newSetFromMap(new
LRUCache<VDBKey, Boolean>(10000));
+
+ @Override
+ public void removed(String name, int version, CompositeVDB vdb) {
+ recentlyRemoved.add(new VDBKey(name, version));
+ }
+
+ @Override
+ public void added(String name, int version, CompositeVDB vdb) {
+ if (!recentlyRemoved.remove(new VDBKey(name, version))) {
+ return;
+ }
+ // terminate all the previous sessions
+ List<ServiceName> services =
context.getController().getServiceContainer().getServiceNames();
+ for (ServiceName service:services) {
+ if (TeiidServiceNames.TRANSPORT_BASE.isParentOf(service)) {
+ ServiceController<?> transport =
context.getController().getServiceContainer().getService(service);
+ if (transport != null) {
+ TransportService t =
TransportService.class.cast(transport.getValue());
+ Collection<SessionMetadata> sessions = t.getActiveSessions();
+ for (SessionMetadata session:sessions) {
+ if (name.equalsIgnoreCase(session.getVDBName()) && version ==
session.getVDBVersion()){
+ t.terminateSession(session.getSessionId());
+ }
+ }
+ }
+ }
+ }
+
+ // dump the caches.
+ if (getResultSetCacheInjector().getValue() != null) {
+ getResultSetCacheInjector().getValue().clearForVDB(name, version);
+ }
+ if (getPreparedPlanCacheInjector().getValue() != null) {
+ getPreparedPlanCacheInjector().getValue().clearForVDB(name, version);
+ }
+ }
+ });
+
+ LogManager.logInfo(LogConstants.CTX_RUNTIME,
IntegrationPlugin.Util.getString("engine_started",
this.dqpCore.getRuntimeVersion(), new Date(System.currentTimeMillis()).toString()));
//$NON-NLS-1$
+ }
+
+ @Override
+ public DQPCore getValue() throws IllegalStateException, IllegalArgumentException {
+ return this.dqpCore;
+ }
+
+ @Override
+ public void stop(StopContext context) {
+ try {
+ this.dqpCore.stop();
+ } catch(TeiidRuntimeException e) {
+ // this bean is already shutdown
+ }
+
+ LogManager.logInfo(LogConstants.CTX_RUNTIME,
IntegrationPlugin.Util.getString("engine_stopped", new
Date(System.currentTimeMillis()).toString())); //$NON-NLS-1$
+ }
+
+ public void setBufferService(BufferService service) {
+ this.dqpCore.setBufferService(service);
+ }
+
+ public InjectedValue<SessionAwareCache> getResultSetCacheInjector() {
+ return resultSetCacheInjector;
+ }
+
+ public InjectedValue<SessionAwareCache> getPreparedPlanCacheInjector() {
+ return preparedPlanCacheInjector;
+ }
+
+ public InjectedValue<TranslatorRepository> getTranslatorRepositoryInjector() {
+ return translatorRepositoryInjector;
+ }
+
+ public InjectedValue<VDBRepository> getVdbRepositoryInjector() {
+ return vdbRepositoryInjector;
+ }
+
+ private VDBRepository getVdbRepository() {
+ return vdbRepositoryInjector.getValue();
+ }
+
+ public InjectedValue<AuthorizationValidator> getAuthorizationValidatorInjector()
{
+ return authorizationValidatorInjector;
+ }
+
+ public InjectedValue<BufferServiceImpl> getBufferServiceInjector() {
+ return bufferServiceInjector;
+ }
+
+ public InjectedValue<TransactionManager> getTxnManagerInjector() {
+ return txnManagerInjector;
+ }
+
+ public InjectedValue<XATerminator> getXaTerminatorInjector() {
+ return xaTerminatorInjector;
+ }
+
+ public InjectedValue<WorkManager> getWorkManagerInjector() {
+ return workManagerInjector;
+ }
+
+ public InjectedValue<EventDistributorFactory> getEventDistributorFactoryInjector()
{
+ return eventDistributorFactoryInjector;
+ }
+}
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/Element.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/Element.java 2011-12-15 22:25:27
UTC (rev 3748)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/Element.java 2011-12-17 03:27:07
UTC (rev 3749)
@@ -89,9 +89,9 @@
// Result set cache
RESULTSET_CACHE_ELEMENT("resultset-cache"),
- RSC_ENABLE_ATTRIBUTE("enable", "resultset-cache-enable",
ModelType.BOOLEAN, false, null),
- RSC_NAME_ELEMENT("name", "resultset-cache-name", ModelType.STRING,
false, "resultset"),
- RSC_CONTAINER_NAME_ELEMENT("container-name",
"resultset-cache-container-name", ModelType.STRING, false, null),
+ RSC_ENABLE_ATTRIBUTE("enable", "resultset-cache-enable",
ModelType.BOOLEAN, false, "true"),
+ RSC_NAME_ELEMENT("name", "resultset-cache-name", ModelType.STRING,
false, null),
+ RSC_CONTAINER_NAME_ELEMENT("infinispan-container",
"resultset-cache-infinispan-container", ModelType.STRING, false, null),
RSC_MAX_STALENESS_ELEMENT("max-staleness",
"resultset-cache-max-staleness",
ModelType.INT, false, "60"),
//transport
@@ -113,6 +113,7 @@
PG_MAX_LOB_SIZE_ALLOWED_ELEMENT("max-lob-size-in-bytes",
"pg-max-lob-size-in-bytes",
ModelType.INT, false, "5242880"),
//$NON-NLS-1$ //$NON-NLS-2$
SSL_ELEMENT("ssl"),
+ SSL_ENABLE_ATTRIBUTE("enable", "ssl-enable", ModelType.BOOLEAN,
false, "false"),
SSL_MODE_ATTRIBUTE("mode", "ssl-mode", ModelType.STRING, false,
"login"),
SSL_AUTH_MODE_ATTRIBUTE("authentication-mode",
"ssl-authentication-mode", ModelType.STRING, false, "anonymous"),
SSL_SSL_PROTOCOL_ATTRIBUTE("ssl-protocol", "ssl-ssl-protocol",
ModelType.STRING, false, "SSLv3"),
Added:
trunk/jboss-integration/src/main/java/org/teiid/jboss/PreparedPlanCacheService.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/PreparedPlanCacheService.java
(rev 0)
+++
trunk/jboss-integration/src/main/java/org/teiid/jboss/PreparedPlanCacheService.java 2011-12-17
03:27:07 UTC (rev 3749)
@@ -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 org.jboss.msc.value.InjectedValue;
+import org.jboss.msc.value.Value;
+import org.teiid.cache.CacheConfiguration;
+import org.teiid.cache.CacheFactory;
+import org.teiid.cache.DefaultCacheFactory;
+import org.teiid.dqp.internal.process.PreparedPlan;
+import org.teiid.dqp.internal.process.SessionAwareCache;
+
+
+class PreparedPlanCacheService extends CacheService<PreparedPlan> {
+ public PreparedPlanCacheService(SessionAwareCache.Type type, CacheConfiguration config)
{
+ super(type, config);
+ this.cacheFactoryInjector = new InjectedValue<CacheFactory>();
+ this.cacheFactoryInjector.setValue(new Value() {
+ @Override
+ public CacheFactory getValue() throws IllegalStateException, IllegalArgumentException
{
+ return new DefaultCacheFactory();
+ }
+ });
+ }
+
+}
Property changes on:
trunk/jboss-integration/src/main/java/org/teiid/jboss/PreparedPlanCacheService.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/TeiidAdd.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/TeiidAdd.java 2011-12-15
22:25:27 UTC (rev 3748)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/TeiidAdd.java 2011-12-17
03:27:07 UTC (rev 3749)
@@ -37,6 +37,7 @@
import javax.resource.spi.work.WorkManager;
import javax.transaction.TransactionManager;
+import org.infinispan.manager.CacheContainer;
import org.jboss.as.clustering.jgroups.ChannelFactory;
import org.jboss.as.controller.AbstractAddStepHandler;
import org.jboss.as.controller.OperationContext;
@@ -66,8 +67,7 @@
import org.teiid.PolicyDecider;
import org.teiid.cache.CacheConfiguration;
import org.teiid.cache.CacheConfiguration.Policy;
-import org.teiid.cache.DefaultCacheFactory;
-import org.teiid.cache.jboss.ClusterableCacheFactory;
+import org.teiid.cache.CacheFactory;
import org.teiid.deployers.SystemVDBDeployer;
import org.teiid.deployers.VDBRepository;
import org.teiid.deployers.VDBStatusChecker;
@@ -81,7 +81,6 @@
import org.teiid.dqp.internal.process.SessionAwareCache;
import org.teiid.dqp.service.BufferService;
import org.teiid.events.EventDistributorFactory;
-import org.teiid.jboss.deployers.RuntimeEngineDeployer;
import org.teiid.logging.LogConstants;
import org.teiid.logging.LogManager;
import org.teiid.metadata.MetadataRepository;
@@ -315,21 +314,48 @@
newControllers.add(target.addService(TeiidServiceNames.AUTHORIZATION_VALIDATOR,
authValidatorService).install());
// resultset cache
- final SessionAwareCache<CachedResults> resultsetCache =
buildResultsetCache(operation);
- CacheService<CachedResults> resultSetService = new
CacheService<CachedResults>(resultsetCache);
- ServiceBuilder<SessionAwareCache<CachedResults>> resultsCacheBuilder =
target.addService(TeiidServiceNames.CACHE_RESULTSET, resultSetService);
- resultsCacheBuilder.addDependency(TeiidServiceNames.BUFFER_MGR, BufferService.class,
resultSetService.bufferMgrInjector);
- newControllers.add(resultsCacheBuilder.install());
+ boolean rsCache = true;
+ if (Element.RSC_ENABLE_ATTRIBUTE.isDefined(operation) &&
!Element.RSC_ENABLE_ATTRIBUTE.asBoolean(operation)) {
+ rsCache = false;
+ }
+
+ String infinispanCacheContainer = null;
+ if (Element.RSC_CONTAINER_NAME_ELEMENT.isDefined(operation)) {
+ infinispanCacheContainer = Element.RSC_CONTAINER_NAME_ELEMENT.asString(operation);
+ }
+
+ String cacheName = null;
+ if (Element.RSC_NAME_ELEMENT.isDefined(operation)) {
+ // if null; default cache will be used
+ cacheName = Element.RSC_NAME_ELEMENT.asString(operation);
+ }
- // prepared-plan cache
- final SessionAwareCache<PreparedPlan> preparedPlanCache =
buildPreparedPlanCache(operation);
- CacheService<PreparedPlan> preparedPlanService = new
CacheService<PreparedPlan>(preparedPlanCache);
+ if (rsCache) {
+ ServiceName cfName = ServiceName.JBOSS.append("teiid",
"infinispan-cache-factory"); //$NON-NLS-1$ //$NON-NLS-2$
+ CacheFactoryService cfs = new CacheFactoryService(cacheName);
+ ServiceBuilder<CacheFactory> cacheFactoryBuilder = target.addService(cfName,
cfs);
+
+ if (infinispanCacheContainer != null) {
+ cacheFactoryBuilder.addDependency(ServiceName.JBOSS.append("infinispan",
infinispanCacheContainer), CacheContainer.class, cfs.cacheContainerInjector);
//$NON-NLS-1$
+ }
+ newControllers.add(cacheFactoryBuilder.install());
+
+ CacheService<CachedResults> resultSetService = new
CacheService<CachedResults>(SessionAwareCache.Type.RESULTSET,
buildCacheConfig(operation));
+ ServiceBuilder<SessionAwareCache<CachedResults>> resultsCacheBuilder =
target.addService(TeiidServiceNames.CACHE_RESULTSET, resultSetService);
+ resultsCacheBuilder.addDependency(TeiidServiceNames.BUFFER_MGR,
BufferService.class, resultSetService.bufferMgrInjector);
+ resultsCacheBuilder.addDependency(cfName, CacheFactory.class,
resultSetService.cacheFactoryInjector);
+ newControllers.add(resultsCacheBuilder.install());
+ }
+
+ // prepared-plan cache (note that there is no dependency on the cache factory for
+ // prepared plan cache, as it is always local)
+ CacheService<PreparedPlan> preparedPlanService = new
PreparedPlanCacheService(SessionAwareCache.Type.PREPAREDPLAN,
buildPreparedPlanCacheConfig(operation));
ServiceBuilder<SessionAwareCache<PreparedPlan>> preparedPlanCacheBuilder
= target.addService(TeiidServiceNames.CACHE_PREPAREDPLAN, preparedPlanService);
preparedPlanCacheBuilder.addDependency(TeiidServiceNames.BUFFER_MGR,
BufferService.class, preparedPlanService.bufferMgrInjector);
newControllers.add(preparedPlanCacheBuilder.install());
// Query Engine
- final RuntimeEngineDeployer engine = buildQueryEngine(operation);
+ final DQPCoreService engine = buildQueryEngine(operation);
String workManager = "default"; //$NON-NLS-1$
if (Element.WORKMANAGER.isDefined(operation)) {
workManager = Element.WORKMANAGER.asString(operation);
@@ -344,7 +370,7 @@
engineBuilder.addDependency(TeiidServiceNames.TRANSLATOR_REPO,
TranslatorRepository.class, engine.getTranslatorRepositoryInjector());
engineBuilder.addDependency(TeiidServiceNames.VDB_REPO, VDBRepository.class,
engine.getVdbRepositoryInjector());
engineBuilder.addDependency(TeiidServiceNames.AUTHORIZATION_VALIDATOR,
AuthorizationValidator.class, engine.getAuthorizationValidatorInjector());
- engineBuilder.addDependency(TeiidServiceNames.CACHE_RESULTSET,
SessionAwareCache.class, engine.getResultSetCacheInjector());
+
engineBuilder.addDependency(rsCache?DependencyType.REQUIRED:DependencyType.OPTIONAL,
TeiidServiceNames.CACHE_RESULTSET, SessionAwareCache.class,
engine.getResultSetCacheInjector());
engineBuilder.addDependency(TeiidServiceNames.CACHE_PREPAREDPLAN,
SessionAwareCache.class, engine.getPreparedPlanCacheInjector());
engineBuilder.addDependency(TeiidServiceNames.EVENT_DISTRIBUTOR_FACTORY,
EventDistributorFactory.class, engine.getEventDistributorFactoryInjector());
@@ -455,7 +481,7 @@
return bufferManger;
}
- private SessionAwareCache<CachedResults> buildResultsetCache(ModelNode node) {
+ private CacheConfiguration buildCacheConfig(ModelNode node) {
CacheConfiguration cacheConfig = new CacheConfiguration();
cacheConfig.setMaxEntries(1024);
@@ -464,40 +490,15 @@
cacheConfig.setLocation("resultset"); //$NON-NLS-1$
cacheConfig.setMaxStaleness(60);
- if (Element.RSC_ENABLE_ATTRIBUTE.isDefined(node)) {
- if (!Element.RSC_ENABLE_ATTRIBUTE.asBoolean(node)) {
- return null;
- }
- }
-
- ClusterableCacheFactory cacheFactory = null;
-
- if (Element.RSC_CONTAINER_NAME_ELEMENT.isDefined(node)) {
- cacheFactory = new ClusterableCacheFactory();
- cacheFactory.setCacheManager(Element.RSC_CONTAINER_NAME_ELEMENT.asString(node));
- }
- else {
- SessionAwareCache<CachedResults> resultsetCache = new
SessionAwareCache<CachedResults>(new DefaultCacheFactory(),
SessionAwareCache.Type.RESULTSET, cacheConfig);
- return resultsetCache;
- }
-
- if (Element.RSC_NAME_ELEMENT.isDefined(node)) {
- cacheFactory.setResultsetCacheName(Element.RSC_NAME_ELEMENT.asString(node));
- }
- else {
- cacheFactory.setResultsetCacheName("resultset"); //$NON-NLS-1$
- }
-
if (Element.RSC_MAX_STALENESS_ELEMENT.isDefined(node)) {
cacheConfig.setMaxStaleness(Element.RSC_MAX_STALENESS_ELEMENT.asInt(node));
}
- SessionAwareCache<CachedResults> resultsetCache = new
SessionAwareCache<CachedResults>(cacheFactory, SessionAwareCache.Type.RESULTSET,
cacheConfig);
- return resultsetCache;
+ return cacheConfig;
}
- private SessionAwareCache<PreparedPlan> buildPreparedPlanCache(ModelNode node)
{
+ private CacheConfiguration buildPreparedPlanCacheConfig(ModelNode node) {
CacheConfiguration cacheConfig = new CacheConfiguration();
if (Element.PPC_MAX_ENTRIES_ATTRIBUTE.isDefined(node)) {
cacheConfig.setMaxEntries(Element.PPC_MAX_ENTRIES_ATTRIBUTE.asInt(node));
@@ -516,14 +517,13 @@
cacheConfig.setType(Policy.LRU.name());
cacheConfig.setLocation("prepared"); //$NON-NLS-1$
- SessionAwareCache<PreparedPlan> cache = new
SessionAwareCache<PreparedPlan>(new DefaultCacheFactory(),
SessionAwareCache.Type.PREPAREDPLAN, cacheConfig);
- return cache;
+ return cacheConfig;
}
- private RuntimeEngineDeployer buildQueryEngine(ModelNode node) {
- RuntimeEngineDeployer engine = new RuntimeEngineDeployer();
+ private DQPCoreService buildQueryEngine(ModelNode node) {
+ DQPCoreService engine = new DQPCoreService();
if (Element.MAX_THREADS_ELEMENT.isDefined(node)) {
engine.setMaxThreads(Element.MAX_THREADS_ELEMENT.asInt(node));
Modified:
trunk/jboss-integration/src/main/java/org/teiid/jboss/TeiidOperationHandler.java
===================================================================
---
trunk/jboss-integration/src/main/java/org/teiid/jboss/TeiidOperationHandler.java 2011-12-15
22:25:27 UTC (rev 3748)
+++
trunk/jboss-integration/src/main/java/org/teiid/jboss/TeiidOperationHandler.java 2011-12-17
03:27:07 UTC (rev 3749)
@@ -84,7 +84,7 @@
import org.teiid.logging.LogManager;
abstract class TeiidOperationHandler extends BaseOperationHandler<DQPCore> {
- List<Transport> transports = new ArrayList<Transport>();
+ List<TransportService> transports = new ArrayList<TransportService>();
protected VDBRepository vdbRepo;
protected DQPCore engine;
@@ -104,7 +104,7 @@
if (TeiidServiceNames.TRANSPORT_BASE.isParentOf(name)) {
ServiceController<?> transport =
context.getServiceRegistry(false).getService(name);
if (transport != null) {
- this.transports.add(Transport.class.cast(transport.getValue()));
+ this.transports.add(TransportService.class.cast(transport.getValue()));
}
}
}
@@ -156,7 +156,7 @@
protected void executeOperation(OperationContext context, DQPCore engine, ModelNode
operation) throws OperationFailedException{
try {
int count = 0;
- for (Transport t: this.transports) {
+ for (TransportService t: this.transports) {
count += t.getActiveSessionsCount();
}
context.getResult().set(count);
@@ -177,7 +177,7 @@
@Override
protected void executeOperation(OperationContext context, DQPCore engine, ModelNode
operation) throws OperationFailedException{
ModelNode result = context.getResult();
- for (Transport t: this.transports) {
+ for (TransportService t: this.transports) {
Collection<SessionMetadata> sessions = t.getActiveSessions();
for (SessionMetadata session:sessions) {
VDBMetadataMapper.SessionMetadataMapper.INSTANCE.wrap(session, result.add());
@@ -254,7 +254,7 @@
ModelNode result = context.getResult();
String vdbName = operation.get(OperationsConstants.VDB_NAME).asString();
int vdbVersion = operation.get(OperationsConstants.VDB_VERSION).asInt();
- for (Transport t: this.transports) {
+ for (TransportService t: this.transports) {
List<RequestMetadata> requests = t.getRequestsUsingVDB(vdbName,vdbVersion);
for (RequestMetadata request:requests) {
VDBMetadataMapper.RequestMetadataMapper.INSTANCE.wrap(request, result.add());
@@ -305,7 +305,7 @@
if (!operation.hasDefined(OperationsConstants.SESSION)) {
throw new OperationFailedException(new
ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.SESSION+MISSING)));
}
- for (Transport t: this.transports) {
+ for (TransportService t: this.transports) {
t.terminateSession(operation.get(OperationsConstants.SESSION).asString());
}
}
@@ -375,7 +375,10 @@
sc =
context.getServiceRegistry(false).getRequiredService(TeiidServiceNames.CACHE_PREPAREDPLAN);
}
- return SessionAwareCache.class.cast(sc.getValue());
+ if (sc != null) {
+ return SessionAwareCache.class.cast(sc.getValue());
+ }
+ return null;
}
}
@@ -417,6 +420,10 @@
}
String cacheType = operation.get(OperationsConstants.CACHE_TYPE).asString();
+ if (cache == null) {
+ throw new OperationFailedException(new
ModelNode().set(IntegrationPlugin.Util.getString("cache_not_found",
cacheType))); //$NON-NLS-1$
+ }
+
if (operation.hasDefined(OperationsConstants.VDB_NAME) &&
operation.hasDefined(OperationsConstants.VDB_VERSION)) {
String vdbName = operation.get(OperationsConstants.VDB_NAME).asString();
int vdbVersion = operation.get(OperationsConstants.VDB_VERSION).asInt();
@@ -456,8 +463,12 @@
if (!operation.hasDefined(OperationsConstants.CACHE_TYPE)) {
throw new OperationFailedException(new
ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.CACHE_TYPE+MISSING)));
}
+ String cacheType = operation.get(OperationsConstants.CACHE_TYPE).asString();
+ if (cache == null) {
+ throw new OperationFailedException(new
ModelNode().set(IntegrationPlugin.Util.getString("cache_not_found",
cacheType))); //$NON-NLS-1$
+ }
+
ModelNode result = context.getResult();
- String cacheType = operation.get(OperationsConstants.CACHE_TYPE).asString();
CacheStatisticsMetadata stats = buildCacheStats(cacheType, cache);
VDBMetadataMapper.CacheStatisticsMetadataMapper.INSTANCE.wrap(stats, result);
}
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/TeiidSubsystemParser.java
===================================================================
---
trunk/jboss-integration/src/main/java/org/teiid/jboss/TeiidSubsystemParser.java 2011-12-15
22:25:27 UTC (rev 3748)
+++
trunk/jboss-integration/src/main/java/org/teiid/jboss/TeiidSubsystemParser.java 2011-12-17
03:27:07 UTC (rev 3749)
@@ -162,6 +162,7 @@
if (like(node, Element.SSL_ELEMENT)) {
writer.writeStartElement(Element.SSL_ELEMENT.getLocalName());
+ writeAttribute(writer, Element.SSL_ENABLE_ATTRIBUTE, node);
writeAttribute(writer, Element.SSL_MODE_ATTRIBUTE, node);
writeAttribute(writer, Element.SSL_AUTH_MODE_ATTRIBUTE, node);
writeAttribute(writer, Element.SSL_SSL_PROTOCOL_ATTRIBUTE, node);
@@ -501,6 +502,7 @@
Element element = Element.forName(attrName, Element.SSL_ELEMENT);
switch(element) {
+ case SSL_ENABLE_ATTRIBUTE:
case SSL_MODE_ATTRIBUTE:
case SSL_AUTH_MODE_ATTRIBUTE:
case SSL_SSL_PROTOCOL_ATTRIBUTE:
Deleted: trunk/jboss-integration/src/main/java/org/teiid/jboss/Transport.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/Transport.java 2011-12-15
22:25:27 UTC (rev 3748)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/Transport.java 2011-12-17
03:27:07 UTC (rev 3749)
@@ -1,289 +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 java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.net.InetSocketAddress;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-
-import org.jboss.as.network.SocketBinding;
-import org.jboss.as.security.plugins.SecurityDomainContext;
-import org.jboss.msc.service.Service;
-import org.jboss.msc.service.StartContext;
-import org.jboss.msc.service.StartException;
-import org.jboss.msc.service.StopContext;
-import org.jboss.msc.value.InjectedValue;
-import org.teiid.adminapi.AdminComponentException;
-import org.teiid.adminapi.AdminException;
-import org.teiid.adminapi.impl.RequestMetadata;
-import org.teiid.adminapi.impl.SessionMetadata;
-import org.teiid.client.DQP;
-import org.teiid.client.security.ILogon;
-import org.teiid.client.util.ExceptionUtil;
-import org.teiid.core.ComponentNotFoundException;
-import org.teiid.deployers.VDBRepository;
-import org.teiid.dqp.internal.process.DQPCore;
-import org.teiid.dqp.internal.process.DQPWorkContext;
-import org.teiid.dqp.service.SessionServiceException;
-import org.teiid.logging.LogConstants;
-import org.teiid.logging.LogManager;
-import org.teiid.logging.MessageLevel;
-import org.teiid.net.socket.AuthenticationType;
-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.LocalServerConnection;
-import org.teiid.transport.LogonImpl;
-import org.teiid.transport.ODBCSocketListener;
-import org.teiid.transport.SocketConfiguration;
-import org.teiid.transport.SocketListener;
-
-public class Transport implements Service<ClientServiceRegistry>,
ClientServiceRegistry {
- private enum Protocol {teiid, pg};
- private ClientServiceRegistryImpl csr = new ClientServiceRegistryImpl();
- private transient ILogon logon;
- private SocketConfiguration socketConfig;
- final ConcurrentMap<String, SecurityDomainContext> securityDomains = new
ConcurrentHashMap<String, SecurityDomainContext>();
- private List<String> authenticationDomains;;
- private long sessionMaxLimit;
- private long sessionExpirationTimeLimit;
- private SocketListener socketListener;
- private transient SessionServiceImpl sessionService;
- private AuthenticationType authenticationType;
- private int maxODBCLobSizeAllowed = 5*1024*1024; // 5 MB
- private boolean embedded;
- private String krb5Domain;
-
- private final InjectedValue<SocketBinding> socketBindingInjector = new
InjectedValue<SocketBinding>();
- private final InjectedValue<VDBRepository> vdbRepositoryInjector = new
InjectedValue<VDBRepository>();
- private final InjectedValue<DQPCore> dqpInjector = new
InjectedValue<DQPCore>();
- private final InjectedValue<BufferServiceImpl> bufferServiceInjector = new
InjectedValue<BufferServiceImpl>();
-
- @Override
- public <T> T getClientService(Class<T> iface) throws
ComponentNotFoundException {
- return csr.getClientService(iface);
- }
-
- @Override
- public SecurityHelper getSecurityHelper() {
- return csr.getSecurityHelper();
- }
-
- @Override
- public ClientServiceRegistry getValue() throws IllegalStateException,
IllegalArgumentException {
- return this;
- }
-
- @Override
- public void start(StartContext context) throws StartException {
- this.csr.setSecurityHelper(new JBossSecurityHelper());
-
- this.sessionService = new JBossSessionService(this.securityDomains);
- if (this.authenticationDomains != null &&
!this.authenticationDomains.isEmpty()) {
- this.sessionService.setSecurityDomains(this.authenticationDomains);
- }
- this.sessionService.setSessionExpirationTimeLimit(this.sessionExpirationTimeLimit);
- this.sessionService.setSessionMaxLimit(this.sessionMaxLimit);
- this.sessionService.setDqp(getDQP());
- this.sessionService.setVDBRepository(getVdbRepository());
- this.sessionService.setSecurityHelper(this.csr.getSecurityHelper());
- this.sessionService.setAuthenticationType(getAuthenticationType());
- this.sessionService.setGssSecurityDomain(this.krb5Domain);
- this.sessionService.start();
-
- // create the necessary services
- this.logon = new LogonImpl(this.sessionService, "teiid-cluster");
//$NON-NLS-1$
-
- if (this.socketConfig != null) {
- InetSocketAddress address =
getSocketBindingInjector().getValue().getSocketAddress();
- Protocol protocol = Protocol.valueOf(socketConfig.getProtocol());
- boolean sslEnabled = false;
- if (this.socketConfig.getSSLConfiguration() != null) {
- sslEnabled = this.socketConfig.getSSLConfiguration().isSslEnabled();
- }
- if (protocol == Protocol.teiid) {
- this.socketListener = new SocketListener(address, this.socketConfig, this.csr,
getBufferServiceInjector().getValue().getBufferManager());
- LogManager.logInfo(LogConstants.CTX_RUNTIME,
IntegrationPlugin.Util.getString("socket_enabled", address.getHostName(),
String.valueOf(address.getPort()), (sslEnabled?"ON":"OFF"),
authenticationDomains)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
- else if (protocol == Protocol.pg) {
- getVdbRepository().odbcEnabled();
- ODBCSocketListener odbc = new ODBCSocketListener(address, this.socketConfig,
this.csr, getBufferServiceInjector().getValue().getBufferManager(),
getMaxODBCLobSizeAllowed(), this.logon);
- odbc.setAuthenticationType(this.sessionService.getAuthenticationType());
- LogManager.logInfo(LogConstants.CTX_RUNTIME,
IntegrationPlugin.Util.getString("odbc_enabled", address.getHostName(),
String.valueOf(address.getPort()), (sslEnabled?"ON":"OFF"),
authenticationDomains)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
- else {
- throw new
StartException(IntegrationPlugin.Util.getString("wrong_protocol"));
//$NON-NLS-1$
- }
- }
- else {
- LogManager.logInfo(LogConstants.CTX_RUNTIME,
IntegrationPlugin.Util.getString("embedded_enabled",
LocalServerConnection.TEIID_RUNTIME_CONTEXT)); //$NON-NLS-1$
- }
-
- DQP dqpProxy = proxyService(DQP.class, getDQP(), LogConstants.CTX_DQP);
- this.csr.registerClientService(ILogon.class, logon, LogConstants.CTX_SECURITY);
- this.csr.registerClientService(DQP.class, dqpProxy, LogConstants.CTX_DQP);
- }
-
- @Override
- public void stop(StopContext context) {
- // Stop socket transport(s)
- if (this.socketListener != null) {
- this.socketListener.stop();
- this.socketListener = null;
- }
- this.sessionService.stop();
- }
-
- /**
- * Creates an proxy to validate the incoming session
- */
- private <T> T proxyService(final Class<T> iface, final T instance, String
context) {
-
- return iface.cast(Proxy.newProxyInstance(this.getClass().getClassLoader(), new Class[]
{iface}, new LogManager.LoggingProxy(instance, context, MessageLevel.TRACE) {
-
- public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
- Throwable exception = null;
- try {
- sessionService.validateSession(DQPWorkContext.getWorkContext().getSessionId());
- return super.invoke(proxy, method, args);
- } catch (InvocationTargetException e) {
- exception = e.getTargetException();
- } catch(Throwable t){
- exception = t;
- }
- throw ExceptionUtil.convertException(method, exception);
- }
- }));
- }
-
- public List<RequestMetadata> getRequestsUsingVDB(String vdbName, int
vdbVersion) {
- List<RequestMetadata> requests = new ArrayList<RequestMetadata>();
- Collection<SessionMetadata> sessions = this.sessionService.getActiveSessions();
- for (SessionMetadata session:sessions) {
- if (session.getVDBName().equals(vdbName) && session.getVDBVersion() ==
vdbVersion) {
- requests.addAll(getDQP().getRequestsForSession(session.getSessionId()));
- }
- }
- return requests;
- }
-
- public void terminateSession(String terminateeId) {
- this.sessionService.terminateSession(terminateeId,
DQPWorkContext.getWorkContext().getSessionId());
- }
-
- public Collection<SessionMetadata> getActiveSessions(){
- return this.sessionService.getActiveSessions();
- }
-
- public int getActiveSessionsCount() throws AdminException{
- try {
- return this.sessionService.getActiveSessionsCount();
- } catch (SessionServiceException e) {
- throw new AdminComponentException(e);
- }
- }
-
- public InjectedValue<SocketBinding> getSocketBindingInjector() {
- return this.socketBindingInjector;
- }
-
- public SocketConfiguration getSocketConfig() {
- return socketConfig;
- }
-
- public void setSocketConfig(SocketConfiguration socketConfig) {
- this.socketConfig = socketConfig;
- }
-
- public List<String> getAuthenticationDomains() {
- return authenticationDomains;
- }
-
- public void setAuthenticationDomains(List<String> authenticationDomains) {
- this.authenticationDomains = new LinkedList(authenticationDomains);
- }
-
- public void setSessionMaxLimit(long limit) {
- this.sessionMaxLimit = limit;
- }
-
- public void setSessionExpirationTimeLimit(long limit) {
- this.sessionExpirationTimeLimit = limit;
- }
-
- public AuthenticationType getAuthenticationType() {
- return authenticationType;
- }
-
- public void setAuthenticationType(AuthenticationType authenticationType) {
- this.authenticationType = authenticationType;
- }
-
- public InjectedValue<VDBRepository> getVdbRepositoryInjector() {
- return vdbRepositoryInjector;
- }
-
- private VDBRepository getVdbRepository() {
- return vdbRepositoryInjector.getValue();
- }
-
- private DQPCore getDQP() {
- return getDqpInjector().getValue();
- }
-
- public InjectedValue<DQPCore> getDqpInjector() {
- return dqpInjector;
- }
-
- public InjectedValue<BufferServiceImpl> getBufferServiceInjector() {
- return bufferServiceInjector;
- }
-
- private int getMaxODBCLobSizeAllowed() {
- return this.maxODBCLobSizeAllowed;
- }
-
- public void setMaxODBCLobSizeAllowed(int lobSize) {
- this.maxODBCLobSizeAllowed = lobSize;
- }
-
- public void setEmbedded(boolean v) {
- this.embedded = v;
- }
-
- public boolean isEmbedded() {
- return this.embedded;
- }
-
- public void setKrb5Domain(String domain) {
- this.krb5Domain = domain;
- }
-}
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/TransportAdd.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/TransportAdd.java 2011-12-15
22:25:27 UTC (rev 3748)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/TransportAdd.java 2011-12-17
03:27:07 UTC (rev 3749)
@@ -81,6 +81,7 @@
Element.PG_MAX_LOB_SIZE_ALLOWED_ELEMENT,
+ Element.SSL_ENABLE_ATTRIBUTE,
Element.SSL_MODE_ATTRIBUTE,
Element.SSL_AUTH_MODE_ATTRIBUTE,
Element.SSL_SSL_PROTOCOL_ATTRIBUTE,
@@ -137,7 +138,7 @@
final PathAddress pathAddress = PathAddress.pathAddress(address);
final String transportName = pathAddress.getLastElement().getValue();
- Transport transport = new Transport();
+ TransportService transport = new TransportService();
String socketBinding = null;
if (Element.TRANSPORT_SOCKET_BINDING_ATTRIBUTE.isDefined(operation)) {
@@ -249,10 +250,14 @@
boolean sslEnabled = false;
SSLConfiguration ssl = new SSLConfiguration();
ssl.setAuthenticationMode(SSLConfiguration.ANONYMOUS);
+
+ if (Element.SSL_ENABLE_ATTRIBUTE.isDefined(node)) {
+ ssl.setMode(Element.SSL_ENABLE_ATTRIBUTE.asString(node));
+ sslEnabled = true;
+ }
if (Element.SSL_MODE_ATTRIBUTE.isDefined(node)) {
ssl.setMode(Element.SSL_MODE_ATTRIBUTE.asString(node));
- sslEnabled = true;
}
if (Element.SSL_SSL_PROTOCOL_ATTRIBUTE.isDefined(node)) {
Copied: trunk/jboss-integration/src/main/java/org/teiid/jboss/TransportService.java (from
rev 3748, trunk/jboss-integration/src/main/java/org/teiid/jboss/Transport.java)
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/TransportService.java
(rev 0)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/TransportService.java 2011-12-17
03:27:07 UTC (rev 3749)
@@ -0,0 +1,303 @@
+/*
+ * 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.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.net.InetSocketAddress;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+import org.jboss.as.network.SocketBinding;
+import org.jboss.as.security.plugins.SecurityDomainContext;
+import org.jboss.msc.service.Service;
+import org.jboss.msc.service.StartContext;
+import org.jboss.msc.service.StartException;
+import org.jboss.msc.service.StopContext;
+import org.jboss.msc.value.InjectedValue;
+import org.teiid.adminapi.AdminComponentException;
+import org.teiid.adminapi.AdminException;
+import org.teiid.adminapi.impl.RequestMetadata;
+import org.teiid.adminapi.impl.SessionMetadata;
+import org.teiid.client.DQP;
+import org.teiid.client.security.ILogon;
+import org.teiid.client.util.ExceptionUtil;
+import org.teiid.core.ComponentNotFoundException;
+import org.teiid.deployers.VDBRepository;
+import org.teiid.dqp.internal.process.DQPCore;
+import org.teiid.dqp.internal.process.DQPWorkContext;
+import org.teiid.dqp.service.SessionServiceException;
+import org.teiid.logging.LogConstants;
+import org.teiid.logging.LogManager;
+import org.teiid.logging.MessageLevel;
+import org.teiid.net.socket.AuthenticationType;
+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.LocalServerConnection;
+import org.teiid.transport.LogonImpl;
+import org.teiid.transport.ODBCSocketListener;
+import org.teiid.transport.SocketConfiguration;
+import org.teiid.transport.SocketListener;
+
+public class TransportService implements Service<ClientServiceRegistry>,
ClientServiceRegistry {
+ private enum Protocol {teiid, pg};
+ private ClientServiceRegistryImpl csr = new ClientServiceRegistryImpl();
+ private transient ILogon logon;
+ private SocketConfiguration socketConfig;
+ final ConcurrentMap<String, SecurityDomainContext> securityDomains = new
ConcurrentHashMap<String, SecurityDomainContext>();
+ private List<String> authenticationDomains;;
+ private long sessionMaxLimit;
+ private long sessionExpirationTimeLimit;
+ private SocketListener socketListener;
+ private transient SessionServiceImpl sessionService;
+ private AuthenticationType authenticationType;
+ private int maxODBCLobSizeAllowed = 5*1024*1024; // 5 MB
+ private boolean embedded;
+ private String krb5Domain;
+ private InetSocketAddress address = null;
+
+ private final InjectedValue<SocketBinding> socketBindingInjector = new
InjectedValue<SocketBinding>();
+ private final InjectedValue<VDBRepository> vdbRepositoryInjector = new
InjectedValue<VDBRepository>();
+ private final InjectedValue<DQPCore> dqpInjector = new
InjectedValue<DQPCore>();
+ private final InjectedValue<BufferServiceImpl> bufferServiceInjector = new
InjectedValue<BufferServiceImpl>();
+
+ @Override
+ public <T> T getClientService(Class<T> iface) throws
ComponentNotFoundException {
+ return csr.getClientService(iface);
+ }
+
+ @Override
+ public SecurityHelper getSecurityHelper() {
+ return csr.getSecurityHelper();
+ }
+
+ @Override
+ public ClientServiceRegistry getValue() throws IllegalStateException,
IllegalArgumentException {
+ return this;
+ }
+
+ @Override
+ public void start(StartContext context) throws StartException {
+ this.csr.setSecurityHelper(new JBossSecurityHelper());
+
+ this.sessionService = new JBossSessionService(this.securityDomains);
+ if (this.authenticationDomains != null &&
!this.authenticationDomains.isEmpty()) {
+ this.sessionService.setSecurityDomains(this.authenticationDomains);
+ }
+ this.sessionService.setSessionExpirationTimeLimit(this.sessionExpirationTimeLimit);
+ this.sessionService.setSessionMaxLimit(this.sessionMaxLimit);
+ this.sessionService.setDqp(getDQP());
+ this.sessionService.setVDBRepository(getVdbRepository());
+ this.sessionService.setSecurityHelper(this.csr.getSecurityHelper());
+ this.sessionService.setAuthenticationType(getAuthenticationType());
+ this.sessionService.setGssSecurityDomain(this.krb5Domain);
+ this.sessionService.start();
+
+ // create the necessary services
+ this.logon = new LogonImpl(this.sessionService, "teiid-cluster");
//$NON-NLS-1$
+
+ if (this.socketConfig != null) {
+ this.address = getSocketBindingInjector().getValue().getSocketAddress();
+ Protocol protocol = Protocol.valueOf(socketConfig.getProtocol());
+ boolean sslEnabled = false;
+ if (this.socketConfig.getSSLConfiguration() != null) {
+ sslEnabled = this.socketConfig.getSSLConfiguration().isSslEnabled();
+ }
+ if (protocol == Protocol.teiid) {
+ this.socketListener = new SocketListener(address, this.socketConfig, this.csr,
getBufferServiceInjector().getValue().getBufferManager());
+ LogManager.logInfo(LogConstants.CTX_RUNTIME,
IntegrationPlugin.Util.getString("socket_enabled", address.getHostName(),
String.valueOf(address.getPort()), (sslEnabled?"ON":"OFF"),
authenticationDomains)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+ else if (protocol == Protocol.pg) {
+ getVdbRepository().odbcEnabled();
+ ODBCSocketListener odbc = new ODBCSocketListener(address, this.socketConfig,
this.csr, getBufferServiceInjector().getValue().getBufferManager(),
getMaxODBCLobSizeAllowed(), this.logon);
+ odbc.setAuthenticationType(this.sessionService.getAuthenticationType());
+ LogManager.logInfo(LogConstants.CTX_RUNTIME,
IntegrationPlugin.Util.getString("odbc_enabled", address.getHostName(),
String.valueOf(address.getPort()), (sslEnabled?"ON":"OFF"),
authenticationDomains)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+ else {
+ throw new
StartException(IntegrationPlugin.Util.getString("wrong_protocol"));
//$NON-NLS-1$
+ }
+ }
+ else {
+ LogManager.logInfo(LogConstants.CTX_RUNTIME,
IntegrationPlugin.Util.getString("embedded_enabled",
LocalServerConnection.TEIID_RUNTIME_CONTEXT)); //$NON-NLS-1$
+ }
+
+ DQP dqpProxy = proxyService(DQP.class, getDQP(), LogConstants.CTX_DQP);
+ this.csr.registerClientService(ILogon.class, logon, LogConstants.CTX_SECURITY);
+ this.csr.registerClientService(DQP.class, dqpProxy, LogConstants.CTX_DQP);
+ }
+
+ @Override
+ public void stop(StopContext context) {
+ // Stop socket transport(s)
+ if (this.socketListener != null) {
+ this.socketListener.stop();
+ this.socketListener = null;
+ }
+ this.sessionService.stop();
+
+ if (this.socketConfig != null) {
+ Protocol protocol = Protocol.valueOf(socketConfig.getProtocol());
+ if (protocol == Protocol.teiid) {
+ LogManager.logInfo(LogConstants.CTX_RUNTIME,
IntegrationPlugin.Util.getString("socket_disabled", this.address.getHostName(),
String.valueOf(this.address.getPort()))); //$NON-NLS-1$
+ }
+ else if (protocol == Protocol.pg) {
+ LogManager.logInfo(LogConstants.CTX_RUNTIME,
IntegrationPlugin.Util.getString("odbc_disabled", this.address.getHostName(),
String.valueOf(this.address.getPort()))); //$NON-NLS-1$
+ }
+ }
+ else {
+ LogManager.logInfo(LogConstants.CTX_RUNTIME,
IntegrationPlugin.Util.getString("embedded_disabled",
LocalServerConnection.TEIID_RUNTIME_CONTEXT)); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * Creates an proxy to validate the incoming session
+ */
+ private <T> T proxyService(final Class<T> iface, final T instance, String
context) {
+
+ return iface.cast(Proxy.newProxyInstance(this.getClass().getClassLoader(), new Class[]
{iface}, new LogManager.LoggingProxy(instance, context, MessageLevel.TRACE) {
+
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+ Throwable exception = null;
+ try {
+ sessionService.validateSession(DQPWorkContext.getWorkContext().getSessionId());
+ return super.invoke(proxy, method, args);
+ } catch (InvocationTargetException e) {
+ exception = e.getTargetException();
+ } catch(Throwable t){
+ exception = t;
+ }
+ throw ExceptionUtil.convertException(method, exception);
+ }
+ }));
+ }
+
+ public List<RequestMetadata> getRequestsUsingVDB(String vdbName, int
vdbVersion) {
+ List<RequestMetadata> requests = new ArrayList<RequestMetadata>();
+ Collection<SessionMetadata> sessions = this.sessionService.getActiveSessions();
+ for (SessionMetadata session:sessions) {
+ if (session.getVDBName().equals(vdbName) && session.getVDBVersion() ==
vdbVersion) {
+ requests.addAll(getDQP().getRequestsForSession(session.getSessionId()));
+ }
+ }
+ return requests;
+ }
+
+ public void terminateSession(String terminateeId) {
+ this.sessionService.terminateSession(terminateeId,
DQPWorkContext.getWorkContext().getSessionId());
+ }
+
+ public Collection<SessionMetadata> getActiveSessions(){
+ return this.sessionService.getActiveSessions();
+ }
+
+ public int getActiveSessionsCount() throws AdminException{
+ try {
+ return this.sessionService.getActiveSessionsCount();
+ } catch (SessionServiceException e) {
+ throw new AdminComponentException(e);
+ }
+ }
+
+ public InjectedValue<SocketBinding> getSocketBindingInjector() {
+ return this.socketBindingInjector;
+ }
+
+ public SocketConfiguration getSocketConfig() {
+ return socketConfig;
+ }
+
+ public void setSocketConfig(SocketConfiguration socketConfig) {
+ this.socketConfig = socketConfig;
+ }
+
+ public List<String> getAuthenticationDomains() {
+ return authenticationDomains;
+ }
+
+ public void setAuthenticationDomains(List<String> authenticationDomains) {
+ this.authenticationDomains = new LinkedList(authenticationDomains);
+ }
+
+ public void setSessionMaxLimit(long limit) {
+ this.sessionMaxLimit = limit;
+ }
+
+ public void setSessionExpirationTimeLimit(long limit) {
+ this.sessionExpirationTimeLimit = limit;
+ }
+
+ public AuthenticationType getAuthenticationType() {
+ return authenticationType;
+ }
+
+ public void setAuthenticationType(AuthenticationType authenticationType) {
+ this.authenticationType = authenticationType;
+ }
+
+ public InjectedValue<VDBRepository> getVdbRepositoryInjector() {
+ return vdbRepositoryInjector;
+ }
+
+ private VDBRepository getVdbRepository() {
+ return vdbRepositoryInjector.getValue();
+ }
+
+ private DQPCore getDQP() {
+ return getDqpInjector().getValue();
+ }
+
+ public InjectedValue<DQPCore> getDqpInjector() {
+ return dqpInjector;
+ }
+
+ public InjectedValue<BufferServiceImpl> getBufferServiceInjector() {
+ return bufferServiceInjector;
+ }
+
+ private int getMaxODBCLobSizeAllowed() {
+ return this.maxODBCLobSizeAllowed;
+ }
+
+ public void setMaxODBCLobSizeAllowed(int lobSize) {
+ this.maxODBCLobSizeAllowed = lobSize;
+ }
+
+ public void setEmbedded(boolean v) {
+ this.embedded = v;
+ }
+
+ public boolean isEmbedded() {
+ return this.embedded;
+ }
+
+ public void setKrb5Domain(String domain) {
+ this.krb5Domain = domain;
+ }
+}
Property changes on:
trunk/jboss-integration/src/main/java/org/teiid/jboss/TransportService.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Deleted:
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-12-15
22:25:27 UTC (rev 3748)
+++
trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2011-12-17
03:27:07 UTC (rev 3749)
@@ -1,204 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.jboss.deployers;
-
-import java.io.Serializable;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
-import java.util.Set;
-
-import javax.resource.spi.XATerminator;
-import javax.resource.spi.work.WorkManager;
-import javax.transaction.TransactionManager;
-
-import org.jboss.msc.service.Service;
-import org.jboss.msc.service.ServiceController;
-import org.jboss.msc.service.ServiceName;
-import org.jboss.msc.service.StartContext;
-import org.jboss.msc.service.StopContext;
-import org.jboss.msc.value.InjectedValue;
-import org.teiid.adminapi.impl.SessionMetadata;
-import org.teiid.core.TeiidRuntimeException;
-import org.teiid.core.util.LRUCache;
-import org.teiid.deployers.CompositeVDB;
-import org.teiid.deployers.VDBLifeCycleListener;
-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.DQPConfiguration;
-import org.teiid.dqp.internal.process.DQPCore;
-import org.teiid.dqp.internal.process.SessionAwareCache;
-import org.teiid.dqp.internal.process.TransactionServerImpl;
-import org.teiid.dqp.service.BufferService;
-import org.teiid.dqp.service.TransactionService;
-import org.teiid.events.EventDistributorFactory;
-import org.teiid.jboss.IntegrationPlugin;
-import org.teiid.jboss.TeiidServiceNames;
-import org.teiid.jboss.Transport;
-import org.teiid.logging.LogConstants;
-import org.teiid.logging.LogManager;
-import org.teiid.logging.MessageLevel;
-import org.teiid.services.BufferServiceImpl;
-import org.teiid.vdb.runtime.VDBKey;
-
-
-public class RuntimeEngineDeployer extends DQPConfiguration implements Serializable,
Service<DQPCore> {
- private static final long serialVersionUID = -4676205340262775388L;
-
- private transient TransactionServerImpl transactionServerImpl = new
TransactionServerImpl();
- private transient DQPCore dqpCore = new DQPCore();
-
- 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<BufferServiceImpl> bufferServiceInjector = new
InjectedValue<BufferServiceImpl>();
- 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<SessionAwareCache> preparedPlanCacheInjector = new
InjectedValue<SessionAwareCache>();
- private final InjectedValue<SessionAwareCache> resultSetCacheInjector = new
InjectedValue<SessionAwareCache>();
- private final InjectedValue<EventDistributorFactory>
eventDistributorFactoryInjector = new InjectedValue<EventDistributorFactory>();
-
- @Override
- public void start(final StartContext context) {
- this.transactionServerImpl.setWorkManager(getWorkManagerInjector().getValue());
- this.transactionServerImpl.setXaTerminator(getXaTerminatorInjector().getValue());
- this.transactionServerImpl.setTransactionManager(getTxnManagerInjector().getValue());
-
- setAuthorizationValidator(authorizationValidatorInjector.getValue());
- setBufferService(bufferServiceInjector.getValue());
-
- this.dqpCore.setTransactionService((TransactionService)LogManager.createLoggingProxy(LogConstants.CTX_TXN_LOG,
transactionServerImpl, new Class[] {TransactionService.class}, MessageLevel.DETAIL,
Thread.currentThread().getContextClassLoader()));
- this.dqpCore.setMetadataRepository(getVdbRepository().getMetadataRepository());
- this.dqpCore.setEventDistributor(getEventDistributorFactoryInjector().getValue().getEventDistributor());
- this.dqpCore.setResultsetCache(getResultSetCacheInjector().getValue());
- this.dqpCore.setPreparedPlanCache(getPreparedPlanCacheInjector().getValue());
- this.dqpCore.start(this);
-
-
- // add vdb life cycle listeners
- getVdbRepository().addListener(new VDBLifeCycleListener() {
-
- private Set<VDBKey> recentlyRemoved = Collections.newSetFromMap(new
LRUCache<VDBKey, Boolean>(10000));
-
- @Override
- public void removed(String name, int version, CompositeVDB vdb) {
- recentlyRemoved.add(new VDBKey(name, version));
- }
-
- @Override
- public void added(String name, int version, CompositeVDB vdb) {
- if (!recentlyRemoved.remove(new VDBKey(name, version))) {
- return;
- }
- // terminate all the previous sessions
- List<ServiceName> services =
context.getController().getServiceContainer().getServiceNames();
- for (ServiceName service:services) {
- if (TeiidServiceNames.TRANSPORT_BASE.isParentOf(service)) {
- ServiceController<?> transport =
context.getController().getServiceContainer().getService(service);
- if (transport != null) {
- Transport t = Transport.class.cast(transport.getValue());
- Collection<SessionMetadata> sessions = t.getActiveSessions();
- for (SessionMetadata session:sessions) {
- if (name.equalsIgnoreCase(session.getVDBName()) && version ==
session.getVDBVersion()){
- t.terminateSession(session.getSessionId());
- }
- }
- }
- }
- }
-
- // dump the caches.
- getResultSetCacheInjector().getValue().clearForVDB(name, version);
- getPreparedPlanCacheInjector().getValue().clearForVDB(name, version);
- }
- });
-
- LogManager.logInfo(LogConstants.CTX_RUNTIME,
IntegrationPlugin.Util.getString("engine_started",
this.dqpCore.getRuntimeVersion(), new Date(System.currentTimeMillis()).toString()));
//$NON-NLS-1$
- }
-
- @Override
- public DQPCore getValue() throws IllegalStateException, IllegalArgumentException {
- return this.dqpCore;
- }
-
- @Override
- public void stop(StopContext context) {
- try {
- this.dqpCore.stop();
- } catch(TeiidRuntimeException e) {
- // this bean is already shutdown
- }
-
- LogManager.logInfo(LogConstants.CTX_RUNTIME,
IntegrationPlugin.Util.getString("engine_stopped", new
Date(System.currentTimeMillis()).toString())); //$NON-NLS-1$
- }
-
- public void setBufferService(BufferService service) {
- this.dqpCore.setBufferService(service);
- }
-
- public InjectedValue<SessionAwareCache> getResultSetCacheInjector() {
- return resultSetCacheInjector;
- }
-
- public InjectedValue<SessionAwareCache> getPreparedPlanCacheInjector() {
- return preparedPlanCacheInjector;
- }
-
- public InjectedValue<TranslatorRepository> getTranslatorRepositoryInjector() {
- return translatorRepositoryInjector;
- }
-
- public InjectedValue<VDBRepository> getVdbRepositoryInjector() {
- return vdbRepositoryInjector;
- }
-
- private VDBRepository getVdbRepository() {
- return vdbRepositoryInjector.getValue();
- }
-
- public InjectedValue<AuthorizationValidator> getAuthorizationValidatorInjector()
{
- return authorizationValidatorInjector;
- }
-
- public InjectedValue<BufferServiceImpl> getBufferServiceInjector() {
- return bufferServiceInjector;
- }
-
- public InjectedValue<TransactionManager> getTxnManagerInjector() {
- return txnManagerInjector;
- }
-
- public InjectedValue<XATerminator> getXaTerminatorInjector() {
- return xaTerminatorInjector;
- }
-
- public InjectedValue<WorkManager> getWorkManagerInjector() {
- return workManagerInjector;
- }
-
- public InjectedValue<EventDistributorFactory> getEventDistributorFactoryInjector()
{
- return eventDistributorFactoryInjector;
- }
-}
Modified: trunk/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties
===================================================================
--- trunk/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties 2011-12-15
22:25:27 UTC (rev 3748)
+++ trunk/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties 2011-12-17
03:27:07 UTC (rev 3749)
@@ -22,8 +22,12 @@
engine_started=Teiid Engine {0} Started = {1}
socket_enabled=Teiid JDBC - Host = {0}, Port = {1}, SSL = {2}, security-domains = {3}
+socket_disabled=Teiid JDBC - Host = {0}, Port = {1} has been shutdown.
odbc_not_enabled=ODBC transport is not enabled in Teiid.
odbc_enabled=Teiid ODBC - Host = {0}, Port = {1}, SSL = {2}, security-domains = {3}
+odbc_disabled=Teiid ODBC - Host = {0}, Port = {1} has been shutdown.
+embedded_enabled=Teiid Embedded transport enabled. Bound to: {0}
+embedded_disabled=Teiid Embedded transport disabled. Local Connections will fail. UnBound
: {0}
engine_stopped=Teiid Engine stopped {0}
admin_connection_closed=Teiid admin connection is already closed.
bad_vdb_extension=The extension of the file name must be either ".vdb" for
designer vdb or "xxx-vdb.xml" for dynamic VDBs
@@ -64,9 +68,9 @@
translator.added = Teiid translator "{0}" added.
wrong_protocol=Wrong type of protocol supplied
socket_binding_not_defined=Socket binding not specified for transport {0}; only embedded
access is granted.
-embedded_enabled=Teiid Embedded transport enabled. Bound to: {0}
vdb-undeploy-failed=error during the undeploy of vdb {0}.{1}
error_adding_translator_deployment=Error adding translator from deployment {0}
+cache_not_found=Cache Type {0} not found in the configuration
# subsystem description
teiid.add = Add the Teiid Subsystem
@@ -115,9 +119,9 @@
preparedplan-cache-max-age-in-seconds.describe=Max age in seconds
#resultset cache
-resultset-cache-enable.describe= Resultset cache enabled
-resultset-cache-container-name.describe=Infinispan cache container name
-resultset-cache-name.describe = Infinispan cache name for resultset
+resultset-cache-enable.describe= Resultset cache enabled (default true)
+resultset-cache-infinispan-container.describe=Infinispan cache container name
+resultset-cache-name.describe = Infinispan cache name for resultset; if not specified
default cache on infinispan container is used.
resultset-cache-max-age-in-seconds.describe=Max age in seconds
resultset-cache-max-staleness.describe=Max staleness in seconds. Modifications are based
upon data updates -1 indicates no max. (default 60 - 1 minute)
@@ -142,6 +146,7 @@
pg-max-lob-size-in-bytes.describe=Max LOB size in Postgres protocol, as streaming is not
supported
+ssl-enable.describe=Enable SSL.
ssl-mode.describe=can be one of disabled, login, or enabled \
disabled = no transport or message level security will be used; \
login = only the login traffic will be encrypted at a message level \
Modified: trunk/jboss-integration/src/main/resources/schema/jboss-teiid.xsd
===================================================================
--- trunk/jboss-integration/src/main/resources/schema/jboss-teiid.xsd 2011-12-15 22:25:27
UTC (rev 3748)
+++ trunk/jboss-integration/src/main/resources/schema/jboss-teiid.xsd 2011-12-17 03:27:07
UTC (rev 3749)
@@ -215,8 +215,8 @@
<xs:documentation>Configuration for result set
caching.</xs:documentation>
</xs:annotation>
<xs:complexType>
- <xs:attribute name="name" type="xs:string"
use="required"/>
- <xs:attribute name="container-name"
type="xs:string" use="required"/>
+ <xs:attribute name="name"
type="xs:string"/>
+ <xs:attribute name="infinispan-container"
type="xs:string" use="required"/>
<xs:attribute name="enable" type="xs:boolean"
default="true"/>
<xs:attribute name="max-staleness"
type="xs:int" default="60"/>
</xs:complexType>
@@ -370,7 +370,7 @@
</xs:attribute>
<xs:attribute name="ssl-protocol"
type="xs:string"/>
<xs:attribute name="keymanagement-algorithm"
type="xs:string"/>
-
+ <xs:attribute name="enable"
type="xs:boolean"/>
</xs:complexType>
</xs:element>
</xs:sequence>
Modified: trunk/jboss-integration/src/test/resources/teiid-model-config.txt
===================================================================
--- trunk/jboss-integration/src/test/resources/teiid-model-config.txt 2011-12-15 22:25:27
UTC (rev 3748)
+++ trunk/jboss-integration/src/test/resources/teiid-model-config.txt 2011-12-17 03:27:07
UTC (rev 3749)
@@ -193,11 +193,10 @@
},
"resultset-cache-name" => {
"type" => STRING,
- "description" => "Infinispan cache name for resultset",
- "required" => false,
- "default" => "resultset"
+ "description" => "Infinispan cache name for resultset; if not
specified default cache on infinispan container is used.",
+ "required" => false
},
- "resultset-cache-container-name" => {
+ "resultset-cache-infinispan-container" => {
"type" => STRING,
"description" => "Infinispan cache container name",
"required" => false
@@ -210,7 +209,8 @@
},
"resultset-cache-enable" => {
"type" => BOOLEAN,
- "description" => "Resultset cache enabled",
- "required" => false
+ "description" => "Resultset cache enabled (default
true)",
+ "required" => false,
+ "default" => true
}
}}
\ No newline at end of file
Modified: trunk/jboss-integration/src/test/resources/teiid-model-json.txt
===================================================================
--- trunk/jboss-integration/src/test/resources/teiid-model-json.txt 2011-12-15 22:25:27
UTC (rev 3748)
+++ trunk/jboss-integration/src/test/resources/teiid-model-json.txt 2011-12-17 03:27:07
UTC (rev 3749)
@@ -27,7 +27,7 @@
"preparedplan-cache-max-age-in-seconds" : 28800,
"preparedplan-cache-max-entries" : 512,
"query-threshold-in-seconds" : 600,
- "resultset-cache-container-name" : "container",
+ "resultset-cache-infinispan-container" : "container",
"resultset-cache-enable" : false,
"resultset-cache-max-staleness" : 90,
"resultset-cache-name" : "cache",
@@ -59,6 +59,7 @@
"pg-max-lob-size-in-bytes" : 5242880,
"protocol" : "pg",
"socket-binding" : "teiid-odbc",
+ "ssl-enable" : true,
"ssl-authentication-mode" : "1-way",
"ssl-keymanagement-algorithm" : "algo",
"ssl-mode" : "login",
Modified: trunk/jboss-integration/src/test/resources/teiid-sample-config.xml
===================================================================
--- trunk/jboss-integration/src/test/resources/teiid-sample-config.xml 2011-12-15 22:25:27
UTC (rev 3748)
+++ trunk/jboss-integration/src/test/resources/teiid-sample-config.xml 2011-12-17 03:27:07
UTC (rev 3749)
@@ -24,7 +24,7 @@
<metadata-repository-module="javax.api"/>
-->
- <resultset-cache name="cache" container-name="container"
enable="false" max-staleness="90"/>
+ <resultset-cache name="cache" infinispan-container="container"
enable="false" max-staleness="90"/>
<preparedplan-cache max-entries="512"
max-age-in-seconds="28800"/>
@@ -35,7 +35,7 @@
<transport name="odbc" protocol="pg"
socket-binding="teiid-odbc" max-socket-threads="1"
input-buffer-size="2" output-buffer-size="3">
<authentication security-domain="teiid-security,teiid-security2"
max-sessions-allowed="5000" sessions-expiration-timelimit="0"
krb5-domain="krb5"/>
<pg max-lob-size-in-bytes="5242880"/>
- <ssl mode="login" authentication-mode="1-way"
ssl-protocol="ssl-protocol" keymanagement-algorithm="algo">
+ <ssl enable="true" mode="login"
authentication-mode="1-way" ssl-protocol="ssl-protocol"
keymanagement-algorithm="algo">
<keystore name="keystore name" password="keystore
passs" type="keystore type"/>
<truststore name="truststore name" password="truststore
pass"/>
</ssl>
Modified: trunk/jboss-integration/src/test/resources/teiid-transport-config.txt
===================================================================
--- trunk/jboss-integration/src/test/resources/teiid-transport-config.txt 2011-12-15
22:25:27 UTC (rev 3748)
+++ trunk/jboss-integration/src/test/resources/teiid-transport-config.txt 2011-12-17
03:27:07 UTC (rev 3749)
@@ -56,6 +56,12 @@
"required" => false,
"default" => 5242880
},
+ "ssl-enable" => {
+ "type" => BOOLEAN,
+ "description" => "Enable SSL.",
+ "required" => false,
+ "default" => false
+ },
"ssl-mode" => {
"type" => STRING,
"description" => "can be one of disabled, login, or enabled
disabled = no transport or message level security will be used; login = only the login
traffic will be encrypted at a message level using 128 bit AES with an ephemerial DH key
exchange. No other config values are needed in this mode; enabled = traffic will be
secured using this configuration,if the client supports SSL",