Author: rareddy
Date: 2011-08-24 13:35:13 -0400 (Wed, 24 Aug 2011)
New Revision: 3423
Added:
branches/as7/jboss-integration/src/test/java/org/teiid/jboss/MockXMLExtendedWriter.java
branches/as7/jboss-integration/src/test/java/org/teiid/jboss/TestObjectSerializer.java
Removed:
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/AuthorizationValidatorService.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidModelDescription.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorRepositoryService.java
branches/as7/runtime/src/test/java/org/teiid/deployers/TestObjectSerializer.java
Modified:
branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/ldap/main/module.xml
branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/olap/main/module.xml
branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/ws/main/module.xml
branches/as7/build/kits/jboss-as7/standalone/configuration/standalone-teiid.xml
branches/as7/client/src/main/java/org/teiid/net/TeiidURL.java
branches/as7/connectors/translator-ldap/src/main/resources/META-INF/services/org.teiid.translator.ExecutionFactory
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/ObjectSerializer.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/ObjectsSerializerService.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineAdd.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidBootServicesAdd.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidExtension.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidServiceNames.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidSubsystemParser.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorAdd.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBDeployer.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBParserDeployer.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBService.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
branches/as7/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties
branches/as7/jboss-integration/src/main/resources/schema/jboss-teiid.xsd
branches/as7/jboss-integration/src/test/java/org/teiid/jboss/TestTeiidConfiguration.java
branches/as7/jboss-integration/src/test/resources/teiid-model-config.txt
branches/as7/jboss-integration/src/test/resources/teiid-sample-config.xml
branches/as7/runtime/src/main/java/org/teiid/deployers/TeiidAttachments.java
branches/as7/runtime/src/main/java/org/teiid/deployers/UDFMetaData.java
branches/as7/runtime/src/main/java/org/teiid/transport/LocalServerConnection.java
Log:
TEIID-1720: Engine starts and translators deploy
Modified:
branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/ldap/main/module.xml
===================================================================
---
branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/ldap/main/module.xml 2011-08-22
14:36:06 UTC (rev 3422)
+++
branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/ldap/main/module.xml 2011-08-24
17:35:13 UTC (rev 3423)
@@ -1,12 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
-<module xmlns="urn:jboss:module:1.0"
name="org.jboss.teiid.translator.file">
+<module xmlns="urn:jboss:module:1.0"
name="org.jboss.teiid.translator.ldap">
<resources>
- <resource-root path="translator-file-${project.version}.jar" />
+ <resource-root path="translator-ldap-${project.version}.jar" />
<!-- Insert resources here -->
</resources>
<dependencies>
+ <module name="javax.api"/>
<module name="javax.resource.api"/>
<module name="org.apache.commons.logging" />
<module name="org.apache.log4j"/>
Modified:
branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/olap/main/module.xml
===================================================================
---
branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/olap/main/module.xml 2011-08-22
14:36:06 UTC (rev 3422)
+++
branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/olap/main/module.xml 2011-08-24
17:35:13 UTC (rev 3423)
@@ -1,11 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
-<module xmlns="urn:jboss:module:1.0"
name="org.jboss.teiid.translator.file">
+<module xmlns="urn:jboss:module:1.0"
name="org.jboss.teiid.translator.olap">
<resources>
- <resource-root path="translator-loopback-${project.version}.jar"
/>
+ <resource-root path="translator-olap-${project.version}.jar" />
<!-- Insert resources here -->
</resources>
<dependencies>
+ <module name="javax.api"/>
<module name="javax.resource.api"/>
<module name="org.apache.commons.logging" />
<module name="org.apache.log4j"/>
Modified:
branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/ws/main/module.xml
===================================================================
---
branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/ws/main/module.xml 2011-08-22
14:36:06 UTC (rev 3422)
+++
branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/ws/main/module.xml 2011-08-24
17:35:13 UTC (rev 3423)
@@ -1,11 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0"
name="org.jboss.teiid.translator.ws">
<resources>
- <resource-root path="translator-ws-${project.name}.jar" />
+ <resource-root path="translator-ws-${project.version}.jar" />
<!-- Insert resources here -->
</resources>
<dependencies>
+ <module name="javax.xml.ws.api"/>
+ <module name="javax.api"/>
<module name="javax.resource.api"/>
<module name="org.apache.commons.logging" />
<module name="org.apache.log4j"/>
Modified: branches/as7/build/kits/jboss-as7/standalone/configuration/standalone-teiid.xml
===================================================================
---
branches/as7/build/kits/jboss-as7/standalone/configuration/standalone-teiid.xml 2011-08-22
14:36:06 UTC (rev 3422)
+++
branches/as7/build/kits/jboss-as7/standalone/configuration/standalone-teiid.xml 2011-08-24
17:35:13 UTC (rev 3423)
@@ -257,8 +257,9 @@
</security-domains>
</subsystem>
<subsystem xmlns="urn:jboss:domain:teiid:1.0">
+ <async-thread-group>teiid-async</async-thread-group>
+
<query-engine name = "default">
- <async-thread-group>teiid-async</async-thread-group>
<event-distributor-name>teiid/event-distributor</event-distributor-name>
<security-domain>teiid-security</security-domain>
<jdbc>
@@ -268,7 +269,34 @@
<socket-binding>teiid-odbc</socket-binding>
</odbc>
</query-engine>
+ <translator name="jdbc-simple"
module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="jdbc-ansi"
module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="access"
module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="db2"
module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="derby"
module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="h2"
module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="hsql"
module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="informix"
module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="metamatrix"
module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="mysql"
module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="mysql5"
module="org.jboss.teiid.translator.jdbc"/>
<translator name="oracle"
module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="postgresql"
module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="sqlserver"
module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="sybase"
module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="teiid"
module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="teradata"
module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="modeshape"
module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="ingres"
module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="ingres93"
module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="intersystems-cache"
module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="netezza"
module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="file"
module="org.jboss.teiid.translator.file"/>
+ <translator name="ldap"
module="org.jboss.teiid.translator.ldap"/>
+ <translator name="loopback"
module="org.jboss.teiid.translator.loopback"/>
+ <translator name="olap"
module="org.jboss.teiid.translator.olap"/>
+ <translator name="ws"
module="org.jboss.teiid.translator.ws"/>
+
</subsystem>
<subsystem xmlns="urn:jboss:domain:threads:1.0">
<queueless-thread-pool name="teiid-async">
Modified: branches/as7/client/src/main/java/org/teiid/net/TeiidURL.java
===================================================================
--- branches/as7/client/src/main/java/org/teiid/net/TeiidURL.java 2011-08-22 14:36:06 UTC
(rev 3422)
+++ branches/as7/client/src/main/java/org/teiid/net/TeiidURL.java 2011-08-24 17:35:13 UTC
(rev 3423)
@@ -90,6 +90,8 @@
public enum AuthenticationType {
CLEARTEXT,KRB5
};
+
+ public static final String ENGINE_NAME = "engineName"; //$NON-NLS-1$
}
public static final String DOT_DELIMITER = "."; //$NON-NLS-1$
Modified:
branches/as7/connectors/translator-ldap/src/main/resources/META-INF/services/org.teiid.translator.ExecutionFactory
===================================================================
---
branches/as7/connectors/translator-ldap/src/main/resources/META-INF/services/org.teiid.translator.ExecutionFactory 2011-08-22
14:36:06 UTC (rev 3422)
+++
branches/as7/connectors/translator-ldap/src/main/resources/META-INF/services/org.teiid.translator.ExecutionFactory 2011-08-24
17:35:13 UTC (rev 3423)
@@ -1 +1 @@
-org.teiid.translator.ldap.LdapExecutionFactory
\ No newline at end of file
+org.teiid.translator.ldap.LDAPExecutionFactory
\ No newline at end of file
Deleted:
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/AuthorizationValidatorService.java
===================================================================
---
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/AuthorizationValidatorService.java 2011-08-22
14:36:06 UTC (rev 3422)
+++
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/AuthorizationValidatorService.java 2011-08-24
17:35:13 UTC (rev 3423)
@@ -1,50 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.jboss;
-
-import org.jboss.msc.service.Service;
-import org.jboss.msc.service.StartContext;
-import org.jboss.msc.service.StartException;
-import org.jboss.msc.service.StopContext;
-import org.teiid.dqp.internal.process.AuthorizationValidator;
-
-public class AuthorizationValidatorService implements
Service<AuthorizationValidator> {
- private AuthorizationValidator validator;
-
- public AuthorizationValidatorService(AuthorizationValidator value){
- this.validator = value;
- }
-
- @Override
- public void start(StartContext context) throws StartException {
- }
-
- @Override
- public void stop(StopContext context) {
- }
-
- @Override
- public AuthorizationValidator getValue() throws IllegalStateException,
IllegalArgumentException {
- return validator;
- }
-
-}
Modified:
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/ObjectSerializer.java
===================================================================
---
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/ObjectSerializer.java 2011-08-22
14:36:06 UTC (rev 3422)
+++
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/ObjectSerializer.java 2011-08-24
17:35:13 UTC (rev 3423)
@@ -24,6 +24,7 @@
import java.io.*;
import org.jboss.logging.Logger;
+import org.teiid.adminapi.impl.VDBMetaData;
import org.teiid.core.util.FileUtils;
import org.teiid.logging.LogConstants;
import org.teiid.logging.LogManager;
@@ -58,43 +59,44 @@
}
}
- public void saveAttachment(File attachmentsStore, Object attachment) throws IOException
{
+ public boolean saveAttachment(File attachmentsStore, Object attachment, boolean force)
throws IOException {
if (log.isTraceEnabled()) {
log.trace("saveAttachment, attachmentsStore=" + attachmentsStore + ",
attachment=" + attachment); //$NON-NLS-1$ //$NON-NLS-2$
}
- ObjectOutputStream oos = null;
- try {
- oos = new ObjectOutputStream(new FileOutputStream(attachmentsStore));
- oos.writeObject(attachment);
- } finally {
- if (oos != null) {
- oos.close();
+ if (!attachmentsStore.exists() || force) {
+ ObjectOutputStream oos = null;
+ try {
+ oos = new ObjectOutputStream(new FileOutputStream(attachmentsStore));
+ oos.writeObject(attachment);
+ return true;
+ } finally {
+ if (oos != null) {
+ oos.close();
+ }
}
}
+ return false;
}
- public boolean isStale(File cacheFile, long timeAfter) {
+ public File buildVDBFile(VDBMetaData vdb) {
+ return new File(baseDirectory(vdb.getName()+"_"+vdb.getVersion()),
vdb.getName()+"_"+vdb.getVersion()+ATTACHMENT_SUFFIX); //$NON-NLS-1$
//$NON-NLS-2$
+ }
+
+ public File buildModelFile(VDBMetaData vdb, String modelName) {
+ return new File(baseDirectory(vdb.getName()+"_"+vdb.getVersion()),
vdb.getName()+"_"+vdb.getVersion()+"_"+modelName+ATTACHMENT_SUFFIX);
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+
+ public boolean isStale(VDBMetaData vdb, long timeAfter) {
+ File cacheFile = buildVDBFile(vdb);
return (cacheFile.exists() && timeAfter > cacheFile.lastModified());
}
- public void removeAttachments(String fileName) {
- String dirName = baseDirectory(fileName);
+ public void removeAttachments(VDBMetaData vdb) {
+ String dirName = baseDirectory(vdb.getName()+"_"+vdb.getVersion());
//$NON-NLS-1$
FileUtils.removeDirectoryAndChildren(new File(dirName));
}
- public File getAttachmentPath(String fileName, String baseName) {
-
- String dirName = baseDirectory(fileName);
-
- final String vfsPath = baseName + ATTACHMENT_SUFFIX;
- File f = new File(dirName, vfsPath);
- if (!f.getParentFile().exists()) {
- f.getParentFile().mkdirs();
- }
- return f;
- }
-
private String baseDirectory(String fileName) {
String dirName = this.storagePath + File.separator + fileName + File.separator;
return dirName;
Modified:
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/ObjectsSerializerService.java
===================================================================
---
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/ObjectsSerializerService.java 2011-08-22
14:36:06 UTC (rev 3422)
+++
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/ObjectsSerializerService.java 2011-08-24
17:35:13 UTC (rev 3423)
@@ -45,10 +45,10 @@
@Override
public ObjectSerializer getValue() throws IllegalStateException,
IllegalArgumentException {
- return serializer;
+ return this.serializer;
}
public InjectedValue<String> getPathInjector() {
- return pathInjector;
+ return this.pathInjector;
}
}
Modified:
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineAdd.java
===================================================================
---
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineAdd.java 2011-08-22
14:36:06 UTC (rev 3422)
+++
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineAdd.java 2011-08-24
17:35:13 UTC (rev 3423)
@@ -22,6 +22,8 @@
package org.teiid.jboss;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.*;
+import static org.teiid.jboss.Configuration.DESC;
+import static org.teiid.jboss.Configuration.addAttribute;
import java.util.List;
import java.util.Locale;
@@ -43,9 +45,11 @@
import org.jboss.as.network.SocketBinding;
import org.jboss.as.security.plugins.SecurityDomainContext;
import org.jboss.dmr.ModelNode;
+import org.jboss.dmr.ModelType;
import org.jboss.msc.inject.ConcurrentMapInjector;
import org.jboss.msc.service.*;
import org.jboss.msc.value.InjectedValue;
+import org.teiid.cache.CacheFactory;
import org.teiid.deployers.SystemVDBDeployer;
import org.teiid.deployers.VDBRepository;
import org.teiid.dqp.internal.datamgr.TranslatorRepository;
@@ -55,7 +59,6 @@
import org.teiid.logging.LogManager;
import org.teiid.services.BufferServiceImpl;
import org.teiid.transport.ClientServiceRegistry;
-import org.teiid.transport.LocalServerConnection;
import org.teiid.transport.SSLConfiguration;
import org.teiid.transport.SocketConfiguration;
@@ -70,76 +73,72 @@
node.get(DESCRIPTION).set("engine.add"); //$NON-NLS-1$
ModelNode engine = node.get(REQUEST_PROPERTIES, Configuration.QUERY_ENGINE);
- TeiidModelDescription.getQueryEngineDescription(engine, ATTRIBUTES, bundle);
+ describeQueryEngine(engine, ATTRIBUTES, bundle);
return node;
}
@Override
protected void populateModel(ModelNode operation, ModelNode model) {
- final ModelNode queryEngineNode = operation.require(Configuration.QUERY_ENGINE);
- model.set(Configuration.QUERY_ENGINE).set(queryEngineNode.clone());
-
+ populateQueryEngine(operation, model);
}
@Override
protected void performBoottime(OperationContext context, ModelNode operation,
ModelNode model, ServiceVerificationHandler verificationHandler,
List<ServiceController<?>> newControllers) throws OperationFailedException {
- final ModelNode queryEngineNode = operation.require(Configuration.QUERY_ENGINE);
ServiceTarget target = context.getServiceTarget();
final JBossLifeCycleListener shutdownListener = new JBossLifeCycleListener();
-
- SocketConfiguration jdbc = null;
- if (queryEngineNode.hasDefined(Configuration.JDBC)) {
- jdbc = buildSocketConfiguration(queryEngineNode.get(Configuration.JDBC));
- }
-
- SocketConfiguration odbc = null;
- if (queryEngineNode.hasDefined(Configuration.ODBC)) {
- odbc = buildSocketConfiguration(queryEngineNode.get(Configuration.ODBC));
- }
-
+
// now build the engine
- final RuntimeEngineDeployer engine = buildQueryEngine(queryEngineNode);
- engine.setJdbcSocketConfiguration(jdbc);
- engine.setOdbcSocketConfiguration(odbc);
+ final RuntimeEngineDeployer engine = buildQueryEngine(operation);
engine.setSecurityHelper(new JBossSecurityHelper());
engine.setContainerLifeCycleListener(shutdownListener);
// TODO: none of the caching is configured..
+ SocketConfiguration jdbc = null;
+ if (operation.hasDefined(Configuration.JDBC)) {
+ jdbc = buildSocketConfiguration(operation.get(Configuration.JDBC));
+ engine.setJdbcSocketConfiguration(jdbc);
+ }
+
+ SocketConfiguration odbc = null;
+ if (operation.hasDefined(Configuration.ODBC)) {
+ odbc = buildSocketConfiguration(operation.get(Configuration.ODBC));
+ engine.setOdbcSocketConfiguration(odbc);
+ }
ServiceBuilder<ClientServiceRegistry> serviceBuilder =
target.addService(TeiidServiceNames.engineServiceName(engine.getName()), engine);
-
- serviceBuilder.addDependency(ServiceName.JBOSS.append("connector",
"workmanager"), WorkManager.class, engine.workManagerInjector); //$NON-NLS-1$
//$NON-NLS-2$
- serviceBuilder.addDependency(ServiceName.JBOSS.append("txn",
"XATerminator"), XATerminator.class, engine.xaTerminatorInjector); //$NON-NLS-1$
//$NON-NLS-2$
- serviceBuilder.addDependency(ServiceName.JBOSS.append("txn",
"TransactionManager"), TransactionManager.class, engine.txnManagerInjector);
//$NON-NLS-1$ //$NON-NLS-2$
- serviceBuilder.addDependency(TeiidServiceNames.BUFFER_MGR,
BufferServiceImpl.class, engine.bufferServiceInjector);
+ serviceBuilder.addDependency(ServiceName.JBOSS.append("connector",
"workmanager"), WorkManager.class, engine.getWorkManagerInjector());
//$NON-NLS-1$ //$NON-NLS-2$
+ serviceBuilder.addDependency(ServiceName.JBOSS.append("txn",
"XATerminator"), XATerminator.class, engine.getXaTerminatorInjector());
//$NON-NLS-1$ //$NON-NLS-2$
+ serviceBuilder.addDependency(ServiceName.JBOSS.append("txn",
"TransactionManager"), TransactionManager.class,
engine.getTxnManagerInjector()); //$NON-NLS-1$ //$NON-NLS-2$
+ serviceBuilder.addDependency(TeiidServiceNames.BUFFER_MGR,
BufferServiceImpl.class, engine.getBufferServiceInjector());
serviceBuilder.addDependency(TeiidServiceNames.SYSTEM_VDB,
SystemVDBDeployer.class, new InjectedValue<SystemVDBDeployer>());
- serviceBuilder.addDependency(TeiidServiceNames.TRANSLATOR_REPO,
TranslatorRepository.class, engine.translatorRepositoryInjector);
- serviceBuilder.addDependency(TeiidServiceNames.VDB_REPO, VDBRepository.class,
engine.vdbRepositoryInjector);
- serviceBuilder.addDependency(TeiidServiceNames.AUTHORIZATION_VALIDATOR,
AuthorizationValidator.class, engine.authorizationValidatorInjector);
+ serviceBuilder.addDependency(TeiidServiceNames.TRANSLATOR_REPO,
TranslatorRepository.class, engine.getTranslatorRepositoryInjector());
+ serviceBuilder.addDependency(TeiidServiceNames.VDB_REPO, VDBRepository.class,
engine.getVdbRepositoryInjector());
+ serviceBuilder.addDependency(TeiidServiceNames.AUTHORIZATION_VALIDATOR,
AuthorizationValidator.class, engine.getAuthorizationValidatorInjector());
+ serviceBuilder.addDependency(TeiidServiceNames.CACHE_FACTORY, CacheFactory.class,
engine.getCachefactoryInjector());
if (jdbc != null) {
- serviceBuilder.addDependency(ServiceName.JBOSS.append("binding",
jdbc.getSocketBinding()), SocketBinding.class, engine.jdbcSocketBindingInjector);
//$NON-NLS-1$
+ serviceBuilder.addDependency(ServiceName.JBOSS.append("binding",
jdbc.getSocketBinding()), SocketBinding.class, engine.getJdbcSocketBindingInjector());
//$NON-NLS-1$
}
if (odbc != null) {
- serviceBuilder.addDependency(ServiceName.JBOSS.append("binding",
odbc.getSocketBinding()), SocketBinding.class, engine.odbcSocketBindingInjector);
//$NON-NLS-1$
+ serviceBuilder.addDependency(ServiceName.JBOSS.append("binding",
odbc.getSocketBinding()), SocketBinding.class, engine.getOdbcSocketBindingInjector());
//$NON-NLS-1$
}
// register JNDI Name
- ServiceName javaContext = ServiceName.JBOSS.append("naming",
"context", "java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- BinderService binder = new BinderService(LocalServerConnection.TEIID_RUNTIME);
- ServiceBuilder<ManagedReferenceFactory> namingBuilder =
target.addService(javaContext.append(LocalServerConnection.TEIID_RUNTIME), binder);
- namingBuilder.addDependency(javaContext, NamingStore.class,
binder.getNamingStoreInjector());
+ ServiceName teiidContext = ServiceName.JBOSS.append("naming",
"context", "teiid"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ BinderService binder = new BinderService(engine.getName());
+ ServiceBuilder<ManagedReferenceFactory> namingBuilder =
target.addService(teiidContext.append(engine.getName()), binder);
+ namingBuilder.addDependency(teiidContext, NamingStore.class,
binder.getNamingStoreInjector());
namingBuilder.addDependency(TeiidServiceNames.engineServiceName(engine.getName()),
RuntimeEngineDeployer.class, new
ManagedReferenceInjector<RuntimeEngineDeployer>(binder.getManagedObjectInjector()));
namingBuilder.setInitialMode(ServiceController.Mode.ON_DEMAND);
newControllers.add(namingBuilder.install());
// add security domains
- if ( queryEngineNode.hasDefined(Configuration.SECURITY_DOMAIN)) {
- String domainNameOrder =
queryEngineNode.get(Configuration.SECURITY_DOMAIN).asString();
+ if ( operation.hasDefined(Configuration.SECURITY_DOMAIN)) {
+ String domainNameOrder =
operation.get(Configuration.SECURITY_DOMAIN).asString();
if (domainNameOrder != null && domainNameOrder.trim().length()>0) {
LogManager.logInfo(LogConstants.CTX_SECURITY, "Security Enabled:
true"); //$NON-NLS-1$
String[] domainNames = domainNameOrder.split(","); //$NON-NLS-1$
@@ -270,4 +269,176 @@
return socket;
}
+
+ static void describeQueryEngine(ModelNode node, String type, ResourceBundle bundle) {
+ addAttribute(node, Configuration.ENGINE_NAME, type,
bundle.getString(Configuration.ENGINE_NAME+Configuration.DESC), ModelType.STRING, true,
null);
+ addAttribute(node, Configuration.MAX_THREADS, type,
bundle.getString(Configuration.MAX_THREADS+DESC),
ModelType.INT, false, "64");
//$NON-NLS-1$
+ addAttribute(node, Configuration.MAX_ACTIVE_PLANS, type,
bundle.getString(Configuration.MAX_ACTIVE_PLANS+DESC),
ModelType.INT, false,
"20"); //$NON-NLS-1$
+ addAttribute(node, Configuration.USER_REQUEST_SOURCE_CONCURRENCY, type,
bundle.getString(Configuration.USER_REQUEST_SOURCE_CONCURRENCY+DESC),
ModelType.INT,
false, "0"); //$NON-NLS-1$
+ addAttribute(node, Configuration.TIME_SLICE_IN_MILLI, type,
bundle.getString(Configuration.TIME_SLICE_IN_MILLI+DESC),
ModelType.INT, false,
"2000"); //$NON-NLS-1$
+ addAttribute(node, Configuration.MAX_ROWS_FETCH_SIZE, type,
bundle.getString(Configuration.MAX_ROWS_FETCH_SIZE+DESC),
ModelType.INT, false,
"20480"); //$NON-NLS-1$
+ addAttribute(node, Configuration.LOB_CHUNK_SIZE_IN_KB, type,
bundle.getString(Configuration.LOB_CHUNK_SIZE_IN_KB+DESC),
ModelType.INT, false,
"100"); //$NON-NLS-1$
+ addAttribute(node, Configuration.QUERY_THRESHOLD_IN_SECS, type,
bundle.getString(Configuration.QUERY_THRESHOLD_IN_SECS+DESC),
ModelType.INT, false,
"600"); //$NON-NLS-1$
+ addAttribute(node, Configuration.MAX_SOURCE_ROWS, type,
bundle.getString(Configuration.MAX_SOURCE_ROWS+DESC),
ModelType.INT, false,
"-1"); //$NON-NLS-1$
+ addAttribute(node, Configuration.EXCEPTION_ON_MAX_SOURCE_ROWS, type,
bundle.getString(Configuration.EXCEPTION_ON_MAX_SOURCE_ROWS+DESC), ModelType.BOOLEAN,
false, "true"); //$NON-NLS-1$
+ addAttribute(node, Configuration.MAX_ODBC_LOB_SIZE_ALLOWED, type,
bundle.getString(Configuration.MAX_ODBC_LOB_SIZE_ALLOWED+DESC),
ModelType.INT, false,
"5242880"); //$NON-NLS-1$
+ addAttribute(node, Configuration.EVENT_DISTRIBUTOR_NAME, type,
bundle.getString(Configuration.EVENT_DISTRIBUTOR_NAME+DESC), ModelType.STRING, false,
"teiid/event-distributor"); //$NON-NLS-1$
+ addAttribute(node, Configuration.DETECTING_CHANGE_EVENTS, type,
bundle.getString(Configuration.DETECTING_CHANGE_EVENTS+DESC), ModelType.BOOLEAN, false,
"true"); //$NON-NLS-1$
+
+ //session stuff
+ addAttribute(node, Configuration.SECURITY_DOMAIN, type,
bundle.getString(Configuration.SECURITY_DOMAIN+DESC), ModelType.STRING, false, null);
+ addAttribute(node, Configuration.MAX_SESSIONS_ALLOWED, type,
bundle.getString(Configuration.MAX_SESSIONS_ALLOWED+DESC),
ModelType.INT, false,
"5000"); //$NON-NLS-1$
+ addAttribute(node, Configuration.SESSION_EXPIRATION_TIME_LIMIT, type,
bundle.getString(Configuration.SESSION_EXPIRATION_TIME_LIMIT+DESC),
ModelType.INT, false,
"0"); //$NON-NLS-1$
+
+ //jdbc
+ ModelNode jdbcSocketNode = node.get(CHILDREN, Configuration.JDBC);
+ jdbcSocketNode.get(TYPE).set(ModelType.OBJECT);
+ jdbcSocketNode.get(DESCRIPTION).set(bundle.getString(Configuration.JDBC+DESC));
+ jdbcSocketNode.get(REQUIRED).set(false);
+ jdbcSocketNode.get(MAX_OCCURS).set(1);
+ jdbcSocketNode.get(MIN_OCCURS).set(1);
+ describeSocketConfig(jdbcSocketNode, type, bundle);
+
+ //odbc
+ ModelNode odbcSocketNode = node.get(CHILDREN, Configuration.ODBC);
+ odbcSocketNode.get(TYPE).set(ModelType.OBJECT);
+ odbcSocketNode.get(DESCRIPTION).set(bundle.getString(Configuration.ODBC+DESC));
+ odbcSocketNode.get(REQUIRED).set(false);
+ odbcSocketNode.get(MAX_OCCURS).set(1);
+ odbcSocketNode.get(MIN_OCCURS).set(1);
+ describeSocketConfig(odbcSocketNode, type, bundle);
+ }
+
+
+ private static void describeSocketConfig(ModelNode node, String type, ResourceBundle
bundle) {
+ addAttribute(node, Configuration.SOCKET_ENABLED, type,
bundle.getString(Configuration.SOCKET_ENABLED+DESC), ModelType.BOOLEAN, false,
"true"); //$NON-NLS-1$
+ addAttribute(node, Configuration.MAX_SOCKET_THREAD_SIZE, type,
bundle.getString(Configuration.MAX_SOCKET_THREAD_SIZE+DESC),
ModelType.INT, false,
"0"); //$NON-NLS-1$
+ addAttribute(node, Configuration.IN_BUFFER_SIZE, type,
bundle.getString(Configuration.IN_BUFFER_SIZE+DESC),
ModelType.INT, false, "0");
//$NON-NLS-1$
+ addAttribute(node, Configuration.OUT_BUFFER_SIZE, type,
bundle.getString(Configuration.OUT_BUFFER_SIZE+DESC),
ModelType.INT, false,
"0"); //$NON-NLS-1$
+ addAttribute(node, Configuration.SOCKET_BINDING, type,
bundle.getString(Configuration.SOCKET_BINDING+DESC),
ModelType.INT, true, null);
+
+ ModelNode sslNode = node.get(CHILDREN, Configuration.SSL);
+ sslNode.get(TYPE).set(ModelType.OBJECT);
+ sslNode.get(DESCRIPTION).set(bundle.getString(Configuration.SSL+DESC));
+ sslNode.get(REQUIRED).set(false);
+ sslNode.get(MAX_OCCURS).set(1);
+ sslNode.get(MIN_OCCURS).set(0);
+ addAttribute(node, Configuration.SSL_MODE, type,
bundle.getString(Configuration.SSL_MODE+DESC), ModelType.STRING, false,
"login"); //$NON-NLS-1$
+ addAttribute(node, Configuration.KEY_STORE_FILE, type,
bundle.getString(Configuration.KEY_STORE_FILE+DESC), ModelType.STRING, false, null);
+ addAttribute(node, Configuration.KEY_STORE_PASSWD, type,
bundle.getString(Configuration.KEY_STORE_PASSWD+DESC), ModelType.STRING, false, null);
+ addAttribute(node, Configuration.KEY_STORE_TYPE, type,
bundle.getString(Configuration.KEY_STORE_TYPE+DESC), ModelType.STRING, false,
"JKS"); //$NON-NLS-1$
+ addAttribute(node, Configuration.SSL_PROTOCOL, type,
bundle.getString(Configuration.SSL_PROTOCOL+DESC), ModelType.BOOLEAN, false,
"SSLv3"); //$NON-NLS-1$
+ addAttribute(node, Configuration.KEY_MANAGEMENT_ALG, type,
bundle.getString(Configuration.KEY_MANAGEMENT_ALG+DESC), ModelType.STRING, false,
"false"); //$NON-NLS-1$
+ addAttribute(node, Configuration.TRUST_FILE, type,
bundle.getString(Configuration.TRUST_FILE+DESC), ModelType.STRING, false, null);
+ addAttribute(node, Configuration.TRUST_PASSWD, type,
bundle.getString(Configuration.TRUST_PASSWD+DESC), ModelType.STRING, false, null);
+ addAttribute(node, Configuration.AUTH_MODE, type,
bundle.getString(Configuration.AUTH_MODE+DESC), ModelType.STRING, false,
"anonymous"); //$NON-NLS-1$
+ }
+
+ private void populateQueryEngine(ModelNode operation, ModelNode model) {
+ model.get(Configuration.ENGINE_NAME).set(operation.require(Configuration.ENGINE_NAME).asString());
+
+ if (operation.hasDefined(Configuration.MAX_THREADS)) {
+
model.get(Configuration.MAX_THREADS).set(operation.get(Configuration.MAX_THREADS).asInt());
+ }
+ if (operation.hasDefined(Configuration.MAX_ACTIVE_PLANS)) {
+
model.get(Configuration.MAX_ACTIVE_PLANS).set(operation.get(Configuration.MAX_ACTIVE_PLANS).asInt());
+ }
+ if (operation.hasDefined(Configuration.USER_REQUEST_SOURCE_CONCURRENCY)) {
+
model.get(Configuration.USER_REQUEST_SOURCE_CONCURRENCY).set(operation.get(Configuration.USER_REQUEST_SOURCE_CONCURRENCY).asInt());
+ }
+ if (operation.hasDefined(Configuration.TIME_SLICE_IN_MILLI)) {
+
model.get(Configuration.TIME_SLICE_IN_MILLI).set(operation.get(Configuration.TIME_SLICE_IN_MILLI).asInt());
+ }
+ if (operation.hasDefined(Configuration.MAX_ROWS_FETCH_SIZE)) {
+
model.get(Configuration.MAX_ROWS_FETCH_SIZE).set(operation.get(Configuration.MAX_ROWS_FETCH_SIZE).asInt());
+ }
+ if (operation.hasDefined(Configuration.LOB_CHUNK_SIZE_IN_KB)) {
+
model.get(Configuration.LOB_CHUNK_SIZE_IN_KB).set(operation.get(Configuration.LOB_CHUNK_SIZE_IN_KB).asInt());
+ }
+ if (operation.hasDefined(Configuration.QUERY_THRESHOLD_IN_SECS)) {
+
model.get(Configuration.QUERY_THRESHOLD_IN_SECS).set(operation.get(Configuration.QUERY_THRESHOLD_IN_SECS).asInt());
+ }
+ if (operation.hasDefined(Configuration.MAX_SOURCE_ROWS)) {
+
model.get(Configuration.MAX_SOURCE_ROWS).set(operation.get(Configuration.MAX_SOURCE_ROWS).asInt());
+ }
+ if (operation.hasDefined(Configuration.EXCEPTION_ON_MAX_SOURCE_ROWS)) {
+
model.get(Configuration.EXCEPTION_ON_MAX_SOURCE_ROWS).set(operation.get(Configuration.EXCEPTION_ON_MAX_SOURCE_ROWS).asBoolean());
+ }
+ if (operation.hasDefined(Configuration.MAX_ODBC_LOB_SIZE_ALLOWED)) {
+
model.get(Configuration.MAX_ODBC_LOB_SIZE_ALLOWED).set(operation.get(Configuration.MAX_ODBC_LOB_SIZE_ALLOWED).asInt());
+ }
+ if (operation.hasDefined(Configuration.EVENT_DISTRIBUTOR_NAME)) {
+
model.get(Configuration.EVENT_DISTRIBUTOR_NAME).set(operation.get(Configuration.EVENT_DISTRIBUTOR_NAME).asString());
+ }
+ if (operation.hasDefined(Configuration.DETECTING_CHANGE_EVENTS)) {
+
model.get(Configuration.DETECTING_CHANGE_EVENTS).set(operation.get(Configuration.DETECTING_CHANGE_EVENTS).asBoolean());
+ }
+ if (operation.hasDefined(Configuration.SESSION_EXPIRATION_TIME_LIMIT)) {
+
model.get(Configuration.SESSION_EXPIRATION_TIME_LIMIT).set(operation.get(Configuration.SESSION_EXPIRATION_TIME_LIMIT).asInt());
+ }
+ if (operation.hasDefined(Configuration.MAX_SESSIONS_ALLOWED)) {
+
model.get(Configuration.MAX_SESSIONS_ALLOWED).set(operation.get(Configuration.MAX_SESSIONS_ALLOWED).asInt());
+ }
+
+ if (operation.hasDefined(Configuration.JDBC)) {
+ populateSocketConfiguration(operation.get(Configuration.JDBC),
model.get(Configuration.JDBC));
+ }
+
+ if (operation.hasDefined(Configuration.ODBC)) {
+ populateSocketConfiguration(operation.get(Configuration.ODBC),
model.get(Configuration.ODBC));
+ }
+ }
+
+ private void populateSocketConfiguration(ModelNode operation, ModelNode model) {
+ if (operation.hasDefined(Configuration.SOCKET_BINDING)) {
+ model.get(Configuration.SOCKET_BINDING).set(operation.get(Configuration.SOCKET_BINDING).asString());
+ }
+ if (operation.hasDefined(Configuration.MAX_SOCKET_THREAD_SIZE)) {
+
model.get(Configuration.MAX_SOCKET_THREAD_SIZE).set(operation.get(Configuration.MAX_SOCKET_THREAD_SIZE).asInt());
+ }
+ if (operation.hasDefined(Configuration.IN_BUFFER_SIZE)) {
+
model.get(Configuration.IN_BUFFER_SIZE).set(operation.get(Configuration.IN_BUFFER_SIZE).asInt());
+ }
+ if (operation.hasDefined(Configuration.OUT_BUFFER_SIZE)) {
+
model.get(Configuration.OUT_BUFFER_SIZE).set(operation.get(Configuration.OUT_BUFFER_SIZE).asInt());
+ }
+
+
+ if (operation.hasDefined(Configuration.SSL)) {
+ operation = operation.get(Configuration.SSL);
+ model = model.get(Configuration.SSL);
+
+ if (operation.hasDefined(Configuration.SSL_MODE)) {
+
model.get(Configuration.SSL_MODE).set(operation.get(Configuration.SSL_MODE).asString());
+ }
+
+ if (operation.hasDefined(Configuration.KEY_STORE_FILE)) {
+
model.get(Configuration.KEY_STORE_FILE).set(operation.get(Configuration.KEY_STORE_FILE).asString());
+ }
+
+ if (operation.hasDefined(Configuration.KEY_STORE_PASSWD)) {
+
model.get(Configuration.KEY_STORE_PASSWD).set(operation.get(Configuration.KEY_STORE_PASSWD).asString());
+ }
+
+ if (operation.hasDefined(Configuration.KEY_STORE_TYPE)) {
+
model.get(Configuration.KEY_STORE_TYPE).set(operation.get(Configuration.KEY_STORE_TYPE).asString());
+ }
+
+ if (operation.hasDefined(Configuration.SSL_PROTOCOL)) {
+
model.get(Configuration.SSL_PROTOCOL).set(operation.get(Configuration.SSL_PROTOCOL).asString());
+ }
+ if (operation.hasDefined(Configuration.KEY_MANAGEMENT_ALG)) {
+
model.get(Configuration.KEY_MANAGEMENT_ALG).set(operation.get(Configuration.KEY_MANAGEMENT_ALG).asString());
+ }
+ if (operation.hasDefined(Configuration.TRUST_FILE)) {
+
model.get(Configuration.TRUST_FILE).set(operation.get(Configuration.TRUST_FILE).asString());
+ }
+ if (operation.hasDefined(Configuration.TRUST_PASSWD)) {
+
model.get(Configuration.TRUST_PASSWD).set(operation.get(Configuration.TRUST_PASSWD).asString());
+ }
+ if (operation.hasDefined(Configuration.AUTH_MODE)) {
+
model.get(Configuration.AUTH_MODE).set(operation.get(Configuration.AUTH_MODE).asString());
+ }
+ }
+ }
}
Modified:
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidBootServicesAdd.java
===================================================================
---
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidBootServicesAdd.java 2011-08-22
14:36:06 UTC (rev 3422)
+++
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidBootServicesAdd.java 2011-08-24
17:35:13 UTC (rev 3423)
@@ -30,9 +30,11 @@
import java.util.Locale;
import java.util.ResourceBundle;
import java.util.ServiceLoader;
-import java.util.concurrent.Executor;
-import org.jboss.as.controller.*;
+import org.jboss.as.controller.AbstractAddStepHandler;
+import org.jboss.as.controller.OperationContext;
+import org.jboss.as.controller.OperationFailedException;
+import org.jboss.as.controller.ServiceVerificationHandler;
import org.jboss.as.controller.descriptions.DescriptionProvider;
import org.jboss.as.server.AbstractDeploymentChainStep;
import org.jboss.as.server.DeploymentProcessorTarget;
@@ -44,12 +46,12 @@
import org.jboss.modules.ModuleIdentifier;
import org.jboss.modules.ModuleLoadException;
import org.jboss.msc.service.*;
-import org.jboss.msc.value.InjectedValue;
import org.teiid.PolicyDecider;
import org.teiid.cache.CacheConfiguration;
import org.teiid.cache.CacheFactory;
import org.teiid.cache.DefaultCacheFactory;
-import org.teiid.deployers.*;
+import org.teiid.deployers.SystemVDBDeployer;
+import org.teiid.deployers.VDBRepository;
import org.teiid.dqp.internal.datamgr.TranslatorRepository;
import org.teiid.dqp.internal.process.AuthorizationValidator;
import org.teiid.dqp.internal.process.DataRolePolicyDecider;
@@ -58,7 +60,6 @@
import org.teiid.services.BufferServiceImpl;
public class TeiidBootServicesAdd extends AbstractAddStepHandler implements
DescriptionProvider {
-
@Override
public ModelNode getModelDescription(Locale locale) {
final ResourceBundle bundle = IntegrationPlugin.getResourceBundle(locale);
@@ -66,40 +67,44 @@
node.get(OPERATION_NAME).set(ADD);
node.get(DESCRIPTION).set(bundle.getString("teiid-boot.add"));
//$NON-NLS-1$
- addAttribute(node, Configuration.ALLOW_ENV_FUNCTION, REQUEST_PROPERTIES,
bundle.getString(Configuration.ALLOW_ENV_FUNCTION+DESC), ModelType.BOOLEAN, false,
"false"); //$NON-NLS-1$
- addAttribute(node, Configuration.ASYNC_THREAD_GROUP, REQUEST_PROPERTIES,
bundle.getString(Configuration.ASYNC_THREAD_GROUP+DESC), ModelType.STRING, false,
"teiid-async-threads"); //$NON-NLS-1$
+ describeTeiidRoot(bundle, REQUEST_PROPERTIES, node);
+
+ return node;
+ }
- addAttribute(node, Configuration.AUTHORIZATION_VALIDATOR_MODULE,
REQUEST_PROPERTIES, bundle.getString(Configuration.AUTHORIZATION_VALIDATOR_MODULE+DESC),
ModelType.BOOLEAN, false, "false"); //$NON-NLS-1$
- addAttribute(node, Configuration.POLICY_DECIDER_MODULE, REQUEST_PROPERTIES,
bundle.getString(Configuration.POLICY_DECIDER_MODULE+DESC), ModelType.STRING, false,
"teiid-async-threads"); //$NON-NLS-1$
+ static void describeTeiidRoot(final ResourceBundle bundle, String type, final ModelNode
node) {
+ addAttribute(node, Configuration.ALLOW_ENV_FUNCTION, type,
bundle.getString(Configuration.ALLOW_ENV_FUNCTION+DESC), ModelType.BOOLEAN, false,
"false"); //$NON-NLS-1$
+ addAttribute(node, Configuration.ASYNC_THREAD_GROUP, type,
bundle.getString(Configuration.ASYNC_THREAD_GROUP+DESC), ModelType.STRING, true,
"teiid-async-threads"); //$NON-NLS-1$
+
+ addAttribute(node, Configuration.AUTHORIZATION_VALIDATOR_MODULE, type,
bundle.getString(Configuration.AUTHORIZATION_VALIDATOR_MODULE+DESC), ModelType.BOOLEAN,
false, "false"); //$NON-NLS-1$
+ addAttribute(node, Configuration.POLICY_DECIDER_MODULE, type,
bundle.getString(Configuration.POLICY_DECIDER_MODULE+DESC), ModelType.STRING, false,
"teiid-async-threads"); //$NON-NLS-1$
ModelNode bufferNode = node.get(CHILDREN, Configuration.BUFFER_SERVICE);
bufferNode.get(TYPE).set(ModelType.OBJECT);
bufferNode.get(DESCRIPTION).set(bundle.getString(Configuration.BUFFER_SERVICE+DESC));
bufferNode.get(REQUIRED).set(false);
- getBufferManagerDesciption(bufferNode, ATTRIBUTES, bundle);
+ describeBufferManager(bufferNode, ATTRIBUTES, bundle);
// result-set-cache
ModelNode rsCacheNode = node.get(CHILDREN, Configuration.RESULTSET_CACHE);
rsCacheNode.get(TYPE).set(ModelType.OBJECT);
rsCacheNode.get(DESCRIPTION).set(bundle.getString(Configuration.RESULTSET_CACHE+DESC));
rsCacheNode.get(REQUIRED).set(false);
- getResultsetCacheDescription(rsCacheNode, ATTRIBUTES, bundle);
+ describeResultsetcache(rsCacheNode, ATTRIBUTES, bundle);
// preparedplan-set-cache
ModelNode preparedPlanCacheNode = node.get(CHILDREN,
Configuration.PREPAREDPLAN_CACHE);
preparedPlanCacheNode.get(TYPE).set(ModelType.OBJECT);
preparedPlanCacheNode.get(DESCRIPTION).set(bundle.getString(Configuration.PREPAREDPLAN_CACHE+DESC));
preparedPlanCacheNode.get(REQUIRED).set(false);
- getResultsetCacheDescription(preparedPlanCacheNode, ATTRIBUTES, bundle);
+ describePreparedPlanCache(preparedPlanCacheNode, ATTRIBUTES, bundle);
//distributed-cache
ModelNode distributedCacheNode = node.get(CHILDREN, Configuration.CACHE_FACORY);
distributedCacheNode.get(TYPE).set(ModelType.OBJECT);
distributedCacheNode.get(DESCRIPTION).set(bundle.getString(Configuration.CACHE_FACORY+DESC));
distributedCacheNode.get(REQUIRED).set(false);
- getDistributedCacheDescription(preparedPlanCacheNode, ATTRIBUTES, bundle);
-
- return node;
+ describeDistributedCache(preparedPlanCacheNode, ATTRIBUTES, bundle);
}
@Override
@@ -111,7 +116,7 @@
model.get(Configuration.ASYNC_THREAD_GROUP).set(operation.get(Configuration.ASYNC_THREAD_GROUP).asString());
}
populateBufferManager(operation, model);
-
+ //TODO: add cache model descriptions
}
@Override
@@ -119,12 +124,18 @@
final ServiceVerificationHandler verificationHandler, final
List<ServiceController<?>> newControllers) throws OperationFailedException {
ServiceTarget target = context.getServiceTarget();
+ final String asyncThreadPoolName =
operation.require(Configuration.ASYNC_THREAD_GROUP).asString();
+
// translator repository
final TranslatorRepository translatorRepo = new TranslatorRepository();
- TranslatorRepositoryService translatorService = new
TranslatorRepositoryService(translatorRepo);
+ ValueService<TranslatorRepository> translatorService = new
ValueService<TranslatorRepository>(new
org.jboss.msc.value.Value<TranslatorRepository>() {
+ @Override
+ public TranslatorRepository getValue() throws IllegalStateException,
IllegalArgumentException {
+ return translatorRepo;
+ }
+ });
ServiceController<TranslatorRepository> service =
target.addService(TeiidServiceNames.TRANSLATOR_REPO, translatorService).install();
newControllers.add(service);
- ServiceContainer serviceContainer = service.getServiceContainer();
// system function tree
SystemFunctionManager systemFunctionManager = new SystemFunctionManager();
@@ -149,7 +160,9 @@
newControllers.add(RelativePathService.addService(TeiidServiceNames.DATA_DIR,
"teiid-data", "jboss.server.data.dir", target)); //$NON-NLS-1$
//$NON-NLS-2$
final ObjectsSerializerService serializer = new ObjectsSerializerService();
- newControllers.add(target.addService(TeiidServiceNames.OBJECT_SERIALIZER,
serializer).install());
+ ServiceBuilder<ObjectSerializer> objectSerializerService =
target.addService(TeiidServiceNames.OBJECT_SERIALIZER, serializer);
+ objectSerializerService.addDependency(TeiidServiceNames.DATA_DIR, String.class,
serializer.getPathInjector());
+ newControllers.add(objectSerializerService.install());
// TODO: remove verbose service by moving the buffer service from runtime project
newControllers.add(RelativePathService.addService(TeiidServiceNames.BUFFER_DIR,
"teiid-buffer", "jboss.server.temp.dir", target)); //$NON-NLS-1$
//$NON-NLS-2$
@@ -170,7 +183,7 @@
policyDecider = drpd;
}
- AuthorizationValidator authValidator;
+ final AuthorizationValidator authValidator;
if (operation.hasDefined(Configuration.AUTHORIZATION_VALIDATOR_MODULE)) {
authValidator = buildService(AuthorizationValidator.class,
operation.get(Configuration.AUTHORIZATION_VALIDATOR_MODULE).asString());
authValidator.setEnabled(true);
@@ -181,24 +194,38 @@
dap.setEnabled(true);
authValidator = dap;
}
- target.addService(TeiidServiceNames.AUTHORIZATION_VALIDATOR, new
AuthorizationValidatorService(authValidator));
- CacheFactory cacheFactory =
getCacheFactory(operation.get(Configuration.CACHE_FACORY));
+ ValueService<AuthorizationValidator> authValidatorService = new
ValueService<AuthorizationValidator>(new
org.jboss.msc.value.Value<AuthorizationValidator>() {
+ @Override
+ public AuthorizationValidator getValue() throws IllegalStateException,
IllegalArgumentException {
+ return authValidator;
+ }
+ });
+ newControllers.add(target.addService(TeiidServiceNames.AUTHORIZATION_VALIDATOR,
authValidatorService).install());
+
+ //cache factory
+ final CacheFactory cacheFactory =
getCacheFactory(operation.get(Configuration.CACHE_FACORY));
+ ValueService<CacheFactory> cacheFactoryService = new
ValueService<CacheFactory>(new org.jboss.msc.value.Value<CacheFactory>() {
+ @Override
+ public CacheFactory getValue() throws IllegalStateException, IllegalArgumentException
{
+ return cacheFactory;
+ }
+ });
+ newControllers.add(target.addService(TeiidServiceNames.CACHE_FACTORY,
cacheFactoryService).install());
+
CacheConfiguration resultsetCache =
buildCacheConfig(operation.get(Configuration.RESULTSET_CACHE));
CacheConfiguration preparePlanCache =
buildCacheConfig(operation.get(Configuration.PREPAREDPLAN_CACHE));
- final JBossLifeCycleListener shutdownListener = new JBossLifeCycleListener();
- serviceContainer.addTerminateListener(shutdownListener);
-
- serviceBuilder.addDependency(ServiceName.JBOSS.append("thread",
"executor", asyncExecutor), Executor.class, engine.threadPoolInjector);
//$NON-NLS-1$ //$NON-NLS-2$
-
+ // add translators
+
+
// Register VDB deployer
context.addStep(new AbstractDeploymentChainStep() {
@Override
public void execute(DeploymentProcessorTarget processorTarget) {
processorTarget.addDeploymentProcessor(Phase.STRUCTURE,
Phase.STRUCTURE_WAR_DEPLOYMENT_INIT|0x0001,new VDBStructure());
- processorTarget.addDeploymentProcessor(Phase.PARSE,
Phase.PARSE_WEB_DEPLOYMENT|0x0001, new VDBParserDeployer(vdbRepository, serializer));
+ processorTarget.addDeploymentProcessor(Phase.PARSE,
Phase.PARSE_WEB_DEPLOYMENT|0x0001, new VDBParserDeployer());
processorTarget.addDeploymentProcessor(Phase.DEPENDENCIES,
Phase.DEPENDENCIES_WAR_MODULE|0x0001, new VDBDependencyProcessor());
processorTarget.addDeploymentProcessor(Phase.INSTALL,
Phase.INSTALL_WAR_DEPLOYMENT|0x0001, new VDBDeployer(translatorRepo,
asyncThreadPoolName));
}
@@ -220,7 +247,7 @@
}
- static void getBufferManagerDesciption(ModelNode node, String type, ResourceBundle
bundle) {
+ static void describeBufferManager(ModelNode node, String type, ResourceBundle bundle) {
addAttribute(node, Configuration.USE_DISK, type,
bundle.getString(Configuration.USE_DISK+DESC), ModelType.BOOLEAN, false,
"true"); //$NON-NLS-1$
addAttribute(node, Configuration.PROCESSOR_BATCH_SIZE, type,
bundle.getString(Configuration.PROCESSOR_BATCH_SIZE+DESC),
ModelType.INT, false,
"512"); //$NON-NLS-1$
addAttribute(node, Configuration.CONNECTOR_BATCH_SIZE, type,
bundle.getString(Configuration.CONNECTOR_BATCH_SIZE+DESC),
ModelType.INT, false,
"1024"); //$NON-NLS-1$
@@ -301,12 +328,12 @@
}
}
- private static void getDistributedCacheDescription(ModelNode node, String type,
ResourceBundle bundle) {
+ private static void describeDistributedCache(ModelNode node, String type, ResourceBundle
bundle) {
addAttribute(node, Configuration.CACHE_SERVICE_JNDI_NAME, type,
bundle.getString(Configuration.CACHE_SERVICE_JNDI_NAME+DESC), ModelType.STRING, false,
"java:TeiidCacheManager"); //$NON-NLS-1$
addAttribute(node, Configuration.RESULTSET_CACHE_NAME, type,
bundle.getString(Configuration.RESULTSET_CACHE_NAME+DESC), ModelType.STRING, false,
"teiid-resultset-cache"); //$NON-NLS-1$
}
- private static void getResultsetCacheDescription(ModelNode node, String type,
ResourceBundle bundle) {
+ private static void describeResultsetcache(ModelNode node, String type, ResourceBundle
bundle) {
addAttribute(node, Configuration.MAX_ENTRIES, type,
bundle.getString(Configuration.MAX_ENTRIES+DESC),
ModelType.INT, false, "1024");
//$NON-NLS-1$
addAttribute(node, Configuration.MAX_AGE_IN_SECS, type,
bundle.getString(Configuration.MAX_AGE_IN_SECS+DESC),
ModelType.INT, false,
"7200");//$NON-NLS-1$
addAttribute(node, Configuration.MAX_STALENESS, type,
bundle.getString(Configuration.MAX_STALENESS+DESC),
ModelType.INT, false,
"60");//$NON-NLS-1$
@@ -314,13 +341,14 @@
addAttribute(node, Configuration.CACHE_LOCATION, type,
bundle.getString(Configuration.CACHE_LOCATION+DESC), ModelType.STRING, false,
"resultset"); //$NON-NLS-1$
}
- private static void getPreparedPalnCacheDescription(ModelNode node, String type,
ResourceBundle bundle) {
+ private static void describePreparedPlanCache(ModelNode node, String type,
ResourceBundle bundle) {
addAttribute(node, Configuration.MAX_ENTRIES, type,
bundle.getString(Configuration.MAX_ENTRIES+DESC),
ModelType.INT, false, "512");
//$NON-NLS-1$
addAttribute(node, Configuration.MAX_AGE_IN_SECS, type,
bundle.getString(Configuration.MAX_AGE_IN_SECS+DESC),
ModelType.INT, false,
"28800");//$NON-NLS-1$
addAttribute(node, Configuration.MAX_STALENESS, type,
bundle.getString(Configuration.MAX_STALENESS+DESC),
ModelType.INT, false,
"0");//$NON-NLS-1$
addAttribute(node, Configuration.CACHE_TYPE, type,
bundle.getString(Configuration.CACHE_TYPE+DESC), ModelType.STRING, false,
"LRU"); //$NON-NLS-1$
addAttribute(node, Configuration.CACHE_LOCATION, type,
bundle.getString(Configuration.CACHE_LOCATION+DESC), ModelType.STRING, false,
"preparedplan"); //$NON-NLS-1$
}
+
private CacheFactory getCacheFactory(ModelNode node) {
CacheFactory cacheFactory = new DefaultCacheFactory();
/*
Modified:
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidExtension.java
===================================================================
---
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidExtension.java 2011-08-22
14:36:06 UTC (rev 3422)
+++
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidExtension.java 2011-08-24
17:35:13 UTC (rev 3423)
@@ -68,6 +68,7 @@
private static QueryEngineRemove ENGINE_REMOVE = new QueryEngineRemove();
private static TranslatorAdd TRANSLATOR_ADD = new TranslatorAdd();
private static TranslatorRemove TRANSLATOR_REMOVE = new TranslatorRemove();
+ private static TeiidBootServicesAdd TEIID_BOOT_ADD = new TeiidBootServicesAdd();
@Override
public void initialize(ExtensionContext context) {
@@ -89,17 +90,18 @@
node.get(ModelDescriptionConstants.TAIL_COMMENT_ALLOWED).set(true);
node.get(ModelDescriptionConstants.NAMESPACE).set(Namespace.CURRENT.getUri());
- node.get(CHILDREN, Configuration.QUERY_ENGINE,
DESCRIPTION).set(bundle.getString(Configuration.QUERY_ENGINE));
+ TeiidBootServicesAdd.describeTeiidRoot(bundle, ATTRIBUTES, node);
+ node.get(CHILDREN, Configuration.QUERY_ENGINE,
DESCRIPTION).set(bundle.getString(Configuration.QUERY_ENGINE+Configuration.DESC));
node.get(CHILDREN, Configuration.QUERY_ENGINE, REQUIRED).set(false);
- node.get(CHILDREN, Configuration.TRANSLATOR,
DESCRIPTION).set(bundle.getString(Configuration.TRANSLATOR));
+ node.get(CHILDREN, Configuration.TRANSLATOR,
DESCRIPTION).set(bundle.getString(Configuration.TRANSLATOR+Configuration.DESC));
node.get(CHILDREN, Configuration.TRANSLATOR, REQUIRED).set(false);
return node;
}
});
- teiidSubsystem.registerOperationHandler(ADD, ENGINE_ADD, ENGINE_ADD, false);
- teiidSubsystem.registerOperationHandler(REMOVE, ENGINE_REMOVE, ENGINE_REMOVE, false);
+ teiidSubsystem.registerOperationHandler(ADD, TEIID_BOOT_ADD, TEIID_BOOT_ADD, false);
+ //teiidSubsystem.registerOperationHandler(REMOVE, ENGINE_REMOVE, ENGINE_REMOVE, false);
// Translator Subsystem
final ManagementResourceRegistration translatorSubsystem =
teiidSubsystem.registerSubModel(PathElement.pathElement(Configuration.TRANSLATOR), new
DescriptionProvider() {
@@ -108,7 +110,7 @@
final ResourceBundle bundle = IntegrationPlugin.getResourceBundle(locale);
final ModelNode node = new ModelNode();
- node.get(DESCRIPTION).set(bundle.getString(Configuration.TRANSLATOR));
+
node.get(DESCRIPTION).set(bundle.getString(Configuration.TRANSLATOR+Configuration.DESC));
node.get(HEAD_COMMENT_ALLOWED).set(true);
node.get(TAIL_COMMENT_ALLOWED).set(true);
@@ -128,10 +130,10 @@
final ResourceBundle bundle = IntegrationPlugin.getResourceBundle(locale);
final ModelNode node = new ModelNode();
- node.get(DESCRIPTION).set(bundle.getString(Configuration.QUERY_ENGINE));
+
node.get(DESCRIPTION).set(bundle.getString(Configuration.QUERY_ENGINE+Configuration.DESC));
node.get(HEAD_COMMENT_ALLOWED).set(true);
node.get(TAIL_COMMENT_ALLOWED).set(true);
- TeiidModelDescription.getQueryEngineDescription(node, ATTRIBUTES, bundle);
+ QueryEngineAdd.describeQueryEngine(node, ATTRIBUTES, bundle);
return node;
}
});
Deleted:
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidModelDescription.java
===================================================================
---
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidModelDescription.java 2011-08-22
14:36:06 UTC (rev 3422)
+++
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidModelDescription.java 2011-08-24
17:35:13 UTC (rev 3423)
@@ -1,98 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.jboss;
-
-import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.*;
-import static org.teiid.jboss.Configuration.DESC;
-import static org.teiid.jboss.Configuration.addAttribute;
-
-import java.util.ResourceBundle;
-
-import org.jboss.dmr.ModelNode;
-import org.jboss.dmr.ModelType;
-
-class TeiidModelDescription {
-
- static void getQueryEngineDescription(ModelNode node, String type, ResourceBundle
bundle) {
- addAttribute(node, Configuration.ENGINE_NAME, type,
bundle.getString(Configuration.ENGINE_NAME+Configuration.DESC), ModelType.STRING, true,
null);
- addAttribute(node, Configuration.MAX_THREADS, type,
bundle.getString(Configuration.MAX_THREADS+DESC),
ModelType.INT, false, "64");
//$NON-NLS-1$
- addAttribute(node, Configuration.MAX_ACTIVE_PLANS, type,
bundle.getString(Configuration.MAX_ACTIVE_PLANS+DESC),
ModelType.INT, false,
"20"); //$NON-NLS-1$
- addAttribute(node, Configuration.USER_REQUEST_SOURCE_CONCURRENCY, type,
bundle.getString(Configuration.USER_REQUEST_SOURCE_CONCURRENCY+DESC),
ModelType.INT,
false, "0"); //$NON-NLS-1$
- addAttribute(node, Configuration.TIME_SLICE_IN_MILLI, type,
bundle.getString(Configuration.TIME_SLICE_IN_MILLI+DESC),
ModelType.INT, false,
"2000"); //$NON-NLS-1$
- addAttribute(node, Configuration.MAX_ROWS_FETCH_SIZE, type,
bundle.getString(Configuration.MAX_ROWS_FETCH_SIZE+DESC),
ModelType.INT, false,
"20480"); //$NON-NLS-1$
- addAttribute(node, Configuration.LOB_CHUNK_SIZE_IN_KB, type,
bundle.getString(Configuration.LOB_CHUNK_SIZE_IN_KB+DESC),
ModelType.INT, false,
"100"); //$NON-NLS-1$
- addAttribute(node, Configuration.QUERY_THRESHOLD_IN_SECS, type,
bundle.getString(Configuration.QUERY_THRESHOLD_IN_SECS+DESC),
ModelType.INT, false,
"600"); //$NON-NLS-1$
- addAttribute(node, Configuration.MAX_SOURCE_ROWS, type,
bundle.getString(Configuration.MAX_SOURCE_ROWS+DESC),
ModelType.INT, false,
"-1"); //$NON-NLS-1$
- addAttribute(node, Configuration.EXCEPTION_ON_MAX_SOURCE_ROWS, type,
bundle.getString(Configuration.EXCEPTION_ON_MAX_SOURCE_ROWS+DESC), ModelType.BOOLEAN,
false, "true"); //$NON-NLS-1$
- addAttribute(node, Configuration.MAX_ODBC_LOB_SIZE_ALLOWED, type,
bundle.getString(Configuration.MAX_ODBC_LOB_SIZE_ALLOWED+DESC),
ModelType.INT, false,
"5242880"); //$NON-NLS-1$
- addAttribute(node, Configuration.EVENT_DISTRIBUTOR_NAME, type,
bundle.getString(Configuration.EVENT_DISTRIBUTOR_NAME+DESC), ModelType.STRING, false,
"teiid/event-distributor"); //$NON-NLS-1$
- addAttribute(node, Configuration.DETECTING_CHANGE_EVENTS, type,
bundle.getString(Configuration.DETECTING_CHANGE_EVENTS+DESC), ModelType.BOOLEAN, false,
"true"); //$NON-NLS-1$
-
- //session stuff
- addAttribute(node, Configuration.SECURITY_DOMAIN, type,
bundle.getString(Configuration.SECURITY_DOMAIN+DESC), ModelType.STRING, false, null);
- addAttribute(node, Configuration.MAX_SESSIONS_ALLOWED, type,
bundle.getString(Configuration.MAX_SESSIONS_ALLOWED+DESC),
ModelType.INT, false,
"5000"); //$NON-NLS-1$
- addAttribute(node, Configuration.SESSION_EXPIRATION_TIME_LIMIT, type,
bundle.getString(Configuration.SESSION_EXPIRATION_TIME_LIMIT+DESC),
ModelType.INT, false,
"0"); //$NON-NLS-1$
-
- //jdbc
- ModelNode jdbcSocketNode = node.get(CHILDREN, Configuration.JDBC);
- jdbcSocketNode.get(TYPE).set(ModelType.OBJECT);
- jdbcSocketNode.get(DESCRIPTION).set(bundle.getString(Configuration.JDBC+DESC));
- jdbcSocketNode.get(REQUIRED).set(false);
- jdbcSocketNode.get(MAX_OCCURS).set(1);
- jdbcSocketNode.get(MIN_OCCURS).set(1);
- getSocketConfig(jdbcSocketNode, type, bundle);
-
- //odbc
- ModelNode odbcSocketNode = node.get(CHILDREN, Configuration.ODBC);
- odbcSocketNode.get(TYPE).set(ModelType.OBJECT);
- odbcSocketNode.get(DESCRIPTION).set(bundle.getString(Configuration.ODBC+DESC));
- odbcSocketNode.get(REQUIRED).set(false);
- odbcSocketNode.get(MAX_OCCURS).set(1);
- odbcSocketNode.get(MIN_OCCURS).set(1);
- getSocketConfig(odbcSocketNode, type, bundle);
- }
-
-
- private static void getSocketConfig(ModelNode node, String type, ResourceBundle bundle)
{
- addAttribute(node, Configuration.SOCKET_ENABLED, type,
bundle.getString(Configuration.SOCKET_ENABLED+DESC), ModelType.BOOLEAN, false,
"true"); //$NON-NLS-1$
- addAttribute(node, Configuration.MAX_SOCKET_THREAD_SIZE, type,
bundle.getString(Configuration.MAX_SOCKET_THREAD_SIZE+DESC),
ModelType.INT, false,
"0"); //$NON-NLS-1$
- addAttribute(node, Configuration.IN_BUFFER_SIZE, type,
bundle.getString(Configuration.IN_BUFFER_SIZE+DESC),
ModelType.INT, false, "0");
//$NON-NLS-1$
- addAttribute(node, Configuration.OUT_BUFFER_SIZE, type,
bundle.getString(Configuration.OUT_BUFFER_SIZE+DESC),
ModelType.INT, false,
"0"); //$NON-NLS-1$
- addAttribute(node, Configuration.SOCKET_BINDING, type,
bundle.getString(Configuration.SOCKET_BINDING+DESC),
ModelType.INT, true, null);
-
- ModelNode sslNode = node.get(CHILDREN, Configuration.SSL);
- sslNode.get(TYPE).set(ModelType.OBJECT);
- sslNode.get(DESCRIPTION).set(bundle.getString(Configuration.SSL+DESC));
- sslNode.get(REQUIRED).set(false);
- sslNode.get(MAX_OCCURS).set(1);
- sslNode.get(MIN_OCCURS).set(0);
- addAttribute(node, Configuration.SSL_MODE, type,
bundle.getString(Configuration.SSL_MODE+DESC), ModelType.STRING, false,
"login"); //$NON-NLS-1$
- addAttribute(node, Configuration.KEY_STORE_FILE, type,
bundle.getString(Configuration.KEY_STORE_FILE+DESC), ModelType.STRING, false, null);
- addAttribute(node, Configuration.KEY_STORE_PASSWD, type,
bundle.getString(Configuration.KEY_STORE_PASSWD+DESC), ModelType.STRING, false, null);
- addAttribute(node, Configuration.KEY_STORE_TYPE, type,
bundle.getString(Configuration.KEY_STORE_TYPE+DESC), ModelType.STRING, false,
"JKS"); //$NON-NLS-1$
- addAttribute(node, Configuration.SSL_PROTOCOL, type,
bundle.getString(Configuration.SSL_PROTOCOL+DESC), ModelType.BOOLEAN, false,
"SSLv3"); //$NON-NLS-1$
- addAttribute(node, Configuration.KEY_MANAGEMENT_ALG, type,
bundle.getString(Configuration.KEY_MANAGEMENT_ALG+DESC), ModelType.STRING, false,
"false"); //$NON-NLS-1$
- addAttribute(node, Configuration.TRUST_FILE, type,
bundle.getString(Configuration.TRUST_FILE+DESC), ModelType.STRING, false, null);
- addAttribute(node, Configuration.TRUST_PASSWD, type,
bundle.getString(Configuration.TRUST_PASSWD+DESC), ModelType.STRING, false, null);
- addAttribute(node, Configuration.AUTH_MODE, type,
bundle.getString(Configuration.AUTH_MODE+DESC), ModelType.STRING, false,
"anonymous"); //$NON-NLS-1$
- }
-}
Modified:
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidServiceNames.java
===================================================================
---
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidServiceNames.java 2011-08-22
14:36:06 UTC (rev 3422)
+++
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidServiceNames.java 2011-08-24
17:35:13 UTC (rev 3423)
@@ -35,7 +35,9 @@
public static ServiceName AUTHORIZATION_VALIDATOR =
ServiceName.JBOSS.append("teiid",
"authorization-validator");//$NON-NLS-1$ //$NON-NLS-2$
private static ServiceName VDB_SVC_BASE = ServiceName.JBOSS.append("teiid",
"vdb"); //$NON-NLS-1$ //$NON-NLS-2$
public static ServiceName OBJECT_SERIALIZER =
ServiceName.JBOSS.append("teiid", "object-serializer"); //$NON-NLS-1$
//$NON-NLS-2$
+ public static ServiceName CACHE_FACTORY = ServiceName.JBOSS.append("teiid",
"cache-factory"); //$NON-NLS-1$ //$NON-NLS-2$
+
public static ServiceName translatorServiceName(String name) {
return TRANSLATOR_BASE.append(name);
}
@@ -49,6 +51,6 @@
}
public static ServiceName executorServiceName(String poolName) {
- return ServiceName.JBOSS.append("thread", "executor", poolName);
+ return ServiceName.JBOSS.append("thread", "executor", poolName);
//$NON-NLS-1$ //$NON-NLS-2$
}
}
Modified:
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidSubsystemParser.java
===================================================================
---
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidSubsystemParser.java 2011-08-22
14:36:06 UTC (rev 3422)
+++
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidSubsystemParser.java 2011-08-24
17:35:13 UTC (rev 3423)
@@ -21,13 +21,14 @@
*/
package org.teiid.jboss;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.ADD;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP_ADDR;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.SUBSYSTEM;
-import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.ADD;
import static org.jboss.as.controller.parsing.ParseUtils.requireNoAttributes;
import java.util.List;
+import java.util.Set;
import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamException;
@@ -49,35 +50,12 @@
if (!node.isDefined()) {
return;
}
- writer.writeStartElement(Element.QUERY_ENGINE_ELEMENT.getLocalName());
- writeQueryEngine(writer, node);
- writer.writeEndElement();
- writer.writeEndElement(); // End of subsystem element
- }
-
- // write the elements according to the schema defined.
- private void writeQueryEngine( XMLExtendedStreamWriter writer, ModelNode node) throws
XMLStreamException {
- writeAttribute(writer, Element.ENGINE_NAME_ATTRIBUTE, node);
- writeElement(writer, Element.ASYNC_THREAD_GROUP_ELEMENT, node);
- writeElement(writer, Element.MAX_THREADS_ELEMENT, node);
- writeElement(writer, Element.MAX_ACTIVE_PLANS_ELEMENT, node);
- writeElement(writer, Element.USER_REQUEST_SOURCE_CONCURRENCY_ELEMENT, node);
- writeElement(writer, Element.TIME_SLICE_IN_MILLI_ELEMENT, node);
- writeElement(writer, Element.MAX_ROWS_FETCH_SIZE_ELEMENT, node);
- writeElement(writer, Element.LOB_CHUNK_SIZE_IN_KB_ELEMENT, node);
- writeElement(writer, Element.AUTHORIZATION_VALIDATOR_MODULE_ELEMENT, node);
- writeElement(writer, Element.POLICY_DECIDER_MODULE_ELEMENT, node);
- writeElement(writer, Element.QUERY_THRESHOLD_IN_SECS_ELEMENT, node);
- writeElement(writer, Element.MAX_SOURCE_ROWS_ELEMENT, node);
- writeElement(writer, Element.EXCEPTION_ON_MAX_SOURCE_ROWS_ELEMENT, node);
- writeElement(writer, Element.MAX_ODBC_LOB_SIZE_ALLOWED_ELEMENT, node);
- writeElement(writer, Element.EVENT_DISTRIBUTOR_NAME_ELEMENT, node);
- writeElement(writer, Element.DETECTING_CHANGE_EVENTS_ELEMENT, node);
- writeElement(writer, Element.JDBC_SECURITY_DOMAIN_ELEMENT, node);
- writeElement(writer, Element.MAX_SESSIONS_ALLOWED_ELEMENT, node);
- writeElement(writer, Element.SESSION_EXPIRATION_TIME_LIMIT_ELEMENT, node);
- writeElement(writer, Element.ALLOW_ENV_FUNCTION_ELEMENT, node);
-
+
+ writeElement(writer, Element.ASYNC_THREAD_GROUP_ELEMENT, node);
+ writeElement(writer, Element.ALLOW_ENV_FUNCTION_ELEMENT, node);
+ writeElement(writer, Element.AUTHORIZATION_VALIDATOR_MODULE_ELEMENT, node);
+ writeElement(writer, Element.POLICY_DECIDER_MODULE_ELEMENT, node);
+
if (has(node, Element.BUFFER_SERVICE_ELEMENT.getLocalName())){
writer.writeStartElement(Element.BUFFER_SERVICE_ELEMENT.getLocalName());
writeBufferService(writer,
node.get(Element.BUFFER_SERVICE_ELEMENT.getLocalName()));
@@ -102,6 +80,53 @@
writer.writeEndElement();
}
+ Set<String> engines =
node.get(Element.QUERY_ENGINE_ELEMENT.getLocalName()).keys();
+ if (engines != null && !engines.isEmpty()) {
+ for (String engine:engines) {
+ writer.writeStartElement(Element.QUERY_ENGINE_ELEMENT.getLocalName());
+ writeQueryEngine(writer,
node.get(Element.QUERY_ENGINE_ELEMENT.getLocalName(), engine));
+ writer.writeEndElement();
+ }
+ }
+
+ Set<String> translators =
node.get(Element.TRANSLATOR_ELEMENT.getLocalName()).keys();
+ if (translators != null && !translators.isEmpty()) {
+ for (String translator:translators) {
+ writer.writeStartElement(Element.TRANSLATOR_ELEMENT.getLocalName());
+ writeTranslator(writer, node.get(Element.TRANSLATOR_ELEMENT.getLocalName(),
translator));
+ writer.writeEndElement();
+ }
+ }
+ writer.writeEndElement(); // End of subsystem element
+ }
+
+ private void writeTranslator(XMLExtendedStreamWriter writer, ModelNode node) throws
XMLStreamException {
+ writeAttribute(writer, Element.TRANSLATOR_NAME_ATTRIBUTE, node);
+ writeAttribute(writer, Element.TRANSLATOR_MODULE_ATTRIBUTE, node);
+ }
+
+ // write the elements according to the schema defined.
+ private void writeQueryEngine( XMLExtendedStreamWriter writer, ModelNode node) throws
XMLStreamException {
+ writeAttribute(writer, Element.ENGINE_NAME_ATTRIBUTE, node);
+
+ writeElement(writer, Element.MAX_THREADS_ELEMENT, node);
+ writeElement(writer, Element.MAX_ACTIVE_PLANS_ELEMENT, node);
+ writeElement(writer, Element.USER_REQUEST_SOURCE_CONCURRENCY_ELEMENT, node);
+ writeElement(writer, Element.TIME_SLICE_IN_MILLI_ELEMENT, node);
+ writeElement(writer, Element.MAX_ROWS_FETCH_SIZE_ELEMENT, node);
+ writeElement(writer, Element.LOB_CHUNK_SIZE_IN_KB_ELEMENT, node);
+ writeElement(writer, Element.AUTHORIZATION_VALIDATOR_MODULE_ELEMENT, node);
+ writeElement(writer, Element.POLICY_DECIDER_MODULE_ELEMENT, node);
+ writeElement(writer, Element.QUERY_THRESHOLD_IN_SECS_ELEMENT, node);
+ writeElement(writer, Element.MAX_SOURCE_ROWS_ELEMENT, node);
+ writeElement(writer, Element.EXCEPTION_ON_MAX_SOURCE_ROWS_ELEMENT, node);
+ writeElement(writer, Element.MAX_ODBC_LOB_SIZE_ALLOWED_ELEMENT, node);
+ writeElement(writer, Element.EVENT_DISTRIBUTOR_NAME_ELEMENT, node);
+ writeElement(writer, Element.DETECTING_CHANGE_EVENTS_ELEMENT, node);
+ writeElement(writer, Element.JDBC_SECURITY_DOMAIN_ELEMENT, node);
+ writeElement(writer, Element.MAX_SESSIONS_ALLOWED_ELEMENT, node);
+ writeElement(writer, Element.SESSION_EXPIRATION_TIME_LIMIT_ELEMENT, node);
+
//jdbc
if (has(node, Element.JDBC_ELEMENT.getLocalName())){
writer.writeStartElement(Element.JDBC_ELEMENT.getLocalName());
@@ -204,33 +229,57 @@
case TEIID_1_0: {
Element element = Element.forName(reader.getLocalName());
switch (element) {
- case QUERY_ENGINE_ELEMENT:
- ModelNode engineNode = parseQueryEngine(reader, new
ModelNode());
-
- final ModelNode engineAddress = address.clone();
- engineAddress.add(Configuration.QUERY_ENGINE,
engineNode.require(Configuration.ENGINE_NAME).asString());
- engineAddress.protect();
- engineNode.get(OP).set(ADD);
- engineNode.get(OP_ADDR).set(engineAddress);
-
- list.add(engineNode);
- break;
-
- case TRANSLATOR_ELEMENT:
- ModelNode translatorNode = parseTranslator(reader, new
ModelNode());
+ case ALLOW_ENV_FUNCTION_ELEMENT:
+
bootServices.get(reader.getLocalName()).set(Boolean.parseBoolean(reader.getElementText()));
+ break;
- final ModelNode translatorAddress = address.clone();
- translatorAddress.add(Configuration.QUERY_ENGINE,
translatorNode.require(Configuration.TRANSLATOR_NAME).asString());
- translatorAddress.protect();
+ case AUTHORIZATION_VALIDATOR_MODULE_ELEMENT:
+ case POLICY_DECIDER_MODULE_ELEMENT:
+ case ASYNC_THREAD_GROUP_ELEMENT:
+ bootServices.get(reader.getLocalName()).set(reader.getElementText());
+ break;
+
+ // complex types
+ case BUFFER_SERVICE_ELEMENT:
+ bootServices.get(reader.getLocalName()).set(parseBufferConfiguration(reader));
+ break;
+ case RESULTSET_CACHE_ELEMENT:
+ bootServices.get(reader.getLocalName()).set(parseCacheConfiguration(reader));
+ break;
+ case PREPAREDPLAN_CACHE_ELEMENT:
+ bootServices.get(reader.getLocalName()).set(parseCacheConfiguration(reader));
+ break;
+ case CACHE_FACORY_ELEMENT:
+
bootServices.get(reader.getLocalName()).set(parseCacheFacoryConfiguration(reader));
+ break;
+
+ case QUERY_ENGINE_ELEMENT:
+ ModelNode engineNode = parseQueryEngine(reader, new
ModelNode());
+
+ final ModelNode engineAddress = address.clone();
+ engineAddress.add(Configuration.QUERY_ENGINE,
engineNode.require(Configuration.ENGINE_NAME).asString());
+ engineAddress.protect();
+ engineNode.get(OP).set(ADD);
+ engineNode.get(OP_ADDR).set(engineAddress);
+
+ list.add(engineNode);
+ break;
+
+ case TRANSLATOR_ELEMENT:
+ ModelNode translatorNode = parseTranslator(reader, new
ModelNode());
+
+ final ModelNode translatorAddress = address.clone();
+ translatorAddress.add(Configuration.TRANSLATOR,
translatorNode.require(Configuration.TRANSLATOR_NAME).asString());
+ translatorAddress.protect();
+
+ translatorNode.get(OP).set(ADD);
+ translatorNode.get(OP_ADDR).set(translatorAddress);
+
+ list.add(translatorNode);
+ break;
- translatorNode.get(OP).set(ADD);
- translatorNode.get(OP_ADDR).set(translatorAddress);
-
- list.add(translatorNode);
- break;
-
- default:
- throw ParseUtils.unexpectedElement(reader);
+ default:
+ throw ParseUtils.unexpectedElement(reader);
}
break;
}
@@ -279,25 +328,9 @@
//Strings
case EVENT_DISTRIBUTOR_NAME_ELEMENT:
case JDBC_SECURITY_DOMAIN_ELEMENT:
- case ASYNC_THREAD_GROUP_ELEMENT:
- case AUTHORIZATION_VALIDATOR_MODULE_ELEMENT:
- case POLICY_DECIDER_MODULE_ELEMENT:
node.get(reader.getLocalName()).set(reader.getElementText());
break;
- // complex types
- case BUFFER_SERVICE_ELEMENT:
- node.get(reader.getLocalName()).set(parseBufferConfiguration(reader));
- break;
- case RESULTSET_CACHE_ELEMENT:
- node.get(reader.getLocalName()).set(parseCacheConfiguration(reader));
- break;
- case PREPAREDPLAN_CACHE_ELEMENT:
- node.get(reader.getLocalName()).set(parseCacheConfiguration(reader));
- break;
- case CACHE_FACORY_ELEMENT:
- node.get(reader.getLocalName()).set(parseCacheFacoryConfiguration(reader));
- break;
case JDBC_ELEMENT:
node.get(reader.getLocalName()).set(parseSocketConfiguration(reader));
break;
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorAdd.java
===================================================================
---
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorAdd.java 2011-08-22
14:36:06 UTC (rev 3422)
+++
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorAdd.java 2011-08-24
17:35:13 UTC (rev 3423)
@@ -55,9 +55,8 @@
operation.get(OPERATION_NAME).set(ADD);
operation.get(DESCRIPTION).set(bundle.getString("translator.add"));
//$NON-NLS-1$
- ModelNode translator = operation.get(REQUEST_PROPERTIES,
Configuration.TRANSLATOR);
- addAttribute(translator, Configuration.TRANSLATOR_NAME, ATTRIBUTES,
bundle.getString(Configuration.TRANSLATOR_NAME+Configuration.DESC), ModelType.STRING,
true, null);
- addAttribute(translator, Configuration.TRANSLATOR_MODULE, ATTRIBUTES,
bundle.getString(Configuration.TRANSLATOR_MODULE+Configuration.DESC), ModelType.STRING,
true, null);
+ addAttribute(operation, Configuration.TRANSLATOR_NAME, ATTRIBUTES,
bundle.getString(Configuration.TRANSLATOR_NAME+Configuration.DESC), ModelType.STRING,
true, null);
+ addAttribute(operation, Configuration.TRANSLATOR_MODULE, ATTRIBUTES,
bundle.getString(Configuration.TRANSLATOR_MODULE+Configuration.DESC), ModelType.STRING,
true, null);
return operation;
}
@@ -66,8 +65,7 @@
final ModelNode address = operation.require(OP_ADDR);
final PathAddress pathAddress = PathAddress.pathAddress(address);
- ModelNode translator = operation.require(Configuration.TRANSLATOR);
- final String moduleName =
translator.require(Configuration.TRANSLATOR_MODULE).asString();
+ final String moduleName =
operation.require(Configuration.TRANSLATOR_MODULE).asString();
model.get(NAME).set(pathAddress.getLastElement().getValue());
model.get(Configuration.TRANSLATOR_MODULE).set(moduleName);
@@ -77,9 +75,8 @@
protected void performRuntime(final OperationContext context, final ModelNode
operation, final ModelNode model,
final ServiceVerificationHandler verificationHandler, final
List<ServiceController<?>> newControllers) throws OperationFailedException {
- ModelNode translator = operation.require(Configuration.TRANSLATOR);
- final String name = translator.require(Configuration.TRANSLATOR_NAME).asString();
- final String moduleName =
translator.require(Configuration.TRANSLATOR_MODULE).asString();
+ final String name = operation.require(Configuration.TRANSLATOR_NAME).asString();
+ final String moduleName =
operation.require(Configuration.TRANSLATOR_MODULE).asString();
final ServiceTarget target = context.getServiceTarget();
Deleted:
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorRepositoryService.java
===================================================================
---
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorRepositoryService.java 2011-08-22
14:36:06 UTC (rev 3422)
+++
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorRepositoryService.java 2011-08-24
17:35:13 UTC (rev 3423)
@@ -1,50 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.jboss;
-
-import org.jboss.msc.service.Service;
-import org.jboss.msc.service.StartContext;
-import org.jboss.msc.service.StartException;
-import org.jboss.msc.service.StopContext;
-import org.teiid.dqp.internal.datamgr.TranslatorRepository;
-
-public class TranslatorRepositoryService implements Service<TranslatorRepository>
{
- private TranslatorRepository repo;
-
- public TranslatorRepositoryService(TranslatorRepository repo) {
- this.repo = repo;
- }
-
- @Override
- public void start(StartContext context) throws StartException {
- }
-
- @Override
- public void stop(StopContext context) {
- }
-
- @Override
- public TranslatorRepository getValue() throws IllegalStateException,
IllegalArgumentException {
- return repo;
- }
-
-}
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBDeployer.java
===================================================================
---
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBDeployer.java 2011-08-22
14:36:06 UTC (rev 3422)
+++
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBDeployer.java 2011-08-24
17:35:13 UTC (rev 3423)
@@ -33,7 +33,6 @@
import org.teiid.adminapi.impl.ModelMetaData;
import org.teiid.adminapi.impl.VDBMetaData;
import org.teiid.adminapi.impl.VDBTranslatorMetaData;
-import org.teiid.deployers.MetadataStoreGroup;
import org.teiid.deployers.TeiidAttachments;
import org.teiid.deployers.UDFMetaData;
import org.teiid.deployers.VDBRepository;
@@ -94,21 +93,14 @@
deployment.addAttchment(UDFMetaData.class, udf);
}
- // get the metadata store of the VDB (this is build in parse stage)
- MetadataStoreGroup store =
deploymentUnit.getAttachment(TeiidAttachments.METADATA_STORE);
- if (store != null) {
- deployment.addAttchment(MetadataStoreGroup.class, store);
- }
-
IndexMetadataFactory indexFactory =
deploymentUnit.getAttachment(TeiidAttachments.INDEX_METADATA);
if (indexFactory != null) {
deployment.addAttchment(IndexMetadataFactory.class, indexFactory);
}
- // removethe metadata objects as attachments
+ // remove the metadata objects as attachments
deploymentUnit.removeAttachment(TeiidAttachments.INDEX_METADATA);
deploymentUnit.removeAttachment(TeiidAttachments.UDF_METADATA);
- deploymentUnit.removeAttachment(TeiidAttachments.METADATA_STORE);
// build a VDB service
VDBService vdb = new VDBService(deployment);
Modified:
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBParserDeployer.java
===================================================================
---
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBParserDeployer.java 2011-08-22
14:36:06 UTC (rev 3422)
+++
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBParserDeployer.java 2011-08-24
17:35:13 UTC (rev 3423)
@@ -21,7 +21,6 @@
*/
package org.teiid.jboss;
-import java.io.File;
import java.io.IOException;
import java.util.List;
@@ -37,7 +36,8 @@
import org.teiid.adminapi.Model;
import org.teiid.adminapi.impl.ModelMetaData;
import org.teiid.adminapi.impl.VDBMetaData;
-import org.teiid.deployers.*;
+import org.teiid.deployers.TeiidAttachments;
+import org.teiid.deployers.UDFMetaData;
import org.teiid.logging.LogConstants;
import org.teiid.logging.LogManager;
import org.teiid.metadata.VdbConstants;
@@ -50,12 +50,8 @@
* This file loads the "vdb.xml" file inside a ".vdb" file, along
with all the metadata in the .INDEX files
*/
public class VDBParserDeployer implements DeploymentUnitProcessor {
- private ObjectSerializer serializer;
- private VDBRepository vdbRepository;
- public VDBParserDeployer(VDBRepository repo, ObjectSerializer serializer) {
- this.vdbRepository = repo;
- this.serializer = serializer;
+ public VDBParserDeployer() {
}
public void deploy(final DeploymentPhaseContext phaseContext) throws
DeploymentUnitProcessingException {
@@ -157,24 +153,9 @@
// build the metadata store
if (imf != null) {
imf.addEntriesPlusVisibilities(file, vdb);
-
- // add the cached store.
- File cacheFile = VDBDeployer.buildCachedVDBFileName(this.serializer, file, vdb);
- // check to see if the vdb has been modified when server is down; if it is then clear
the old files
- if (this.serializer.isStale(cacheFile, file.getLastModified())) {
- this.serializer.removeAttachments(file);
- LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB", file.getName(),
"old cached metadata has been removed"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- MetadataStoreGroup stores = this.serializer.loadSafe(cacheFile,
MetadataStoreGroup.class);
- if (stores == null) {
- // start to build the new metadata
- stores = new MetadataStoreGroup();
- stores.addStore(imf.getMetadataStore(vdbRepository.getSystemStore().getDatatypes()));
- }
- else {
- LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB", file.getName(),
"was loaded from cached metadata"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- deploymentUnit.putAttachment(TeiidAttachments.METADATA_STORE, stores);
+
+ // This time stamp is used to check if the VDB is modified after the metadata is
written to disk
+ vdb.addProperty(VDBService.VDB_LASTMODIFIED_TIME,
String.valueOf(file.getLastModified()));
}
if (udf != null) {
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBService.java
===================================================================
---
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBService.java 2011-08-22
14:36:06 UTC (rev 3422)
+++
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBService.java 2011-08-24
17:35:13 UTC (rev 3423)
@@ -1,3 +1,24 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
package org.teiid.jboss;
import java.io.File;
@@ -6,16 +27,9 @@
import java.util.*;
import java.util.concurrent.Executor;
-import javax.resource.spi.work.WorkManager;
-
-import org.jboss.as.server.deployment.Attachments;
-import org.jboss.as.server.deployment.DeploymentUnitProcessingException;
-import org.jboss.msc.service.Service;
-import org.jboss.msc.service.StartContext;
-import org.jboss.msc.service.StartException;
-import org.jboss.msc.service.StopContext;
+import org.jboss.msc.service.*;
+import org.jboss.msc.service.ServiceContainer.TerminateListener;
import org.jboss.msc.value.InjectedValue;
-import org.jboss.vfs.VirtualFile;
import org.teiid.adminapi.Model;
import org.teiid.adminapi.Translator;
import org.teiid.adminapi.VDB;
@@ -39,6 +53,7 @@
import org.teiid.translator.TranslatorException;
public class VDBService implements Service<VDBMetaData> {
+ public static final String VDB_LASTMODIFIED_TIME = "VDB_LASTMODIFIED_TIME";
//$NON-NLS-1$
private VDBMetaData vdb;
private final InjectedValue<VDBRepository> vdbRepositoryInjector = new
InjectedValue<VDBRepository>();
private final InjectedValue<TranslatorRepository> translatorRepositoryInjector =
new InjectedValue<TranslatorRepository>();
@@ -53,9 +68,14 @@
public void start(StartContext context) throws StartException {
ConnectorManagerRepository cmr = new ConnectorManagerRepository();
TranslatorRepository repo = new TranslatorRepository();
+
+ // check if this is a VDB with index files, if there are then build the
TransformationMetadata
+ UDFMetaData udf = this.vdb.getAttachment(UDFMetaData.class);
+ IndexMetadataFactory indexFactory =
this.vdb.getAttachment(IndexMetadataFactory.class);
+ long vdbModifiedTime =
Long.parseLong(vdb.getPropertyValue(VDBService.VDB_LASTMODIFIED_TIME));
// add required connector managers; if they are not already there
- for (Translator t: vdb.getOverrideTranslators()) {
+ for (Translator t: this.vdb.getOverrideTranslators()) {
VDBTranslatorMetaData data = (VDBTranslatorMetaData)t;
String type = data.getType();
@@ -70,20 +90,37 @@
repo.addTranslatorMetadata(data.getName(), data);
}
- createConnectorManagers(cmr, repo, vdb);
-
- // check if this is a VDB with index files, if there are then build the
TransformationMetadata
- UDFMetaData udf = vdb.getAttachment(UDFMetaData.class);
- MetadataStoreGroup store = vdb.getAttachment(MetadataStoreGroup.class);
-
+ createConnectorManagers(cmr, repo, this.vdb);
+
+ // check to see if the vdb has been modified when server is down; if it is then clear
the old files
+ if (getSerializer().isStale(this.vdb, vdbModifiedTime)) {
+ getSerializer().removeAttachments(this.vdb);
+ LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB ", vdb.getName(), "
old cached metadata has been removed"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
boolean asynchLoad = false;
- boolean preview = vdb.isPreview();
+ boolean preview = this.vdb.isPreview();
// if store is null and vdb dynamic vdb then try to get the metadata
- if (store == null && vdb.isDynamic()) {
+ MetadataStoreGroup store = null;
+ if (this.vdb.isDynamic()) {
store = new MetadataStoreGroup();
- asynchLoad = buildDynamicMetadataStore(vdb, store, cmr);
+ asynchLoad = buildDynamicMetadataStore(this.vdb, store, cmr);
}
+ else if (indexFactory != null){
+ store = getSerializer().loadSafe(getSerializer().buildVDBFile(this.vdb),
MetadataStoreGroup.class);
+ if (store == null) {
+ store = new MetadataStoreGroup();
+ try {
+ store.addStore(indexFactory.getMetadataStore(getVDBRepository().getSystemStore().getDatatypes()));
+ } catch (IOException e) {
+ throw new StartException(e);
+ }
+ }
+ else {
+ LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB ", vdb.getName(), "
was loaded from cached metadata"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
// allow empty vdbs for enabling the preview functionality
if (preview && store == null) {
@@ -91,27 +128,29 @@
}
if (store == null) {
- LogManager.logError(LogConstants.CTX_RUNTIME,
RuntimePlugin.Util.getString("failed_matadata_load", vdb.getName(),
vdb.getVersion())); //$NON-NLS-1$
+ LogManager.logError(LogConstants.CTX_RUNTIME,
RuntimePlugin.Util.getString("failed_matadata_load", this.vdb.getName(),
vdb.getVersion())); //$NON-NLS-1$
}
LinkedHashMap<String, Resource> visibilityMap = null;
- IndexMetadataFactory indexFactory = vdb.getAttachment(IndexMetadataFactory.class);
+
if (indexFactory != null) {
visibilityMap = indexFactory.getEntriesPlusVisibilities();
}
try {
// add transformation metadata to the repository.
- getVDBRepository().addVDB(vdb, store, visibilityMap, udf, cmr);
+ getVDBRepository().addVDB(this.vdb, store, visibilityMap, udf, cmr);
} catch (VirtualDatabaseException e) {
throw new StartException(e);
}
boolean valid = true;
- synchronized (vdb) {
+ synchronized (this.vdb) {
if (indexFactory != null) {
try {
- saveMetadataStore(vdb, store);
+ if (getSerializer().saveAttachment(getSerializer().buildVDBFile(this.vdb),store,
false)) {
+ LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB ", vdb.getName(),
" metadata has been cached to data folder"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
} catch (IOException e1) {
LogManager.logWarning(LogConstants.CTX_RUNTIME, e1,
RuntimePlugin.Util.getString("vdb_save_failed",
vdb.getName()+"."+vdb.getVersion())); //$NON-NLS-1$ //$NON-NLS-2$
}
@@ -142,13 +181,19 @@
@Override
public void stop(StopContext context) {
- getVDBRepository().removeVDB(vdb.getName(), vdb.getVersion());
- vdb.setRemoved(true);
-
- deleteMetadataStore(vdb);
+ getVDBRepository().removeVDB(this.vdb.getName(), this.vdb.getVersion());
+ this.vdb.setRemoved(true);
- LogManager.logInfo(LogConstants.CTX_RUNTIME,
RuntimePlugin.Util.getString("vdb_undeployed", vdb)); //$NON-NLS-1$
-
+ context.getController().getServiceContainer().addTerminateListener(new
TerminateListener() {
+ @Override
+ public void handleTermination(Info info) {
+ if (info.getShutdownInitiated() < 0) {
+ getSerializer().removeAttachments(vdb);
+ LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB "+vdb.getName()+"
metadata removed"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+ });
+ LogManager.logInfo(LogConstants.CTX_RUNTIME,
RuntimePlugin.Util.getString("vdb_undeployed", this.vdb)); //$NON-NLS-1$
}
@Override
@@ -239,7 +284,7 @@
}
final boolean cache =
"cached".equalsIgnoreCase(vdb.getPropertyValue("UseConnectorMetadata"));
//$NON-NLS-1$ //$NON-NLS-2$
- final File cacheFile = buildCachedModelFileName(vdb, model.getName());
+ final File cacheFile = getSerializer().buildModelFile(this.vdb, model.getName());
boolean loaded = false;
if (cache) {
MetadataStore store = getSerializer().loadSafe(cacheFile, MetadataStore.class);
@@ -297,7 +342,7 @@
try {
MetadataStore store = cm.getMetadata(model.getName(),
getVDBRepository().getBuiltinDatatypes(), model.getProperties());
if (cache) {
- getSerializer().saveAttachment(cacheFile, store);
+ getSerializer().saveAttachment(cacheFile, store, false);
}
vdbStore.addStore(store);
loaded = true;
@@ -336,31 +381,7 @@
return loaded;
}
-
- private void saveMetadataStore(VDBMetaData vdb, MetadataStoreGroup store) throws
IOException {
- File cacheFileName = buildCachedVDBFileName(getSerializer(), vdb);
- if (!cacheFileName.exists()) {
- getSerializer().saveAttachment(cacheFileName,store);
- LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB "+vdb.getName()+"
metadata has been cached to "+ cacheFileName); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- private void deleteMetadataStore(VDBMetaData vdb) {
- if (!unit.exists() || !shutdownListener.isShutdownInProgress()) {
- getSerializer().removeAttachments(vdb.getName()+"_"+vdb.getVersion());
//$NON-NLS-1$
- LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB "+vdb.getName()+"
metadata removed"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
-
- private File buildCachedModelFileName(VDBMetaData vdb, String modelName) {
- return getSerializer().getAttachmentPath(vdb.getName()+"_"+vdb.getVersion(),
vdb.getName()+"_"+vdb.getVersion()+"_"+modelName); //$NON-NLS-1$
//$NON-NLS-2$ //$NON-NLS-3$
- }
-
- static File buildCachedVDBFileName(ObjectSerializer serializer, VDBMetaData vdb) {
- return serializer.getAttachmentPath(vdb.getName()+"_"+vdb.getVersion(),
vdb.getName()+"_"+vdb.getVersion()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
+
public InjectedValue<VDBRepository> getVDBRepositoryInjector(){
return this.vdbRepositoryInjector;
}
Modified:
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
===================================================================
---
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2011-08-22
14:36:06 UTC (rev 3422)
+++
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2011-08-24
17:35:13 UTC (rev 3423)
@@ -107,7 +107,6 @@
private transient ILogon logon;
private transient ClientServiceRegistryImpl csr = new ClientServiceRegistryImpl();
private transient VDBRepository vdbRepository;
- private transient TranslatorRepository translatorRepository;
private long sessionMaxLimit = SessionService.DEFAULT_MAX_SESSIONS;
private long sessionExpirationTimeLimit = SessionService.DEFAULT_SESSION_EXPIRATION;
@@ -117,18 +116,17 @@
private transient EventDistributor eventDistributorProxy;
private transient ContainerLifeCycleListener lifecycleListener;
- // TODO: remove public?
- public final InjectedValue<WorkManager> workManagerInjector = new
InjectedValue<WorkManager>();
- public final InjectedValue<XATerminator> xaTerminatorInjector = new
InjectedValue<XATerminator>();
- public final InjectedValue<TransactionManager> txnManagerInjector = new
InjectedValue<TransactionManager>();
- public final InjectedValue<SocketBinding> jdbcSocketBindingInjector = new
InjectedValue<SocketBinding>();
- public final InjectedValue<BufferServiceImpl> bufferServiceInjector = new
InjectedValue<BufferServiceImpl>();
- public final InjectedValue<SocketBinding> odbcSocketBindingInjector = new
InjectedValue<SocketBinding>();
- public final InjectedValue<TranslatorRepository> translatorRepositoryInjector =
new InjectedValue<TranslatorRepository>();
- public final InjectedValue<VDBRepository> vdbRepositoryInjector = new
InjectedValue<VDBRepository>();
- public final InjectedValue<AuthorizationValidator> authorizationValidatorInjector
= new InjectedValue<AuthorizationValidator>();
+ private final InjectedValue<WorkManager> workManagerInjector = new
InjectedValue<WorkManager>();
+ private final InjectedValue<XATerminator> xaTerminatorInjector = new
InjectedValue<XATerminator>();
+ private final InjectedValue<TransactionManager> txnManagerInjector = new
InjectedValue<TransactionManager>();
+ private final InjectedValue<SocketBinding> jdbcSocketBindingInjector = new
InjectedValue<SocketBinding>();
+ private final InjectedValue<BufferServiceImpl> bufferServiceInjector = new
InjectedValue<BufferServiceImpl>();
+ private final InjectedValue<SocketBinding> odbcSocketBindingInjector = new
InjectedValue<SocketBinding>();
+ private final InjectedValue<TranslatorRepository> translatorRepositoryInjector =
new InjectedValue<TranslatorRepository>();
+ private final InjectedValue<VDBRepository> vdbRepositoryInjector = new
InjectedValue<VDBRepository>();
+ private final InjectedValue<AuthorizationValidator> authorizationValidatorInjector
= new InjectedValue<AuthorizationValidator>();
+ private final InjectedValue<CacheFactory> cachefactoryInjector = new
InjectedValue<CacheFactory>();
-
public final ConcurrentMap<String, SecurityDomainContext> securityDomains = new
ConcurrentHashMap<String, SecurityDomainContext>();
private LinkedList<String> securityDomainNames = new LinkedList<String>();
private String instanceName;
@@ -154,12 +152,12 @@
@Override
public void start(StartContext context) {
- setWorkManager(this.workManagerInjector.getValue());
- setXATerminator(xaTerminatorInjector.getValue());
- setTransactionManager(txnManagerInjector.getValue());
- setTranslatorRepository(translatorRepositoryInjector.getValue());
+ this.transactionServerImpl.setWorkManager(getWorkManagerInjector().getValue());
+ this.transactionServerImpl.setXaTerminator(getXaTerminatorInjector().getValue());
+ this.transactionServerImpl.setTransactionManager(getTxnManagerInjector().getValue());
+
setVDBRepository(vdbRepositoryInjector.getValue());
- setAuthorizationValidator(authorizationValidatorInjector.getValue());
+ setAuthorizationValidator(getAuthorizationValidatorInjector().getValue());
this.sessionService = new SessionServiceImpl();
if (!this.securityDomainNames.isEmpty()) {
@@ -196,6 +194,7 @@
}
this.dqpCore.setMetadataRepository(this.vdbRepository.getMetadataRepository());
this.dqpCore.setEventDistributor(this.eventDistributor);
+ this.dqpCore.setCacheFactory(getCachefactoryInjector().getValue());
this.dqpCore.start(this);
this.eventDistributorProxy =
(EventDistributor)Proxy.newProxyInstance(Module.getCallerModule().getClassLoader(), new
Class[] {EventDistributor.class}, new InvocationHandler() {
@@ -353,18 +352,7 @@
this.odbcSocketConfiguration = socketConfig;
}
- public void setXATerminator(XATerminator xaTerminator){
- this.transactionServerImpl.setXaTerminator(xaTerminator);
- }
- public void setTransactionManager(TransactionManager transactionManager) {
- this.transactionServerImpl.setTransactionManager(transactionManager);
- }
-
- public void setWorkManager(WorkManager mgr) {
- this.transactionServerImpl.setWorkManager(mgr);
- }
-
public void setBufferService(BufferService service) {
this.dqpCore.setBufferService(service);
}
@@ -482,10 +470,6 @@
this.vdbRepository.mergeVDBs(sourceVDBName, sourceVDBVersion, targetVDBName,
targetVDBVersion);
}
- public void setCacheFactory(CacheFactory factory) {
- this.dqpCore.setCacheFactory(factory);
- }
-
@Override
public List<List> executeQuery(final String vdbName, final int version, final
String command, final long timoutInMilli) throws AdminException {
@@ -620,12 +604,12 @@
@Override
public void updateMatViewRow(String vdbName, int vdbVersion, String schema,
String viewName, List<?> tuple, boolean delete) {
- this.dqpCore.updateMatViewRow(getcontextProvider(), vdbName, vdbVersion, schema,
viewName, tuple, delete);
+ this.dqpCore.updateMatViewRow(getContextProvider(), vdbName, vdbVersion, schema,
viewName, tuple, delete);
}
@Override
public void refreshMatView(final String vdbName, final int vdbVersion, final String
viewName) {
- this.dqpCore.refreshMatView(getcontextProvider(), vdbName, vdbVersion, viewName);
+ this.dqpCore.refreshMatView(getContextProvider(), vdbName, vdbVersion, viewName);
}
@Override
@@ -764,7 +748,7 @@
this.lifecycleListener.addListener(new
ContainerLifeCycleListener.LifeCycleEventListener() {
@Override
public void onStartupFinish() {
- dqpCore.synchronizeInternalMaterializedViews(getcontextProvider());
+ dqpCore.synchronizeInternalMaterializedViews(getContextProvider());
}
@Override
public void onShutdownStart() {
@@ -797,18 +781,14 @@
}
public List<VDBTranslatorMetaData> getTranslators(){
- return this.translatorRepository.getTranslators();
+ return getTranslatorRepositoryInjector().getValue().getTranslators();
}
public VDBTranslatorMetaData getTranslator(String translatorName) {
- return this.translatorRepository.getTranslatorMetaData(translatorName);
+ return
getTranslatorRepositoryInjector().getValue().getTranslatorMetaData(translatorName);
}
- public void setTranslatorRepository(TranslatorRepository translatorRepo) {
- this.translatorRepository = translatorRepo;
- }
-
- private DQPCore.ContextProvider getcontextProvider() {
+ private DQPCore.ContextProvider getContextProvider() {
return new DQPCore.ContextProvider() {
@Override
public DQPWorkContext getContext(final String vdbName, final int vdbVersion) {
@@ -830,4 +810,44 @@
public void setContainerLifeCycleListener(ContainerLifeCycleListener listener) {
this.lifecycleListener = listener;
}
+
+ public InjectedValue<CacheFactory> getCachefactoryInjector() {
+ return cachefactoryInjector;
+ }
+
+ public InjectedValue<TranslatorRepository> getTranslatorRepositoryInjector() {
+ return translatorRepositoryInjector;
+ }
+
+ public InjectedValue<VDBRepository> getVdbRepositoryInjector() {
+ return vdbRepositoryInjector;
+ }
+
+ public InjectedValue<AuthorizationValidator> getAuthorizationValidatorInjector()
{
+ return authorizationValidatorInjector;
+ }
+
+ public InjectedValue<BufferServiceImpl> getBufferServiceInjector() {
+ return bufferServiceInjector;
+ }
+
+ public InjectedValue<SocketBinding> getJdbcSocketBindingInjector() {
+ return jdbcSocketBindingInjector;
+ }
+
+ public InjectedValue<TransactionManager> getTxnManagerInjector() {
+ return txnManagerInjector;
+ }
+
+ public InjectedValue<XATerminator> getXaTerminatorInjector() {
+ return xaTerminatorInjector;
+ }
+
+ public InjectedValue<WorkManager> getWorkManagerInjector() {
+ return workManagerInjector;
+ }
+
+ public InjectedValue<SocketBinding> getOdbcSocketBindingInjector() {
+ return odbcSocketBindingInjector;
+ }
}
Modified:
branches/as7/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties
===================================================================
---
branches/as7/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties 2011-08-22
14:36:06 UTC (rev 3422)
+++
branches/as7/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties 2011-08-24
17:35:13 UTC (rev 3423)
@@ -47,7 +47,7 @@
template_not_found=Template not found for {0}
admin_executing=JOPR admin {0} is executing command {1}
error_adding_translator=Error loading the Translator {0}. Execution Factory class is not
valid class or not defined.
-failed_load_module=Failed to load module {0} for translator {1}
+failed_load_module=Failed to load module "{0}"
translator.add=Add Translator
translator.remove=Remove Translator
@@ -63,6 +63,8 @@
jdbc.describe=Remote JDBC Access Configuration
admin.describe=Remote Admin Access Configuration
odbc.describe=ODBC Access Configuration
+authorization-validator-module.describe=Authorization Module; Implementation of
org.teiid.dqp.internal.process.AuthorizationValidator class.
+policy-decider-module.describe=Policy Module; Implementation of org.teiid.PolicyDecider
class
#Query-ENGINE
jndi-name.describe=JNDI name of the Teiid Query Engine
@@ -184,8 +186,10 @@
socket-binding.not_defined=Teiid socket binding not defined for JDBC or ODBC port.
name.describe = Name of the subsystem
+module.describe = Name of the implementing module
engine.remove = Remove Teiid query engine
engine.add = Add Teiid query engine
+translator.describe = Teiid Translators
translator.add = Add Teiid translator
translator.remove = Remove Teiid translator
teiid-boot.add = Teiid boot services
\ No newline at end of file
Modified: branches/as7/jboss-integration/src/main/resources/schema/jboss-teiid.xsd
===================================================================
--- branches/as7/jboss-integration/src/main/resources/schema/jboss-teiid.xsd 2011-08-22
14:36:06 UTC (rev 3422)
+++ branches/as7/jboss-integration/src/main/resources/schema/jboss-teiid.xsd 2011-08-24
17:35:13 UTC (rev 3423)
@@ -83,7 +83,7 @@
</xs:annotation>
</xs:element>
- <xs:element name="query-engine"
type="runtime-engine-type" maxOccurs="1" minOccurs="1">
+ <xs:element name="query-engine"
type="runtime-engine-type" maxOccurs="2" minOccurs="1">
<xs:annotation>
<xs:documentation>Main Teiid runtime engine
configuration</xs:documentation>
</xs:annotation>
@@ -240,7 +240,7 @@
<xs:documentation>Maximum size of lob allowed through ODBC
connection in bytes (default 5MB)</xs:documentation>
</xs:annotation>
</xs:element>
- <xs:element name="event-distributor-name"
type="xs:string" minOccurs="1" maxOccurs="1">
+ <xs:element name="event-distributor-name"
type="xs:string" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation>The JNDI name of the Teiid Event
Distributor</xs:documentation>
</xs:annotation>
@@ -276,6 +276,7 @@
</xs:annotation>
</xs:element>
</xs:sequence>
+ <xs:attribute name="name" type="xs:string"
use="required"/>
</xs:complexType>
<xs:complexType name="authorization-validator-type">
Added:
branches/as7/jboss-integration/src/test/java/org/teiid/jboss/MockXMLExtendedWriter.java
===================================================================
---
branches/as7/jboss-integration/src/test/java/org/teiid/jboss/MockXMLExtendedWriter.java
(rev 0)
+++
branches/as7/jboss-integration/src/test/java/org/teiid/jboss/MockXMLExtendedWriter.java 2011-08-24
17:35:13 UTC (rev 3423)
@@ -0,0 +1,227 @@
+package org.teiid.jboss;
+
+import java.util.Iterator;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.jboss.staxmapper.XMLExtendedStreamWriter;
+
+public class MockXMLExtendedWriter implements XMLExtendedStreamWriter {
+ private XMLStreamWriter writer;
+
+ public MockXMLExtendedWriter(XMLStreamWriter writer) {
+ this.writer = writer;
+ }
+
+ public void writeStartElement(String localName) throws XMLStreamException {
+ writer.writeStartElement(localName);
+ }
+
+ public void writeStartElement(String namespaceURI, String localName)
+ throws XMLStreamException {
+ writer.writeStartElement(namespaceURI, localName);
+ }
+
+ public void writeStartElement(String prefix, String localName,
+ String namespaceURI) throws XMLStreamException {
+ writer.writeStartElement(prefix, localName, namespaceURI);
+ }
+
+ public void writeEmptyElement(String namespaceURI, String localName)
+ throws XMLStreamException {
+ writer.writeEmptyElement(namespaceURI, localName);
+ }
+
+ public void writeEmptyElement(String prefix, String localName,
+ String namespaceURI) throws XMLStreamException {
+ writer.writeEmptyElement(prefix, localName, namespaceURI);
+ }
+
+ public void writeEmptyElement(String localName) throws XMLStreamException {
+ writer.writeEmptyElement(localName);
+ }
+
+ public void writeEndElement() throws XMLStreamException {
+ writer.writeEndElement();
+ }
+
+ public void writeEndDocument() throws XMLStreamException {
+ writer.writeEndDocument();
+ }
+
+ public void close() throws XMLStreamException {
+ writer.close();
+ }
+
+ public void flush() throws XMLStreamException {
+ writer.flush();
+ }
+
+ public void writeAttribute(String localName, String value)
+ throws XMLStreamException {
+ writer.writeAttribute(localName, value);
+ }
+
+ public void writeAttribute(String prefix, String namespaceURI,
+ String localName, String value) throws XMLStreamException {
+ writer.writeAttribute(prefix, namespaceURI, localName, value);
+ }
+
+ public void writeAttribute(String namespaceURI, String localName,
+ String value) throws XMLStreamException {
+ writer.writeAttribute(namespaceURI, localName, value);
+ }
+
+ public void writeNamespace(String prefix, String namespaceURI)
+ throws XMLStreamException {
+ writer.writeNamespace(prefix, namespaceURI);
+ }
+
+ public void writeDefaultNamespace(String namespaceURI)
+ throws XMLStreamException {
+ writer.writeDefaultNamespace(namespaceURI);
+ }
+
+ public void writeComment(String data) throws XMLStreamException {
+ writer.writeComment(data);
+ }
+
+ public void writeProcessingInstruction(String target)
+ throws XMLStreamException {
+ writer.writeProcessingInstruction(target);
+ }
+
+ public void writeProcessingInstruction(String target, String data)
+ throws XMLStreamException {
+ writer.writeProcessingInstruction(target, data);
+ }
+
+ public void writeCData(String data) throws XMLStreamException {
+ writer.writeCData(data);
+ }
+
+ public void writeDTD(String dtd) throws XMLStreamException {
+ writer.writeDTD(dtd);
+ }
+
+ public void writeEntityRef(String name) throws XMLStreamException {
+ writer.writeEntityRef(name);
+ }
+
+ public void writeStartDocument() throws XMLStreamException {
+ writer.writeStartDocument();
+ }
+
+ public void writeStartDocument(String version) throws XMLStreamException {
+ writer.writeStartDocument(version);
+ }
+
+ public void writeStartDocument(String encoding, String version)
+ throws XMLStreamException {
+ writer.writeStartDocument(encoding, version);
+ }
+
+ public void writeCharacters(String text) throws XMLStreamException {
+ writer.writeCharacters(text);
+ }
+
+ public void writeCharacters(char[] text, int start, int len)
+ throws XMLStreamException {
+ writer.writeCharacters(text, start, len);
+ }
+
+ public String getPrefix(String uri) throws XMLStreamException {
+ return writer.getPrefix(uri);
+ }
+
+ public void setPrefix(String prefix, String uri) throws XMLStreamException {
+ writer.setPrefix(prefix, uri);
+ }
+
+ public void setDefaultNamespace(String uri) throws XMLStreamException {
+ writer.setDefaultNamespace(uri);
+ }
+
+ public void setNamespaceContext(NamespaceContext context)
+ throws XMLStreamException {
+ writer.setNamespaceContext(context);
+ }
+
+ public NamespaceContext getNamespaceContext() {
+ return writer.getNamespaceContext();
+ }
+
+ public Object getProperty(String name) throws IllegalArgumentException {
+ return writer.getProperty(name);
+ }
+
+ @Override
+ public void writeAttribute(String localName, String[] values) throws XMLStreamException
{
+ this.writer.writeAttribute(localName, join(values));
+
+ }
+
+ private static String join(final String[] values) {
+ final StringBuilder b = new StringBuilder();
+ for (int i = 0, valuesLength = values.length; i < valuesLength; i++) {
+ final String s = values[i];
+ if (s != null) {
+ if (i > 0) {
+ b.append(' ');
+ }
+ b.append(s);
+ }
+ }
+ return b.toString();
+ }
+
+ private static String join(final Iterable<String> values) {
+ final StringBuilder b = new StringBuilder();
+ Iterator<String> iterator = values.iterator();
+ while (iterator.hasNext()) {
+ final String s = iterator.next();
+ if (s != null) {
+ b.append(s);
+ if (iterator.hasNext()) b.append(' ');
+ }
+ }
+ return b.toString();
+ }
+
+ @Override
+ public void writeAttribute(String prefix, String namespaceURI, String localName,
String[] values) throws XMLStreamException {
+ this.writer.writeAttribute(prefix, namespaceURI, localName, join(values));
+
+ }
+
+ @Override
+ public void writeAttribute(String namespaceURI, String localName, String[] values)
throws XMLStreamException {
+ this.writer.writeAttribute(namespaceURI, localName, join(values));
+ }
+
+ @Override
+ public void writeAttribute(String localName, Iterable<String> value)
+ throws XMLStreamException {
+ this.writer.writeAttribute(localName, join(value));
+
+ }
+
+ @Override
+ public void writeAttribute(String prefix, String namespaceURI,
+ String localName, Iterable<String> value) throws XMLStreamException {
+ this.writer.writeAttribute(prefix, namespaceURI, localName, join(value));
+
+ }
+
+ @Override
+ public void writeAttribute(String namespaceURI, String localName,
+ Iterable<String> value) throws XMLStreamException {
+ this.writer.writeAttribute(namespaceURI, localName, join(value));
+ }
+
+ @Override
+ public void setUnspecifiedElementNamespace(String namespace) {
+ }
+}
Property changes on:
branches/as7/jboss-integration/src/test/java/org/teiid/jboss/MockXMLExtendedWriter.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Copied:
branches/as7/jboss-integration/src/test/java/org/teiid/jboss/TestObjectSerializer.java
(from rev 3422,
branches/as7/runtime/src/test/java/org/teiid/deployers/TestObjectSerializer.java)
===================================================================
---
branches/as7/jboss-integration/src/test/java/org/teiid/jboss/TestObjectSerializer.java
(rev 0)
+++
branches/as7/jboss-integration/src/test/java/org/teiid/jboss/TestObjectSerializer.java 2011-08-24
17:35:13 UTC (rev 3423)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.jboss;
+
+import static org.junit.Assert.*;
+
+import java.io.File;
+
+import org.junit.Test;
+import org.teiid.core.util.UnitTestUtil;
+import org.teiid.jboss.ObjectSerializer;
+
+
+@SuppressWarnings("nls")
+public class TestObjectSerializer {
+
+ @Test public void testLoadSafe() throws Exception {
+ ObjectSerializer os = new
ObjectSerializer(System.getProperty("java.io.tmpdir"));
+ File f = UnitTestUtil.getTestScratchFile("foo");
+ os.saveAttachment(f, new Long(2), false);
+ assertNotNull(os.loadAttachment(f, Long.class));
+ assertNull(os.loadSafe(f, Integer.class));
+ }
+
+}
Property changes on:
branches/as7/jboss-integration/src/test/java/org/teiid/jboss/TestObjectSerializer.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified:
branches/as7/jboss-integration/src/test/java/org/teiid/jboss/TestTeiidConfiguration.java
===================================================================
---
branches/as7/jboss-integration/src/test/java/org/teiid/jboss/TestTeiidConfiguration.java 2011-08-22
14:36:06 UTC (rev 3422)
+++
branches/as7/jboss-integration/src/test/java/org/teiid/jboss/TestTeiidConfiguration.java 2011-08-24
17:35:13 UTC (rev 3423)
@@ -31,10 +31,9 @@
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
+import javax.xml.namespace.NamespaceContext;
import javax.xml.namespace.QName;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.*;
import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamSource;
import javax.xml.validation.Schema;
@@ -50,6 +49,7 @@
import org.jboss.as.controller.operations.global.GlobalOperationHandlers;
import org.jboss.as.controller.persistence.ConfigurationPersistenceException;
import org.jboss.as.controller.persistence.ConfigurationPersister;
+import org.jboss.as.controller.persistence.ModelMarshallingContext;
import org.jboss.as.controller.persistence.SubsystemMarshallingContext;
import org.jboss.as.controller.registry.ManagementResourceRegistration;
import org.jboss.as.controller.registry.Resource;
@@ -58,10 +58,12 @@
import org.jboss.dmr.Property;
import org.jboss.msc.service.*;
import org.jboss.staxmapper.XMLElementWriter;
+import org.jboss.staxmapper.XMLExtendedStreamWriter;
import org.jboss.staxmapper.XMLMapper;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
+import org.mockito.Mockito;
import org.teiid.core.util.ObjectConverterUtil;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
@@ -115,7 +117,7 @@
@Test
public void testTeiidConfiguration() throws Exception {
List<ModelNode> updates =
createSubSystem(ObjectConverterUtil.convertToString(new
FileReader("src/test/resources/teiid-sample-config.xml")));
- assertEquals(1, updates.size());
+ assertEquals(3, updates.size());
for (ModelNode update : updates) {
try {
executeForResult(update);
@@ -125,18 +127,23 @@
}
ModelNode subsystem =
model.require("profile").require("test").require("subsystem").require("teiid");
- ModelNode bufferService = subsystem.require("buffer-service");
- assertEquals(8, bufferService.keys().size());
- assertEquals("true",
bufferService.require("use-disk").asString());
+ ModelNode engine = subsystem.require("query-engine");
+ assertEquals(2, engine.keys().size());
+ ModelNode defaultEngine = engine.get("default");
+ assertEquals("default",
defaultEngine.require("name").asString());
+
+ ModelNode alternateEngine = engine.get("alternate");
+ assertEquals("alternate",
alternateEngine.require("name").asString());
}
@Test
public void testSimpleTeiidConfiguration() throws Exception {
List<ModelNode> updates = createSubSystem("<subsystem
xmlns=\"urn:jboss:domain:teiid:1.0\">" +
- " <query-engine jndi-name=\"teiid/engine-deployer\">"
+
+ "<async-thread-group>async</async-thread-group>"+
+ " <query-engine name=\"default\">" +
" </query-engine>" +
"</subsystem>");
- assertEquals(1, updates.size());
+ assertEquals(2, updates.size());
for (ModelNode update : updates) {
try {
executeForResult(update);
@@ -194,7 +201,7 @@
List<ModelNode> updates = new ArrayList<ModelNode>();
xmlMapper.parseDocument(updates, xmlReader);
-
+
// Process subsystems
for(final ModelNode update : updates) {
// Process relative subsystem path address
@@ -366,10 +373,26 @@
return rsp.get(RESULT);
}
+ public void susbsytemParserDeparser(String xmlContent) throws Exception {
+ XMLMapper xmlMapper = XMLMapper.Factory.create();
+ List<ModelNode> updates = createSubSystem(xmlContent);
+
+ StringWriter sw = new StringWriter();
+ XMLStreamWriter streamWriter =
XMLOutputFactory.newInstance().createXMLStreamWriter(sw);
+ xmlMapper.deparseDocument(new TeiidSubsystemParser(), new
SubsystemMarshallingContext(updates.get(1), new MockXMLExtendedWriter(streamWriter)),
streamWriter);
+
+ System.out.println(sw.toString());
+ }
+
+ //@Test
+ public void testXMLPersistence() throws Exception {
+ susbsytemParserDeparser(ObjectConverterUtil.convertToString(new
FileReader("src/test/resources/teiid-sample-config.xml")));
+ }
+
@Test
public void testSubSystemDescription() throws IOException {
ModelNode node = new ModelNode();
- TeiidModelDescription.getQueryEngineDescription(node, ATTRIBUTES,
IntegrationPlugin.getResourceBundle(null));
+ QueryEngineAdd.describeQueryEngine(node, ATTRIBUTES,
IntegrationPlugin.getResourceBundle(null));
assertEquals(ObjectConverterUtil.convertToString(new
FileReader("src/test/resources/teiid-model-config.txt")), node.toString());
}
}
Modified: branches/as7/jboss-integration/src/test/resources/teiid-model-config.txt
===================================================================
--- branches/as7/jboss-integration/src/test/resources/teiid-model-config.txt 2011-08-22
14:36:06 UTC (rev 3422)
+++ branches/as7/jboss-integration/src/test/resources/teiid-model-config.txt 2011-08-24
17:35:13 UTC (rev 3423)
@@ -1,11 +1,10 @@
{
"attributes" => {
- "async-thread-group" => {
+ "name" => {
"type" => STRING,
- "description" => "Thread Pool to be used with Asynchronous
operations in Teiid",
- "required" => false,
- "max-occurs" => 1,
- "default" => "teiid-async"
+ "description" => "Name of the subsystem",
+ "required" => true,
+ "max-occurs" => 1
},
"max-threads" => {
"type" => INT,
@@ -110,190 +109,9 @@
"required" => false,
"max-occurs" => 1,
"default" => 0
- },
- "allow-env-function" => {
- "type" => BOOLEAN,
- "description" => "Allow the execution of ENV function.
(default false)",
- "required" => false,
- "max-occurs" => 1,
- "default" => false
}
},
"children" => {
- "buffer-service" => {
- "type" => OBJECT,
- "description" => "Buffer Manager Configuration",
- "required" => false,
- "max-occurs" => 1,
- "min-occurs" => 1,
- "attributes" => {
- "use-disk" => {
- "type" => BOOLEAN,
- "description" => "Use disk for buffer
management",
- "required" => false,
- "max-occurs" => 1,
- "default" => true
- },
- "processor-batch-size" => {
- "type" => INT,
- "description" => "The max row count of a batch sent
internally within the query processor. Should be <= the connectorBatchSize. (default
512)",
- "required" => false,
- "max-occurs" => 1,
- "default" => 512
- },
- "connector-batch-size" => {
- "type" => INT,
- "description" => "The max row count of a batch from
a connector. Should be even multiple of processorBatchSize. (default 1024)",
- "required" => false,
- "max-occurs" => 1,
- "default" => 1024
- },
- "max-processing-kb" => {
- "type" => INT,
- "description" => "The approximate amount of buffer
memory in kilobytes allowable for a single processing operation (sort, grouping, etc.)
regardless of existing memory commitments. -1 means to automatically calculate a value
(default -1)",
- "required" => false,
- "max-occurs" => 1,
- "default" => -1
- },
- "max-reserve-kb" => {
- "type" => INT,
- "description" => "The approximate amount of memory
in kilobytes allowed to be held by the buffer manager. -1 means to automatically calculate
a value (default -1)",
- "required" => false,
- "max-occurs" => 1,
- "default" => -1
- },
- "max-file-size" => {
- "type" => LONG,
- "description" => "Max File size in MB (default
2GB)",
- "required" => false,
- "max-occurs" => 1,
- "default" => 2048L
- },
- "max-buffer-space" => {
- "type" => LONG,
- "description" => "Max storage space, in MB, to be
used for buffer files (default 50G)",
- "required" => false,
- "max-occurs" => 1,
- "default" => 51200L
- },
- "max-open-files" => {
- "type" => INT,
- "description" => "Max open buffer files (default
64)",
- "required" => false,
- "max-occurs" => 1,
- "default" => 64
- }
- }
- },
- "resultset-cache" => {
- "type" => OBJECT,
- "description" => "Configuration for result set caching.
There will be 2 caches with these settings. One cache holds results that are specific to
sessions. The other cache holds vdb scoped results and can be replicated",
- "required" => false,
- "max-occurs" => 1,
- "min-occurs" => 1,
- "attributes" => {
- "maxEntries" => {
- "type" => INT,
- "description" => "Max Entries allowed",
- "required" => false,
- "max-occurs" => 1,
- "default" => 1024
- },
- "maxAgeInSeconds" => {
- "type" => INT,
- "description" => "Max age in seconds",
- "required" => false,
- "max-occurs" => 1,
- "default" => 7200
- },
- "maxStaleness" => {
- "type" => INT,
- "description" => "Max staleness in seconds.
Modifications are based upon data updates -1 indicates no max. (default 60 - 1
minute)",
- "required" => false,
- "max-occurs" => 1,
- "default" => 60
- },
- "type" => {
- "type" => STRING,
- "description" => "Allowed values are LRU,
EXPIRATION. ",
- "required" => false,
- "max-occurs" => 1,
- "default" => "EXPIRATION"
- },
- "location" => {
- "type" => STRING,
- "description" => "location",
- "required" => false,
- "max-occurs" => 1,
- "default" => "resultset"
- }
- }
- },
- "preparedplan-cache" => {
- "type" => OBJECT,
- "description" => "PreparedPlan Cache Configuration",
- "required" => false,
- "max-occurs" => 1,
- "min-occurs" => 1,
- "attributes" => {
- "maxEntries" => {
- "type" => INT,
- "description" => "Max Entries allowed",
- "required" => false,
- "max-occurs" => 1,
- "default" => 1024
- },
- "maxAgeInSeconds" => {
- "type" => INT,
- "description" => "Max age in seconds",
- "required" => false,
- "max-occurs" => 1,
- "default" => 7200
- },
- "maxStaleness" => {
- "type" => INT,
- "description" => "Max staleness in seconds.
Modifications are based upon data updates -1 indicates no max. (default 60 - 1
minute)",
- "required" => false,
- "max-occurs" => 1,
- "default" => 60
- },
- "type" => {
- "type" => STRING,
- "description" => "Allowed values are LRU,
EXPIRATION. ",
- "required" => false,
- "max-occurs" => 1,
- "default" => "EXPIRATION"
- },
- "location" => {
- "type" => STRING,
- "description" => "location",
- "required" => false,
- "max-occurs" => 1,
- "default" => "resultset"
- },
- "cache-service-jndi-name" => {
- "type" => STRING,
- "description" => "cache service for the distributed
cache",
- "required" => false,
- "max-occurs" => 1,
- "default" => "java:TeiidCacheManager"
- },
- "resultsetCacheName" => {
- "type" => STRING,
- "description" => "resultset cache node name",
- "required" => false,
- "max-occurs" => 1,
- "default" => "teiid-resultset-cache"
- }
- }
- },
- "distributed-cache-factory" => {
- "type" => OBJECT,
- "description" => "Distributed Cache Configuration",
- "required" => false,
- "max-occurs" => 1,
- "min-occurs" => 1
- },
"jdbc" => {
"type" => OBJECT,
"description" => "Remote JDBC Access Configuration ",
Modified: branches/as7/jboss-integration/src/test/resources/teiid-sample-config.xml
===================================================================
--- branches/as7/jboss-integration/src/test/resources/teiid-sample-config.xml 2011-08-22
14:36:06 UTC (rev 3422)
+++ branches/as7/jboss-integration/src/test/resources/teiid-sample-config.xml 2011-08-24
17:35:13 UTC (rev 3423)
@@ -1,24 +1,6 @@
<subsystem xmlns="urn:jboss:domain:teiid:1.0">
- <async-thread-group>teiid-async</async-thread-group>
- <allow-env-function>false</allow-env-function>
-
- <query-engine>
- <max-threads>64</max-threads>
- <max-active-plans>20</max-active-plans>
-
<thread-count-for-source-concurrency>0</thread-count-for-source-concurrency>
- <time-slice-in-millseconds>2000</time-slice-in-millseconds>
- <max-row-fetch-size>20480</max-row-fetch-size>
- <lob-chunk-size-in-kb>100</lob-chunk-size-in-kb>
- <query-threshold-in-seconds>600</query-threshold-in-seconds>
- <max-source-rows-allowed>-1</max-source-rows-allowed>
- <exception-on-max-source-rows>true</exception-on-max-source-rows>
- <max-odbc-lob-size-allowed>5242880</max-odbc-lob-size-allowed>
-
<event-distributor-name>teiid/event-distributor</event-distributor-name>
- <detect-change-events>true</detect-change-events>
- <security-domain>teiid-security</security-domain>
- <max-sessions-allowed>5000</max-sessions-allowed>
- <sessions-expiration-timelimit>0</sessions-expiration-timelimit>
-
+ <allow-env-function>false</allow-env-function>
+ <async-thread-group>teiid-async</async-thread-group>
<buffer-service>
<use-disk>true</use-disk>
@@ -30,7 +12,10 @@
<max-buffer-space>51200</max-buffer-space>
<max-open-files>64</max-open-files>
</buffer-service>
-
+ <!--
+
<authorization-validator-module>javax.api</authorization-validator-module>
+ <policy-decider-module>javax.api</policy-decider-module>
+ -->
<distributed-cache-factory>
<cache-service-jndi-name>java:TeiidCacheManager</cache-service-jndi-name>
<resultsetCacheName>teiid-resultset-cache</resultsetCacheName>
@@ -48,8 +33,25 @@
<maxEntries>512</maxEntries>
<maxAgeInSeconds>28800</maxAgeInSeconds>
<maxStaleness>0</maxStaleness>
- </preparedplan-cache>
-
+ </preparedplan-cache>
+
+ <query-engine name="default">
+ <max-threads>64</max-threads>
+ <max-active-plans>20</max-active-plans>
+
<thread-count-for-source-concurrency>0</thread-count-for-source-concurrency>
+ <time-slice-in-millseconds>2000</time-slice-in-millseconds>
+ <max-row-fetch-size>20480</max-row-fetch-size>
+ <lob-chunk-size-in-kb>100</lob-chunk-size-in-kb>
+ <query-threshold-in-seconds>600</query-threshold-in-seconds>
+ <max-source-rows-allowed>-1</max-source-rows-allowed>
+ <exception-on-max-source-rows>true</exception-on-max-source-rows>
+ <max-odbc-lob-size-allowed>5242880</max-odbc-lob-size-allowed>
+
<event-distributor-name>teiid/event-distributor</event-distributor-name>
+ <detect-change-events>true</detect-change-events>
+ <security-domain>teiid-security</security-domain>
+ <max-sessions-allowed>5000</max-sessions-allowed>
+ <sessions-expiration-timelimit>0</sessions-expiration-timelimit>
+
<jdbc>
<maxSocketThreads>0</maxSocketThreads>
<inputBufferSize>0</inputBufferSize>
@@ -64,5 +66,7 @@
<socket-binding>teiid-odbc</socket-binding>
</odbc>
</query-engine>
+
+ <query-engine name="alternate"/>
</subsystem>
\ No newline at end of file
Modified: branches/as7/runtime/src/main/java/org/teiid/deployers/TeiidAttachments.java
===================================================================
---
branches/as7/runtime/src/main/java/org/teiid/deployers/TeiidAttachments.java 2011-08-22
14:36:06 UTC (rev 3422)
+++
branches/as7/runtime/src/main/java/org/teiid/deployers/TeiidAttachments.java 2011-08-24
17:35:13 UTC (rev 3423)
@@ -34,7 +34,6 @@
public static final AttachmentKey<VDBMetaData> VDB_METADATA =
AttachmentKey.create(VDBMetaData.class);
public static final AttachmentKey<UDFMetaData> UDF_METADATA =
AttachmentKey.create(UDFMetaData.class);
public static final AttachmentKey<IndexMetadataFactory> INDEX_METADATA =
AttachmentKey.create(IndexMetadataFactory.class);
- public static final AttachmentKey<MetadataStoreGroup> METADATA_STORE =
AttachmentKey.create(MetadataStoreGroup.class);
public static final AttachmentKey<DeploymentType> DEPLOYMENT_TYPE =
AttachmentKey.create(DeploymentType.class);
@@ -53,5 +52,4 @@
public static void setAsDynamicVDBDeployment(final DeploymentUnit deploymentUnit) {
deploymentUnit.putAttachment(DEPLOYMENT_TYPE, DeploymentType.DYNAMIC_VDB);
}
-
}
Modified: branches/as7/runtime/src/main/java/org/teiid/deployers/UDFMetaData.java
===================================================================
--- branches/as7/runtime/src/main/java/org/teiid/deployers/UDFMetaData.java 2011-08-22
14:36:06 UTC (rev 3422)
+++ branches/as7/runtime/src/main/java/org/teiid/deployers/UDFMetaData.java 2011-08-24
17:35:13 UTC (rev 3423)
@@ -45,7 +45,7 @@
}
- void buildFunctionModelFile(String name, String path) throws IOException, JAXBException
{
+ public void buildFunctionModelFile(String name, String path) throws IOException,
JAXBException {
for (String f:files.keySet()) {
if (f.endsWith(path)) {
path = f;
Modified:
branches/as7/runtime/src/main/java/org/teiid/transport/LocalServerConnection.java
===================================================================
---
branches/as7/runtime/src/main/java/org/teiid/transport/LocalServerConnection.java 2011-08-22
14:36:06 UTC (rev 3422)
+++
branches/as7/runtime/src/main/java/org/teiid/transport/LocalServerConnection.java 2011-08-24
17:35:13 UTC (rev 3423)
@@ -49,7 +49,7 @@
public class LocalServerConnection implements ServerConnection {
- public static final String TEIID_RUNTIME = "teiid/engine-deployer";
//$NON-NLS-1$
+ private static final String TEIID_RUNTIME_CONTEXT = "teiid/"; //$NON-NLS-1$
private LogonResult result;
private boolean shutdown;
@@ -69,8 +69,9 @@
protected ClientServiceRegistry getClientServiceRegistry() {
try {
+ String engineName =
this.connectionProperties.getProperty(TeiidURL.CONNECTION.ENGINE_NAME,
"default"); //$NON-NLS-1$
InitialContext ic = new InitialContext();
- return (ClientServiceRegistry)ic.lookup(TEIID_RUNTIME);
+ return (ClientServiceRegistry)ic.lookup(TEIID_RUNTIME_CONTEXT+engineName);
} catch (NamingException e) {
throw new TeiidRuntimeException(e);
}
Deleted: branches/as7/runtime/src/test/java/org/teiid/deployers/TestObjectSerializer.java
===================================================================
---
branches/as7/runtime/src/test/java/org/teiid/deployers/TestObjectSerializer.java 2011-08-22
14:36:06 UTC (rev 3422)
+++
branches/as7/runtime/src/test/java/org/teiid/deployers/TestObjectSerializer.java 2011-08-24
17:35:13 UTC (rev 3423)
@@ -1,45 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.deployers;
-
-import static org.junit.Assert.*;
-
-import java.io.File;
-
-import org.junit.Test;
-import org.teiid.core.util.UnitTestUtil;
-import org.teiid.jboss.ObjectSerializer;
-
-
-@SuppressWarnings("nls")
-public class TestObjectSerializer {
-
- @Test public void testLoadSafe() throws Exception {
- ObjectSerializer os = new
ObjectSerializer(System.getProperty("java.io.tmpdir"));
- File f = UnitTestUtil.getTestScratchFile("foo");
- os.saveAttachment(f, new Long(2));
- assertNotNull(os.loadAttachment(f, Long.class));
- assertNull(os.loadSafe(f, Integer.class));
- }
-
-}