Author: rareddy
Date: 2011-08-31 11:51:27 -0400 (Wed, 31 Aug 2011)
New Revision: 3438
Added:
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineReferenceFactoryService.java
Modified:
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineAdd.java
branches/as7/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties
branches/as7/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java
branches/as7/runtime/src/main/java/org/teiid/transport/LocalServerConnection.java
Log:
TEIID-1720: Bind the engine correctly so that local connections have access to it.
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-30
19:30:48 UTC (rev 3437)
+++
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineAdd.java 2011-08-31
15:51:27 UTC (rev 3438)
@@ -39,8 +39,8 @@
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.deployment.ContextNames;
import org.jboss.as.naming.service.BinderService;
import org.jboss.as.network.SocketBinding;
import org.jboss.as.security.plugins.SecurityDomainContext;
@@ -59,6 +59,7 @@
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;
@@ -107,49 +108,56 @@
engine.setOdbcSocketConfiguration(odbc);
}
- ServiceBuilder<ClientServiceRegistry> serviceBuilder =
target.addService(TeiidServiceNames.engineServiceName(engine.getName()), engine);
- 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.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());
+ ServiceBuilder<ClientServiceRegistry> engineBuilder =
target.addService(TeiidServiceNames.engineServiceName(engine.getName()), engine);
+ engineBuilder.addDependency(ServiceName.JBOSS.append("connector",
"workmanager"), WorkManager.class, engine.getWorkManagerInjector());
//$NON-NLS-1$ //$NON-NLS-2$
+ engineBuilder.addDependency(ServiceName.JBOSS.append("txn",
"XATerminator"), XATerminator.class, engine.getXaTerminatorInjector());
//$NON-NLS-1$ //$NON-NLS-2$
+ engineBuilder.addDependency(ServiceName.JBOSS.append("txn",
"TransactionManager"), TransactionManager.class,
engine.getTxnManagerInjector()); //$NON-NLS-1$ //$NON-NLS-2$
+ engineBuilder.addDependency(TeiidServiceNames.BUFFER_MGR,
BufferServiceImpl.class, engine.getBufferServiceInjector());
+ engineBuilder.addDependency(TeiidServiceNames.SYSTEM_VDB,
SystemVDBDeployer.class, new InjectedValue<SystemVDBDeployer>());
+ 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_FACTORY, CacheFactory.class,
engine.getCachefactoryInjector());
if (jdbc != null) {
- serviceBuilder.addDependency(ServiceName.JBOSS.append("binding",
jdbc.getSocketBinding()), SocketBinding.class, engine.getJdbcSocketBindingInjector());
//$NON-NLS-1$
+ engineBuilder.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.getOdbcSocketBindingInjector());
//$NON-NLS-1$
+ engineBuilder.addDependency(ServiceName.JBOSS.append("binding",
odbc.getSocketBinding()), SocketBinding.class, engine.getOdbcSocketBindingInjector());
//$NON-NLS-1$
}
+
+ // register a JNDI name, this looks hard.
+ final QueryEngineReferenceFactoryService referenceFactoryService = new
QueryEngineReferenceFactoryService();
+ final ServiceName referenceFactoryServiceName =
TeiidServiceNames.engineServiceName(engine.getName()).append("reference-factory");
//$NON-NLS-1$
+ final ServiceBuilder<?> referenceBuilder =
target.addService(referenceFactoryServiceName,referenceFactoryService);
+
referenceBuilder.addDependency(TeiidServiceNames.engineServiceName(engine.getName()),
RuntimeEngineDeployer.class, referenceFactoryService.getQueryEngineInjector());
+ referenceBuilder.setInitialMode(ServiceController.Mode.ACTIVE);
- // register JNDI Name
- 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());
+ final ContextNames.BindInfo bindInfo =
ContextNames.bindInfoFor(LocalServerConnection.TEIID_RUNTIME_CONTEXT+engine.getName());
+ final BinderService engineBinderService = new
BinderService(bindInfo.getBindName());
+ final ServiceBuilder<?> engineBinderBuilder =
target.addService(bindInfo.getBinderServiceName(), engineBinderService);
+ engineBinderBuilder.addDependency(referenceFactoryServiceName,
ManagedReferenceFactory.class, engineBinderService.getManagedObjectInjector());
+ engineBinderBuilder.addDependency(bindInfo.getParentContextServiceName(),
NamingStore.class, engineBinderService.getNamingStoreInjector());
+ engineBinderBuilder.setInitialMode(ServiceController.Mode.ACTIVE);
-
// add security domains
if ( operation.hasDefined(Configuration.SECURITY_DOMAIN)) {
List<ModelNode> domains =
operation.get(Configuration.SECURITY_DOMAIN).asList();
for (ModelNode domain:domains) {
LogManager.logInfo(LogConstants.CTX_SECURITY, "Security Enabled:
true"); //$NON-NLS-1$
- serviceBuilder.addDependency(ServiceName.JBOSS.append("security",
"security-domain", domain.asString()), SecurityDomainContext.class, new
ConcurrentMapInjector<String,SecurityDomainContext>(engine.securityDomains,
domain.asString())); //$NON-NLS-1$ //$NON-NLS-2$
+ engineBuilder.addDependency(ServiceName.JBOSS.append("security",
"security-domain", domain.asString()), SecurityDomainContext.class, new
ConcurrentMapInjector<String,SecurityDomainContext>(engine.securityDomains,
domain.asString())); //$NON-NLS-1$ //$NON-NLS-2$
}
}
- serviceBuilder.setInitialMode(ServiceController.Mode.ACTIVE);
- ServiceController<ClientServiceRegistry> controller =
serviceBuilder.install();
+ engineBuilder.setInitialMode(ServiceController.Mode.ACTIVE);
+ ServiceController<ClientServiceRegistry> controller =
engineBuilder.install();
newControllers.add(controller);
ServiceContainer container = controller.getServiceContainer();
- container.addTerminateListener(shutdownListener);
+ container.addTerminateListener(shutdownListener);
+
+ newControllers.add(referenceBuilder.install());
+ newControllers.add(engineBinderBuilder.install());
}
Added:
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineReferenceFactoryService.java
===================================================================
---
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineReferenceFactoryService.java
(rev 0)
+++
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineReferenceFactoryService.java 2011-08-31
15:51:27 UTC (rev 3438)
@@ -0,0 +1,62 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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.
+ */
+
+package org.teiid.jboss;
+
+import org.jboss.as.naming.ManagedReference;
+import org.jboss.as.naming.ManagedReferenceFactory;
+import org.jboss.as.naming.ValueManagedReference;
+import org.jboss.msc.inject.Injector;
+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.ImmediateValue;
+import org.jboss.msc.value.InjectedValue;
+import org.teiid.jboss.deployers.RuntimeEngineDeployer;
+
+
+public class QueryEngineReferenceFactoryService implements
Service<ManagedReferenceFactory>, ManagedReferenceFactory {
+ private final InjectedValue<RuntimeEngineDeployer> engineInjector = new
InjectedValue<RuntimeEngineDeployer>();
+
+ private ManagedReference reference;
+
+ public synchronized void start(StartContext startContext) throws StartException {
+ reference = new ValueManagedReference(new
ImmediateValue<Object>(engineInjector.getValue()));
+ }
+
+ public synchronized void stop(StopContext stopContext) {
+ reference = null;
+ }
+
+ public synchronized ManagedReferenceFactory getValue() throws IllegalStateException,
IllegalArgumentException {
+ return this;
+ }
+
+ public synchronized ManagedReference getReference() {
+ return reference;
+ }
+
+ public Injector<RuntimeEngineDeployer> getQueryEngineInjector() {
+ return engineInjector;
+ }
+}
Property changes on:
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineReferenceFactoryService.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
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-30
19:30:48 UTC (rev 3437)
+++
branches/as7/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties 2011-08-31
15:51:27 UTC (rev 3438)
@@ -86,7 +86,7 @@
max-odbc-lob-size-allowed.describe=Maximum size of lob allowed through ODBC connection in
bytes (default 5MB)
event-distributor-name.describe=The JNDI name of the Teiid Event Distributor
detect-change-events.describe=Set to true for the engine to detect local change events.
Should be disabled if using external change data capture tools. (default true)
-security-domain.describe=Comma separated list of domains to be used to login into Teiid
+security-domain.describe=List of domains to be used to login into Teiid
admin-security-domain.describe=security domain to be used with Admin API (please do not
change this, as this should be same as profile service)
max-sessions-allowed.describe=Maximum number of sessions allowed by the system (default
5000)
sessions-expiration-timelimit.describe=Max allowed time before the session is terminated
by the system, 0 indicates unlimited (default 0)
Modified: branches/as7/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java
===================================================================
---
branches/as7/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java 2011-08-30
19:30:48 UTC (rev 3437)
+++
branches/as7/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java 2011-08-31
15:51:27 UTC (rev 3438)
@@ -159,7 +159,7 @@
throw new
SessionServiceException(RuntimePlugin.Util.getString("SessionServiceImpl.reached_max_sessions",
new Object[] {new Long(sessionMaxLimit)})); //$NON-NLS-1$
}
- if (!domains.isEmpty() && authenticate) {
+ if (domains!= null && !domains.isEmpty() && authenticate) {
// Authenticate user...
// if not authenticated, this method throws exception
boolean onlyAllowPassthrough =
Boolean.valueOf(properties.getProperty(TeiidURL.CONNECTION.PASSTHROUGH_AUTHENTICATION,
"false")); //$NON-NLS-1$
@@ -168,7 +168,9 @@
securityDomain = membership.getSecurityDomain();
securityContext = membership.getSecurityContext();
subject = membership.getSubject();
- }
+ } else {
+ LogManager.logDetail(LogConstants.CTX_SECURITY, new Object[] {"No Security
Domain configured for Teiid for authentication"}); //$NON-NLS-1$
+ }
long creationTime = System.currentTimeMillis();
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-30
19:30:48 UTC (rev 3437)
+++
branches/as7/runtime/src/main/java/org/teiid/transport/LocalServerConnection.java 2011-08-31
15:51:27 UTC (rev 3438)
@@ -49,7 +49,7 @@
public class LocalServerConnection implements ServerConnection {
- private static final String TEIID_RUNTIME_CONTEXT = "teiid/"; //$NON-NLS-1$
+ public static final String TEIID_RUNTIME_CONTEXT = "teiid/queryengine/";
//$NON-NLS-1$
private LogonResult result;
private boolean shutdown;