teiid SVN: r3306 - branches/7.1.1.CP3/jboss-integration/src/main/java/org/teiid/jboss/deployers.
by teiid-commits@lists.jboss.org
Author: mdrillin
Date: 2011-07-11 15:37:33 -0400 (Mon, 11 Jul 2011)
New Revision: 3306
Modified:
branches/7.1.1.CP3/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
Log:
TEIID-1493 Rolling back the previous change.
Modified: branches/7.1.1.CP3/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
===================================================================
--- branches/7.1.1.CP3/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2011-07-11 03:06:57 UTC (rev 3305)
+++ branches/7.1.1.CP3/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2011-07-11 19:37:33 UTC (rev 3306)
@@ -62,6 +62,7 @@
import org.teiid.adminapi.AdminComponentException;
import org.teiid.adminapi.AdminException;
import org.teiid.adminapi.AdminProcessingException;
+import org.teiid.adminapi.Admin.Cache;
import org.teiid.adminapi.impl.CacheStatisticsMetadata;
import org.teiid.adminapi.impl.DQPManagement;
import org.teiid.adminapi.impl.RequestMetadata;
@@ -239,6 +240,10 @@
} catch (SessionServiceException e) {
//ignore
}
+
+ // dump the caches.
+ dqpCore.clearCache(Cache.PREPARED_PLAN_CACHE.toString(), name, version);
+ dqpCore.clearCache(Cache.QUERY_SERVICE_RESULT_SET_CACHE.toString(), name, version);
}
});
}
13 years, 8 months
teiid SVN: r3305 - in branches/as7: adminshell/src/main/java/org/teiid/adminshell and 37 other directories.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2011-07-10 23:06:57 -0400 (Sun, 10 Jul 2011)
New Revision: 3305
Added:
branches/as7/build/kits/jboss-as7/standalone/configuration/standalone-teiid.xml
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/BufferManagerService.java
Removed:
branches/as7/build/kits/jboss-as7/standalone/configuration/standalone.xml
branches/as7/client/src/main/java/org/teiid/adminapi/impl/Admin.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidXOMSubsystemDescription.java
branches/as7/test-integration/db/src/test/java/org/teiid/adminapi/jboss/TestConnectorBindings.java
Modified:
branches/as7/adminshell/src/main/java/org/teiid/adminshell/AdminShell.java
branches/as7/api/src/main/java/org/teiid/logging/LogManager.java
branches/as7/build/assembly/jboss-as7/dist.xml
branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/api/main/module.xml
branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/client/main/module.xml
branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/main/module.xml
branches/as7/client/pom.xml
branches/as7/client/src/main/java/org/teiid/adminapi/AdminFactory.java
branches/as7/client/src/main/java/org/teiid/adminapi/impl/MetadataMapper.java
branches/as7/client/src/test/java/org/teiid/adminapi/impl/TestRequestMetadata.java
branches/as7/client/src/test/java/org/teiid/adminapi/impl/TestSessionMetadata.java
branches/as7/client/src/test/java/org/teiid/adminapi/impl/TestTransactionMetadata.java
branches/as7/client/src/test/java/org/teiid/adminapi/impl/TestVDBMetaData.java
branches/as7/connectors/connector-file/pom.xml
branches/as7/connectors/connector-file/src/main/rar/META-INF/MANIFEST.MF
branches/as7/connectors/connector-ldap/pom.xml
branches/as7/connectors/connector-ldap/src/main/rar/META-INF/MANIFEST.MF
branches/as7/connectors/connector-salesforce/pom.xml
branches/as7/connectors/connector-salesforce/src/main/rar/META-INF/MANIFEST.MF
branches/as7/connectors/connector-ws/pom.xml
branches/as7/connectors/connector-ws/src/main/rar/META-INF/MANIFEST.MF
branches/as7/engine/src/main/java/org/teiid/cache/CacheConfiguration.java
branches/as7/engine/src/main/java/org/teiid/dqp/internal/process/DQPConfiguration.java
branches/as7/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
branches/as7/jboss-integration/pom.xml
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/Configuration.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/Element.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineAdd.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineDescription.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineOperationHandler.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidExtension.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidServiceNames.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidSubsystemParser.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorAdd.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorRemove.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
branches/as7/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties
branches/as7/jboss-integration/src/main/resources/schema/jboss-teiid.xsd
branches/as7/jboss-integration/src/test/java/org/teiid/adminapi/jboss/TestAdminObjectBuilder.java
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/pom.xml
branches/as7/runtime/pom.xml
branches/as7/runtime/src/main/java/org/teiid/deployers/VDBDependencyProcessor.java
branches/as7/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java
branches/as7/runtime/src/main/java/org/teiid/deployers/VDBRepository.java
branches/as7/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java
branches/as7/runtime/src/main/java/org/teiid/transport/LocalServerConnection.java
branches/as7/runtime/src/main/java/org/teiid/transport/SocketConfiguration.java
branches/as7/runtime/src/test/java/org/teiid/deployers/TestObjectSerializer.java
branches/as7/runtime/src/test/java/org/teiid/deployers/TestTranslatorUtil.java
branches/as7/runtime/src/test/java/org/teiid/services/TestMembershipServiceImpl.java
branches/as7/runtime/src/test/java/org/teiid/services/TestSessionServiceImpl.java
branches/as7/runtime/src/test/java/org/teiid/transport/TestLogonImpl.java
branches/as7/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java
Log:
updated to 7.0.0.CR1 compatibility. Fixed for interface and behavior changes
Modified: branches/as7/adminshell/src/main/java/org/teiid/adminshell/AdminShell.java
===================================================================
--- branches/as7/adminshell/src/main/java/org/teiid/adminshell/AdminShell.java 2011-07-09 00:08:35 UTC (rev 3304)
+++ branches/as7/adminshell/src/main/java/org/teiid/adminshell/AdminShell.java 2011-07-11 03:06:57 UTC (rev 3305)
@@ -64,11 +64,12 @@
@Doc(text="Get a named Admin connection to the specified server")
public static void connectAsAdmin(
- @Doc(text = "url - URL in the format \"mm[s]://host:port\"") String url,
+ @Doc(text = "host - hostname") String host,
+ @Doc(text = "port - port") int port,
@Doc(text = "username") String username,
@Doc(text = "password") String password,
@Doc(text = "connection name") String connectionName) throws AdminException {
- internalAdmin = AdminFactory.getInstance().createAdmin(username, password.toCharArray(), url);
+ internalAdmin = AdminFactory.getInstance().createAdmin(host, port, username, password.toCharArray());
currentName = connectionName;
Admin old = connections.put(connectionName, internalAdmin);
if (old != null) {
@@ -81,8 +82,7 @@
@SuppressWarnings("nls")
public static void connectAsAdmin() throws AdminException {
loadConnectionProperties();
- connectAsAdmin(p.getProperty("admin.url", "mm://localhost:31443"), p.getProperty("admin.user", "admin"),
- p.getProperty("admin.password", "admin"), "conn-" + connectionCount++);
+ connectAsAdmin(p.getProperty("admin.host", "localhost"), Integer.parseInt(p.getProperty("admin.port", "9990")), p.getProperty("admin.user", "admin"), p.getProperty("admin.password", "admin"), "conn-" + connectionCount++);
}
static void loadConnectionProperties() {
Modified: branches/as7/api/src/main/java/org/teiid/logging/LogManager.java
===================================================================
--- branches/as7/api/src/main/java/org/teiid/logging/LogManager.java 2011-07-09 00:08:35 UTC (rev 3304)
+++ branches/as7/api/src/main/java/org/teiid/logging/LogManager.java 2011-07-11 03:06:57 UTC (rev 3305)
@@ -396,4 +396,12 @@
final int level) {
return Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), interfaces, new LoggingProxy(instance, loggingContext, level));
}
+
+ public static Object createLoggingProxy(final String loggingContext,
+ final Object instance,
+ final Class<?>[] interfaces,
+ final int level,
+ ClassLoader classLoader) {
+ return Proxy.newProxyInstance(classLoader, interfaces, new LoggingProxy(instance, loggingContext, level));
+ }
}
Modified: branches/as7/build/assembly/jboss-as7/dist.xml
===================================================================
--- branches/as7/build/assembly/jboss-as7/dist.xml 2011-07-09 00:08:35 UTC (rev 3304)
+++ branches/as7/build/assembly/jboss-as7/dist.xml 2011-07-11 03:06:57 UTC (rev 3305)
@@ -105,6 +105,18 @@
<outputDirectory>modules/org/jboss/teiid/common-core/main</outputDirectory>
</binaries>
</moduleSet>
+
+ <moduleSet>
+ <useAllReactorProjects>true</useAllReactorProjects>
+ <includes>
+ <include>org.jboss.teiid:teiid-api</include>
+ </includes>
+ <binaries>
+ <includeDependencies>false</includeDependencies>
+ <unpack>false</unpack>
+ <outputDirectory>modules/org/jboss/teiid/api/main</outputDirectory>
+ </binaries>
+ </moduleSet>
<moduleSet>
<useAllReactorProjects>true</useAllReactorProjects>
@@ -179,7 +191,7 @@
<useDefaultExcludes>true</useDefaultExcludes>
</dependencySet>
</dependencySets>
- <outputDirectory>standalone/deployments/teiid</outputDirectory>
+ <outputDirectory>standalone/deployments</outputDirectory>
<fileMode>0644</fileMode>
</binaries>
@@ -218,7 +230,7 @@
<useAllReactorProjects>true</useAllReactorProjects>
<includes>
- <include>org.jboss.teiid.connectors:translator-loopback/main</include>
+ <include>org.jboss.teiid.connectors:translator-loopback</include>
</includes>
<binaries>
@@ -328,7 +340,7 @@
<useDefaultExcludes>true</useDefaultExcludes>
</dependencySet>
</dependencySets>
- <outputDirectory>modules/org/jboss/teiid/translator/ws</outputDirectory>
+ <outputDirectory>modules/org/jboss/teiid/translator/ws/main</outputDirectory>
<fileMode>0644</fileMode>
</binaries>
Modified: branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/api/main/module.xml
===================================================================
--- branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/api/main/module.xml 2011-07-09 00:08:35 UTC (rev 3304)
+++ branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/api/main/module.xml 2011-07-11 03:06:57 UTC (rev 3305)
@@ -30,6 +30,8 @@
<dependencies>
+ <module name="javax.resource.api"/>
+ <module name="org.jboss.teiid.common-core"/>
<module name="org.jboss.teiid.client" />
</dependencies>
</module>
\ No newline at end of file
Modified: branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/client/main/module.xml
===================================================================
--- branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/client/main/module.xml 2011-07-09 00:08:35 UTC (rev 3304)
+++ branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/client/main/module.xml 2011-07-11 03:06:57 UTC (rev 3305)
@@ -31,5 +31,7 @@
<dependencies>
<module name="org.jboss.teiid.common-core" />
+ <module name="javax.transaction.api"/>
+ <module name="javax.api"/>
</dependencies>
</module>
\ No newline at end of file
Modified: branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/main/module.xml
===================================================================
--- branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/main/module.xml 2011-07-09 00:08:35 UTC (rev 3304)
+++ branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/main/module.xml 2011-07-11 03:06:57 UTC (rev 3305)
@@ -25,12 +25,13 @@
<module xmlns="urn:jboss:module:1.0" name="org.jboss.teiid">
<resources>
<resource-root path="teiid-engine-${version}.jar" />
+ <!--
<resource-root path="teiid-cache-jbosscache-${version}.jar" />
+ -->
<resource-root path="teiid-jboss-integration-${version}.jar" />
<resource-root path="teiid-metadata-${version}.jar" />
<resource-root path="teiid-runtime-${version}.jar" />
<resource-root path="teiid-engine-${version}.jar" />
- <resource-root path="teiid-engine-${version}.jar" />
<resource-root path="saxon-9.1.0.8.jar" />
<resource-root path="saxon-9.1.0.8-dom.jar" />
<resource-root path="json-simple-1.1.jar" />
@@ -39,35 +40,27 @@
<dependencies>
- <module name="com.sun.xml.bind"/>
+ <module name="org.jboss.teiid.common-core" />
<module name="org.jboss.teiid.api" />
+ <module name="org.jboss.teiid.client" />
<module name="javax.api" />
- <module name="javax.resource.api" />
- <module name="javax.transaction.api" />
- <module name="javax.annotation.api" />
- <module name="org.jboss.as.controller" />
- <module name="org.jboss.as.naming" />
- <module name="org.jboss.as.server" />
- <module name="org.jboss.as.security" />
- <module name="org.jboss.as.ee" />
- <module name="org.jboss.as.threads" />
- <module name="org.jboss.as.transactions" />
- <module name="org.jboss.common-core" />
- <module name="org.jboss.integration.jboss-jca-spi" />
- <module name="org.jboss.integration.jboss-transaction-spi" />
- <module name="org.jboss.ironjacamar.api" />
- <module name="org.jboss.ironjacamar.impl" />
- <module name="org.jboss.ironjacamar.jdbcadapters" />
- <module name="org.jboss.jandex" />
- <module name="org.jboss.jts" />
- <module name="org.jboss.jts.integration" />
+ <module name="javax.resource.api"/>
<module name="org.jboss.logging" />
- <module name="org.jboss.modules" />
+ <module name="org.jboss.as.controller"/>
+ <module name="org.jboss.modules"/>
<module name="org.jboss.msc" />
<module name="org.jboss.netty"/>
<module name="org.jboss.staxmapper" />
- <module name="org.jboss.threads" />
<module name="org.jboss.vfs" />
- <module name="org.picketbox" />
+ <module name="org.picketbox"/>
+ <!-- REMOVE DIRECT DEPENDENCY ON LOG4J, and use jboss logging -->
+ <module name="org.apache.log4j"/>
+ <module name="org.jboss.as.network"/>
+ <module name="org.jboss.as.security"/>
+ <module name="org.jboss.as.server"/>
+ <module name="org.jboss.as.naming"/>
+ <module name="javax.xml.bind.api"/>
+ <module name="javax.transaction.api"/>
</dependencies>
+
</module>
\ No newline at end of file
Copied: branches/as7/build/kits/jboss-as7/standalone/configuration/standalone-teiid.xml (from rev 3274, branches/as7/build/kits/jboss-as7/standalone/configuration/standalone.xml)
===================================================================
--- branches/as7/build/kits/jboss-as7/standalone/configuration/standalone-teiid.xml (rev 0)
+++ branches/as7/build/kits/jboss-as7/standalone/configuration/standalone-teiid.xml 2011-07-11 03:06:57 UTC (rev 3305)
@@ -0,0 +1,304 @@
+<!--
+ ~ JBoss, Home of Professional Open Source.
+ ~ Copyright 2011, Red Hat, Inc., and individual contributors
+ ~ as indicated by the @author tags. See the copyright.txt file in the
+ ~ distribution for a full listing of individual contributors.
+ ~
+ ~ This is free software; you can redistribute it and/or modify it
+ ~ under the terms of the GNU Lesser General Public License as
+ ~ published by the Free Software Foundation; either version 2.1 of
+ ~ the License, or (at your option) any later version.
+ ~
+ ~ This software is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ ~ Lesser General Public License for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public
+ ~ License along with this software; if not, write to the Free
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ -->
+
+<server xmlns="urn:jboss:domain:1.0">
+
+ <extensions>
+ <extension module="org.jboss.as.clustering.infinispan"/>
+ <extension module="org.jboss.as.connector"/>
+ <extension module="org.jboss.as.deployment-scanner"/>
+ <extension module="org.jboss.as.ee"/>
+ <extension module="org.jboss.as.ejb3"/>
+ <extension module="org.jboss.as.jaxrs"/>
+ <extension module="org.jboss.as.jmx"/>
+ <extension module="org.jboss.as.jpa"/>
+ <extension module="org.jboss.as.logging"/>
+ <extension module="org.jboss.as.naming"/>
+ <extension module="org.jboss.as.osgi"/>
+ <extension module="org.jboss.as.remoting"/>
+ <extension module="org.jboss.as.sar"/>
+ <extension module="org.jboss.as.security"/>
+ <extension module="org.jboss.teiid"/>
+ <extension module="org.jboss.as.threads"/>
+ <extension module="org.jboss.as.transactions"/>
+ <extension module="org.jboss.as.web" />
+ <extension module="org.jboss.as.weld" />
+ </extensions>
+
+ <management>
+ <security-realms>
+ <security-realm name="PropertiesMgmtSecurityRealm">
+ <authentication>
+ <properties path="mgmt-users.properties" relative-to="jboss.server.config.dir" />
+ </authentication>
+ </security-realm>
+ </security-realms>
+ <management-interfaces>
+ <native-interface interface="management" port="9999" />
+ <http-interface interface="management" port="9990"/>
+ </management-interfaces>
+ </management>
+
+ <profile>
+ <subsystem xmlns="urn:jboss:domain:logging:1.0">
+ <console-handler name="CONSOLE">
+ <level name="INFO"/>
+ <formatter>
+ <pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
+ </formatter>
+ </console-handler>
+
+ <periodic-rotating-file-handler name="FILE">
+ <level name="INFO"/>
+ <formatter>
+ <pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
+ </formatter>
+ <file relative-to="jboss.server.log.dir" path="server.log"/>
+ <suffix value=".yyyy-MM-dd"/>
+ </periodic-rotating-file-handler>
+
+ <logger category="com.arjuna">
+ <level name="WARN"/>
+ </logger>
+ <logger category="org.apache.tomcat.util.modeler">
+ <level name="WARN"/>
+ </logger>
+ <logger category="sun.rmi">
+ <level name="WARN"/>
+ </logger>
+
+ <root-logger>
+ <level name="INFO"/>
+ <handlers>
+ <handler name="CONSOLE"/>
+ <handler name="FILE"/>
+ </handlers>
+ </root-logger>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:datasources:1.0">
+ <datasources>
+ <datasource jndi-name="java:jboss/datasources/ExampleDS" enabled="true" use-java-context="true" pool-name="H2DS">
+ <connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1</connection-url>
+ <driver>h2</driver>
+ <pool></pool>
+ <security>
+ <user-name>sa</user-name>
+ <password>sa</password>
+ </security>
+ <validation></validation>
+ <timeout></timeout>
+ <statement></statement>
+ </datasource>
+ <drivers>
+ <driver name="h2" module="com.h2database.h2">
+ <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
+ </driver>
+ </drivers>
+ </datasources>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:deployment-scanner:1.0">
+ <deployment-scanner scan-interval="5000" relative-to="jboss.server.base.dir" path="deployments" />
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:ee:1.0" />
+ <subsystem xmlns="urn:jboss:domain:ejb3:1.0" />
+ <subsystem xmlns="urn:jboss:domain:infinispan:1.0" default-cache-container="hibernate">
+ <cache-container name="hibernate" default-cache="local-query">
+ <local-cache name="entity">
+ <eviction strategy="LRU" max-entries="10000"/>
+ <expiration max-idle="100000"/>
+ </local-cache>
+ <local-cache name="local-query">
+ <eviction strategy="LRU" max-entries="10000"/>
+ <expiration max-idle="100000"/>
+ </local-cache>
+ <local-cache name="timestamps">
+ <eviction strategy="NONE"/>
+ </local-cache>
+ </cache-container>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:jaxrs:1.0"/>
+ <subsystem xmlns="urn:jboss:domain:jca:1.0">
+ <archive-validation enabled="false" />
+ <bean-validation enabled="false" />
+ <default-workmanager>
+ <short-running-threads blocking="true">
+ <core-threads count="10" per-cpu="20"/>
+ <queue-length count="10" per-cpu="20"/>
+ <max-threads count="10" per-cpu="20"/>
+ <keepalive-time time="10" unit="seconds"/>
+ </short-running-threads>
+ <long-running-threads blocking="true">
+ <core-threads count="10" per-cpu="20"/>
+ <queue-length count="10" per-cpu="20"/>
+ <max-threads count="10" per-cpu="20"/>
+ <keepalive-time time="10" unit="seconds"/>
+ </long-running-threads>
+ </default-workmanager>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:jmx:1.0">
+ <jmx-connector registry-binding="jmx-connector-registry" server-binding="jmx-connector-server" />
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:jpa:1.0">
+ <jpa default-datasource=""/>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:naming:1.0" />
+ <subsystem xmlns="urn:jboss:domain:osgi:1.0" activation="lazy">
+ <configuration pid="org.apache.felix.webconsole.internal.servlet.OsgiManager">
+ <property name="manager.root">jboss-osgi</property>
+ </configuration>
+ <properties>
+ <!--
+ A comma seperated list of module identifiers. Each system module
+ is added as a dependency to the OSGi framework module. The packages
+ from these system modules can be made visible as framework system packages.
+ http://www.osgi.org/javadoc/r4v42/org/osgi/framework/Constants.html#FRAME...
+ -->
+ <property name="org.jboss.osgi.system.modules">
+ org.apache.commons.logging,
+ org.apache.log4j,
+ org.jboss.as.osgi,
+ org.slf4j,
+ </property>
+ <!--
+ Framework environment property identifying extra packages which the system bundle
+ must export from the current execution environment
+ -->
+ <property name="org.osgi.framework.system.packages.extra">
+ org.apache.commons.logging;version=1.1.1,
+ org.apache.log4j;version=1.2,
+ org.jboss.as.osgi.service;version=7.0,
+ org.jboss.osgi.deployment.interceptor;version=1.0,
+ org.jboss.osgi.spi.capability;version=1.0,
+ org.jboss.osgi.spi.util;version=1.0,
+ org.jboss.osgi.testing;version=1.0,
+ org.jboss.osgi.vfs;version=1.0,
+ org.slf4j;version=1.5.10,
+ </property>
+ <!-- Specifies the beginning start level of the framework -->
+ <property name="org.osgi.framework.startlevel.beginning">1</property>
+ </properties>
+ <modules>
+ <!-- modules registered with the OSGi layer on startup -->
+ <module identifier="javaee.api"/>
+ <module identifier="org.jboss.logging"/>
+ <!-- bundles installed on startup -->
+ <module identifier="org.apache.aries.util"/>
+ <module identifier="org.jboss.osgi.webconsole"/>
+ <module identifier="org.osgi.compendium"/>
+ <!-- bundles started in startlevel 1 -->
+ <module identifier="org.apache.felix.log" startlevel="1"/>
+ <module identifier="org.jboss.osgi.logging" startlevel="1"/>
+ <module identifier="org.apache.felix.configadmin" startlevel="1"/>
+ <module identifier="org.jboss.as.osgi.configadmin" startlevel="1"/>
+ <!-- bundles started in startlevel 2 -->
+ <module identifier="org.apache.aries.jmx" startlevel="2"/>
+ <module identifier="org.apache.felix.eventadmin" startlevel="2"/>
+ <module identifier="org.apache.felix.metatype" startlevel="2"/>
+ <module identifier="org.apache.felix.webconsole" startlevel="2"/>
+ <module identifier="org.jboss.osgi.jmx" startlevel="2"/>
+ <module identifier="org.jboss.osgi.http" startlevel="2"/>
+ <!-- bundles started in startlevel 3 -->
+ <module identifier="org.jboss.osgi.blueprint" startlevel="3"/>
+ <module identifier="org.jboss.osgi.webapp" startlevel="3"/>
+ <module identifier="org.jboss.osgi.xerces" startlevel="3"/>
+ </modules>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:remoting:1.0"/>
+ <subsystem xmlns="urn:jboss:domain:resource-adapters:1.0" />
+ <subsystem xmlns="urn:jboss:domain:sar:1.0"/>
+ <subsystem xmlns="urn:jboss:domain:security:1.0">
+ <security-domains>
+ <security-domain name="other" cache-type="default">
+ <authentication>
+ <login-module code="UsersRoles" flag="required"/>
+ </authentication>
+ </security-domain>
+ <security-domain name="teiid-security" cache-type="default">
+ <authentication>
+ <login-module code="UsersRoles" flag="required">
+ <module-option name="usersProperties" value="teiid-security-users.properties"/>
+ <module-option name="rolesProperties" value="teiid-security-roles.properties"/>
+ </login-module>
+ </authentication>
+ </security-domain>
+ </security-domains>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:teiid:1.0">
+ <query-engine>
+ <thread-group-async>teiid-async</thread-group-async>
+ <eventDistributorName>teiid/event-distributor</eventDistributorName>
+ <security-domain>teiid-security</security-domain>
+ <jdbc>
+ <socket-binding>teiid-jdbc</socket-binding>
+ </jdbc>
+ <odbc>
+ <socket-binding>teiid-odbc</socket-binding>
+ </odbc>
+ </query-engine>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:threads:1.0">
+ <queueless-thread-pool name="teiid-async">
+ <max-threads count="2" per-cpu="2"/>
+ </queueless-thread-pool>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:transactions:1.0">
+ <recovery-environment socket-binding="txn-recovery-environment" status-socket-binding="txn-status-manager"/>
+ <core-environment>
+ <process-id>
+ <uuid />
+ </process-id>
+ </core-environment>
+ <coordinator-environment default-timeout="300"/>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:web:1.0">
+ <connector name="http" scheme="http" protocol="HTTP/1.1" socket-binding="http"/>
+ <virtual-server name="localhost" enable-welcome-root="true">
+ <alias name="example.com" />
+ </virtual-server>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:weld:1.0" />
+ </profile>
+
+ <interfaces>
+ <interface name="management">
+ <inet-address value="127.0.0.1"/>
+ </interface>
+ <interface name="public">
+ <inet-address value="127.0.0.1"/>
+ </interface>
+ </interfaces>
+
+ <socket-binding-group name="standard-sockets" default-interface="public">
+ <socket-binding name="http" port="8080"/>
+ <socket-binding name="https" port="8443"/>
+ <socket-binding name="jmx-connector-registry" port="1090"/>
+ <socket-binding name="jmx-connector-server" port="1091"/>
+ <socket-binding name="jndi" port="1099"/>
+ <socket-binding name="osgi-http" port="8090"/>
+ <socket-binding name="remoting" port="4447"/>
+ <socket-binding name="txn-recovery-environment" port="4712"/>
+ <socket-binding name="txn-status-manager" port="4713"/>
+ <socket-binding name="teiid-jdbc" port="31000"/>
+ <socket-binding name="teiid-odbc" port="35432"/>
+ </socket-binding-group>
+
+</server>
Property changes on: branches/as7/build/kits/jboss-as7/standalone/configuration/standalone-teiid.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Deleted: branches/as7/build/kits/jboss-as7/standalone/configuration/standalone.xml
===================================================================
--- branches/as7/build/kits/jboss-as7/standalone/configuration/standalone.xml 2011-07-09 00:08:35 UTC (rev 3304)
+++ branches/as7/build/kits/jboss-as7/standalone/configuration/standalone.xml 2011-07-11 03:06:57 UTC (rev 3305)
@@ -1,451 +0,0 @@
-<!--
- ~ JBoss, Home of Professional Open Source.
- ~ Copyright 2010, Red Hat, Inc., and individual contributors
- ~ as indicated by the @author tags. See the copyright.txt file in the
- ~ distribution for a full listing of individual contributors.
- ~
- ~ This is free software; you can redistribute it and/or modify it
- ~ under the terms of the GNU Lesser General Public License as
- ~ published by the Free Software Foundation; either version 2.1 of
- ~ the License, or (at your option) any later version.
- ~
- ~ This software is distributed in the hope that it will be useful,
- ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
- ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- ~ Lesser General Public License for more details.
- ~
- ~ You should have received a copy of the GNU Lesser General Public
- ~ License along with this software; if not, write to the Free
- ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- -->
-
-<server name="example"
- xmlns="urn:jboss:domain:1.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="urn:jboss:domain:1.0 jboss_7_0.xsd
- urn:jboss:domain:arquillian:1.0 jboss-arquillian.xsd
- urn:jboss:domain:connector:1.0 jboss-connector.xsd
- urn:jboss:domain:datasources:1.0 jboss-datasources.xsd
- urn:jboss:domain:ejb3:1.0 jboss-ejb3.xsd
- urn:jboss:domain:ee:1.0 jboss-ee.xsd
- urn:jboss:domain:jaxrs:1.0 jboss-jaxrs.xsd
- urn:jboss:domain:jmx:1.0 jboss-jmx.xsd
- urn:jboss:domain:jpa:1.0 jboss-jpa.xsd
- urn:jboss:domain:messaging:1.0 jboss-messaging.xsd
- urn:jboss:domain:naming:1.0 jboss-naming.xsd
- urn:jboss:domain:osgi:1.0 jboss-osgi.xsd
- urn:jboss:domain:remoting:1.0 jboss-remoting.xsd
- urn:jboss:domain:resourceadapters:1.0 jboss-resource-adapters.xsd
- urn:jboss:domain:sar:1.0 jboss-sar.xsd
- urn:jboss:domain:teiid:1.0 jboss-teiid.xsd
- urn:jboss:domain:threads:1.0 jboss-threads.xsd
- urn:jboss:domain:transactions:1.0 jboss-txn.xsd
- urn:jboss:domain:web:1.0 jboss-web.xsd
- urn:jboss:domain:deployment-scanner:1.0 jboss-deployment-scanner.xsd
- urn:jboss:domain:security:1.0 jboss-security.xsd
- urn:jboss:domain:webservices:1.0 jboss-webservices.xsd
- urn:jboss:domain:weld:1.0 jboss-weld.xsd">
-
- <extensions>
- <extension module="org.jboss.as.arquillian.service"/>
- <extension module="org.jboss.as.connector"/>
- <extension module="org.jboss.as.deployment-scanner"/>
- <extension module="org.jboss.as.ee"/>
- <extension module="org.jboss.as.ejb3"/>
- <extension module="org.jboss.as.jaxrs"/>
- <extension module="org.jboss.as.jmx"/>
- <extension module="org.jboss.as.jpa"/>
- <extension module="org.jboss.as.logging"/>
- <extension module="org.jboss.as.messaging"/>
- <extension module="org.jboss.as.naming"/>
- <extension module="org.jboss.as.osgi"/>
- <extension module="org.jboss.as.remoting"/>
- <extension module="org.jboss.as.sar"/>
- <extension module="org.jboss.as.security"/>
- <extension module="org.jboss.teiid"/>
- <extension module="org.jboss.as.threads"/>
- <extension module="org.jboss.as.transactions"/>
- <extension module="org.jboss.as.web" />
- <extension module="org.jboss.as.webservices" />
- <extension module="org.jboss.as.weld" />
- </extensions>
-
- <paths>
- <path name="absolute" path="tmp"/>
- <path name="relative" path="relative" relative-to="absolute"/>
- </paths>
-
- <management-interfaces>
- <native-interface interface="default" port="9999"/>
- <http-interface interface="default" port="9990"/>
- </management-interfaces>
-
- <profile name="ignore">
- <subsystem xmlns="urn:jboss:domain:logging:1.0">
- <console-handler name="CONSOLE">
- <level name="INFO"/>
- <formatter>
- <pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
- </formatter>
- </console-handler>
-
- <periodic-rotating-file-handler name="FILE">
- <level name="INFO"/>
- <formatter>
- <pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
- </formatter>
- <file relative-to="jboss.server.log.dir" path="server.log"/>
- <suffix value=".yyyy-MM-dd"/>
- </periodic-rotating-file-handler>
-
- <logger category="com.arjuna">
- <level name="WARN"/>
- </logger>
- <logger category="org.apache.tomcat.util.modeler">
- <level name="WARN"/>
- </logger>
- <logger category="sun.rmi">
- <level name="WARN"/>
- </logger>
-
- <root-logger>
- <level name="INFO"/>
- <handlers>
- <handler name="CONSOLE"/>
- <handler name="FILE"/>
- </handlers>
- </root-logger>
- </subsystem>
- <subsystem xmlns="urn:jboss:domain:threads:1.0">
- <scheduled-thread-pool name="remoting">
- <max-threads count="10" per-cpu="20"/>
- <keepalive-time time="10" unit="seconds"/>
- </scheduled-thread-pool>
- <bounded-queue-thread-pool name="jca-short-running" blocking="true">
- <core-threads count="10" per-cpu="20"/>
- <queue-length count="10" per-cpu="20"/>
- <max-threads count="10" per-cpu="20"/>
- <keepalive-time time="10" unit="seconds"/>
- </bounded-queue-thread-pool>
- <bounded-queue-thread-pool name="jca-long-running" blocking="true">
- <core-threads count="10" per-cpu="20"/>
- <queue-length count="10" per-cpu="20"/>
- <max-threads count="10" per-cpu="20"/>
- <keepalive-time time="10" unit="seconds"/>
- </bounded-queue-thread-pool>
- <bounded-queue-thread-pool name="ejb3-async" blocking="true">
- <core-threads count="10" per-cpu="20"/>
- <queue-length count="10" per-cpu="20"/>
- <max-threads count="10" per-cpu="20"/>
- <keepalive-time time="10" unit="seconds"/>
- </bounded-queue-thread-pool>
- <bounded-queue-thread-pool name="teiid-async" blocking="true">
- <core-threads count="10" per-cpu="20"/>
- <queue-length count="10" per-cpu="20"/>
- <max-threads count="10" per-cpu="20"/>
- <keepalive-time time="10" unit="seconds"/>
- </bounded-queue-thread-pool>
- </subsystem>
- <subsystem xmlns="urn:jboss:domain:arquillian:1.0" />
- <subsystem xmlns="urn:jboss:domain:ee:1.0" />
- <subsystem xmlns="urn:jboss:domain:ejb3:1.0" />
- <subsystem xmlns="urn:jboss:domain:naming:1.0" />
- <subsystem xmlns="urn:jboss:domain:security:1.0">
- <security-domains>
- <security-domain name="other">
- <authentication>
- <login-module code="UsersRoles" flag="required"/>
- </authentication>
- </security-domain>
- </security-domains>
- </subsystem>
- <subsystem xmlns="urn:jboss:domain:remoting:1.0" thread-pool="remoting"/>
- <subsystem xmlns="urn:jboss:domain:jmx:1.0">
- <jmx-connector registry-binding="jmx-connector-registry" server-binding="jmx-connector-server" />
- </subsystem>
- <subsystem xmlns="urn:jboss:domain:jaxrs:1.0"/>
- <subsystem xmlns="urn:jboss:domain:jpa:1.0"/>
- <subsystem xmlns="urn:jboss:domain:sar:1.0"/>
- <subsystem xmlns="urn:jboss:domain:transactions:1.0">
- <recovery-environment socket-binding="txn-recovery-environment" status-socket-binding="txn-status-manager"/>
- <core-environment socket-binding="txn-socket-process-id"/>
- </subsystem>
- <subsystem xmlns="urn:jboss:domain:connector:1.0">
- <archive-validation enabled="false" />
- <bean-validation enabled="false" />
- <default-workmanager short-running-thread-pool="jca-short-running" long-running-thread-pool="jca-long-running" />
- </subsystem>
- <subsystem xmlns="urn:jboss:domain:datasources:1.0">
- <datasources>
- <datasource jndi-name="java:/H2DS" enabled="true" use-java-context="true" pool-name="H2DS">
- <connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1</connection-url>
- <driver-class>org.h2.Driver</driver-class>
- <driver>org.h2.Driver#1.2</driver>
- <pool></pool>
- <security>
- <user-name>sa</user-name>
- <password>sa</password>
- </security>
- <validation></validation>
- <timeout></timeout>
- <statement></statement>
- </datasource>
- </datasources>
- <drivers>
- <driver module="com.h2database.h2"/>
- </drivers>
- </subsystem>
- <subsystem xmlns="urn:jboss:domain:resourceadapters:1.0">
- <!-- <resource-adapters>
- <resource-adapter>
- <archive>ra16out.rar</archive>
- <connection-definitions>
- <connection-definition jndi-name="java:/eis/ra16out-raxml"
- class-name="org.jboss.jca.test.deployers.spec.rars.ra16out.TestManagedConnectionFactory">
- </connection-definition>
- </connection-definitions>
- </resource-adapter>
- </resource-adapters>-->
- </subsystem>
- <subsystem xmlns="urn:jboss:domain:osgi:1.0" activation="lazy">
- <configuration pid="org.apache.felix.webconsole.internal.servlet.OsgiManager">
- <property name="manager.root">jboss-osgi</property>
- </configuration>
- <properties>
- <!--
- A comma seperated list of module identifiers. Each system module
- is added as a dependency to the OSGi framework module. The packages
- from these system modules can be made visible as framework system packages.
- http://www.osgi.org/javadoc/r4v42/org/osgi/framework/Constants.html#FRAME...
- -->
- <property name="org.jboss.osgi.system.modules">
- org.apache.log4j,
- org.jboss.as.osgi,
- </property>
- <!--
- Framework environment property identifying extra packages which the system bundle
- must export from the current execution environment
- -->
- <property name="org.osgi.framework.system.packages.extra">
- org.apache.log4j;version=1.2,
- org.jboss.as.osgi.service;version=7.0,
- org.jboss.osgi.spi.capability;version=1.0,
- org.jboss.osgi.spi.util;version=1.0,
- org.jboss.osgi.testing;version=1.0,
- </property>
- </properties>
- <modules>
- <!-- modules registered with the OSGi layer on startup -->
- <module identifier="org.jboss.as.arquillian.aggregate"/>
- <module identifier="org.jboss.logging"/>
- <!-- bundles installed on startup -->
- <module identifier="org.apache.aries.jmx" start="true"/>
- <module identifier="org.apache.aries.util"/>
- <module identifier="org.apache.felix.configadmin" start="true"/>
- <module identifier="org.jboss.as.osgi.configadmin" start="true"/>
- <module identifier="org.jboss.osgi.common" start="true"/>
- <module identifier="org.jboss.osgi.jmx" start="true"/>
- <module identifier="org.osgi.compendium"/>
- </modules>
- </subsystem>
- <subsystem xmlns="urn:jboss:domain:messaging:1.0">
- <!-- Default journal file size is 10Mb, reduced here to 100k for faster first boot -->
- <journal-file-size>102400</journal-file-size>
- <journal-min-files>2</journal-min-files>
- <journal-type>NIO</journal-type>
- <!-- disable messaging persistence -->
- <persistence-enabled>false</persistence-enabled>
-
- <connectors>
- <in-vm-connector name="in-vm" server-id="0" />
- <netty-connector name="netty" socket-binding="messaging" />
- <netty-connector name="netty-throughput" socket-binding="messaging-throughput">
- <param key="batch-delay" value="50"/>
- </netty-connector>
- </connectors>
-
- <acceptors>
- <in-vm-acceptor name="in-vm" server-id="0" />
- <netty-acceptor name="netty" socket-binding="messaging" />
- <netty-acceptor name="netty-throughput" socket-binding="messaging-throughput">
- <param key="batch-delay" value="50"/>
- <param key="direct-deliver" value="false"/>
- </netty-acceptor>
- </acceptors>
-
- <security-settings>
- <security-setting match="#">
- <permission type="createNonDurableQueue" roles="guest"/>
- <permission type="deleteNonDurableQueue" roles="guest"/>
- <permission type="consume" roles="guest"/>
- <permission type="send" roles="guest"/>
- </security-setting>
- </security-settings>
-
- <address-settings>
- <!--default for catch all-->
- <address-setting match="#">
- <dead-letter-address>jms.queue.DLQ</dead-letter-address>
- <expiry-address>jms.queue.ExpiryQueue</expiry-address>
- <redelivery-delay>0</redelivery-delay>
- <max-size-bytes>10485760</max-size-bytes>
- <message-counter-history-day-limit>10</message-counter-history-day-limit>
- <address-full-policy>BLOCK</address-full-policy>
- </address-setting>
- </address-settings>
- </subsystem>
- <subsystem xmlns="urn:jboss:domain:messaging:jms:1.0">
- <connection-factory name="InVmConnectionFactory">
- <connectors>
- <connector-ref connector-name="in-vm" backup-connector-name="netty"/>
- </connectors>
- <entries>
- <entry name="java:/ConnectionFactory" />
- </entries>
- </connection-factory>
- <connection-factory name="RemoteConnectionFactory">
- <connectors>
- <connector-ref connector-name="netty" backup-connector-name="in-vm"/>
- </connectors>
- <entries>
- <entry name="RemoteConnectionFactory" />
- </entries>
- </connection-factory>
- <queue name="testQueue">
- <entry name="queue/test" />
- </queue>
- <topic name="testTopic">
- <entry name="topic/test" />
- </topic>
- </subsystem>
- <subsystem xmlns="urn:jboss:domain:web:1.0">
- <connector name="http" scheme="http" protocol="HTTP/1.1" socket-binding="http"/>
- <virtual-server name="localhost">
- <alias name="example.com" />
- </virtual-server>
- </subsystem>
- <subsystem xmlns="urn:jboss:domain:weld:1.0" />
- <subsystem xmlns="urn:jboss:domain:deployment-scanner:1.0">
- <deployment-scanner scan-interval="5000" relative-to="jboss.server.base.dir" path="deployments" />
- </subsystem>
- <subsystem xmlns="urn:jboss:domain:webservices:1.0">
- <configuration>
- <webServiceHost>localhost</webServiceHost>
- <modifySOAPAddress>true</modifySOAPAddress>
- <!-- <webServiceSecurePort>8443</webServiceSecurePort>
- <webServicePort>8080</webServicePort> -->
- </configuration>
- </subsystem>
-
- <subsystem xmlns="urn:jboss:domain:teiid:1.0">
- <buffer-service>
- <useDisk>true</useDisk>
- <diskDirectory>${jboss.server.temp.dir}/teiid</diskDirectory>
- <processorBatchSize>512</processorBatchSize>
- <connectorBatchSize>1024</connectorBatchSize>
- <maxReserveBatchColumns>-1</maxReserveBatchColumns>
- <maxProcessingBatchesColumns>-1</maxProcessingBatchesColumns>
- <maxFileSize>2048</maxFileSize>
- <maxBufferSpace>51200</maxBufferSpace>
- <maxOpenFiles>64</maxOpenFiles>
- </buffer-service>
- <cache-factory class="org.teiid.cache.jboss.ClusterableCacheFactory" enabled="true">
- <cacheManager>java:TeiidCacheManager</cacheManager>
- <resultsetCacheName>teiid-resultset-cache</resultsetCacheName>
- </cache-factory>
- <resultset-cache-config class="org.teiid.cache.CacheConfiguration" enabled="true">
- <maxEntries>1024</maxEntries>
- <maxAgeInSeconds>7200</maxAgeInSeconds>
- <maxStaleness>60</maxStaleness>
- <type>EXPIRATION</type>
- <location>resultset</location>
- </resultset-cache-config>
- <preparedplan-cache-config class="org.teiid.cache.CacheConfiguration">
- <maxEntries>512</maxEntries>
- <maxAgeInSeconds>28800</maxAgeInSeconds>
- <maxStaleness>0</maxStaleness>
- </preparedplan-cache-config>
-
- <runtime-engine jndi-name="teiid/engine-deployer">
- <thread-group-async>teiid-async</thread-group-async>
- <maxThreads>64</maxThreads>
- <maxActivePlans>20</maxActivePlans>
- <userRequestSourceConcurrency>0</userRequestSourceConcurrency>
- <timeSliceInMilli>2000</timeSliceInMilli>
- <maxRowsFetchSize>20480</maxRowsFetchSize>
- <lobChunkSizeInKB>100</lobChunkSizeInKB>
- <useDataRoles>true</useDataRoles>
- <allowCreateTemporaryTablesByDefault>true</allowCreateTemporaryTablesByDefault>
- <allowFunctionCallsByDefault>true</allowFunctionCallsByDefault>
- <queryThresholdInSecs>600</queryThresholdInSecs>
- <maxSourceRows>-1</maxSourceRows>
- <exceptionOnMaxSourceRows>true</exceptionOnMaxSourceRows>
- <maxODBCLobSizeAllowed>5242880</maxODBCLobSizeAllowed>
- <eventDistributorName>teiid/event-distributor</eventDistributorName>
- <detectingChangeEvents>true</detectingChangeEvents>
- <securityDomains>teiid-security</securityDomains>
- <adminSecurityDomain>jmx-console</adminSecurityDomain>
- <sessionMaxLimit>5000</sessionMaxLimit>
- <sessionExpirationTimeLimit>0</sessionExpirationTimeLimit>
- </runtime-engine>
-
- <jdbc enabled="true">
- <maxSocketThreads>0</maxSocketThreads>
- <inputBufferSize>0</inputBufferSize>
- <outputBufferSize>0</outputBufferSize>
- <socket-binding>teiid-jdbc</socket-binding>
- </jdbc>
-
- <odbc enabled="true">
- <maxSocketThreads>0</maxSocketThreads>
- <inputBufferSize>0</inputBufferSize>
- <outputBufferSize>0</outputBufferSize>
- <socket-binding>teiid-odbc</socket-binding>
- </odbc>
- </subsystem>
- </profile>
-
- <interfaces>
- <interface name="default">
- <inet-address value="127.0.0.1"/>
- </interface>
- <interface name="any">
- <any-address/>
- </interface>
- <interface name="complex">
- <any>
- <subnet-match value="192.168.0.0/16"/>
- <public-address/>
- </any>
- <not>
- <site-local-address/>
- </not>
- <up/>
- <multicast/>
- </interface>
- </interfaces>
-
- <socket-binding-group name="standard-sockets" default-interface="default">
- <socket-binding name="jndi" port="1099"/>
- <socket-binding name="jmx-connector-registry" port="1090"/>
- <socket-binding name="jmx-connector-server" port="1091"/>
- <socket-binding name="http" port="8080"/>
- <socket-binding name="https" port="8447"/>
- <socket-binding name="osgi-http" port="8090"/>
- <socket-binding name="remoting" port="4447"/>
- <socket-binding name="txn-recovery-environment" port="4712"/>
- <socket-binding name="txn-status-manager" port="4713"/>
- <socket-binding name="txn-socket-process-id" port="4714"/>
- <socket-binding name="messaging" port="5445" />
- <socket-binding name="messaging-throughput" port="5455"/>
- <socket-binding name="teiid-jdbc" port="31000"/>
- <socket-binding name="teiid-odbc" port="35432"/>
- </socket-binding-group>
-
- <system-properties>
- <property name="foo" value="bar"/>
- <property name="key" value="value"/>
- </system-properties>
-</server>
-
Modified: branches/as7/client/pom.xml
===================================================================
--- branches/as7/client/pom.xml 2011-07-09 00:08:35 UTC (rev 3304)
+++ branches/as7/client/pom.xml 2011-07-11 03:06:57 UTC (rev 3305)
@@ -23,7 +23,17 @@
<dependency>
<groupId>org.jboss</groupId>
<artifactId>jboss-dmr</artifactId>
- </dependency>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-controller-client</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-cli</artifactId>
+ <scope>provided</scope>
+ </dependency>
<!--
<dependency>
<groupId>org.jboss.man</groupId>
Modified: branches/as7/client/src/main/java/org/teiid/adminapi/AdminFactory.java
===================================================================
--- branches/as7/client/src/main/java/org/teiid/adminapi/AdminFactory.java 2011-07-09 00:08:35 UTC (rev 3304)
+++ branches/as7/client/src/main/java/org/teiid/adminapi/AdminFactory.java 2011-07-11 03:06:57 UTC (rev 3305)
@@ -22,147 +22,322 @@
package org.teiid.adminapi;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.UnknownHostException;
+import java.util.Collection;
+import java.util.List;
import java.util.Properties;
+import java.util.Set;
-import org.teiid.core.util.PropertiesUtils;
-import org.teiid.jdbc.JDBCPlugin;
-import org.teiid.net.CommunicationException;
-import org.teiid.net.ConnectionException;
-import org.teiid.net.ServerConnection;
-import org.teiid.net.ServerConnectionFactory;
-import org.teiid.net.TeiidURL;
-import org.teiid.net.socket.SocketServerConnectionFactory;
+import javax.security.auth.callback.*;
+import javax.security.sasl.RealmCallback;
+import javax.security.sasl.RealmChoiceCallback;
+import org.jboss.as.cli.Util;
+import org.jboss.as.cli.operation.impl.DefaultOperationRequestAddress;
+import org.jboss.as.controller.client.ModelControllerClient;
+import org.teiid.adminapi.VDB.ConnectionType;
+
/**
* Singleton factory for class for creating Admin connections to the Teiid
*/
public class AdminFactory {
+ private static AdminFactory INSTANCE = new AdminFactory();
- private final class AdminProxy implements InvocationHandler {
-
- private Admin admin;
- private ServerConnection serverConnection;
- private boolean closed;
-
- public AdminProxy(Properties p) throws ConnectionException, CommunicationException {
- this.serverConnection = serverConnectionFactory.getConnection(p);
- this.admin = serverConnection.getService(Admin.class);
- }
-
- private synchronized Admin getTarget() throws AdminComponentException {
- if (closed) {
- throw new AdminComponentException(JDBCPlugin.Util.getString("admin_conn_closed")); //$NON-NLS-1$
- }
- return admin;
- }
-
- @Override
- public Object invoke(Object proxy, Method method, Object[] args)
- throws Throwable {
- if (method.getName().equals("close")) { //$NON-NLS-1$
- close();
- return null;
- }
- if (!method.getDeclaringClass().equals(Admin.class)) {
- return method.invoke(this, args);
- }
- try {
- return method.invoke(getTarget(), args);
- } catch (InvocationTargetException e) {
- throw e.getTargetException();
- }
- }
-
- public synchronized void close() {
- if (closed) {
- return;
- }
- this.closed = true;
- if (serverConnection != null) {
- serverConnection.close();
- }
- }
- }
-
- public static final String DEFAULT_APPLICATION_NAME = "Admin"; //$NON-NLS-1$
-
- private static AdminFactory instance = new AdminFactory(SocketServerConnectionFactory.getInstance());
-
- private ServerConnectionFactory serverConnectionFactory;
-
- AdminFactory(ServerConnectionFactory connFactory) {
- this.serverConnectionFactory = connFactory;
- }
-
- public static AdminFactory getInstance() {
- return instance;
- }
-
-
+ public static AdminFactory getInstance() {
+ return INSTANCE;
+ }
/**
* Creates a ServerAdmin with the specified connection properties.
- * Uses the DEFAULT_APPLICATION_NAME as the application name.
* @param userName
* @param password
* @param serverURL
+ * @param applicationName
* @return
* @throws AdminException
*/
- public Admin createAdmin(String userName,
- char[] password,
- String serverURL) throws AdminException {
-
- return createAdmin(userName, password, serverURL, DEFAULT_APPLICATION_NAME);
-
+ public Admin createAdmin(String host, int port, String userName, char[] password) throws AdminException {
+ if(host == null) {
+ host = "localhost"; //$NON-NLS-1$
+ }
+
+ if(port < 0) {
+ port = 9990;
+ }
+
+ try {
+ CallbackHandler cbh = new AuthenticationCallbackHandler(userName, password);
+ ModelControllerClient newClient = ModelControllerClient.Factory.create(host, port, cbh);
+
+ List<String> nodeTypes = Util.getNodeTypes(newClient, new DefaultOperationRequestAddress());
+ if (!nodeTypes.isEmpty()) {
+ boolean domainMode = nodeTypes.contains("server-group"); //$NON-NLS-1$
+ System.out.println("Connected to " //$NON-NLS-1$
+ + (domainMode ? "domain controller at " : "standalone controller at ") //$NON-NLS-1$ //$NON-NLS-2$
+ + host + ":" + port); //$NON-NLS-1$
+ return new AdminImpl(newClient);
+ }
+ System.out.println("The controller is not available at " + host + ":" + port); //$NON-NLS-1$ //$NON-NLS-2$
+ } catch (UnknownHostException e) {
+ System.out.println("Failed to resolve host '" + host + "': " + e.getLocalizedMessage()); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ return null;
}
- /**
- * Creates a ServerAdmin with the specified connection properties.
- * @param userName
- * @param password
- * @param serverURL
- * @param applicationName
- * @return
- * @throws AdminException
- */
- public Admin createAdmin(String userName,
- char[] password,
- String serverURL,
- String applicationName) throws AdminException {
-
- if (userName == null || userName.trim().length() == 0) {
- throw new IllegalArgumentException(JDBCPlugin.Util.getString("invalid_parameter")); //$NON-NLS-1$
+ private class AuthenticationCallbackHandler implements CallbackHandler {
+ private boolean realmShown = false;
+ private String userName = null;
+ private char[] password = null;
+
+ public AuthenticationCallbackHandler(String user, char[] password) {
+ this.userName = user;
+ this.password = password;
}
- final Properties p = new Properties();
- p.setProperty(TeiidURL.CONNECTION.APP_NAME, applicationName);
- p.setProperty(TeiidURL.CONNECTION.USER_NAME, userName);
- if (password != null) {
- p.setProperty(TeiidURL.CONNECTION.PASSWORD, new String(password));
+ public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
+ // Special case for anonymous authentication to avoid prompting user for their name.
+ if (callbacks.length == 1 && callbacks[0] instanceof NameCallback) {
+ ((NameCallback)callbacks[0]).setName("anonymous CLI user"); //$NON-NLS-1$
+ return;
+ }
+
+ for (Callback current : callbacks) {
+ if (current instanceof RealmCallback) {
+ RealmCallback rcb = (RealmCallback) current;
+ String defaultText = rcb.getDefaultText();
+ rcb.setText(defaultText); // For now just use the realm suggested.
+ if (realmShown == false) {
+ realmShown = true;
+ }
+ } else if (current instanceof RealmChoiceCallback) {
+ throw new UnsupportedCallbackException(current, "Realm choice not currently supported."); //$NON-NLS-1$
+ } else if (current instanceof NameCallback) {
+ NameCallback ncb = (NameCallback) current;
+ ncb.setName(userName);
+ } else if (current instanceof PasswordCallback) {
+ PasswordCallback pcb = (PasswordCallback) current;
+ pcb.setPassword(password);
+ } else {
+ throw new UnsupportedCallbackException(current);
+ }
+ }
}
- p.setProperty(TeiidURL.CONNECTION.SERVER_URL, serverURL);
- return createAdmin(p);
- }
- public Admin createAdmin(Properties p) throws AdminException {
- p = PropertiesUtils.clone(p);
- p.remove(TeiidURL.JDBC.VDB_NAME);
- p.remove(TeiidURL.JDBC.VDB_VERSION);
- p.setProperty(TeiidURL.CONNECTION.ADMIN, Boolean.TRUE.toString());
-
- try {
- Admin serverAdmin = (Admin)Proxy.newProxyInstance(this.getClass().getClassLoader(), new Class[] { Admin.class }, new AdminProxy(p));
- return serverAdmin;
- } catch (ConnectionException e) {
- throw new AdminComponentException(e);
- } catch (CommunicationException e) {
- throw new AdminComponentException(e);
+ }
+
+ private class AdminImpl implements Admin{
+ public AdminImpl (ModelControllerClient connection) {
+
+ }
+
+ @Override
+ public void addDataRoleMapping(String vdbName, int vdbVersion,
+ String dataRole, String mappedRoleName) throws AdminException {
+ // rameshTODO Auto-generated method stub
+
}
+
+ @Override
+ public void assignToModel(String vdbName, int vdbVersion,
+ String modelName, String sourceName, String translatorName,
+ String dsName) throws AdminException {
+ // rameshTODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void cancelRequest(String sessionId, long executionId)
+ throws AdminException {
+ // rameshTODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void changeVDBConnectionType(String vdbName, int vdbVersion,
+ ConnectionType type) throws AdminException {
+ // rameshTODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void clearCache(String cacheType) throws AdminException {
+ // rameshTODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void clearCache(String cacheType, String vdbName, int vdbVersion)
+ throws AdminException {
+ // rameshTODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void close() {
+ // rameshTODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void createDataSource(String deploymentName,
+ String templateName, Properties properties)
+ throws AdminException {
+ // rameshTODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void deleteDataSource(String deployedName) throws AdminException {
+ // rameshTODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void deleteVDB(String vdbName, int vdbVersion)
+ throws AdminException {
+ // rameshTODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void deployVDB(String fileName, InputStream vdb)
+ throws AdminException {
+ // rameshTODO Auto-generated method stub
+
+ }
+
+ @Override
+ public CacheStatistics getCacheStats(String cacheType)
+ throws AdminException {
+ // rameshTODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Collection<String> getCacheTypes() throws AdminException {
+ // rameshTODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Collection<String> getDataSourceNames() throws AdminException {
+ // rameshTODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Set<String> getDataSourceTemplateNames() throws AdminException {
+ // rameshTODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Collection<Request> getRequests() throws AdminException {
+ // rameshTODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Collection<Request> getRequestsForSession(String sessionId)
+ throws AdminException {
+ // rameshTODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Collection<Session> getSessions() throws AdminException {
+ // rameshTODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Collection<PropertyDefinition> getTemplatePropertyDefinitions(
+ String templateName) throws AdminException {
+ // rameshTODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Collection<Transaction> getTransactions() throws AdminException {
+ // rameshTODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Translator getTranslator(String deployedName)
+ throws AdminException {
+ // rameshTODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Collection<Translator> getTranslators() throws AdminException {
+ // rameshTODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public VDB getVDB(String vdbName, int vbdVersion) throws AdminException {
+ // rameshTODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Set<VDB> getVDBs() throws AdminException {
+ // rameshTODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public WorkerPoolStatistics getWorkerPoolStats() throws AdminException {
+ // rameshTODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void markDataSourceAvailable(String jndiName)
+ throws AdminException {
+ // rameshTODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void mergeVDBs(String sourceVDBName, int sourceVDBVersion,
+ String targetVDBName, int targetVDBVersion)
+ throws AdminException {
+ // rameshTODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void removeDataRoleMapping(String vdbName, int vdbVersion,
+ String dataRole, String mappedRoleName) throws AdminException {
+ // rameshTODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setAnyAuthenticatedForDataRole(String vdbName,
+ int vdbVersion, String dataRole, boolean anyAuthenticated)
+ throws AdminException {
+ // rameshTODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void terminateSession(String sessionId) throws AdminException {
+ // rameshTODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void terminateTransaction(String transactionId)
+ throws AdminException {
+ // rameshTODO Auto-generated method stub
+
+ }
}
}
Deleted: branches/as7/client/src/main/java/org/teiid/adminapi/impl/Admin.java
===================================================================
--- branches/as7/client/src/main/java/org/teiid/adminapi/impl/Admin.java 2011-07-09 00:08:35 UTC (rev 3304)
+++ branches/as7/client/src/main/java/org/teiid/adminapi/impl/Admin.java 2011-07-11 03:06:57 UTC (rev 3305)
@@ -1,745 +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.adminapi.impl;
-
-import java.io.InputStream;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-
-import org.jboss.deployers.spi.management.ManagementView;
-import org.jboss.deployers.spi.management.deploy.DeploymentManager;
-import org.jboss.managed.api.ComponentType;
-import org.jboss.managed.api.DeploymentTemplateInfo;
-import org.jboss.managed.api.ManagedComponent;
-import org.jboss.managed.api.ManagedObject;
-import org.jboss.managed.api.ManagedProperty;
-import org.jboss.managed.plugins.DefaultFieldsImpl;
-import org.jboss.managed.plugins.WritethroughManagedPropertyImpl;
-import org.jboss.metatype.api.types.CollectionMetaType;
-import org.jboss.metatype.api.types.EnumMetaType;
-import org.jboss.metatype.api.types.SimpleMetaType;
-import org.jboss.metatype.api.values.CollectionValueSupport;
-import org.jboss.metatype.api.values.MetaValue;
-import org.jboss.metatype.api.values.MetaValueFactory;
-import org.jboss.metatype.api.values.SimpleValue;
-import org.jboss.metatype.api.values.SimpleValueSupport;
-import org.jboss.profileservice.spi.NoSuchDeploymentException;
-import org.jboss.profileservice.spi.ProfileKey;
-import org.jboss.virtual.VFS;
-import org.teiid.adminapi.AdminComponentException;
-import org.teiid.adminapi.AdminException;
-import org.teiid.adminapi.AdminObject;
-import org.teiid.adminapi.AdminProcessingException;
-import org.teiid.adminapi.CacheStatistics;
-import org.teiid.adminapi.PropertyDefinition;
-import org.teiid.adminapi.Request;
-import org.teiid.adminapi.Session;
-import org.teiid.adminapi.Transaction;
-import org.teiid.adminapi.Translator;
-import org.teiid.adminapi.VDB;
-import org.teiid.adminapi.WorkerPoolStatistics;
-import org.teiid.adminapi.VDB.ConnectionType;
-import org.teiid.adminapi.impl.CacheStatisticsMetadata;
-import org.teiid.adminapi.impl.PropertyDefinitionMetadata;
-import org.teiid.adminapi.impl.RequestMetadata;
-import org.teiid.adminapi.impl.SessionMetadata;
-import org.teiid.adminapi.impl.TransactionMetadata;
-import org.teiid.adminapi.impl.TranslatorMetaData;
-import org.teiid.adminapi.impl.VDBMetaData;
-import org.teiid.adminapi.impl.WorkerPoolStatisticsMetadata;
-import org.teiid.deployers.VDBStatusChecker;
-import org.teiid.jboss.IntegrationPlugin;
-
-public class Admin implements org.teiid.adminapi.Admin, Serializable {
- private static final String CONNECTOR_PREFIX = "connector-"; //$NON-NLS-1$
- private static final ProfileKey DEFAULT_PROFILE_KEY = new ProfileKey(ProfileKey.DEFAULT);
- private static final long serialVersionUID = 7081309086056911304L;
- private static ComponentType VDBTYPE = new ComponentType("teiid", "vdb");//$NON-NLS-1$ //$NON-NLS-2$
- private static ComponentType DQPTYPE = new ComponentType("teiid", "dqp");//$NON-NLS-1$ //$NON-NLS-2$
- private static String DQPNAME = "RuntimeEngineDeployer"; //$NON-NLS-1$
- private static ComponentType TRANSLATOR_TYPE = new ComponentType("teiid", "translator");//$NON-NLS-1$ //$NON-NLS-2$
-
- private static final String[] DS_TYPES = {"XA", "NoTx", "LocalTx"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- private static final String[] CF_TYPES = {"NoTx", "Tx"}; //$NON-NLS-1$ //$NON-NLS-2$
-
-
- private ManagementView view;
- private DeploymentManager deploymentMgr;
-
- final private VDBStatusChecker statusChecker;
-
- static {
- VFS.init();
- }
-
- public Admin(ManagementView view, DeploymentManager deployMgr, VDBStatusChecker statusChecker) {
- this.view = view;
- this.statusChecker = statusChecker;
- this.view.load();
-
- this.deploymentMgr = deployMgr;
- try {
- this.deploymentMgr.loadProfile(DEFAULT_PROFILE_KEY);
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- private ManagementView getView() throws AdminProcessingException {
- if (this.view == null) {
- throw new AdminProcessingException(IntegrationPlugin.Util.getString("admin_connection_closed")); //$NON-NLS-1$
- }
- this.view.load();
- return this.view;
- }
-
- private DeploymentManager getDeploymentManager() throws AdminProcessingException{
- if (this.deploymentMgr == null) {
- throw new AdminProcessingException(IntegrationPlugin.Util.getString("admin_connection_closed")); //$NON-NLS-1$
- }
- return this.deploymentMgr;
- }
-
- public void close() {
- this.view = null;
- this.deploymentMgr = null;
- }
-
-// private DQPManagement getDQPManagement() throws Exception {
-// final ManagedComponent mc = getView().getComponent(DQPManagementView.class.getName(), DQPTYPE);
-//
-// return (DQPManagement)Proxy.newProxyInstance(this.getClass().getClassLoader(), new Class[] {DQPManagement.class}, new InvocationHandler() {
-// @Override
-// public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
-//
-// MetaValue value = ManagedUtil.executeOperation(mc, method.getName());
-// Class returnType = method.getReturnType();
-// if (returnType.equals(Void.class)) {
-// return value;
-// }
-// return null;
-// }
-// });
-// }
-
- @Override
- public Collection<Translator> getTranslators() throws AdminException {
- ArrayList<Translator> factories = new ArrayList<Translator>();
- try {
- Set<ManagedComponent> mcSet = getView().getComponentsForType(TRANSLATOR_TYPE);
- for (ManagedComponent mc:mcSet) {
- factories.add(AdminObjectBuilder.buildAO(mc, TranslatorMetaData.class));
- }
- } catch (Exception e) {
- throw new AdminComponentException(e);
- }
- return factories;
- }
-
- @Override
- public Translator getTranslator(String deployedName) throws AdminException {
- try {
- ManagedComponent mc = getView().getComponent(deployedName, TRANSLATOR_TYPE);
- if (mc != null) {
- return AdminObjectBuilder.buildAO(mc, TranslatorMetaData.class);
- }
- return null;
- } catch(Exception e) {
- throw new AdminProcessingException(e.getMessage(), e);
- }
- }
-
- boolean matches(String regEx, String value) {
- regEx = regEx.replaceAll(AdminObject.ESCAPED_WILDCARD, ".*"); //$NON-NLS-1$
- regEx = regEx.replaceAll(AdminObject.ESCAPED_DELIMITER, ""); //$NON-NLS-1$
- return value.matches(regEx);
- }
-
- @Override
- public void deployVDB(String fileName, InputStream vdb) throws AdminException {
- if (!fileName.endsWith(".vdb") && !fileName.endsWith("-vdb.xml")) {//$NON-NLS-1$ //$NON-NLS-2$
- throw new AdminProcessingException(IntegrationPlugin.Util.getString("bad_vdb_extension")); //$NON-NLS-1$
- }
- ManagedUtil.deployArchive(getDeploymentManager(), fileName, vdb, false);
- }
-
-
- @Override
- public void deleteVDB(String vdbName, int vdbVersion) throws AdminException {
- ManagedComponent mc = getVDBManagedComponent(vdbName, vdbVersion);
- if (mc != null) {
- ManagedUtil.removeArchive(getDeploymentManager(), mc.getDeployment().getName());
- }
- }
-
- @Override
- public VDB getVDB(String vdbName, int vdbVersion) throws AdminException{
- ManagedComponent mc = getVDBManagedComponent(vdbName, vdbVersion);
- if (mc != null) {
- return AdminObjectBuilder.buildAO(mc, VDBMetaData.class);
- }
- return null;
- }
-
- private ManagedComponent getVDBManagedComponent(String vdbName, int vdbVersion) throws AdminException{
- try {
- Set<ManagedComponent> vdbComponents = getView().getComponentsForType(VDBTYPE);
- for (ManagedComponent mc: vdbComponents) {
- String name = ManagedUtil.getSimpleValue(mc, "name", String.class);//$NON-NLS-1$
- int version = ManagedUtil.getSimpleValue(mc, "version", Integer.class);//$NON-NLS-1$
- if (name.equalsIgnoreCase(vdbName) && version == vdbVersion) {
- return mc;
- }
- }
- return null;
- } catch (Exception e) {
- throw new AdminComponentException(e.getMessage(), e);
- }
- }
-
- @Override
- public Set<VDB> getVDBs() throws AdminException {
- try {
- Set<VDB> vdbs = new HashSet<VDB>();
- Set<ManagedComponent> vdbComponents = getView().getComponentsForType(VDBTYPE);
- for (ManagedComponent mc: vdbComponents) {
- vdbs.add(AdminObjectBuilder.buildAO(mc, VDBMetaData.class));
- }
- return vdbs;
- } catch (Exception e) {
- throw new AdminComponentException(e.getMessage(), e);
- }
- }
-
- @Override
- public Collection<Session> getSessions() throws AdminException {
- try {
- Collection<Session> sessionList = new ArrayList<Session>();
- ManagedComponent mc = getView().getComponent(DQPNAME, DQPTYPE);
- MetaValue value = ManagedUtil.executeOperation(mc, "getActiveSessions");//$NON-NLS-1$
- MetaValue[] sessions = ((CollectionValueSupport)value).getElements();
- for (MetaValue mv:sessions) {
- sessionList.add((SessionMetadata)MetaValueFactory.getInstance().unwrap(mv, SessionMetadata.class));
- }
- return sessionList;
- } catch (Exception e) {
- throw new AdminComponentException(e.getMessage(), e);
- }
- }
-
- @Override
- public void terminateSession(String sessionId) throws AdminException {
- try {
- ManagedComponent mc = getView().getComponent(DQPNAME, DQPTYPE);
- ManagedUtil.executeOperation(mc, "terminateSession", SimpleValueSupport.wrap(sessionId));//$NON-NLS-1$
- } catch (Exception e) {
- throw new AdminComponentException(e.getMessage(), e);
- }
- }
-
- @Override
- public Collection<Request> getRequests() throws AdminException {
- try {
- Collection<Request> requestList = new ArrayList<Request>();
- ManagedComponent mc = getView().getComponent(DQPNAME, DQPTYPE);
- MetaValue value = ManagedUtil.executeOperation(mc, "getRequests");//$NON-NLS-1$
- MetaValue[] requests = ((CollectionValueSupport)value).getElements();
- for (MetaValue mv:requests) {
- requestList.add((RequestMetadata)MetaValueFactory.getInstance().unwrap(mv, RequestMetadata.class));
- }
- return requestList;
- } catch (Exception e) {
- throw new AdminComponentException(e.getMessage(), e);
- }
- }
-
- @Override
- public Collection<Request> getRequestsForSession(String sessionId) throws AdminException {
- try {
- Collection<Request> requestList = new ArrayList<Request>();
- ManagedComponent mc = getView().getComponent(DQPNAME, DQPTYPE);
- MetaValue value = ManagedUtil.executeOperation(mc, "getRequestsForSession", SimpleValueSupport.wrap(sessionId));//$NON-NLS-1$
- MetaValue[] requests = ((CollectionValueSupport)value).getElements();
- for (MetaValue mv:requests) {
- requestList.add((RequestMetadata)MetaValueFactory.getInstance().unwrap(mv, RequestMetadata.class));
- }
- return requestList;
- } catch (Exception e) {
- throw new AdminComponentException(e.getMessage(), e);
- }
- }
-
- @Override
- public void cancelRequest(String sessionId, long executionId) throws AdminException{
- try {
- ManagedComponent mc = getView().getComponent(DQPNAME, DQPTYPE);
- ManagedUtil.executeOperation(mc, "cancelRequest", SimpleValueSupport.wrap(sessionId), SimpleValueSupport.wrap(executionId));//$NON-NLS-1$
- } catch (Exception e) {
- throw new AdminComponentException(e.getMessage(), e);
- }
- }
-
- @Override
- public Collection<String> getCacheTypes() throws AdminException {
- try {
- Collection<String> requestList = new ArrayList<String>();
- ManagedComponent mc = getView().getComponent(DQPNAME, DQPTYPE);
- MetaValue value = ManagedUtil.executeOperation(mc, "getCacheTypes");//$NON-NLS-1$
- MetaValue[] requests = ((CollectionValueSupport)value).getElements();
- for (MetaValue mv:requests) {
- requestList.add(ManagedUtil.stringValue(mv));
- }
- return requestList;
- } catch (Exception e) {
- throw new AdminComponentException(e.getMessage(), e);
- }
- }
-
- @Override
- public void clearCache(String cacheType) throws AdminException{
- try {
- ManagedComponent mc = getView().getComponent(DQPNAME, DQPTYPE);
- ManagedUtil.executeOperation(mc, "clearCache", SimpleValueSupport.wrap(cacheType));//$NON-NLS-1$
- } catch (Exception e) {
- throw new AdminComponentException(e.getMessage(), e);
- }
- }
-
- @Override
- public void clearCache(String cacheType, String vdbName, int version) throws AdminException{
- try {
- ManagedComponent mc = getView().getComponent(DQPNAME, DQPTYPE);
- ManagedUtil.executeOperation(mc, "clearCache", SimpleValueSupport.wrap(cacheType), //$NON-NLS-1$
- SimpleValueSupport.wrap(vdbName), SimpleValueSupport.wrap(version));
- } catch (Exception e) {
- throw new AdminComponentException(e.getMessage(), e);
- }
- }
-
- @Override
- public Collection<Transaction> getTransactions() throws AdminException {
- try {
- Collection<Transaction> txnList = new ArrayList<Transaction>();
- ManagedComponent mc = getView().getComponent(DQPNAME, DQPTYPE);
- MetaValue value = ManagedUtil.executeOperation(mc, "getTransactions");//$NON-NLS-1$
- MetaValue[] requests = ((CollectionValueSupport)value).getElements();
- for (MetaValue mv:requests) {
- txnList.add((TransactionMetadata)MetaValueFactory.getInstance().unwrap(mv, TransactionMetadata.class));
- }
- return txnList;
- } catch (Exception e) {
- throw new AdminComponentException(e.getMessage(), e);
- }
- }
-
- @Override
- public void terminateTransaction(String xid) throws AdminException {
- try {
- ManagedComponent mc = getView().getComponent(DQPNAME, DQPTYPE);
- ManagedUtil.executeOperation(mc, "terminateTransaction", MetaValueFactory.getInstance().create(xid));//$NON-NLS-1$
- } catch (Exception e) {
- throw new AdminComponentException(e.getMessage(), e);
- }
- }
-
- @Override
- public WorkerPoolStatistics getWorkerPoolStats() throws AdminException {
- try {
- ManagedComponent mc = getView().getComponent(DQPNAME, DQPTYPE);
- MetaValue value = ManagedUtil.executeOperation(mc, "getWorkerPoolStatistics");//$NON-NLS-1$
- return (WorkerPoolStatistics)MetaValueFactory.getInstance().unwrap(value, WorkerPoolStatisticsMetadata.class);
- } catch (Exception e) {
- throw new AdminComponentException(e.getMessage(), e);
- }
- }
-
-
- @Override
- public Collection<PropertyDefinition> getTemplatePropertyDefinitions(String templateName) throws AdminException {
-
- DeploymentTemplateInfo info = null;
-
- try {
-
- try {
- info = getView().getTemplate(templateName);
- } catch (Exception e) {
- // ignore..
- }
-
- if (info == null && !templateName.startsWith(TranslatorMetaData.TRANSLATOR_PREFIX)) {
- info = getView().getTemplate(TranslatorMetaData.TRANSLATOR_PREFIX+templateName);
- }
- if(info == null) {
- throw new AdminProcessingException(IntegrationPlugin.Util.getString("template_not_found", templateName)); //$NON-NLS-1$
- }
-
- ArrayList<PropertyDefinition> props = new ArrayList<PropertyDefinition>();
- Map<String, ManagedProperty> propertyMap = info.getProperties();
-
- for (ManagedProperty mp:propertyMap.values()) {
- if (!includeInTemplate(mp)) {
- continue;
- }
- PropertyDefinitionMetadata p = new PropertyDefinitionMetadata();
- p.setName(mp.getName());
- p.setDescription(mp.getDescription());
- p.setDisplayName(mp.getMappedName());
- if (mp.getDefaultValue() != null) {
- p.setDefaultValue(((SimpleValueSupport)mp.getDefaultValue()).getValue());
- }
- p.setPropertyTypeClassName(mp.getMetaType().getTypeName());
- p.setModifiable(!mp.isReadOnly());
-
- if (mp.getField("masked", Boolean.class) != null) {//$NON-NLS-1$
- p.setMasked(mp.getField("masked", Boolean.class));//$NON-NLS-1$
- }
- else {
- p.setMasked(false);
- }
-
- if (mp.getField("advanced", Boolean.class) != null) {//$NON-NLS-1$
- p.setAdvanced(mp.getField("advanced", Boolean.class));//$NON-NLS-1$
- }
- else {
- p.setAdvanced(true);
- }
- if (mp.getLegalValues() != null) {
- HashSet<String> values = new HashSet<String>();
- for (MetaValue value:mp.getLegalValues()) {
- values.add(ManagedUtil.stringValue(value));
- }
- p.setAllowedValues(values);
- }
-
- p.setRequired(mp.isMandatory());
- props.add(p);
- };
- return props;
- } catch (NoSuchDeploymentException e) {
- throw new AdminComponentException(e.getMessage(), e);
- } catch(Exception e) {
- throw new AdminComponentException(e.getMessage(), e);
- }
- }
-
- private boolean includeInTemplate(ManagedProperty mp) {
- Boolean teiidProperty = mp.getField("teiid-property", Boolean.class);//$NON-NLS-1$
- if ( teiidProperty != null && teiidProperty.booleanValue()) {
- return true;
- }
- if (mp.isMandatory() && mp.getDefaultValue() == null) {
- return true;
- }
- return false;
- }
-
- @Override
- public void changeVDBConnectionType(String vdbName, int vdbVersion,
- ConnectionType type) throws AdminException {
- ManagedComponent mc = getVDBManagedComponent(vdbName, vdbVersion);
- if (mc == null) {
- throw new AdminProcessingException(IntegrationPlugin.Util.getString("vdb_not_found", vdbName, vdbVersion)); //$NON-NLS-1$
- }
-
- ManagedProperty connectionTypeProperty = mc.getProperty("connectionType"); //$NON-NLS-1$
- if (connectionTypeProperty != null) {
- connectionTypeProperty.setValue(ManagedUtil.wrap(new EnumMetaType(ConnectionType.values()), type != null ?type.name():ConnectionType.BY_VERSION.name()));
- }
-
- try {
- getView().updateComponent(mc);
- } catch (Exception e) {
- throw new AdminComponentException(e.getMessage(), e);
- }
- }
-
- @Override
- public void assignToModel(String vdbName, int vdbVersion, String modelName, String sourceName, String translatorName, String dsName) throws AdminException {
- ManagedComponent mc = getVDBManagedComponent(vdbName, vdbVersion);
- if (mc == null) {
- throw new AdminProcessingException(IntegrationPlugin.Util.getString("vdb_not_found", vdbName, vdbVersion)); //$NON-NLS-1$
- }
-
- ManagedProperty mp = mc.getProperty("models");//$NON-NLS-1$
- List<ManagedObject> models = (List<ManagedObject>)MetaValueFactory.getInstance().unwrap(mp.getValue());
- ManagedObject managedModel = null;
- if (models != null && !models.isEmpty()) {
- for(ManagedObject mo:models) {
- String name = ManagedUtil.getSimpleValue(mo, "name", String.class); //$NON-NLS-1$
- if (modelName.equals(name)) {
- managedModel = mo;
- }
- }
- }
-
- if (managedModel == null) {
- throw new AdminProcessingException(IntegrationPlugin.Util.getString("model_not_found", modelName, vdbName, vdbVersion)); //$NON-NLS-1$
- }
-
- ManagedProperty sourceMappings = managedModel.getProperty("sourceMappings");//$NON-NLS-1$
- if (sourceMappings != null){
- List<ManagedObject> mappings = (List<ManagedObject>)MetaValueFactory.getInstance().unwrap(sourceMappings.getValue());
- for (ManagedObject mo:mappings) {
- String sName = ManagedUtil.getSimpleValue(mo, "name", String.class);//$NON-NLS-1$
- if (sName.equals(sourceName)) {
-
- ManagedProperty translatorProperty = mo.getProperty("translatorName"); //$NON-NLS-1$
- if (translatorProperty == null) {
- translatorProperty = new WritethroughManagedPropertyImpl(mo, new DefaultFieldsImpl("translatorName")); //$NON-NLS-1$
- }
- translatorProperty.setValue(ManagedUtil.wrap(SimpleMetaType.STRING, translatorName));
-
- // set the jndi name for the ds.
- ManagedProperty jndiProperty = mo.getProperty("connectionJndiName"); //$NON-NLS-1$
- if (jndiProperty == null) {
- jndiProperty = new WritethroughManagedPropertyImpl(mo, new DefaultFieldsImpl("connectionJndiName")); //$NON-NLS-1$
- }
- jndiProperty.setValue(ManagedUtil.wrap(SimpleMetaType.STRING, dsName));
- }
- }
- } else {
- //TODO: this can be in the default situation when no source mappings are specified
- throw new AdminProcessingException(IntegrationPlugin.Util.getString("sourcename_not_found", sourceName, vdbName, vdbVersion, modelName)); //$NON-NLS-1$
- }
-
- try {
- getView().updateComponent(mc);
- } catch (Exception e) {
- throw new AdminComponentException(e.getMessage(), e);
- }
- }
-
- private void manageRoleToDataPolicy(String vdbName, int vdbVersion, String policyName, String role, boolean add) throws AdminException {
- ManagedComponent mc = getVDBManagedComponent(vdbName, vdbVersion);
- if (mc == null) {
- throw new AdminProcessingException(IntegrationPlugin.Util.getString("vdb_not_found", vdbName, vdbVersion)); //$NON-NLS-1$
- }
-
- ManagedProperty mp = mc.getProperty("dataPolicies");//$NON-NLS-1$
- List<ManagedObject> policies = (List<ManagedObject>)MetaValueFactory.getInstance().unwrap(mp.getValue());
- ManagedObject managedPolicy = null;
- if (policies != null && !policies.isEmpty()) {
- for(ManagedObject mo:policies) {
- String name = ManagedUtil.getSimpleValue(mo, "name", String.class); //$NON-NLS-1$
- if (policyName.equals(name)) {
- managedPolicy = mo;
- }
- }
- }
-
- if (managedPolicy == null) {
- throw new AdminProcessingException(IntegrationPlugin.Util.getString("policy_not_found", policyName, vdbName, vdbVersion)); //$NON-NLS-1$
- }
-
- if (role != null) {
- ManagedProperty mappedRoleNames = managedPolicy.getProperty("mappedRoleNames");//$NON-NLS-1$
- CollectionValueSupport roleCollection = (CollectionValueSupport)mappedRoleNames.getValue();
- ArrayList<MetaValue> modifiedRoleNames = new ArrayList<MetaValue>();
- if (roleCollection != null) {
- MetaValue[] roleNames = roleCollection.getElements();
- for (MetaValue mv:roleNames) {
- String existing = (String)((SimpleValueSupport)mv).getValue();
- if (!existing.equals(role)) {
- modifiedRoleNames.add(mv);
- }
- }
- }
- else {
- roleCollection = new CollectionValueSupport(new CollectionMetaType("java.util.List", SimpleMetaType.STRING)); //$NON-NLS-1$
- mappedRoleNames.setValue(roleCollection);
- }
-
- if (add) {
- modifiedRoleNames.add(ManagedUtil.wrap(SimpleMetaType.STRING, role));
- }
-
- roleCollection.setElements(modifiedRoleNames.toArray(new MetaValue[modifiedRoleNames.size()]));
- } else {
- ManagedProperty anyAuthenticated = managedPolicy.getProperty("anyAuthenticated");//$NON-NLS-1$
- anyAuthenticated.setValue(SimpleValueSupport.wrap(add));
- }
-
- try {
- getView().updateComponent(mc);
- } catch (Exception e) {
- throw new AdminComponentException(e.getMessage(), e);
- }
- }
-
-
- @Override
- public void addDataRoleMapping(String vdbName, int vdbVersion, String policyName, String role) throws AdminException {
- manageRoleToDataPolicy(vdbName, vdbVersion, policyName, role, true);
- }
-
- @Override
- public void removeDataRoleMapping(String vdbName, int vdbVersion, String policyName, String role) throws AdminException{
- manageRoleToDataPolicy(vdbName, vdbVersion, policyName, role, false);
- }
-
- @Override
- public void setAnyAuthenticatedForDataRole(String vdbName, int vdbVersion,
- String dataRole, boolean anyAuthenticated) throws AdminException {
- manageRoleToDataPolicy(vdbName, vdbVersion, dataRole, null, anyAuthenticated);
- }
-
- @Override
- public void mergeVDBs(String sourceVDBName, int sourceVDBVersion, String targetVDBName, int targetVDBVersion) throws AdminException {
- try {
- ManagedComponent mc = getView().getComponent(DQPNAME, DQPTYPE);
- ManagedUtil.executeOperation(mc, "mergeVDBs", //$NON-NLS-1$
- SimpleValueSupport.wrap(sourceVDBName),
- SimpleValueSupport.wrap(sourceVDBVersion),
- SimpleValueSupport.wrap(targetVDBName),
- SimpleValueSupport.wrap(targetVDBVersion));
- } catch (Exception e) {
- throw new AdminComponentException(e.getMessage(), e);
- }
- }
-
- private ManagedComponent getDatasource(String deployedName) throws Exception {
- ManagedComponent mc = null;
- for (String type:DS_TYPES) {
- ComponentType ct = new ComponentType("DataSource", type); //$NON-NLS-1$
- mc = getView().getComponent(deployedName, ct);
- if (mc != null) {
- return mc;
- }
- }
- for (String type:CF_TYPES) {
- ComponentType ct = new ComponentType("ConnectionFactory", type); //$NON-NLS-1$
- mc = getView().getComponent(deployedName, ct);
- if (mc != null) {
- return mc;
- }
- }
- return mc;
- }
-
-
- @Override
- public void createDataSource(String deploymentName, String templateName, Properties properties) throws AdminException {
- try {
- ManagedComponent mc = getDatasource(deploymentName);
- if (mc != null) {
- throw new AdminProcessingException(IntegrationPlugin.Util.getString("datasource_exists",deploymentName)); //$NON-NLS-1$;
- }
-
- DeploymentTemplateInfo info = getView().getTemplate(templateName);
- if(info == null) {
- throw new AdminProcessingException(IntegrationPlugin.Util.getString("datasource_template_not_found", templateName)); //$NON-NLS-1$
- }
-
- // template properties specific to the template
- Map<String, ManagedProperty> propertyMap = info.getProperties();
-
- // walk through the supplied properties and assign properly to template
- for (String key:properties.stringPropertyNames()) {
- ManagedProperty mp = propertyMap.get(key);
- if (mp != null) {
- String value = properties.getProperty(key);
- if (!ManagedUtil.sameValue(mp.getDefaultValue(), value)){
- mp.setValue(SimpleValueSupport.wrap(value));
- }
- }
- }
- info.getProperties().get("jndi-name").setValue(SimpleValueSupport.wrap(deploymentName)); //$NON-NLS-1$
- getView().applyTemplate(deploymentName, info);
- } catch (NoSuchDeploymentException e) {
- throw new AdminComponentException(e.getMessage(), e);
- } catch(Exception e) {
- throw new AdminComponentException(e.getMessage(), e);
- }
- }
-
- @Override
- public void deleteDataSource(String deployedName) throws AdminException {
- try {
- ManagedComponent mc = getDatasource(deployedName);
- if (mc != null) {
- ManagedUtil.removeArchive(getDeploymentManager(),mc.getDeployment().getName());
- }
- } catch (Exception e) {
- throw new AdminComponentException(e);
- }
- }
-
- @Override
- public Collection<String> getDataSourceNames() throws AdminException {
- ArrayList<String> names = new ArrayList<String>();
- try {
- for (String type:DS_TYPES) {
- ComponentType ct = new ComponentType("DataSource", type); //$NON-NLS-1$
- Set<ManagedComponent> mcs = getView().getComponentsForType(ct);
- for (ManagedComponent mc:mcs) {
- names.add(((SimpleValue)mc.getProperty("jndi-name").getValue()).getValue().toString()); //$NON-NLS-1$
- }
- }
- for (String type:CF_TYPES) {
- ComponentType ct = new ComponentType("ConnectionFactory", type); //$NON-NLS-1$
- Set<ManagedComponent> mcs = getView().getComponentsForType(ct);
- for (ManagedComponent mc:mcs) {
- names.add(((SimpleValue)mc.getProperty("jndi-name").getValue()).getValue().toString()); //$NON-NLS-1$
- }
- }
- } catch (Exception e) {
- throw new AdminComponentException(e);
- }
- return names;
- }
-
- @Override
- public Set<String> getDataSourceTemplateNames() throws AdminException{
- Set<String> names = getView().getTemplateNames();
- HashSet<String> matched = new HashSet<String>();
- for(String name:names) {
- if (name.startsWith(CONNECTOR_PREFIX)) {
- matched.add(name);
- }
- }
- return matched;
- }
-
- @Override
- public CacheStatistics getCacheStats(String cacheType) throws AdminException {
- try {
- ManagedComponent mc = getView().getComponent(DQPNAME, DQPTYPE);
- MetaValue value = ManagedUtil.executeOperation(mc, "getCacheStatistics", SimpleValueSupport.wrap(cacheType));//$NON-NLS-1$
- return (CacheStatistics)MetaValueFactory.getInstance().unwrap(value, CacheStatisticsMetadata.class);
- } catch (Exception e) {
- throw new AdminComponentException(e.getMessage(), e);
- }
- }
-
- @Override
- public void markDataSourceAvailable(String name) throws AdminException {
- statusChecker.dataSourceAdded(name);
- }
-}
Modified: branches/as7/client/src/main/java/org/teiid/adminapi/impl/MetadataMapper.java
===================================================================
--- branches/as7/client/src/main/java/org/teiid/adminapi/impl/MetadataMapper.java 2011-07-09 00:08:35 UTC (rev 3304)
+++ branches/as7/client/src/main/java/org/teiid/adminapi/impl/MetadataMapper.java 2011-07-11 03:06:57 UTC (rev 3305)
@@ -52,11 +52,10 @@
private static final String DATA_POLICIES = "data-policies"; //$NON-NLS-1$
- public static ModelNode wrap(VDBMetaData vdb) {
+ public static ModelNode wrap(VDBMetaData vdb, ModelNode node) {
if (vdb == null) {
return null;
}
- ModelNode node = new ModelNode();
node.get(ModelNodeConstants.TYPE).set(ModelType.OBJECT);
node.get(VDBNAME).set(vdb.getName());
@@ -75,7 +74,7 @@
if (properties!= null && !properties.isEmpty()) {
ModelNode propsNode = node.get(CHILDREN, PROPERTIES);
for (PropertyMetadata prop:properties) {
- propsNode.add(PropertyMetaDataMapper.wrap(prop));
+ propsNode.add(PropertyMetaDataMapper.wrap(prop, new ModelNode()));
}
}
@@ -84,7 +83,7 @@
if (models != null && !models.isEmpty()) {
ModelNode modelNodes = node.get(CHILDREN, MODELS);
for(ModelMetaData model:models.values()) {
- modelNodes.add(ModelMetadataMapper.wrap(model));
+ modelNodes.add(ModelMetadataMapper.wrap(model, new ModelNode()));
}
}
@@ -93,7 +92,7 @@
if (translators != null && !translators.isEmpty()) {
ModelNode translatorNodes = node.get(CHILDREN, OVERRIDE_TRANSLATORS);
for (Translator translator:translators) {
- translatorNodes.add(VDBTranslatorMetaDataMapper.wrap((VDBTranslatorMetaData)translator));
+ translatorNodes.add(VDBTranslatorMetaDataMapper.wrap((VDBTranslatorMetaData)translator, new ModelNode()));
}
}
@@ -102,7 +101,7 @@
if (policies != null && !policies.isEmpty()) {
ModelNode dataPoliciesNodes = node.get(CHILDREN, DATA_POLICIES);
for (DataPolicy policy:policies) {
- dataPoliciesNodes.add(DataPolicyMetadataMapper.wrap((DataPolicyMetadata)policy));
+ dataPoliciesNodes.add(DataPolicyMetadataMapper.wrap((DataPolicyMetadata)policy, new ModelNode()));
}
}
return node;
@@ -234,11 +233,10 @@
private static final String SOURCE_MAPPINGS = "source-mappings"; //$NON-NLS-1$
private static final String VALIDITY_ERRORS = "validity-errors"; //$NON-NLS-1$
- public static ModelNode wrap(ModelMetaData model) {
+ public static ModelNode wrap(ModelMetaData model, ModelNode node) {
if (model == null) {
return null;
}
- ModelNode node = new ModelNode();
node.get(TYPE).set(ModelType.OBJECT);
node.get(MODEL_NAME).set(model.getName());
@@ -255,7 +253,7 @@
if (properties!= null && !properties.isEmpty()) {
ModelNode propsNode = node.get(CHILDREN, PROPERTIES);
for (PropertyMetadata prop:properties) {
- propsNode.add(PropertyMetaDataMapper.wrap(prop));
+ propsNode.add(PropertyMetaDataMapper.wrap(prop, new ModelNode()));
}
}
@@ -263,7 +261,7 @@
if (sources != null && !sources.isEmpty()) {
ModelNode sourceMappingNode = node.get(CHILDREN, SOURCE_MAPPINGS);
for(SourceMappingMetadata source:sources) {
- sourceMappingNode.add(SourceMappingMetadataMapper.wrap(source));
+ sourceMappingNode.add(SourceMappingMetadataMapper.wrap(source, new ModelNode()));
}
}
@@ -421,12 +419,11 @@
private static final String JNDI_NAME = "jndi-name"; //$NON-NLS-1$
private static final String TRANSLATOR_NAME = "translator-name"; //$NON-NLS-1$
- public static ModelNode wrap(SourceMappingMetadata source) {
+ public static ModelNode wrap(SourceMappingMetadata source, ModelNode node) {
if (source == null) {
return null;
}
- ModelNode node = new ModelNode();
node.get(TYPE).set(ModelType.OBJECT);
node.get(SOURCE_NAME).set(source.getName());
@@ -471,15 +468,16 @@
private static final String PROPERTIES = "properties"; //$NON-NLS-1$
private static final String MODULE_NAME = "module-name"; //$NON-NLS-1$
- public static ModelNode wrap(VDBTranslatorMetaData translator) {
+ public static ModelNode wrap(VDBTranslatorMetaData translator, ModelNode node) {
if (translator == null) {
return null;
}
- ModelNode node = new ModelNode();
node.get(TYPE).set(ModelType.OBJECT);
node.get(TRANSLATOR_NAME).set(translator.getName());
- node.get(BASETYPE).set(translator.getType());
+ if (translator.getType() != null) {
+ node.get(BASETYPE).set(translator.getType());
+ }
if (translator.getDescription() != null) {
node.get(DESCRIPTION).set(translator.getDescription());
}
@@ -492,7 +490,7 @@
if (properties!= null && !properties.isEmpty()) {
ModelNode propsNode = node.get(CHILDREN, PROPERTIES);
for (PropertyMetadata prop:properties) {
- propsNode.add(PropertyMetaDataMapper.wrap(prop));
+ propsNode.add(PropertyMetaDataMapper.wrap(prop, new ModelNode()));
}
}
return node;
@@ -549,11 +547,10 @@
private static final String PROPERTY_NAME = "property-name"; //$NON-NLS-1$
private static final String PROPERTY_VALUE = "property-value"; //$NON-NLS-1$
- public static ModelNode wrap(PropertyMetadata property) {
+ public static ModelNode wrap(PropertyMetadata property, ModelNode node) {
if (property == null) {
return null;
}
- ModelNode node = new ModelNode();
node.get(ModelNodeConstants.TYPE).set(ModelType.OBJECT);
node.get(PROPERTY_NAME).set(property.getName());
@@ -594,11 +591,10 @@
private static final String ALLOW_CREATE_TEMP_TABLES = "allow-create-temp-tables"; //$NON-NLS-1$
private static final String ANY_AUTHENTICATED = "any-authenticated"; //$NON-NLS-1$
- public static ModelNode wrap(DataPolicyMetadata policy) {
+ public static ModelNode wrap(DataPolicyMetadata policy, ModelNode node) {
if (policy == null) {
return null;
}
- ModelNode node = new ModelNode();
node.get(ModelNodeConstants.TYPE).set(ModelType.OBJECT);
node.get(POLICY_NAME).set(policy.getName());
@@ -615,7 +611,7 @@
if (permissions != null && !permissions.isEmpty()) {
ModelNode permissionNodes = node.get(CHILDREN, DATA_PERMISSIONS);
for (DataPolicy.DataPermission dataPermission:permissions) {
- permissionNodes.add(PermissionMetaDataMapper.wrap((PermissionMetaData)dataPermission));
+ permissionNodes.add(PermissionMetaDataMapper.wrap((PermissionMetaData)dataPermission, new ModelNode()));
}
}
@@ -699,12 +695,11 @@
- public static ModelNode wrap(PermissionMetaData permission) {
+ public static ModelNode wrap(PermissionMetaData permission, ModelNode node) {
if (permission == null) {
return null;
}
- ModelNode node = new ModelNode();
node.get(ModelNodeConstants.TYPE).set(ModelType.OBJECT);
node.get(RESOURCE_NAME).set(permission.getResourceName());
@@ -775,18 +770,17 @@
private static final String TOTAL_ENTRIES = "totalEntries"; //$NON-NLS-1$
private static final String REQUEST_COUNT = "requestCount"; //$NON-NLS-1$
- public static ModelNode wrap(CacheStatisticsMetadata object) {
+ public static ModelNode wrap(CacheStatisticsMetadata object, ModelNode node) {
if (object == null)
return null;
- ModelNode cache = new ModelNode();
- cache.get(ModelNodeConstants.TYPE).set(ModelType.OBJECT);
+ node.get(ModelNodeConstants.TYPE).set(ModelType.OBJECT);
- cache.get(TOTAL_ENTRIES).set(object.getTotalEntries());
- cache.get(HITRATIO).set(object.getHitRatio());
- cache.get(REQUEST_COUNT).set(object.getRequestCount());
+ node.get(TOTAL_ENTRIES).set(object.getTotalEntries());
+ node.get(HITRATIO).set(object.getHitRatio());
+ node.get(REQUEST_COUNT).set(object.getRequestCount());
- return cache;
+ return node;
}
public static CacheStatisticsMetadata unwrap(ModelNode node) {
@@ -821,27 +815,26 @@
private static final String THREAD_STATE = "thread-state"; //$NON-NLS-1$
- public static ModelNode wrap(RequestMetadata object) {
- if (object == null) {
+ public static ModelNode wrap(RequestMetadata request, ModelNode node) {
+ if (request == null) {
return null;
}
- ModelNode request = new ModelNode();
- request.get(ModelNodeConstants.TYPE).set(ModelType.OBJECT);
+ node.get(ModelNodeConstants.TYPE).set(ModelType.OBJECT);
- request.get(EXECUTION_ID).set(object.getExecutionId());
- request.get(SESSION_ID).set(object.getSessionId());
- request.get(START_TIME).set(object.getStartTime());
- request.get(COMMAND).set(object.getCommand());
- request.get(SOURCE_REQUEST).set(object.sourceRequest());
- if (object.getNodeId() != null) {
- request.get(NODE_ID).set(object.getNodeId());
+ node.get(EXECUTION_ID).set(request.getExecutionId());
+ node.get(SESSION_ID).set(request.getSessionId());
+ node.get(START_TIME).set(request.getStartTime());
+ node.get(COMMAND).set(request.getCommand());
+ node.get(SOURCE_REQUEST).set(request.sourceRequest());
+ if (request.getNodeId() != null) {
+ node.get(NODE_ID).set(request.getNodeId());
}
- if (object.getTransactionId() != null) {
- request.get(TRANSACTION_ID).set(object.getTransactionId());
+ if (request.getTransactionId() != null) {
+ node.get(TRANSACTION_ID).set(request.getTransactionId());
}
- request.get(STATE).set(object.getState().name());
- request.get(THREAD_STATE).set(object.getThreadState().name());
- return request;
+ node.get(STATE).set(request.getState().name());
+ node.get(THREAD_STATE).set(request.getThreadState().name());
+ return node;
}
public static RequestMetadata unwrap(ModelNode node) {
@@ -893,11 +886,10 @@
private static final String APPLICATION_NAME = "application-name"; //$NON-NLS-1$
- public static ModelNode wrap(SessionMetadata session) {
+ public static ModelNode wrap(SessionMetadata session, ModelNode node) {
if (session == null) {
return null;
}
- ModelNode node = new ModelNode();
node.get(ModelNodeConstants.TYPE).set(ModelType.OBJECT);
if (session.getApplicationName() != null) {
@@ -961,11 +953,10 @@
private static final String CREATED_TIME = "txn-created-time"; //$NON-NLS-1$
private static final String ASSOCIATED_SESSION = "session-id"; //$NON-NLS-1$
- public static ModelNode wrap(TransactionMetadata object) {
+ public static ModelNode wrap(TransactionMetadata object, ModelNode transaction) {
if (object == null)
return null;
- ModelNode transaction = new ModelNode();
transaction.get(ModelNodeConstants.TYPE).set(ModelType.OBJECT);
transaction.get(ASSOCIATED_SESSION).set(object.getAssociatedSession());
transaction.get(CREATED_TIME).set(object.getCreatedTime());
@@ -1008,22 +999,21 @@
private static final String ACTIVE_THREADS = "active-threads"; //$NON-NLS-1$
- public static ModelNode wrap(WorkerPoolStatisticsMetadata object) {
- if (object == null)
+ public static ModelNode wrap(WorkerPoolStatisticsMetadata stats, ModelNode node) {
+ if (stats == null)
return null;
- ModelNode transaction = new ModelNode();
- transaction.get(ModelNodeConstants.TYPE).set(ModelType.OBJECT);
+ node.get(ModelNodeConstants.TYPE).set(ModelType.OBJECT);
- transaction.get(ACTIVE_THREADS).set(object.getActiveThreads());
- transaction.get(HIGHEST_ACTIVE_THREADS).set(object.getHighestActiveThreads());
- transaction.get(TOTAL_COMPLETED).set(object.getTotalCompleted());
- transaction.get(TOTAL_SUBMITTED).set(object.getTotalSubmitted());
- transaction.get(QUEUE_NAME).set(object.getQueueName());
- transaction.get(QUEUED).set(object.getQueued());
- transaction.get(HIGHEST_QUEUED).set(object.getHighestQueued());
- transaction.get(MAX_THREADS).set(object.getMaxThreads());
+ node.get(ACTIVE_THREADS).set(stats.getActiveThreads());
+ node.get(HIGHEST_ACTIVE_THREADS).set(stats.getHighestActiveThreads());
+ node.get(TOTAL_COMPLETED).set(stats.getTotalCompleted());
+ node.get(TOTAL_SUBMITTED).set(stats.getTotalSubmitted());
+ node.get(QUEUE_NAME).set(stats.getQueueName());
+ node.get(QUEUED).set(stats.getQueued());
+ node.get(HIGHEST_QUEUED).set(stats.getHighestQueued());
+ node.get(MAX_THREADS).set(stats.getMaxThreads());
- return transaction;
+ return node;
}
public static WorkerPoolStatisticsMetadata unwrapMetaValue(ModelNode node) {
Modified: branches/as7/client/src/test/java/org/teiid/adminapi/impl/TestRequestMetadata.java
===================================================================
--- branches/as7/client/src/test/java/org/teiid/adminapi/impl/TestRequestMetadata.java 2011-07-09 00:08:35 UTC (rev 3304)
+++ branches/as7/client/src/test/java/org/teiid/adminapi/impl/TestRequestMetadata.java 2011-07-11 03:06:57 UTC (rev 3305)
@@ -34,7 +34,7 @@
@Test public void testMapping() {
RequestMetadata request = buildRequest();
- ModelNode node = MetadataMapper.RequestMetadataMapper.wrap(request);
+ ModelNode node = MetadataMapper.RequestMetadataMapper.wrap(request, new ModelNode());
RequestMetadata actual = MetadataMapper.RequestMetadataMapper.unwrap(node);
Modified: branches/as7/client/src/test/java/org/teiid/adminapi/impl/TestSessionMetadata.java
===================================================================
--- branches/as7/client/src/test/java/org/teiid/adminapi/impl/TestSessionMetadata.java 2011-07-09 00:08:35 UTC (rev 3304)
+++ branches/as7/client/src/test/java/org/teiid/adminapi/impl/TestSessionMetadata.java 2011-07-11 03:06:57 UTC (rev 3305)
@@ -42,7 +42,7 @@
session.setSecurityContext("auth-domain");
session.setUserName("user");
- ModelNode node = MetadataMapper.SessionMetadataMapper.wrap(session);
+ ModelNode node = MetadataMapper.SessionMetadataMapper.wrap(session, new ModelNode());
SessionMetadata session1 = MetadataMapper.SessionMetadataMapper.unwrap(node);
Modified: branches/as7/client/src/test/java/org/teiid/adminapi/impl/TestTransactionMetadata.java
===================================================================
--- branches/as7/client/src/test/java/org/teiid/adminapi/impl/TestTransactionMetadata.java 2011-07-09 00:08:35 UTC (rev 3304)
+++ branches/as7/client/src/test/java/org/teiid/adminapi/impl/TestTransactionMetadata.java 2011-07-11 03:06:57 UTC (rev 3305)
@@ -37,7 +37,7 @@
tm.setId("tnx-id");
tm.setScope("scope");
- ModelNode node = MetadataMapper.TransactionMetadataMapper.wrap(tm);
+ ModelNode node = MetadataMapper.TransactionMetadataMapper.wrap(tm, new ModelNode());
TransactionMetadata tm1 = MetadataMapper.TransactionMetadataMapper.unwrap(node);
Modified: branches/as7/client/src/test/java/org/teiid/adminapi/impl/TestVDBMetaData.java
===================================================================
--- branches/as7/client/src/test/java/org/teiid/adminapi/impl/TestVDBMetaData.java 2011-07-09 00:08:35 UTC (rev 3304)
+++ branches/as7/client/src/test/java/org/teiid/adminapi/impl/TestVDBMetaData.java 2011-07-11 03:06:57 UTC (rev 3305)
@@ -217,7 +217,7 @@
@Test public void testVDBMetaDataMapper() {
VDBMetaData vdb = buildVDB();
- ModelNode node = MetadataMapper.wrap(vdb);
+ ModelNode node = MetadataMapper.wrap(vdb, new ModelNode());
vdb = MetadataMapper.unwrap(node);
validateVDB(vdb);
Modified: branches/as7/connectors/connector-file/pom.xml
===================================================================
--- branches/as7/connectors/connector-file/pom.xml 2011-07-09 00:08:35 UTC (rev 3304)
+++ branches/as7/connectors/connector-file/pom.xml 2011-07-11 03:06:57 UTC (rev 3305)
@@ -40,6 +40,11 @@
<goals>
<goal>jar</goal>
</goals>
+ <configuration>
+ <archive>
+ <manifestFile>src/main/rar/META-INF/MANIFEST.MF</manifestFile>
+ </archive>
+ </configuration>
</execution>
<execution>
<id>deploy_jar</id>
Modified: branches/as7/connectors/connector-file/src/main/rar/META-INF/MANIFEST.MF
===================================================================
--- branches/as7/connectors/connector-file/src/main/rar/META-INF/MANIFEST.MF 2011-07-09 00:08:35 UTC (rev 3304)
+++ branches/as7/connectors/connector-file/src/main/rar/META-INF/MANIFEST.MF 2011-07-11 03:06:57 UTC (rev 3305)
@@ -1 +1 @@
-Dependencies: org.jboss.teiid.common-core org.jboss.teiid.api
+Dependencies: org.jboss.teiid.common-core,org.jboss.teiid.api
Modified: branches/as7/connectors/connector-ldap/pom.xml
===================================================================
--- branches/as7/connectors/connector-ldap/pom.xml 2011-07-09 00:08:35 UTC (rev 3304)
+++ branches/as7/connectors/connector-ldap/pom.xml 2011-07-11 03:06:57 UTC (rev 3305)
@@ -39,6 +39,12 @@
<goals>
<goal>jar</goal>
</goals>
+ <configuration>
+ <archive>
+ <manifestFile>src/main/rar/META-INF/MANIFEST.MF</manifestFile>
+ </archive>
+ </configuration>
+
</execution>
<execution>
<id>deploy_jar</id>
Modified: branches/as7/connectors/connector-ldap/src/main/rar/META-INF/MANIFEST.MF
===================================================================
--- branches/as7/connectors/connector-ldap/src/main/rar/META-INF/MANIFEST.MF 2011-07-09 00:08:35 UTC (rev 3304)
+++ branches/as7/connectors/connector-ldap/src/main/rar/META-INF/MANIFEST.MF 2011-07-11 03:06:57 UTC (rev 3305)
@@ -1 +1 @@
-Dependencies: org.jboss.teiid.common-core org.jboss.teiid.api
+Dependencies: org.jboss.teiid.common-core,org.jboss.teiid.api
Modified: branches/as7/connectors/connector-salesforce/pom.xml
===================================================================
--- branches/as7/connectors/connector-salesforce/pom.xml 2011-07-09 00:08:35 UTC (rev 3304)
+++ branches/as7/connectors/connector-salesforce/pom.xml 2011-07-11 03:06:57 UTC (rev 3305)
@@ -76,6 +76,11 @@
<goals>
<goal>jar</goal>
</goals>
+ <configuration>
+ <archive>
+ <manifestFile>src/main/rar/META-INF/MANIFEST.MF</manifestFile>
+ </archive>
+ </configuration>
</execution>
<execution>
<id>deploy_jar</id>
Modified: branches/as7/connectors/connector-salesforce/src/main/rar/META-INF/MANIFEST.MF
===================================================================
--- branches/as7/connectors/connector-salesforce/src/main/rar/META-INF/MANIFEST.MF 2011-07-09 00:08:35 UTC (rev 3304)
+++ branches/as7/connectors/connector-salesforce/src/main/rar/META-INF/MANIFEST.MF 2011-07-11 03:06:57 UTC (rev 3305)
@@ -1 +1 @@
-Dependencies: org.jboss.teiid.common-core org.jboss.teiid.api
+Dependencies: org.jboss.teiid.common-core,org.jboss.teiid.api
Modified: branches/as7/connectors/connector-ws/pom.xml
===================================================================
--- branches/as7/connectors/connector-ws/pom.xml 2011-07-09 00:08:35 UTC (rev 3304)
+++ branches/as7/connectors/connector-ws/pom.xml 2011-07-11 03:06:57 UTC (rev 3305)
@@ -64,6 +64,11 @@
<goals>
<goal>jar</goal>
</goals>
+ <configuration>
+ <archive>
+ <manifestFile>src/main/rar/META-INF/MANIFEST.MF</manifestFile>
+ </archive>
+ </configuration>
</execution>
<execution>
<id>deploy_jar</id>
Modified: branches/as7/connectors/connector-ws/src/main/rar/META-INF/MANIFEST.MF
===================================================================
--- branches/as7/connectors/connector-ws/src/main/rar/META-INF/MANIFEST.MF 2011-07-09 00:08:35 UTC (rev 3304)
+++ branches/as7/connectors/connector-ws/src/main/rar/META-INF/MANIFEST.MF 2011-07-11 03:06:57 UTC (rev 3305)
@@ -1 +1 @@
-Dependencies: org.jboss.teiid.common-core org.jboss.teiid.api
+Dependencies: org.jboss.teiid.common-core,org.jboss.teiid.api
Modified: branches/as7/engine/src/main/java/org/teiid/cache/CacheConfiguration.java
===================================================================
--- branches/as7/engine/src/main/java/org/teiid/cache/CacheConfiguration.java 2011-07-09 00:08:35 UTC (rev 3304)
+++ branches/as7/engine/src/main/java/org/teiid/cache/CacheConfiguration.java 2011-07-11 03:06:57 UTC (rev 3305)
@@ -34,7 +34,6 @@
private Policy policy;
private int maxage = -1;
private int maxEntries = SessionAwareCache.DEFAULT_MAX_SIZE_TOTAL;
- private boolean enabled = true;
private String name;
private String location;
@@ -97,12 +96,4 @@
public void setLocation(String location) {
this.location = location;
}
-
- public boolean isEnabled() {
- return enabled;
- }
-
- public void setEnabled(boolean enabled) {
- this.enabled = enabled;
- }
}
Modified: branches/as7/engine/src/main/java/org/teiid/dqp/internal/process/DQPConfiguration.java
===================================================================
--- branches/as7/engine/src/main/java/org/teiid/dqp/internal/process/DQPConfiguration.java 2011-07-09 00:08:35 UTC (rev 3304)
+++ branches/as7/engine/src/main/java/org/teiid/dqp/internal/process/DQPConfiguration.java 2011-07-11 03:06:57 UTC (rev 3305)
@@ -115,7 +115,7 @@
}
public boolean isResultSetCacheEnabled() {
- return this.resultsetCacheConfig != null && this.resultsetCacheConfig.isEnabled();
+ return this.resultsetCacheConfig != null;
}
/**
Modified: branches/as7/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
===================================================================
--- branches/as7/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2011-07-09 00:08:35 UTC (rev 3304)
+++ branches/as7/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2011-07-11 03:06:57 UTC (rev 3305)
@@ -684,7 +684,7 @@
//result set cache
CacheConfiguration rsCacheConfig = config.getResultsetCacheConfig();
- if (rsCacheConfig != null && rsCacheConfig.isEnabled()) {
+ if (rsCacheConfig != null) {
this.rsCache = new SessionAwareCache<CachedResults>(this.cacheFactory, SessionAwareCache.Type.RESULTSET, rsCacheConfig);
this.rsCache.setBufferManager(this.bufferManager);
}
Modified: branches/as7/jboss-integration/pom.xml
===================================================================
--- branches/as7/jboss-integration/pom.xml 2011-07-09 00:08:35 UTC (rev 3304)
+++ branches/as7/jboss-integration/pom.xml 2011-07-11 03:06:57 UTC (rev 3305)
@@ -20,15 +20,11 @@
<dependency>
<groupId>org.jboss.teiid</groupId>
<artifactId>teiid-api</artifactId>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-cache-jbosscache</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.teiid</groupId>
<artifactId>teiid-client</artifactId>
<scope>provided</scope>
</dependency>
@@ -73,32 +69,25 @@
<artifactId>jta</artifactId>
<scope>provided</scope>
</dependency>
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-common-core</artifactId>
- <scope>provided</scope>
- </dependency>
<dependency>
- <groupId>org.picketbox</groupId>
- <artifactId>picketbox</artifactId>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-security</artifactId>
<scope>provided</scope>
</dependency>
+
<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-server</artifactId>
<scope>provided</scope>
- </dependency>
+ </dependency>
+
<dependency>
- <groupId>org.jboss.as</groupId>
- <artifactId>jboss-as-connector</artifactId>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
<scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.as</groupId>
- <artifactId>jboss-as-security</artifactId>
- <scope>provided</scope>
- </dependency>
+ </dependency>
+
<!--
<dependency>
<groupId>org.jboss</groupId>
Added: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/BufferManagerService.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/BufferManagerService.java (rev 0)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/BufferManagerService.java 2011-07-11 03:06:57 UTC (rev 3305)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.jboss;
+
+import org.jboss.msc.service.Service;
+import org.jboss.msc.service.StartContext;
+import org.jboss.msc.service.StartException;
+import org.jboss.msc.service.StopContext;
+import org.jboss.msc.value.InjectedValue;
+import org.teiid.services.BufferServiceImpl;
+
+public class BufferManagerService implements Service<BufferServiceImpl> {
+
+ private BufferServiceImpl bufferMgr;
+ public final InjectedValue<String> pathInjector = new InjectedValue<String>();
+
+ public BufferManagerService(BufferServiceImpl buffer) {
+ this.bufferMgr = buffer;
+ }
+
+ @Override
+ public void start(StartContext context) throws StartException {
+ bufferMgr.setDiskDirectory(pathInjector.getValue());
+ bufferMgr.start();
+ }
+
+ @Override
+ public void stop(StopContext context) {
+ bufferMgr.stop();
+ }
+
+ @Override
+ public BufferServiceImpl getValue() throws IllegalStateException,IllegalArgumentException {
+ return this.bufferMgr;
+ }
+
+}
Property changes on: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/BufferManagerService.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/Configuration.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/Configuration.java 2011-07-09 00:08:35 UTC (rev 3304)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/Configuration.java 2011-07-11 03:06:57 UTC (rev 3305)
@@ -37,7 +37,6 @@
public static final String TRANSLATOR = "translator"; //$NON-NLS-1$
// Query-ENGINE
- public static final String JNDI_NAME = "jndi-name"; //$NON-NLS-1$
public static final String ASYNC_THREAD_GROUP = "thread-group-async";//$NON-NLS-1$
public static final String MAX_THREADS = "maxThreads";//$NON-NLS-1$
public static final String MAX_ACTIVE_PLANS = "maxActivePlans";//$NON-NLS-1$
@@ -54,13 +53,12 @@
public static final String MAX_ODBC_LOB_SIZE_ALLOWED = "maxODBCLobSizeAllowed";//$NON-NLS-1$
public static final String EVENT_DISTRIBUTOR_NAME = "eventDistributorName";//$NON-NLS-1$
public static final String DETECTING_CHANGE_EVENTS = "detectingChangeEvents";//$NON-NLS-1$
- public static final String JDBC_SECURITY_DOMAIN = "jdbc-security-domain";//$NON-NLS-1$
+ public static final String SECURITY_DOMAIN = "security-domain";//$NON-NLS-1$
public static final String MAX_SESSIONS_ALLOWED = "max-sessions-allowed";//$NON-NLS-1$
public static final String SESSION_EXPIRATION_TIME_LIMIT = "sessions-expiration-timelimit";//$NON-NLS-1$
public static final String ALLOW_ENV_FUNCTION = "allow-env-function";//$NON-NLS-1$
public static final String USE_DISK = "useDisk";//$NON-NLS-1$
- public static final String DISK_DIRECTORY = "diskDirectory";//$NON-NLS-1$
public static final String PROCESSOR_BATCH_SIZE = "processorBatchSize";//$NON-NLS-1$
public static final String CONNECTOR_BATCH_SIZE = "connectorBatchSize";//$NON-NLS-1$
public static final String MAX_RESERVE_BATCH_COLUMNS = "maxReserveBatchColumns";//$NON-NLS-1$
@@ -70,7 +68,6 @@
public static final String MAX_OPEN_FILES = "maxOpenFiles";//$NON-NLS-1$
//cache-config
- public static final String ENABLED = "enabled";//$NON-NLS-1$
public static final String MAX_ENTRIES = "maxEntries";//$NON-NLS-1$
public static final String MAX_AGE_IN_SECS = "maxAgeInSeconds";//$NON-NLS-1$
public static final String MAX_STALENESS = "maxStaleness";//$NON-NLS-1$
@@ -80,6 +77,7 @@
// cache-factory
public static final String CACHE_SERVICE_JNDI_NAME = "cache-service-jndi-name";//$NON-NLS-1$
public static final String RESULTSET_CACHE_NAME = "resultsetCacheName";//$NON-NLS-1$
+ public static final String CLASS = "class";//$NON-NLS-1$
//socket config
public static final String MAX_SOCKET_THREAD_SIZE = "maxSocketThreads";//$NON-NLS-1$
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/Element.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/Element.java 2011-07-09 00:08:35 UTC (rev 3304)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/Element.java 2011-07-11 03:06:57 UTC (rev 3305)
@@ -48,7 +48,7 @@
MAX_ODBC_LOB_SIZE_ALLOWED_ELEMENT(MAX_ODBC_LOB_SIZE_ALLOWED),
EVENT_DISTRIBUTOR_NAME_ELEMENT(EVENT_DISTRIBUTOR_NAME),
DETECTING_CHANGE_EVENTS_ELEMENT(DETECTING_CHANGE_EVENTS),
- JDBC_SECURITY_DOMAIN_ELEMENT(JDBC_SECURITY_DOMAIN),
+ JDBC_SECURITY_DOMAIN_ELEMENT(SECURITY_DOMAIN),
MAX_SESSIONS_ALLOWED_ELEMENT(MAX_SESSIONS_ALLOWED),
SESSION_EXPIRATION_TIME_LIMIT_ELEMENT(SESSION_EXPIRATION_TIME_LIMIT),
ALLOW_ENV_FUNCTION_ELEMENT(ALLOW_ENV_FUNCTION),
@@ -63,7 +63,6 @@
// buffer manager
USE_DISK_ELEMENT(USE_DISK),
- DISK_DIRECTORY_ELEMENT(DISK_DIRECTORY),
PROCESSOR_BATCH_SIZE_ELEMENT(PROCESSOR_BATCH_SIZE),
CONNECTOR_BATCH_SIZE_ELEMENT(CONNECTOR_BATCH_SIZE),
MAX_RESERVE_BATCH_COLUMNS_ELEMENT(MAX_RESERVE_BATCH_COLUMNS),
@@ -73,7 +72,6 @@
MAX_OPEN_FILES_ELEMENT(MAX_OPEN_FILES),
//cache-config
- ENABLED_ELEMENT(ENABLED),
MAX_ENTRIES_ELEMENT(MAX_ENTRIES),
MAX_AGE_IN_SECS_ELEMENT(MAX_AGE_IN_SECS),
MAX_STALENESS_ELEMENT(MAX_STALENESS),
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineAdd.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineAdd.java 2011-07-09 00:08:35 UTC (rev 3304)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineAdd.java 2011-07-11 03:06:57 UTC (rev 3305)
@@ -21,27 +21,33 @@
*/
package org.teiid.jboss;
-import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP_ADDR;
-
+import java.util.List;
import java.util.concurrent.Executor;
import javax.resource.spi.XATerminator;
import javax.resource.spi.work.WorkManager;
import javax.transaction.TransactionManager;
-import org.jboss.as.controller.*;
-import org.jboss.as.controller.operations.common.Util;
+import org.jboss.as.controller.AbstractBoottimeAddStepHandler;
+import org.jboss.as.controller.OperationContext;
+import org.jboss.as.controller.OperationFailedException;
+import org.jboss.as.controller.ServiceVerificationHandler;
+import org.jboss.as.naming.ManagedReferenceFactory;
+import org.jboss.as.naming.ManagedReferenceInjector;
+import org.jboss.as.naming.NamingStore;
+import org.jboss.as.naming.service.BinderService;
+import org.jboss.as.network.SocketBinding;
import org.jboss.as.security.plugins.SecurityDomainContext;
-import org.jboss.as.server.BootOperationContext;
-import org.jboss.as.server.BootOperationHandler;
+import org.jboss.as.server.AbstractDeploymentChainStep;
+import org.jboss.as.server.DeploymentProcessorTarget;
import org.jboss.as.server.deployment.Phase;
-import org.jboss.as.server.services.net.SocketBinding;
+import org.jboss.as.server.services.path.RelativePathService;
import org.jboss.dmr.ModelNode;
import org.jboss.msc.inject.ConcurrentMapInjector;
import org.jboss.msc.service.*;
import org.teiid.cache.CacheConfiguration;
import org.teiid.cache.CacheFactory;
-import org.teiid.cache.jboss.ClusterableCacheFactory;
+import org.teiid.cache.DefaultCacheFactory;
import org.teiid.deployers.*;
import org.teiid.dqp.internal.datamgr.TranslatorRepository;
import org.teiid.jboss.deployers.RuntimeEngineDeployer;
@@ -50,183 +56,206 @@
import org.teiid.query.function.SystemFunctionManager;
import org.teiid.services.BufferServiceImpl;
import org.teiid.transport.ClientServiceRegistry;
+import org.teiid.transport.LocalServerConnection;
import org.teiid.transport.SSLConfiguration;
import org.teiid.transport.SocketConfiguration;
-class QueryEngineAdd implements ModelAddOperationHandler, BootOperationHandler {
+class QueryEngineAdd extends AbstractBoottimeAddStepHandler {
@Override
- public OperationResult execute(OperationContext context, ModelNode operation, ResultHandler resultHandler) throws OperationFailedException {
- final ModelNode modelNode = context.getSubModel();
-
-
+ protected void populateModel(ModelNode operation, ModelNode model) {
final ModelNode queryEngineNode = operation.require(Configuration.QUERY_ENGINE);
- modelNode.set(Configuration.QUERY_ENGINE).set(queryEngineNode.clone());
-
- RuntimeOperationContext runtime = context.getRuntimeContext();
- if (runtime != null) {
- RuntimeTask task = new RuntimeTask() {
- @Override
- public void execute(RuntimeTaskContext context) throws OperationFailedException {
-
- ServiceTarget target = context.getServiceTarget();
-
- final VDBRepository vdbRepo = buildVDBRepository(queryEngineNode);
- JBossLifeCycleListener shutdownListener = new JBossLifeCycleListener();
-
- //FIXME *******************
- ObjectSerializer serializer = new ObjectSerializer("/tmp");
- //FIXME *******************
-
- TranslatorRepository translatorRepo = new TranslatorRepository();
- TranslatorRepositoryService translatorService = new TranslatorRepositoryService(translatorRepo);
- target.addService(TeiidServiceNames.TRANSLATOR_REPO, translatorService);
-
- final BufferServiceImpl bufferManager = buildBufferManager(queryEngineNode.get(Configuration.BUFFER_SERVICE));
- CacheFactory cacheFactory = getCacheFactory(queryEngineNode.get(Configuration.CACHE_FACORY));
-
- CacheConfiguration resultsetCache = buildCacheConfig(queryEngineNode.get(Configuration.RESULTSET_CACHE));
- CacheConfiguration preparePlanCache = buildCacheConfig(queryEngineNode.get(Configuration.PREPAREDPLAN_CACHE));
-
- SocketConfiguration jdbc = buildSocketConfiguration(queryEngineNode.get(Configuration.JDBC));
- SocketConfiguration odbc = buildSocketConfiguration(queryEngineNode.get(Configuration.ODBC));
-
- String asyncExecutor = "teiid-async"; //$NON-NLS-1$
- if (queryEngineNode.get(Configuration.ASYNC_THREAD_GROUP) != null) {
- asyncExecutor = queryEngineNode.get(Configuration.ASYNC_THREAD_GROUP).asString();
- }
-
- // now build the engine
- RuntimeEngineDeployer engine = buildQueryEngine(queryEngineNode);
- engine.setJdbcSocketConfiguration(jdbc);
- engine.setOdbcSocketConfiguration(odbc);
- engine.setBufferService(bufferManager);
- engine.setVDBRepository(vdbRepo);
- engine.setCacheFactory(cacheFactory);
- engine.setResultsetCacheConfig(resultsetCache);
- engine.setPreparedPlanCacheConfig(preparePlanCache);
- engine.setSecurityHelper(new JBossSecurityHelper());
- engine.setTranslatorRepository(translatorRepo);
-
-
- ServiceBuilder<ClientServiceRegistry> serviceBuilder = target.addService(TeiidServiceNames.ENGINE, engine);
-
- serviceBuilder.addDependency(ServiceName.JBOSS.append("connector", "workmanager"), WorkManager.class, engine.workManagerInjector); //$NON-NLS-1$ //$NON-NLS-2$
- serviceBuilder.addDependency(ServiceName.JBOSS.append("txn", "XATerminator"), XATerminator.class, engine.xaTerminatorInjector); //$NON-NLS-1$ //$NON-NLS-2$
- serviceBuilder.addDependency(ServiceName.JBOSS.append("txn", "TransactionManager"), TransactionManager.class, engine.txnManagerInjector); //$NON-NLS-1$ //$NON-NLS-2$
- serviceBuilder.addDependency(ServiceName.JBOSS.append("thread", "executor", asyncExecutor), Executor.class, engine.threadPoolInjector); //$NON-NLS-1$ //$NON-NLS-2$
- serviceBuilder.addDependency(ServiceName.JBOSS.append("binding", jdbc.getSocketBinding()), SocketBinding.class, engine.jdbcSocketBindingInjector); //$NON-NLS-1$
- serviceBuilder.addDependency(ServiceName.JBOSS.append("binding", odbc.getSocketBinding()), SocketBinding.class, engine.odbcSocketBindingInjector); //$NON-NLS-1$
-
- // add security domains
- String domainNameOrder = queryEngineNode.get(Configuration.JDBC_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$
- for (String domainName : domainNames) {
- serviceBuilder.addDependency(ServiceName.JBOSS.append("security", "security-domain", domainName), SecurityDomainContext.class, new ConcurrentMapInjector<String,SecurityDomainContext>(engine.securityDomains, domainName)); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- serviceBuilder.addListener(new AbstractServiceListener<Object>() {
- @Override
- public void serviceStarting(ServiceController<?> serviceController) {
- vdbRepo.start();
- bufferManager.start();
- }
-
- @Override
- public void serviceStopped(ServiceController<?> serviceController) {
- bufferManager.stop();
- }
-
- @Override
- public void serviceRemoved(ServiceController<?> serviceController) {
- serviceController.removeListener(this);
- }
- });
-
- if (context instanceof BootOperationContext) {
- BootOperationContext ctx = (BootOperationContext)context;
- ctx.addDeploymentProcessor(Phase.STRUCTURE, Phase.STRUCTURE_WAR_DEPLOYMENT_INIT|0x0001,new VDBStructure());
- ctx.addDeploymentProcessor(Phase.PARSE, Phase.PARSE_WEB_DEPLOYMENT|0x0001, new VDBParserDeployer(vdbRepo, serializer));
- ctx.addDeploymentProcessor(Phase.DEPENDENCIES, Phase.DEPENDENCIES_WAR_MODULE|0x0001, new VDBDependencyProcessor());
- ctx.addDeploymentProcessor(Phase.INSTALL, Phase.INSTALL_WAR_DEPLOYMENT|0x0001, new VDBDeployer(vdbRepo, engine.threadPoolInjector, translatorRepo, serializer, shutdownListener));
- }
-
- serviceBuilder.setInitialMode(ServiceController.Mode.ACTIVE);
- ServiceController<ClientServiceRegistry> controller = serviceBuilder.install();
- ServiceContainer container = controller.getServiceContainer();
- container.addTerminateListener(shutdownListener);
- }
- };
- runtime.setRuntimeTask(task);
- }
-
- // compensating is remove operation
- final ModelNode address = operation.require(OP_ADDR);
- BasicOperationResult operationResult = new BasicOperationResult(Util.getResourceRemoveOperation(address));
- resultHandler.handleResultComplete();
- return operationResult;
+ model.set(Configuration.QUERY_ENGINE).set(queryEngineNode.clone());
+
}
+ @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 VDBRepository vdbRepo = buildVDBRepository(queryEngineNode);
+ final JBossLifeCycleListener shutdownListener = new JBossLifeCycleListener();
+
+ //FIXME *******************
+ final ObjectSerializer serializer = new ObjectSerializer("/tmp");
+ //FIXME *******************
+
+ final TranslatorRepository translatorRepo = new TranslatorRepository();
+ TranslatorRepositoryService translatorService = new TranslatorRepositoryService(translatorRepo);
+ newControllers.add(target.addService(TeiidServiceNames.TRANSLATOR_REPO, translatorService).install());
+
+ RelativePathService.addService(TeiidServiceNames.BUFFER_DIR, "teiid-buffer", "jboss.server.temp.dir", target); //$NON-NLS-1$ //$NON-NLS-2$
+
+ // TODO: remove verbose service by moving the buffer service from runtime project
+ final BufferServiceImpl bufferManager = buildBufferManager(queryEngineNode.get(Configuration.BUFFER_SERVICE));
+ BufferManagerService bufferService = new BufferManagerService(bufferManager);
+ ServiceBuilder<BufferServiceImpl> bufferServiceBuilder = target.addService(TeiidServiceNames.BUFFER_MGR, bufferService);
+ bufferServiceBuilder.addDependency(TeiidServiceNames.BUFFER_DIR, String.class, bufferService.pathInjector);
+ newControllers.add(bufferServiceBuilder.install());
+
+ CacheFactory cacheFactory = getCacheFactory(queryEngineNode.get(Configuration.CACHE_FACORY));
+ CacheConfiguration resultsetCache = buildCacheConfig(queryEngineNode.get(Configuration.RESULTSET_CACHE));
+ CacheConfiguration preparePlanCache = buildCacheConfig(queryEngineNode.get(Configuration.PREPAREDPLAN_CACHE));
+
+ SocketConfiguration jdbc = null;
+ if (queryEngineNode.hasDefined(Configuration.JDBC)) {
+ jdbc = buildSocketConfiguration(queryEngineNode.get(Configuration.JDBC));
+ }
+
+ SocketConfiguration odbc = null;
+ if (queryEngineNode.hasDefined(Configuration.ODBC)) {
+ odbc = buildSocketConfiguration(queryEngineNode.get(Configuration.ODBC));
+ }
+
+ String asyncExecutor = "teiid-async"; //$NON-NLS-1$
+ if (queryEngineNode.hasDefined(Configuration.ASYNC_THREAD_GROUP)) {
+ asyncExecutor = queryEngineNode.get(Configuration.ASYNC_THREAD_GROUP).asString();
+ }
+
+ // now build the engine
+ final RuntimeEngineDeployer engine = buildQueryEngine(queryEngineNode);
+ engine.setJdbcSocketConfiguration(jdbc);
+ engine.setOdbcSocketConfiguration(odbc);
+ engine.setVDBRepository(vdbRepo);
+ engine.setCacheFactory(cacheFactory);
+ engine.setResultsetCacheConfig(resultsetCache);
+ engine.setPreparedPlanCacheConfig(preparePlanCache);
+ engine.setSecurityHelper(new JBossSecurityHelper());
+ engine.setTranslatorRepository(translatorRepo);
+
+
+ ServiceBuilder<ClientServiceRegistry> serviceBuilder = target.addService(TeiidServiceNames.ENGINE, engine);
+
+ serviceBuilder.addDependency(ServiceName.JBOSS.append("connector", "workmanager"), WorkManager.class, engine.workManagerInjector); //$NON-NLS-1$ //$NON-NLS-2$
+ serviceBuilder.addDependency(ServiceName.JBOSS.append("txn", "XATerminator"), XATerminator.class, engine.xaTerminatorInjector); //$NON-NLS-1$ //$NON-NLS-2$
+ serviceBuilder.addDependency(ServiceName.JBOSS.append("txn", "TransactionManager"), TransactionManager.class, engine.txnManagerInjector); //$NON-NLS-1$ //$NON-NLS-2$
+ serviceBuilder.addDependency(ServiceName.JBOSS.append("thread", "executor", asyncExecutor), Executor.class, engine.threadPoolInjector); //$NON-NLS-1$ //$NON-NLS-2$
+ serviceBuilder.addDependency(TeiidServiceNames.BUFFER_MGR, BufferServiceImpl.class, engine.bufferServiceInjector);
+
+ if (jdbc != null) {
+ serviceBuilder.addDependency(ServiceName.JBOSS.append("binding", jdbc.getSocketBinding()), SocketBinding.class, engine.jdbcSocketBindingInjector); //$NON-NLS-1$
+ }
+
+ if (odbc != null) {
+ serviceBuilder.addDependency(ServiceName.JBOSS.append("binding", odbc.getSocketBinding()), SocketBinding.class, engine.odbcSocketBindingInjector); //$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());
+ namingBuilder.addDependency(TeiidServiceNames.ENGINE, 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 (domainNameOrder != null && domainNameOrder.trim().length()>0) {
+ LogManager.logInfo(LogConstants.CTX_SECURITY, "Security Enabled: true"); //$NON-NLS-1$
+ String[] domainNames = domainNameOrder.split(","); //$NON-NLS-1$
+ for (String domainName : domainNames) {
+ engine.addSecurityDomain(domainName);
+ serviceBuilder.addDependency(ServiceName.JBOSS.append("security", "security-domain", domainName), SecurityDomainContext.class, new ConcurrentMapInjector<String,SecurityDomainContext>(engine.securityDomains, domainName)); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+ }
+
+ serviceBuilder.addListener(new AbstractServiceListener<Object>() {
+ @Override
+ public void transition(ServiceController<?> serviceController, ServiceController.Transition transition) {
+
+ if (transition.equals(ServiceController.Transition.START_INITIATING_to_STARTING)) {
+ vdbRepo.start();
+ bufferManager.start();
+ }
+
+ if (transition.equals(ServiceController.Transition.STOPPING_to_DOWN)) {
+ bufferManager.stop();
+ }
+ }
+
+ @Override
+ public void serviceRemoveRequested(ServiceController<?> serviceController) {
+ serviceController.removeListener(this);
+ }
+ });
+
+ serviceBuilder.setInitialMode(ServiceController.Mode.ACTIVE);
+ ServiceController<ClientServiceRegistry> controller = serviceBuilder.install();
+ newControllers.add(controller);
+ ServiceContainer container = controller.getServiceContainer();
+ container.addTerminateListener(shutdownListener);
+
+ context.addStep(new AbstractDeploymentChainStep() {
+ @Override
+ public void execute(DeploymentProcessorTarget processorTarget) {
+ processorTarget.addDeploymentProcessor(Phase.STRUCTURE, Phase.STRUCTURE_WAR_DEPLOYMENT_INIT|0x0001,new VDBStructure());
+ processorTarget.addDeploymentProcessor(Phase.PARSE, Phase.PARSE_WEB_DEPLOYMENT|0x0001, new VDBParserDeployer(vdbRepo, serializer));
+ processorTarget.addDeploymentProcessor(Phase.DEPENDENCIES, Phase.DEPENDENCIES_WAR_MODULE|0x0001, new VDBDependencyProcessor());
+ processorTarget.addDeploymentProcessor(Phase.INSTALL, Phase.INSTALL_WAR_DEPLOYMENT|0x0001, new VDBDeployer(vdbRepo, engine.threadPoolInjector, translatorRepo, serializer, shutdownListener));
+ }
+
+ }, OperationContext.Stage.RUNTIME);
+ }
+
private RuntimeEngineDeployer buildQueryEngine(ModelNode node) {
RuntimeEngineDeployer engine = new RuntimeEngineDeployer();
- if (node.get(Configuration.JNDI_NAME) != null) {
- engine.setJndiName(node.get(Configuration.JNDI_NAME).asString());
- }
- if (node.get(Configuration.MAX_THREADS) != null) {
+ if (node.hasDefined(Configuration.MAX_THREADS)) {
engine.setMaxThreads(node.get(Configuration.MAX_THREADS).asInt());
}
- if (node.get(Configuration.MAX_ACTIVE_PLANS) != null) {
+ if (node.hasDefined(Configuration.MAX_ACTIVE_PLANS)) {
engine.setMaxActivePlans(node.get(Configuration.MAX_ACTIVE_PLANS).asInt());
}
- if (node.get(Configuration.USER_REQUEST_SOURCE_CONCURRENCY) != null) {
+ if (node.hasDefined(Configuration.USER_REQUEST_SOURCE_CONCURRENCY)) {
engine.setUserRequestSourceConcurrency(node.get(Configuration.USER_REQUEST_SOURCE_CONCURRENCY).asInt());
}
- if (node.get(Configuration.TIME_SLICE_IN_MILLI) != null) {
+ if (node.hasDefined(Configuration.TIME_SLICE_IN_MILLI)) {
engine.setTimeSliceInMilli(node.get(Configuration.TIME_SLICE_IN_MILLI).asInt());
}
- if (node.get(Configuration.MAX_ROWS_FETCH_SIZE) != null) {
+ if (node.hasDefined(Configuration.MAX_ROWS_FETCH_SIZE)) {
engine.setMaxRowsFetchSize(node.get(Configuration.MAX_ROWS_FETCH_SIZE).asInt());
}
- if (node.get(Configuration.LOB_CHUNK_SIZE_IN_KB) != null) {
+ if (node.hasDefined(Configuration.LOB_CHUNK_SIZE_IN_KB)) {
engine.setLobChunkSizeInKB(node.get(Configuration.LOB_CHUNK_SIZE_IN_KB).asInt());
}
- if (node.get(Configuration.USE_DATA_ROLES) != null) {
+ if (node.hasDefined(Configuration.USE_DATA_ROLES)) {
engine.setUseDataRoles(node.get(Configuration.USE_DATA_ROLES).asBoolean());
}
- if (node.get(Configuration.ALLOW_CREATE_TEMPORY_TABLES_BY_DEFAULT) != null) {
+ if (node.hasDefined(Configuration.ALLOW_CREATE_TEMPORY_TABLES_BY_DEFAULT)) {
engine.setAllowCreateTemporaryTablesByDefault(node.get(Configuration.ALLOW_CREATE_TEMPORY_TABLES_BY_DEFAULT).asBoolean());
}
- if (node.get(Configuration.ALLOW_FUNCTION_CALLS_BY_DEFAULT) != null) {
+ if (node.hasDefined(Configuration.ALLOW_FUNCTION_CALLS_BY_DEFAULT)) {
engine.setAllowFunctionCallsByDefault(node.get(Configuration.ALLOW_FUNCTION_CALLS_BY_DEFAULT).asBoolean());
}
- if (node.get(Configuration.QUERY_THRESHOLD_IN_SECS) != null) {
+ if (node.hasDefined(Configuration.QUERY_THRESHOLD_IN_SECS)) {
engine.setQueryThresholdInSecs(node.get(Configuration.QUERY_THRESHOLD_IN_SECS).asInt());
}
- if (node.get(Configuration.MAX_SOURCE_ROWS) != null) {
+ if (node.hasDefined(Configuration.MAX_SOURCE_ROWS)) {
engine.setMaxSourceRows(node.get(Configuration.MAX_SOURCE_ROWS).asInt());
}
- if (node.get(Configuration.EXCEPTION_ON_MAX_SOURCE_ROWS) != null) {
+ if (node.hasDefined(Configuration.EXCEPTION_ON_MAX_SOURCE_ROWS)) {
engine.setExceptionOnMaxSourceRows(node.get(Configuration.EXCEPTION_ON_MAX_SOURCE_ROWS).asBoolean());
}
- if (node.get(Configuration.MAX_ODBC_LOB_SIZE_ALLOWED) != null) {
+ if (node.hasDefined(Configuration.MAX_ODBC_LOB_SIZE_ALLOWED)) {
engine.setMaxODBCLobSizeAllowed(node.get(Configuration.MAX_ODBC_LOB_SIZE_ALLOWED).asInt());
}
- if (node.get(Configuration.EVENT_DISTRIBUTOR_NAME) != null) {
+ if (node.hasDefined(Configuration.EVENT_DISTRIBUTOR_NAME)) {
engine.setEventDistributorName(node.get(Configuration.EVENT_DISTRIBUTOR_NAME).asString());
}
- if (node.get(Configuration.DETECTING_CHANGE_EVENTS) != null) {
+ if (node.hasDefined(Configuration.DETECTING_CHANGE_EVENTS)) {
engine.setDetectingChangeEvents(node.get(Configuration.DETECTING_CHANGE_EVENTS).asBoolean());
}
- if (node.get(Configuration.SESSION_EXPIRATION_TIME_LIMIT) != null) {
+ if (node.hasDefined(Configuration.SESSION_EXPIRATION_TIME_LIMIT)) {
engine.setSessionExpirationTimeLimit(node.get(Configuration.SESSION_EXPIRATION_TIME_LIMIT).asInt());
}
- if (node.get(Configuration.MAX_SESSIONS_ALLOWED) != null) {
+ if (node.hasDefined(Configuration.MAX_SESSIONS_ALLOWED)) {
engine.setSessionMaxLimit(node.get(Configuration.MAX_SESSIONS_ALLOWED).asInt());
}
@@ -236,7 +265,7 @@
private VDBRepository buildVDBRepository(ModelNode node) {
SystemFunctionManager systemFunctionManager = new SystemFunctionManager();
- if (node.get(Configuration.ALLOW_ENV_FUNCTION) != null) {
+ if (node.hasDefined(Configuration.ALLOW_ENV_FUNCTION)) {
systemFunctionManager.setAllowEnvFunction(node.get(Configuration.ALLOW_ENV_FUNCTION).asBoolean());
}
else {
@@ -255,73 +284,72 @@
return bufferManger;
}
- if (node.get(Configuration.USE_DISK) != null) {
+ if (node.hasDefined(Configuration.USE_DISK)) {
bufferManger.setUseDisk(node.get(Configuration.USE_DISK).asBoolean());
}
- if (node.get(Configuration.DISK_DIRECTORY) != null) {
- bufferManger.setDiskDirectory(node.get(Configuration.DISK_DIRECTORY).asString());
- }
- if (node.get(Configuration.PROCESSOR_BATCH_SIZE) != null) {
+ if (node.hasDefined(Configuration.PROCESSOR_BATCH_SIZE)) {
bufferManger.setProcessorBatchSize(node.get(Configuration.PROCESSOR_BATCH_SIZE).asInt());
}
- if (node.get(Configuration.CONNECTOR_BATCH_SIZE) != null) {
+ if (node.hasDefined(Configuration.CONNECTOR_BATCH_SIZE)) {
bufferManger.setConnectorBatchSize(node.get(Configuration.CONNECTOR_BATCH_SIZE).asInt());
}
- if (node.get(Configuration.MAX_RESERVE_BATCH_COLUMNS) != null) {
+ if (node.hasDefined(Configuration.MAX_RESERVE_BATCH_COLUMNS)) {
bufferManger.setMaxReserveBatchColumns(node.get(Configuration.MAX_RESERVE_BATCH_COLUMNS).asInt());
}
- if (node.get(Configuration.MAX_PROCESSING_BATCH_COLUMNS) != null) {
+ if (node.hasDefined(Configuration.MAX_PROCESSING_BATCH_COLUMNS)) {
bufferManger.setMaxProcessingBatchesColumns(node.get(Configuration.MAX_PROCESSING_BATCH_COLUMNS).asInt());
}
- if (node.get(Configuration.MAX_FILE_SIZE) != null) {
+ if (node.hasDefined(Configuration.MAX_FILE_SIZE)) {
bufferManger.setMaxFileSize(node.get(Configuration.MAX_FILE_SIZE).asInt());
}
- if (node.get(Configuration.MAX_BUFFER_SPACE) != null) {
+ if (node.hasDefined(Configuration.MAX_BUFFER_SPACE)) {
bufferManger.setMaxBufferSpace(node.get(Configuration.MAX_BUFFER_SPACE).asInt());
}
- if (node.get(Configuration.MAX_OPEN_FILES) != null) {
+ if (node.hasDefined(Configuration.MAX_OPEN_FILES)) {
bufferManger.setMaxOpenFiles(node.get(Configuration.MAX_OPEN_FILES).asInt());
}
return bufferManger;
}
private CacheFactory getCacheFactory(ModelNode node) {
- ClusterableCacheFactory cacheFactory = new ClusterableCacheFactory();
+ CacheFactory cacheFactory = new DefaultCacheFactory();
+ /*
+ if (node.hasDefined(Configuration.CLASS)) {
+ String className = node.get(Configuration.CLASS).asString();
+ }
- if (node.get(Configuration.ENABLED) != null) {
+ if (node.hasDefined(Configuration.ENABLED)) {
cacheFactory.setEnabled(node.get(Configuration.ENABLED).asBoolean());
}
else {
cacheFactory.setEnabled(true);
}
- if (node.get(Configuration.CACHE_SERVICE_JNDI_NAME) != null) {
+ if (node.hasDefined(Configuration.CACHE_SERVICE_JNDI_NAME)) {
cacheFactory.setCacheManager(node.get(Configuration.CACHE_SERVICE_JNDI_NAME).asString());
}
- if (node.get(Configuration.RESULTSET_CACHE_NAME) != null) {
+ if (node.hasDefined(Configuration.RESULTSET_CACHE_NAME)) {
cacheFactory.setResultsetCacheName(node.get(Configuration.RESULTSET_CACHE_NAME).asString());
- }
+ }
+ */
return cacheFactory;
}
private CacheConfiguration buildCacheConfig(ModelNode node) {
CacheConfiguration cacheConfig = new CacheConfiguration();
- if (node.get(Configuration.ENABLED) != null) {
- cacheConfig.setEnabled(node.get(Configuration.ENABLED).asBoolean());
- }
- if (node.get(Configuration.MAX_ENTRIES) != null) {
+ if (node.hasDefined(Configuration.MAX_ENTRIES)) {
cacheConfig.setMaxEntries(node.get(Configuration.MAX_ENTRIES).asInt());
}
- if (node.get(Configuration.MAX_AGE_IN_SECS) != null) {
+ if (node.hasDefined(Configuration.MAX_AGE_IN_SECS)) {
cacheConfig.setMaxAgeInSeconds(node.get(Configuration.MAX_AGE_IN_SECS).asInt());
}
- if (node.get(Configuration.MAX_STALENESS) != null) {
+ if (node.hasDefined(Configuration.MAX_STALENESS)) {
cacheConfig.setMaxStaleness(node.get(Configuration.MAX_STALENESS).asInt());
}
- if (node.get(Configuration.CACHE_TYPE) != null) {
+ if (node.hasDefined(Configuration.CACHE_TYPE)) {
cacheConfig.setType(node.get(Configuration.CACHE_TYPE).asString());
}
- if (node.get(Configuration.CACHE_LOCATION) != null) {
+ if (node.hasDefined(Configuration.CACHE_LOCATION)) {
cacheConfig.setLocation(node.get(Configuration.CACHE_LOCATION).asString());
}
return cacheConfig;
@@ -330,62 +358,63 @@
private SocketConfiguration buildSocketConfiguration(ModelNode node) {
SocketConfiguration socket = new SocketConfiguration();
- if (node.get(Configuration.ENABLED) != null) {
- socket.setEnabled(node.get(Configuration.ENABLED).asBoolean());
- }
- if (node.get(Configuration.SOCKET_BINDING) != null) {
- socket.setSocketBinding(node.get(Configuration.SOCKET_BINDING).asString());
- }
- if (node.get(Configuration.MAX_SOCKET_THREAD_SIZE) != null) {
+ if (node.hasDefined(Configuration.SOCKET_BINDING)) {
+ socket.setSocketBinding(node.require(Configuration.SOCKET_BINDING).asString());
+ }
+ else {
+ throw new IllegalArgumentException(IntegrationPlugin.Util.getString(Configuration.SOCKET_BINDING+".not_defined")); //$NON-NLS-1$
+ }
+
+ if (node.hasDefined(Configuration.MAX_SOCKET_THREAD_SIZE)) {
socket.setMaxSocketThreads(node.get(Configuration.MAX_SOCKET_THREAD_SIZE).asInt());
}
- if (node.get(Configuration.IN_BUFFER_SIZE) != null) {
+ if (node.hasDefined(Configuration.IN_BUFFER_SIZE)) {
socket.setInputBufferSize(node.get(Configuration.IN_BUFFER_SIZE).asInt());
}
- if (node.get(Configuration.OUT_BUFFER_SIZE) != null) {
+ if (node.hasDefined(Configuration.OUT_BUFFER_SIZE)) {
socket.setOutputBufferSize(node.get(Configuration.OUT_BUFFER_SIZE).asInt());
}
SSLConfiguration ssl = new SSLConfiguration();
ssl.setAuthenticationMode(SSLConfiguration.ANONYMOUS);
- if (node.get(Configuration.SSL) != null) {
+ if (node.hasDefined(Configuration.SSL)) {
ModelNode sslNode = node.get(Configuration.SSL);
- if (sslNode.get(Configuration.SSL_MODE) != null) {
+ if (sslNode.hasDefined(Configuration.SSL_MODE)) {
ssl.setMode(sslNode.get(Configuration.SSL_MODE).asString());
}
- if (sslNode.get(Configuration.KEY_STORE_FILE) != null) {
+ if (sslNode.hasDefined(Configuration.KEY_STORE_FILE)) {
ssl.setKeystoreFilename(sslNode.get(Configuration.KEY_STORE_FILE).asString());
}
- if (sslNode.get(Configuration.KEY_STORE_PASSWD) != null) {
+ if (sslNode.hasDefined(Configuration.KEY_STORE_PASSWD)) {
ssl.setKeystorePassword(sslNode.get(Configuration.KEY_STORE_PASSWD).asString());
}
- if (sslNode.get(Configuration.KEY_STORE_TYPE) != null) {
+ if (sslNode.hasDefined(Configuration.KEY_STORE_TYPE)) {
ssl.setKeystoreType(sslNode.get(Configuration.KEY_STORE_TYPE).asString());
}
- if (sslNode.get(Configuration.SSL_PROTOCOL) != null) {
+ if (sslNode.hasDefined(Configuration.SSL_PROTOCOL)) {
ssl.setSslProtocol(sslNode.get(Configuration.SSL_PROTOCOL).asString());
}
- if (sslNode.get(Configuration.KEY_MANAGEMENT_ALG) != null) {
+ if (sslNode.hasDefined(Configuration.KEY_MANAGEMENT_ALG)) {
ssl.setKeymanagementAlgorithm(sslNode.get(Configuration.KEY_MANAGEMENT_ALG).asString());
}
- if (sslNode.get(Configuration.TRUST_FILE) != null) {
+ if (sslNode.hasDefined(Configuration.TRUST_FILE)) {
ssl.setTruststoreFilename(sslNode.get(Configuration.TRUST_FILE).asString());
}
- if (sslNode.get(Configuration.TRUST_PASSWD) != null) {
+ if (sslNode.hasDefined(Configuration.TRUST_PASSWD)) {
ssl.setTruststorePassword(sslNode.get(Configuration.TRUST_PASSWD).asString());
}
- if (sslNode.get(Configuration.AUTH_MODE) != null) {
+ if (sslNode.hasDefined(Configuration.AUTH_MODE)) {
ssl.setAuthenticationMode(sslNode.get(Configuration.AUTH_MODE).asString());
- }
+ }
}
+ socket.setSSLConfiguration(ssl);
- socket.setSSLConfiguration(ssl);
return socket;
}
}
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineDescription.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineDescription.java 2011-07-09 00:08:35 UTC (rev 3304)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineDescription.java 2011-07-11 03:06:57 UTC (rev 3305)
@@ -47,7 +47,6 @@
}
static void getQueryEngineDescription(ModelNode node, String type, ResourceBundle bundle) {
- addAttribute(node, Configuration.JNDI_NAME, type, bundle.getString(Configuration.JNDI_NAME+DESC), ModelType.STRING, true, "teiid/engine-deployer"); //$NON-NLS-1$
addAttribute(node, Configuration.ASYNC_THREAD_GROUP, type, bundle.getString(Configuration.ASYNC_THREAD_GROUP+DESC), ModelType.STRING, false, "teiid-async"); //$NON-NLS-1$
addAttribute(node, Configuration.MAX_THREADS, type, bundle.getString(Configuration.MAX_THREADS+DESC), ModelType.INT, false, "64"); //$NON-NLS-1$
addAttribute(node, Configuration.MAX_ACTIVE_PLANS, type, bundle.getString(Configuration.MAX_ACTIVE_PLANS+DESC), ModelType.INT, false, "20"); //$NON-NLS-1$
@@ -66,7 +65,7 @@
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.JDBC_SECURITY_DOMAIN, type, bundle.getString(Configuration.JDBC_SECURITY_DOMAIN+DESC), ModelType.STRING, false, null);
+ 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$
@@ -128,14 +127,12 @@
}
private static void getDistributedCacheDescription(ModelNode node, String type, ResourceBundle bundle) {
- addAttribute(node, Configuration.ENABLED, type, bundle.getString(Configuration.ENABLED+DESC), ModelType.BOOLEAN, false, "true"); //$NON-NLS-1$
addAttribute(node, Configuration.CACHE_SERVICE_JNDI_NAME, type, bundle.getString(Configuration.CACHE_SERVICE_JNDI_NAME+DESC), ModelType.STRING, false, "java:TeiidCacheManager"); //$NON-NLS-1$
addAttribute(node, Configuration.RESULTSET_CACHE_NAME, type, bundle.getString(Configuration.RESULTSET_CACHE_NAME+DESC), ModelType.STRING, false, "teiid-resultset-cache"); //$NON-NLS-1$
}
private static void getBufferDescription(ModelNode node, String type, ResourceBundle bundle) {
addAttribute(node, Configuration.USE_DISK, type, bundle.getString(Configuration.USE_DISK+DESC), ModelType.BOOLEAN, false, "true"); //$NON-NLS-1$
- addAttribute(node, Configuration.DISK_DIRECTORY, type, bundle.getString(Configuration.DISK_DIRECTORY+DESC), ModelType.STRING, true, null);
addAttribute(node, Configuration.PROCESSOR_BATCH_SIZE, type, bundle.getString(Configuration.PROCESSOR_BATCH_SIZE+DESC), ModelType.INT, false, "512"); //$NON-NLS-1$
addAttribute(node, Configuration.CONNECTOR_BATCH_SIZE, type, bundle.getString(Configuration.CONNECTOR_BATCH_SIZE+DESC), ModelType.INT, false, "1024"); //$NON-NLS-1$
addAttribute(node, Configuration.MAX_RESERVE_BATCH_COLUMNS, type, bundle.getString(Configuration.MAX_RESERVE_BATCH_COLUMNS+DESC), ModelType.INT, false, "-1"); //$NON-NLS-1$
@@ -146,7 +143,6 @@
}
static void getResultsetCacheDescription(ModelNode node, String type, ResourceBundle bundle) {
- addAttribute(node, Configuration.ENABLED, type, bundle.getString(Configuration.ENABLED+DESC), ModelType.BOOLEAN, false, "true"); //$NON-NLS-1$
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$
@@ -155,7 +151,6 @@
}
static void getPreparedPalnCacheDescription(ModelNode node, String type, ResourceBundle bundle) {
- addAttribute(node, Configuration.ENABLED, type, bundle.getString(Configuration.ENABLED+DESC), ModelType.BOOLEAN, false, "true"); //$NON-NLS-1$
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$
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineOperationHandler.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineOperationHandler.java 2011-07-09 00:08:35 UTC (rev 3304)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineOperationHandler.java 2011-07-11 03:06:57 UTC (rev 3305)
@@ -35,9 +35,10 @@
import org.jboss.msc.service.ServiceController;
import org.teiid.adminapi.AdminException;
import org.teiid.adminapi.impl.*;
+import org.teiid.adminapi.impl.MetadataMapper.VDBTranslatorMetaDataMapper;
import org.teiid.jboss.deployers.RuntimeEngineDeployer;
-abstract class QueryEngineOperationHandler implements OperationHandler, DescriptionProvider {
+abstract class QueryEngineOperationHandler extends AbstractAddStepHandler implements DescriptionProvider {
private static final String DESCRIBE = ".describe"; //$NON-NLS-1$
private String operationName;
@@ -47,25 +48,20 @@
}
@Override
- public OperationResult execute(final OperationContext context, final ModelNode operation, final ResultHandler resultHandler) throws OperationFailedException {
-
- final RuntimeOperationContext runtimeContext = context.getRuntimeContext();
- if (runtimeContext != null) {
- runtimeContext.setRuntimeTask(new RuntimeTask() {
-
- @Override
- public void execute(RuntimeTaskContext context) throws OperationFailedException {
- ServiceController<?> sc = context.getServiceRegistry().getRequiredService(TeiidServiceNames.ENGINE);
- RuntimeEngineDeployer engine = RuntimeEngineDeployer.class.cast(sc.getValue());
-
- resultHandler.handleResultFragment(ResultHandler.EMPTY_LOCATION, executeOperation(engine, operation));
- }});
- }
-
- resultHandler.handleResultComplete();
- return new BasicOperationResult();
+ protected void populateModel(final ModelNode operation, final ModelNode model) throws OperationFailedException{
+
}
+ @Override
+ protected void performRuntime(final OperationContext context, final ModelNode operation, final ModelNode model,
+ final ServiceVerificationHandler verificationHandler, final List<ServiceController<?>> newControllers) throws OperationFailedException {
+
+ ServiceController<?> sc = context.getServiceRegistry(false).getRequiredService(TeiidServiceNames.ENGINE);
+ RuntimeEngineDeployer engine = RuntimeEngineDeployer.class.cast(sc.getValue());
+ executeOperation(engine, operation, model);
+ }
+
+
@Override
public ModelNode getModelDescription(final Locale locale) {
final ResourceBundle bundle = IntegrationPlugin.getResourceBundle(locale);
@@ -88,7 +84,7 @@
return bundle.getString(RuntimeEngineDeployer.class.getSimpleName()+"."+this.operationName+"."+parmName+DESCRIBE); //$NON-NLS-1$ //$NON-NLS-2$
}
- abstract protected ModelNode executeOperation(RuntimeEngineDeployer engine, ModelNode operation) throws OperationFailedException;
+ abstract protected void executeOperation(RuntimeEngineDeployer engine, ModelNode operation, ModelNode node) throws OperationFailedException;
protected void describeParameters(@SuppressWarnings("unused") ModelNode operationNode, @SuppressWarnings("unused")ResourceBundle bundle) {
}
@@ -99,10 +95,8 @@
super(operationName);
}
@Override
- protected ModelNode executeOperation(RuntimeEngineDeployer engine, ModelNode operation) throws OperationFailedException{
- ModelNode node = new ModelNode();
+ protected void executeOperation(RuntimeEngineDeployer engine, ModelNode operation, ModelNode node) throws OperationFailedException{
node.set(engine.getRuntimeVersion());
- return node;
}
}
@@ -111,14 +105,12 @@
super(operationName);
}
@Override
- protected ModelNode executeOperation(RuntimeEngineDeployer engine, ModelNode operation) throws OperationFailedException{
- ModelNode node = new ModelNode();
+ protected void executeOperation(RuntimeEngineDeployer engine, ModelNode operation, ModelNode node) throws OperationFailedException{
try {
node.set(String.valueOf(engine.getActiveSessionsCount()));
} catch (AdminException e) {
// TODO: handle exception in model node terms
}
- return node;
}
}
@@ -127,19 +119,17 @@
super(operationName);
}
@Override
- protected ModelNode executeOperation(RuntimeEngineDeployer engine, ModelNode operation) throws OperationFailedException{
- ModelNode node = new ModelNode();
+ protected void executeOperation(RuntimeEngineDeployer engine, ModelNode operation, ModelNode node) throws OperationFailedException{
node.get(TYPE).set(ModelType.LIST);
try {
Collection<SessionMetadata> sessions = engine.getActiveSessions();
for (SessionMetadata session:sessions) {
- node.add(MetadataMapper.SessionMetadataMapper.wrap(session));
+ node.add(MetadataMapper.SessionMetadataMapper.wrap(session, node.add()));
}
} catch (AdminException e) {
// TODO: handle exception in model node terms
}
- return node;
}
}
@@ -148,15 +138,13 @@
super(operationName);
}
@Override
- protected ModelNode executeOperation(RuntimeEngineDeployer engine, ModelNode operation) throws OperationFailedException{
- ModelNode node = new ModelNode();
+ protected void executeOperation(RuntimeEngineDeployer engine, ModelNode operation, ModelNode node) throws OperationFailedException{
node.get(TYPE).set(ModelType.LIST);
List<RequestMetadata> requests = engine.getRequestsForSession(operation.get(OperationsConstants.SESSION).asString());
for (RequestMetadata request:requests) {
- node.add(MetadataMapper.RequestMetadataMapper.wrap(request));
+ node.add(MetadataMapper.RequestMetadataMapper.wrap(request, node.add()));
}
- return node;
}
protected void describeParameters(ModelNode operationNode, ResourceBundle bundle) {
@@ -173,8 +161,7 @@
super(operationName);
}
@Override
- protected ModelNode executeOperation(RuntimeEngineDeployer engine, ModelNode operation) throws OperationFailedException{
- ModelNode node = new ModelNode();
+ protected void executeOperation(RuntimeEngineDeployer engine, ModelNode operation, ModelNode node) throws OperationFailedException{
node.get(TYPE).set(ModelType.LIST);
try {
@@ -182,12 +169,11 @@
int vdbVersion = operation.get(OperationsConstants.VDB_VERSION).asInt();
List<RequestMetadata> requests = engine.getRequestsUsingVDB(vdbName,vdbVersion);
for (RequestMetadata request:requests) {
- node.add(MetadataMapper.RequestMetadataMapper.wrap(request));
+ node.add(MetadataMapper.RequestMetadataMapper.wrap(request, node.add()));
}
} catch (AdminException e) {
// TODO: handle exception in model node terms
}
- return node;
}
protected void describeParameters(ModelNode operationNode, ResourceBundle bundle) {
@@ -208,15 +194,13 @@
super(operationName);
}
@Override
- protected ModelNode executeOperation(RuntimeEngineDeployer engine, ModelNode operation) throws OperationFailedException{
- ModelNode node = new ModelNode();
+ protected void executeOperation(RuntimeEngineDeployer engine, ModelNode operation, ModelNode node) throws OperationFailedException{
node.get(TYPE).set(ModelType.LIST);
List<RequestMetadata> requests = engine.getLongRunningRequests();
for (RequestMetadata request:requests) {
- node.add(MetadataMapper.RequestMetadataMapper.wrap(request));
+ node.add(MetadataMapper.RequestMetadataMapper.wrap(request, node.add()));
}
- return node;
}
}
@@ -225,10 +209,8 @@
super(operationName);
}
@Override
- protected ModelNode executeOperation(RuntimeEngineDeployer engine, ModelNode operation) throws OperationFailedException{
- ModelNode node = new ModelNode();
+ protected void executeOperation(RuntimeEngineDeployer engine, ModelNode operation, ModelNode node) throws OperationFailedException{
engine.terminateSession(operation.get(OperationsConstants.SESSION).asString());
- return node;
}
protected void describeParameters(ModelNode operationNode, ResourceBundle bundle) {
@@ -243,14 +225,12 @@
super(operationName);
}
@Override
- protected ModelNode executeOperation(RuntimeEngineDeployer engine, ModelNode operation) throws OperationFailedException{
- ModelNode node = new ModelNode();
+ protected void executeOperation(RuntimeEngineDeployer engine, ModelNode operation, ModelNode node) throws OperationFailedException{
try {
engine.cancelRequest(operation.get(OperationsConstants.SESSION).asString(), operation.get(OperationsConstants.EXECUTION_ID).asLong());
} catch (AdminException e) {
// TODO: handle exception in model node terms
}
- return node;
}
protected void describeParameters(ModelNode operationNode, ResourceBundle bundle) {
@@ -269,14 +249,12 @@
super(operationName);
}
@Override
- protected ModelNode executeOperation(RuntimeEngineDeployer engine, ModelNode operation) throws OperationFailedException {
- ModelNode node = new ModelNode();
+ protected void executeOperation(RuntimeEngineDeployer engine, ModelNode operation, ModelNode node) throws OperationFailedException {
node.get(TYPE).set(ModelType.LIST);
Collection<String> types = engine.getCacheTypes();
for (String type:types) {
node.add(type);
}
- return node;
}
}
@@ -286,8 +264,7 @@
super(operationName);
}
@Override
- protected ModelNode executeOperation(RuntimeEngineDeployer engine, ModelNode operation) throws OperationFailedException {
- ModelNode node = new ModelNode();
+ protected void executeOperation(RuntimeEngineDeployer engine, ModelNode operation, ModelNode node) throws OperationFailedException {
String cacheType = operation.get(OperationsConstants.CACHE_TYPE).asString();
if (operation.get(OperationsConstants.VDB_NAME) != null && operation.get(OperationsConstants.VDB_VERSION) != null) {
@@ -298,7 +275,6 @@
else {
engine.clearCache(cacheType);
}
- return node;
}
protected void describeParameters(ModelNode operationNode, ResourceBundle bundle) {
@@ -323,10 +299,10 @@
super(operationName);
}
@Override
- protected ModelNode executeOperation(RuntimeEngineDeployer engine, ModelNode operation) throws OperationFailedException {
+ protected void executeOperation(RuntimeEngineDeployer engine, ModelNode operation, ModelNode node) throws OperationFailedException {
String cacheType = operation.get(OperationsConstants.CACHE_TYPE).asString();
CacheStatisticsMetadata stats = engine.getCacheStatistics(cacheType);
- return MetadataMapper.CacheStatisticsMetadataMapper.wrap(stats);
+ MetadataMapper.CacheStatisticsMetadataMapper.wrap(stats, node);
}
protected void describeParameters(ModelNode operationNode, ResourceBundle bundle) {
@@ -342,9 +318,9 @@
super(operationName);
}
@Override
- protected ModelNode executeOperation(RuntimeEngineDeployer engine, ModelNode operation) throws OperationFailedException {
+ protected void executeOperation(RuntimeEngineDeployer engine, ModelNode operation, ModelNode node) throws OperationFailedException {
WorkerPoolStatisticsMetadata stats = engine.getWorkerPoolStatistics();
- return MetadataMapper.WorkerPoolStatisticsMetadataMapper.wrap(stats);
+ MetadataMapper.WorkerPoolStatisticsMetadataMapper.wrap(stats, node);
}
}
@@ -354,17 +330,15 @@
super(operationName);
}
@Override
- protected ModelNode executeOperation(RuntimeEngineDeployer engine, ModelNode operation) throws OperationFailedException {
+ protected void executeOperation(RuntimeEngineDeployer engine, ModelNode operation, ModelNode node) throws OperationFailedException {
Collection<TransactionMetadata> txns = engine.getTransactions();
- ModelNode node = new ModelNode();
node.get(TYPE).set(ModelType.LIST);
for (TransactionMetadata txn:txns) {
- node.add(MetadataMapper.TransactionMetadataMapper.wrap(txn));
+ node.add(MetadataMapper.TransactionMetadataMapper.wrap(txn, node.add()));
}
- return node;
}
}
@@ -374,14 +348,13 @@
super(operationName);
}
@Override
- protected ModelNode executeOperation(RuntimeEngineDeployer engine, ModelNode operation) throws OperationFailedException {
+ protected void executeOperation(RuntimeEngineDeployer engine, ModelNode operation, ModelNode node) throws OperationFailedException {
String xid = operation.get(OperationsConstants.XID).asString();
try {
engine.terminateTransaction(xid);
} catch (AdminException e) {
// TODO: Handle exception
}
- return new ModelNode();
}
protected void describeParameters(ModelNode operationNode, ResourceBundle bundle) {
@@ -397,7 +370,7 @@
super(operationName);
}
@Override
- protected ModelNode executeOperation(RuntimeEngineDeployer engine, ModelNode operation) throws OperationFailedException {
+ protected void executeOperation(RuntimeEngineDeployer engine, ModelNode operation, ModelNode node) throws OperationFailedException {
String sourceVDBName = operation.get(OperationsConstants.SOURCE_VDBNAME).asString();
int sourceVDBversion = operation.get(OperationsConstants.SOURCE_VDBVERSION).asInt();
String targetVDBName = operation.get(OperationsConstants.TARGET_VDBNAME).asString();
@@ -407,7 +380,6 @@
} catch (AdminException e) {
throw new OperationFailedException(new ModelNode().set(e.getMessage()));
}
- return new ModelNode();
}
protected void describeParameters(ModelNode operationNode, ResourceBundle bundle) {
@@ -435,12 +407,11 @@
super(operationName);
}
@Override
- protected ModelNode executeOperation(RuntimeEngineDeployer engine, ModelNode operation) throws OperationFailedException {
+ protected void executeOperation(RuntimeEngineDeployer engine, ModelNode operation, ModelNode node) throws OperationFailedException {
String vdbName = operation.get(OperationsConstants.VDB_NAME).asString();
int vdbVersion = operation.get(OperationsConstants.VDB_VERSION).asInt();
String sql = operation.get(OperationsConstants.SQL_QUERY).asString();
int timeout = operation.get(OperationsConstants.TIMEOUT_IN_MILLI).asInt();
- ModelNode node = new ModelNode();
try {
node.get(TYPE).set(ModelType.LIST);
@@ -461,7 +432,6 @@
} catch (AdminException e) {
throw new OperationFailedException(new ModelNode().set(e.getMessage()));
}
- return node;
}
protected void describeParameters(ModelNode operationNode, ResourceBundle bundle) {
@@ -489,12 +459,12 @@
super(operationName);
}
@Override
- protected ModelNode executeOperation(RuntimeEngineDeployer engine, ModelNode operation) throws OperationFailedException {
+ protected void executeOperation(RuntimeEngineDeployer engine, ModelNode operation, ModelNode node) throws OperationFailedException {
String vdbName = operation.get(OperationsConstants.VDB_NAME).asString();
int vdbVersion = operation.get(OperationsConstants.VDB_VERSION).asInt();
VDBMetaData vdb = engine.getVDB(vdbName, vdbVersion);
- return MetadataMapper.wrap(vdb);
+ MetadataMapper.wrap(vdb, node);
}
protected void describeParameters(ModelNode operationNode, ResourceBundle bundle) {
@@ -514,15 +484,13 @@
super(operationName);
}
@Override
- protected ModelNode executeOperation(RuntimeEngineDeployer engine, ModelNode operation) throws OperationFailedException {
+ protected void executeOperation(RuntimeEngineDeployer engine, ModelNode operation, ModelNode node) throws OperationFailedException {
List<VDBMetaData> vdbs = engine.getVDBs();
- ModelNode node = new ModelNode();
node.get(TYPE).set(ModelType.LIST);
for (VDBMetaData vdb:vdbs) {
- node.add(MetadataMapper.wrap(vdb));
+ node.add(MetadataMapper.wrap(vdb, node.add()));
}
- return node;
}
}
@@ -533,15 +501,13 @@
super(operationName);
}
@Override
- protected ModelNode executeOperation(RuntimeEngineDeployer engine, ModelNode operation) throws OperationFailedException {
+ protected void executeOperation(RuntimeEngineDeployer engine, ModelNode operation, ModelNode node) throws OperationFailedException {
List<VDBTranslatorMetaData> translators = engine.getTranslators();
- ModelNode node = new ModelNode();
node.get(TYPE).set(ModelType.OBJECT);
for (VDBTranslatorMetaData t:translators) {
- node.add(MetadataMapper.VDBTranslatorMetaDataMapper.wrap(t));
+ node.add(MetadataMapper.VDBTranslatorMetaDataMapper.wrap(t, node.add()));
}
- return node;
}
protected void describeParameters(ModelNode operationNode, ResourceBundle bundle) {
@@ -558,11 +524,11 @@
}
@Override
- protected ModelNode executeOperation(RuntimeEngineDeployer engine, ModelNode operation) throws OperationFailedException {
+ protected void executeOperation(RuntimeEngineDeployer engine, ModelNode operation, ModelNode node) throws OperationFailedException {
String translatorName = operation.get(OperationsConstants.TRANSLATOR_NAME).asString();
VDBTranslatorMetaData translator = engine.getTranslator(translatorName);
- return MetadataMapper.VDBTranslatorMetaDataMapper.wrap(translator);
+ MetadataMapper.VDBTranslatorMetaDataMapper.wrap(translator, node);
}
protected void describeParameters(ModelNode operationNode, ResourceBundle bundle) {
@@ -570,7 +536,7 @@
operationNode.get(REQUEST_PROPERTIES, OperationsConstants.TRANSLATOR_NAME, REQUIRED).set(true);
operationNode.get(REQUEST_PROPERTIES, OperationsConstants.TRANSLATOR_NAME, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.TRANSLATOR_NAME));
- operationNode.get(REPLY_PROPERTIES, TYPE).set(ModelType.OBJECT);
+ VDBTranslatorMetaDataMapper.describe(operationNode.get(REPLY_PROPERTIES));
operationNode.get(REPLY_PROPERTIES, DESCRIPTION).set(bundle.getString(getReplyName()));
}
}
\ No newline at end of file
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-07-09 00:08:35 UTC (rev 3304)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidExtension.java 2011-07-11 03:06:57 UTC (rev 3305)
@@ -34,7 +34,7 @@
import org.jboss.as.controller.descriptions.DescriptionProvider;
import org.jboss.as.controller.descriptions.ModelDescriptionConstants;
import org.jboss.as.controller.parsing.ExtensionParsingContext;
-import org.jboss.as.controller.registry.ModelNodeRegistration;
+import org.jboss.as.controller.registry.ManagementResourceRegistration;
import org.jboss.as.controller.registry.AttributeAccess.Storage;
import org.jboss.dmr.ModelNode;
import org.jboss.dmr.ModelType;
@@ -73,7 +73,7 @@
registration.registerXMLElementWriter(parser);
- final ModelNodeRegistration subsystem = registration.registerSubsystemModel(new DescriptionProvider() {
+ final ManagementResourceRegistration subsystem = registration.registerSubsystemModel(new DescriptionProvider() {
@Override
public ModelNode getModelDescription(Locale locale) {
@@ -99,7 +99,7 @@
subsystem.registerOperationHandler(ModelDescriptionConstants.ADD, ENGINE_ADD, ENGINE_DESC);
//subsystem.registerOperationHandler(ModelDescriptionConstants.DESCRIBE, describe, describe, false);
- final ModelNodeRegistration translators = subsystem.registerSubModel(PathElement.pathElement(Configuration.TRANSLATOR), new DescriptionProvider() {
+ final ManagementResourceRegistration translators = subsystem.registerSubModel(PathElement.pathElement(Configuration.TRANSLATOR), new DescriptionProvider() {
@Override
public ModelNode getModelDescription(Locale locale) {
final ResourceBundle bundle = IntegrationPlugin.getResourceBundle(locale);
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidServiceNames.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidServiceNames.java 2011-07-09 00:08:35 UTC (rev 3304)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidServiceNames.java 2011-07-11 03:06:57 UTC (rev 3305)
@@ -27,6 +27,8 @@
public static ServiceName ENGINE = ServiceName.JBOSS.append("teiid", "query-engine");
public static ServiceName TRANSLATOR_REPO = ServiceName.JBOSS.append("teiid", "translator-repository");
static ServiceName TRANSLATOR_BASE = ServiceName.JBOSS.append("teiid", "translator");
+ public static ServiceName BUFFER_DIR = ServiceName.JBOSS.append("teiid", "buffer.dir");
+ public static ServiceName BUFFER_MGR = ServiceName.JBOSS.append("teiid", "buffer-mgr");
public static ServiceName translatorServiceName(String name) {
return TRANSLATOR_BASE.append(name);
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidSubsystemParser.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidSubsystemParser.java 2011-07-09 00:08:35 UTC (rev 3304)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidSubsystemParser.java 2011-07-11 03:06:57 UTC (rev 3305)
@@ -191,9 +191,6 @@
case USE_DISK_ELEMENT:
node.get(reader.getLocalName()).set(Boolean.parseBoolean(reader.getElementText()));
break;
- case DISK_DIRECTORY_ELEMENT:
- node.get(reader.getLocalName()).set(reader.getElementText());
- break;
case PROCESSOR_BATCH_SIZE_ELEMENT:
case CONNECTOR_BATCH_SIZE_ELEMENT:
case MAX_RESERVE_BATCH_COLUMNS_ELEMENT:
Deleted: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidXOMSubsystemDescription.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidXOMSubsystemDescription.java 2011-07-09 00:08:35 UTC (rev 3304)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidXOMSubsystemDescription.java 2011-07-11 03:06:57 UTC (rev 3305)
@@ -1,332 +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.ATTRIBUTES;
-import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.CHILDREN;
-import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.DEFAULT;
-import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.DESCRIPTION;
-import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.MAX_OCCURS;
-import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.MIN_OCCURS;
-import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.REQUIRED;
-import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.TYPE;
-
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Locale;
-
-import org.jboss.as.controller.descriptions.DescriptionProvider;
-import org.jboss.as.controller.descriptions.ModelDescriptionConstants;
-import org.jboss.dmr.ModelNode;
-import org.jboss.dmr.ModelType;
-import org.teiid.core.TeiidRuntimeException;
-import org.xml.sax.Attributes;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.Locator;
-import org.xml.sax.SAXException;
-
-import com.sun.xml.xsom.XSAnnotation;
-import com.sun.xml.xsom.XSAttributeDecl;
-import com.sun.xml.xsom.XSAttributeUse;
-import com.sun.xml.xsom.XSComplexType;
-import com.sun.xml.xsom.XSContentType;
-import com.sun.xml.xsom.XSElementDecl;
-import com.sun.xml.xsom.XSFacet;
-import com.sun.xml.xsom.XSModelGroup;
-import com.sun.xml.xsom.XSParticle;
-import com.sun.xml.xsom.XSRestrictionSimpleType;
-import com.sun.xml.xsom.XSSchema;
-import com.sun.xml.xsom.XSSchemaSet;
-import com.sun.xml.xsom.XSSimpleType;
-import com.sun.xml.xsom.XSTerm;
-import com.sun.xml.xsom.parser.AnnotationContext;
-import com.sun.xml.xsom.parser.AnnotationParser;
-import com.sun.xml.xsom.parser.AnnotationParserFactory;
-import com.sun.xml.xsom.parser.XSOMParser;
-
-/**
- * Lot of XSD parsing code is from http://it.toolbox.com/blogs/enterprise-web-solutions/parsing-an-xsd-schem...
- */
-public class TeiidXOMSubsystemDescription implements DescriptionProvider {
-
-
- @Override
- public ModelNode getModelDescription(Locale locale) {
-
- ModelNode node = new ModelNode();
- node.get(ModelDescriptionConstants.DESCRIPTION).set("teiid subsystem"); //$NON-NLS-1$
- node.get(ModelDescriptionConstants.HEAD_COMMENT_ALLOWED).set(true);
- node.get(ModelDescriptionConstants.TAIL_COMMENT_ALLOWED).set(true);
- node.get(ModelDescriptionConstants.NAMESPACE).set(Namespace.CURRENT.getUri());
-
- try {
- XSOMParser parser = new XSOMParser();
- URL xsdURL = Thread.currentThread().getContextClassLoader().getResource("schema/jboss-teiid.xsd"); //$NON-NLS-1$
- parser.setAnnotationParser(new AnnotationFactory());
- parser.parse(xsdURL);
- XSSchemaSet schemaSet = parser.getResult();
- if (schemaSet == null) {
- throw new TeiidRuntimeException("No Schema parsed");
- }
- XSSchema xsSchema = schemaSet.getSchema(1);
- Iterator<XSElementDecl> it = xsSchema.iterateElementDecls();
- while (it.hasNext()) {
- XSElementDecl element = it.next();
- parseElement(null, element, node, false);
- }
- } catch (SAXException e) {
- throw new TeiidRuntimeException(e);
- }
-
- return node;
- }
-
- public void describeNode(ModelNode node, String type, String name, String description, String dataType, String defaultValue,
- SimpleTypeRestriction restriction, boolean required) {
- node.get(type, name, TYPE).set(getModelType(dataType));
- node.get(type, name, DESCRIPTION).set(description);
- node.get(type, name, REQUIRED).set(required);
- node.get(type, name, MAX_OCCURS).set(1);
- if (defaultValue != null) {
- node.get(type, name, DEFAULT).set(defaultValue);
- }
-
- if (restriction.enumeration != null) {
- //TODO:
- //node.get(type, name, "allowed").set(Arrays.asList(restriction.enumeration));
- }
- }
-
-
-
- private void parseElement(XSParticle p, XSElementDecl element, ModelNode node, boolean addChild) {
- if (element.getType().isComplexType()) {
- if (addChild) {
- ModelNode childNode = node.get(CHILDREN, element.getName());
- childNode.get(TYPE).set(ModelType.OBJECT);
- childNode.get(DESCRIPTION).set(getDescription(element));
- childNode.get(REQUIRED).set(false);
- childNode.get(MAX_OCCURS).set(p.getMaxOccurs());
- childNode.get(MIN_OCCURS).set(p.getMinOccurs());
- parseComplexType(element, childNode);
- }
- else {
- parseComplexType(element, node);
- }
- }
- else {
- String defaultValue = null;
- if (element.getDefaultValue() != null) {
- defaultValue = element.getDefaultValue().value;
- }
- boolean required = false;
- XSParticle particle = ((XSContentType)element.getType()).asParticle();
- if (particle != null) {
- if (particle.getMinOccurs() != 0) {
- required = true;
- }
- }
- describeNode(node, ATTRIBUTES, element.getName(), getDescription(element), element.getType().getName(), defaultValue, getRestrictions(element.getType().asSimpleType()), required);
-
- }
- }
-
- private void parseComplexType(XSElementDecl element, ModelNode node) {
- XSComplexType type = element.getType().asComplexType();
- Iterator<? extends XSAttributeUse> attrIter = type.iterateAttributeUses();
- while(attrIter.hasNext()) {
- XSAttributeDecl attr = attrIter.next().getDecl();
- String defaultValue = null;
- if (attr.getDefaultValue() != null) {
- defaultValue = attr.getDefaultValue().value;
- }
- describeNode(node, ATTRIBUTES, attr.getName(), attr.getName(), attr.getType().getName(), defaultValue, getRestrictions(attr.getType().asSimpleType()), true);
- }
-
- XSContentType contentType = type.getContentType();
- XSParticle particle = contentType.asParticle();
- if (particle != null) {
- XSTerm term = particle.getTerm();
- if (term.isModelGroup()) {
- XSModelGroup xsModelGroup = term.asModelGroup();
- XSParticle[] particles = xsModelGroup.getChildren();
- for (XSParticle p : particles) {
- XSTerm pterm = p.getTerm();
- if (pterm.isElementDecl()) {
- parseElement(p, pterm.asElementDecl(), node, true);
- }
- }
- }
- }
- }
-
- private ModelType getModelType(String type) {
- if (type == null) {
- return ModelType.STRING;
- }
- if (type.equals("int")) { //$NON-NLS-1$
- return ModelType.INT;
- }
- else if (type.equals("boolean")) { //$NON-NLS-1$
- return ModelType.BOOLEAN;
- }
- return ModelType.STRING;
- }
-
- private String getDescription(XSElementDecl element) {
- String description = element.getName();
- XSAnnotation annotation = element.getAnnotation();
- if (annotation != null) {
- description = (String)annotation.getAnnotation();
- }
- return description;
- }
-
-
- private class AnnotationFactory implements AnnotationParserFactory{
- @Override
- public AnnotationParser create() {
- return new XsdAnnotationParser();
- }
- }
-
- private class XsdAnnotationParser extends AnnotationParser {
- private StringBuilder documentation = new StringBuilder();
- @Override
- public ContentHandler getContentHandler(AnnotationContext context, String parentElementName, ErrorHandler handler, EntityResolver resolver) {
- return new ContentHandler(){
- private boolean parsingDocumentation = false;
- @Override
- public void characters(char[] ch, int start, int length) throws SAXException {
- if(parsingDocumentation){
- documentation.append(ch,start,length);
- }
- }
- @Override
- public void endElement(String uri, String localName, String name)
- throws SAXException {
- if(localName.equals("documentation")){ //$NON-NLS-1$
- parsingDocumentation = false;
- }
- }
- @Override
- public void startElement(String uri, String localName,String name,
- Attributes atts) throws SAXException {
- if(localName.equals("documentation")){ //$NON-NLS-1$
- parsingDocumentation = true;
- }
- }
- @Override
- public void endDocument() throws SAXException {
- }
- @Override
- public void endPrefixMapping(String prefix) throws SAXException {
- }
- @Override
- public void ignorableWhitespace(char[] ch, int start, int length)
- throws SAXException {
- }
- @Override
- public void processingInstruction(String target, String data)
- throws SAXException {
- }
- @Override
- public void setDocumentLocator(Locator locator) {
- }
- @Override
- public void skippedEntity(String name) throws SAXException {
- }
- @Override
- public void startDocument() throws SAXException {
- }
- @Override
- public void startPrefixMapping(String prefix, String uri) throws SAXException {
- }
- };
- }
- @Override
- public Object getResult(Object existing) {
- return documentation.toString().trim();
- }
- }
-
- public class SimpleTypeRestriction{
- public String[] enumeration = null;
- public String maxValue = null;
- public String minValue = null;
- public String length = null;
- public String maxLength = null;
- public String minLength = null;
- public String pattern = null;
- public String totalDigits = null;
- }
-
- private SimpleTypeRestriction getRestrictions(XSSimpleType xsSimpleType){
- SimpleTypeRestriction t = new SimpleTypeRestriction();
- XSRestrictionSimpleType restriction = xsSimpleType.asRestriction();
- if(restriction != null){
- List<String> enumeration = new ArrayList<String>();
- Iterator<? extends XSFacet> i = restriction.getDeclaredFacets().iterator();
- while(i.hasNext()){
- XSFacet facet = i.next();
- if(facet.getName().equals(XSFacet.FACET_ENUMERATION)){
- enumeration.add(facet.getValue().value);
- }
- if(facet.getName().equals(XSFacet.FACET_MAXINCLUSIVE)){
- t.maxValue = facet.getValue().value;
- }
- if(facet.getName().equals(XSFacet.FACET_MININCLUSIVE)){
- t.minValue = facet.getValue().value;
- }
- if(facet.getName().equals(XSFacet.FACET_MAXEXCLUSIVE)){
- t.maxValue = String.valueOf(Integer.parseInt(facet.getValue().value) - 1);
- }
- if(facet.getName().equals(XSFacet.FACET_MINEXCLUSIVE)){
- t.minValue = String.valueOf(Integer.parseInt(facet.getValue().value) + 1);
- }
- if(facet.getName().equals(XSFacet.FACET_LENGTH)){
- t.length = facet.getValue().value;
- }
- if(facet.getName().equals(XSFacet.FACET_MAXLENGTH)){
- t.maxLength = facet.getValue().value;
- }
- if(facet.getName().equals(XSFacet.FACET_MINLENGTH)){
- t.minLength = facet.getValue().value;
- }
- if(facet.getName().equals(XSFacet.FACET_PATTERN)){
- t.pattern = facet.getValue().value;
- }
- if(facet.getName().equals(XSFacet.FACET_TOTALDIGITS)){
- t.totalDigits = facet.getValue().value;
- }
- }
- if(enumeration.size() > 0){
- t.enumeration = enumeration.toArray(new String[]{});
- }
- }
- return t;
- }
-}
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-07-09 00:08:35 UTC (rev 3304)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorAdd.java 2011-07-11 03:06:57 UTC (rev 3305)
@@ -24,13 +24,13 @@
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.*;
import static org.teiid.jboss.Configuration.addAttribute;
+import java.util.List;
import java.util.Locale;
import java.util.ResourceBundle;
import java.util.ServiceLoader;
import org.jboss.as.controller.*;
import org.jboss.as.controller.descriptions.DescriptionProvider;
-import org.jboss.as.controller.operations.common.Util;
import org.jboss.dmr.ModelNode;
import org.jboss.dmr.ModelType;
import org.jboss.modules.Module;
@@ -46,7 +46,7 @@
import org.teiid.logging.LogManager;
import org.teiid.translator.ExecutionFactory;
-public class TranslatorAdd implements DescriptionProvider, ModelAddOperationHandler {
+public class TranslatorAdd extends AbstractAddStepHandler implements DescriptionProvider {
@Override
public ModelNode getModelDescription(final Locale locale) {
@@ -58,56 +58,54 @@
addAttribute(operation, Configuration.TRANSLATOR_MODULE, REQUEST_PROPERTIES, bundle.getString(Configuration.TRANSLATOR_MODULE+Configuration.DESC), ModelType.STRING, true, null);
return operation;
}
-
- @Override
- public OperationResult execute(final OperationContext context, final ModelNode operation, final ResultHandler resultHandler) throws OperationFailedException {
+
+ @Override
+ protected void populateModel(final ModelNode operation, final ModelNode model) throws OperationFailedException{
final ModelNode address = operation.require(OP_ADDR);
final PathAddress pathAddress = PathAddress.pathAddress(address);
- final String name = operation.require(Configuration.TRANSLATOR_NAME).asString();
+ final String name = operation.require(Configuration.TRANSLATOR_NAME).asString();
final String moduleName = operation.require(Configuration.TRANSLATOR_MODULE).asString();
- //Apply to the model
- final ModelNode model = context.getSubModel();
model.get(NAME).set(pathAddress.getLastElement().getValue());
model.get(Configuration.TRANSLATOR_NAME).set(name);
model.get(Configuration.TRANSLATOR_MODULE).set(moduleName);
+ }
+
+ @Override
+ protected void performRuntime(final OperationContext context, final ModelNode operation, final ModelNode model,
+ final ServiceVerificationHandler verificationHandler, final List<ServiceController<?>> newControllers) throws OperationFailedException {
- if (context.getRuntimeContext() != null) {
- context.getRuntimeContext().setRuntimeTask(new RuntimeTask() {
- @Override
- public void execute(RuntimeTaskContext context) throws OperationFailedException {
- final ServiceTarget target = context.getServiceTarget();
+ final String name = operation.require(Configuration.TRANSLATOR_NAME).asString();
+ final String moduleName = operation.require(Configuration.TRANSLATOR_MODULE).asString();
+
+ final ServiceTarget target = context.getServiceTarget();
- final ModuleIdentifier moduleId;
- final Module module;
- try {
- moduleId = ModuleIdentifier.create(moduleName);
- module = Module.getCallerModuleLoader().loadModule(moduleId);
- } catch (ModuleLoadException e) {
- throw new OperationFailedException(e, new ModelNode().set("Failed to load module for translator [" + moduleName + "]"));
- }
- final ServiceLoader<ExecutionFactory> serviceLoader = module.loadService(ExecutionFactory.class);
- if (serviceLoader != null) {
- for (ExecutionFactory ef:serviceLoader) {
- VDBTranslatorMetaData metadata = TranslatorUtil.buildTranslatorMetadata(ef, moduleName);
- if (metadata == null) {
- throw new OperationFailedException( new ModelNode().set("Execution Factory is not valid"));
- }
- LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.getString("translator.added", metadata.getName())); //$NON-NLS-1$
-
- TranslatorService translatorService = new TranslatorService(metadata);
- ServiceBuilder<VDBTranslatorMetaData> builder = target.addService(TeiidServiceNames.translatorServiceName(metadata.getName()), translatorService);
- builder.addDependency(TeiidServiceNames.TRANSLATOR_REPO, TranslatorRepository.class, translatorService.repositoryInjector);
- builder.setInitialMode(ServiceController.Mode.ACTIVE).install();
- }
- resultHandler.handleResultComplete();
- }
- }
- });
- } else {
- resultHandler.handleResultComplete();
+ final ModuleIdentifier moduleId;
+ final Module module;
+ try {
+ moduleId = ModuleIdentifier.create(moduleName);
+ module = Module.getCallerModuleLoader().loadModule(moduleId);
+ } catch (ModuleLoadException e) {
+ throw new OperationFailedException(e, new ModelNode().set(IntegrationPlugin.Util.getString("failed_load_module", moduleName, name))); //$NON-NLS-1$
}
- return new BasicOperationResult(Util.getResourceRemoveOperation(address));
- }
+ final ServiceLoader<ExecutionFactory> serviceLoader = module.loadService(ExecutionFactory.class);
+ if (serviceLoader != null) {
+ for (ExecutionFactory ef:serviceLoader) {
+ VDBTranslatorMetaData metadata = TranslatorUtil.buildTranslatorMetadata(ef, moduleName);
+ if (metadata == null) {
+ throw new OperationFailedException( new ModelNode().set(IntegrationPlugin.Util.getString("error_adding_translator", name))); //$NON-NLS-1$
+ }
+
+ if (name.equalsIgnoreCase(metadata.getName())) {
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.getString("translator.added", metadata.getName())); //$NON-NLS-1$
+
+ TranslatorService translatorService = new TranslatorService(metadata);
+ ServiceBuilder<VDBTranslatorMetaData> builder = target.addService(TeiidServiceNames.translatorServiceName(metadata.getName()), translatorService);
+ builder.addDependency(TeiidServiceNames.TRANSLATOR_REPO, TranslatorRepository.class, translatorService.repositoryInjector);
+ builder.setInitialMode(ServiceController.Mode.ACTIVE).install();
+ }
+ }
+ }
+ }
}
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorRemove.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorRemove.java 2011-07-09 00:08:35 UTC (rev 3304)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorRemove.java 2011-07-11 03:06:57 UTC (rev 3305)
@@ -21,54 +21,49 @@
*/
package org.teiid.jboss;
-import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.*;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.DESCRIPTION;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OPERATION_NAME;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.REMOVE;
+import java.util.List;
import java.util.Locale;
import java.util.ResourceBundle;
-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.controller.operations.common.Util;
import org.jboss.dmr.ModelNode;
import org.jboss.msc.service.ServiceController;
import org.jboss.msc.service.ServiceRegistry;
-public class TranslatorRemove implements DescriptionProvider, ModelAddOperationHandler {
+public class TranslatorRemove extends AbstractAddStepHandler implements DescriptionProvider {
@Override
public ModelNode getModelDescription(Locale locale) {
final ResourceBundle bundle = IntegrationPlugin.getResourceBundle(locale);
final ModelNode operation = new ModelNode();
operation.get(OPERATION_NAME).set(REMOVE);
- operation.get(DESCRIPTION).set(bundle.getString("translator.add")); //$NON-NLS-1$
+ operation.get(DESCRIPTION).set(bundle.getString("translator.remove")); //$NON-NLS-1$
return operation;
}
-
+
@Override
- public OperationResult execute(final OperationContext context, final ModelNode operation, final ResultHandler resultHandler) throws OperationFailedException {
- final ModelNode opAddr = operation.require(OP_ADDR);
-
- // Compensating is add
- final ModelNode model = context.getSubModel();
- final String translatorName = model.get(Configuration.TRANSLATOR_NAME).asString();
-
- final ModelNode compensating = Util.getEmptyOperation(ADD, opAddr);
- compensating.get(Configuration.TRANSLATOR_NAME).set(translatorName);
-
- if (context.getRuntimeContext() != null) {
- context.getRuntimeContext().setRuntimeTask(new RuntimeTask() {
- public void execute(final RuntimeTaskContext context) throws OperationFailedException {
- final ServiceRegistry registry = context.getServiceRegistry();
- final ServiceController<?> controller = registry.getService(TeiidServiceNames.translatorServiceName(translatorName));
- if (controller != null) {
- controller.setMode(ServiceController.Mode.REMOVE);
- }
- resultHandler.handleResultComplete();
- }
- });
- } else {
- resultHandler.handleResultComplete();
+ protected void populateModel(final ModelNode operation, final ModelNode model) throws OperationFailedException {
+ final String translatorName = model.require(Configuration.TRANSLATOR_NAME).asString();
+ model.get(Configuration.TRANSLATOR_NAME).set(translatorName);
+ }
+
+ @Override
+ protected void performRuntime(final OperationContext context, final ModelNode operation, final ModelNode model,
+ final ServiceVerificationHandler verificationHandler, final List<ServiceController<?>> newControllers) throws OperationFailedException {
+
+ final String translatorName = model.require(Configuration.TRANSLATOR_NAME).asString();
+ final ServiceRegistry registry = context.getServiceRegistry(true);
+ final ServiceController<?> controller = registry.getService(TeiidServiceNames.translatorServiceName(translatorName));
+ if (controller != null) {
+ controller.setMode(ServiceController.Mode.REMOVE);
}
- return new BasicOperationResult(compensating);
- }
+ }
}
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-07-09 00:08:35 UTC (rev 3304)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2011-07-11 03:06:57 UTC (rev 3305)
@@ -39,8 +39,9 @@
import javax.security.auth.login.LoginException;
import javax.transaction.TransactionManager;
+import org.jboss.as.network.SocketBinding;
import org.jboss.as.security.plugins.SecurityDomainContext;
-import org.jboss.as.server.services.net.SocketBinding;
+import org.jboss.modules.Module;
import org.jboss.msc.service.Service;
import org.jboss.msc.service.StartContext;
import org.jboss.msc.service.StopContext;
@@ -90,6 +91,7 @@
import org.teiid.query.processor.DdlPlan;
import org.teiid.query.tempdata.TempTableStore;
import org.teiid.security.SecurityHelper;
+import org.teiid.services.BufferServiceImpl;
import org.teiid.services.SessionServiceImpl;
import org.teiid.transport.*;
import org.teiid.vdb.runtime.VDBKey;
@@ -111,8 +113,6 @@
private transient VDBRepository vdbRepository;
private transient TranslatorRepository translatorRepository;
- private transient String jndiName;
-
private String eventDistributorName;
private transient EventDistributor eventDistributor;
private long sessionMaxLimit = SessionService.DEFAULT_MAX_SESSIONS;
@@ -124,6 +124,7 @@
public final InjectedValue<TransactionManager> txnManagerInjector = new InjectedValue<TransactionManager>();
public final InjectedValue<Executor> threadPoolInjector = new InjectedValue<Executor>();
public final InjectedValue<SocketBinding> jdbcSocketBindingInjector = new InjectedValue<SocketBinding>();
+ public final InjectedValue<BufferServiceImpl> bufferServiceInjector = new InjectedValue<BufferServiceImpl>();
public final InjectedValue<SocketBinding> odbcSocketBindingInjector = new InjectedValue<SocketBinding>();
public final ConcurrentMap<String, SecurityDomainContext> securityDomains = new ConcurrentHashMap<String, SecurityDomainContext>();
private LinkedList<String> securityDomainNames = new LinkedList<String>();
@@ -151,22 +152,30 @@
setXATerminator(xaTerminatorInjector.getValue());
setTransactionManager(txnManagerInjector.getValue());
- this.sessionService = new SessionServiceImpl(this.securityDomainNames, this.securityDomains);
+ this.sessionService = new SessionServiceImpl();
+ if (!this.securityDomainNames.isEmpty()) {
+ this.sessionService.setSecurityDomains(this.securityDomainNames, this.securityDomains);
+ }
this.sessionService.setSessionExpirationTimeLimit(this.sessionExpirationTimeLimit);
this.sessionService.setSessionMaxLimit(this.sessionMaxLimit);
this.sessionService.setDqp(this.dqpCore);
this.sessionService.setVDBRepository(this.vdbRepository);
this.sessionService.start();
+ this.setBufferService(bufferServiceInjector.getValue());
- this.jdbcSocketConfiguration.setHostAddress(this.jdbcSocketBindingInjector.getValue().getAddress());
- this.jdbcSocketConfiguration.setPortNumber(this.jdbcSocketBindingInjector.getValue().getPort());
- this.odbcSocketConfiguration.setHostAddress(this.odbcSocketBindingInjector.getValue().getAddress());
- this.odbcSocketConfiguration.setPortNumber(this.odbcSocketBindingInjector.getValue().getPort());
+ if (this.jdbcSocketConfiguration != null) {
+ this.jdbcSocketConfiguration.setHostAddress(this.jdbcSocketBindingInjector.getValue().getAddress());
+ this.jdbcSocketConfiguration.setPortNumber(this.jdbcSocketBindingInjector.getValue().getPort());
+ }
+ if (this.odbcSocketConfiguration != null) {
+ this.odbcSocketConfiguration.setHostAddress(this.odbcSocketBindingInjector.getValue().getAddress());
+ this.odbcSocketConfiguration.setPortNumber(this.odbcSocketBindingInjector.getValue().getPort());
+ }
+
+ dqpCore.setTransactionService((TransactionService)LogManager.createLoggingProxy(LogConstants.CTX_TXN_LOG, transactionServerImpl, new Class[] {TransactionService.class}, MessageLevel.DETAIL, Module.getCallerModule().getClassLoader()));
- dqpCore.setTransactionService((TransactionService)LogManager.createLoggingProxy(LogConstants.CTX_TXN_LOG, transactionServerImpl, new Class[] {TransactionService.class}, MessageLevel.DETAIL));
-
if (this.eventDistributorName != null) {
try {
InitialContext ic = new InitialContext();
@@ -204,14 +213,14 @@
jdbcCsr.registerClientService(ILogon.class, logon, LogConstants.CTX_SECURITY);
jdbcCsr.registerClientService(DQP.class, dqpProxy, LogConstants.CTX_DQP);
- if (this.jdbcSocketConfiguration.getEnabled()) {
+ if (this.jdbcSocketConfiguration != null) {
this.jdbcSocket = new SocketListener(this.jdbcSocketConfiguration, jdbcCsr, this.dqpCore.getBufferManager(), offset);
LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.getString("socket_enabled","Teiid JDBC = ",(this.jdbcSocketConfiguration.getSSLConfiguration().isSslEnabled()?"mms://":"mm://")+this.jdbcSocketConfiguration.getHostAddress().getHostName()+":"+(this.jdbcSocketConfiguration.getPortNumber()+offset))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
} else {
LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.getString("socket_not_enabled", "jdbc connections")); //$NON-NLS-1$ //$NON-NLS-2$
}
- if (this.odbcSocketConfiguration.getEnabled()) {
+ if (this.odbcSocketConfiguration != null) {
this.vdbRepository.odbcEnabled();
this.odbcSocket = new ODBCSocketListener(this.odbcSocketConfiguration, this.dqpCore.getBufferManager(), offset, getMaxODBCLobSizeAllowed());
LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.getString("odbc_enabled","Teiid ODBC - SSL=", (this.odbcSocketConfiguration.getSSLConfiguration().isSslEnabled()?"ON":"OFF")+" Host = "+this.odbcSocketConfiguration.getHostAddress().getHostName()+" Port = "+(this.odbcSocketConfiguration.getPortNumber()+offset))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
@@ -220,17 +229,7 @@
}
LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.getString("engine_started", getRuntimeVersion(), new Date(System.currentTimeMillis()).toString())); //$NON-NLS-1$
- if (jndiName != null) {
- final InitialContext ic ;
- try {
- ic = new InitialContext() ;
- Util.bind(ic, jndiName, this) ;
- } catch (final NamingException ne) {
- // Add jndi_failed to bundle
- LogManager.logError(LogConstants.CTX_RUNTIME, ne, IntegrationPlugin.Util.getString("jndi_failed", new Date(System.currentTimeMillis()).toString())); //$NON-NLS-1$
- }
- }
-
+
// add vdb life cycle listeners
this.vdbRepository.addListener(new VDBLifeCycleListener() {
@@ -272,15 +271,6 @@
@Override
public void stop(StopContext context) {
- if (jndiName != null) {
- final InitialContext ic ;
- try {
- ic = new InitialContext() ;
- Util.unbind(ic, jndiName) ;
- } catch (final NamingException ne) {
- }
- }
-
try {
this.dqpCore.stop();
} catch(TeiidRuntimeException e) {
@@ -361,10 +351,6 @@
this.vdbRepository = repo;
}
- public void setJndiName(final String jndiName) {
- this.jndiName = jndiName ;
- }
-
@Override
public List<RequestMetadata> getRequestsForSession(String sessionId) {
return this.dqpCore.getRequestsForSession(sessionId);
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-07-09 00:08:35 UTC (rev 3304)
+++ branches/as7/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties 2011-07-11 03:06:57 UTC (rev 3305)
@@ -46,6 +46,10 @@
distribute_failed=Deploy of the archive failed {0}
template_not_found=Template not found for {0}
admin_executing=JOPR admin {0} is executing command {1}
+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}
+translator.add=Add Translator
+translator.remove=Remove Translator
DQPCore.unable_to_process_event=Unable to process event.
translator.added = Teiid translator "{0}" added.
@@ -81,11 +85,11 @@
maxODBCLobSizeAllowed.describe=Maximum size of lob allowed through ODBC connection in bytes (default 5MB)
eventDistributorName.describe=The JNDI name of the Teiid Event Distributor
detectingChangeEvents.describe=Set to true for the engine to detect local change events. Should be disabled if using external change data capture tools. (default true)
-jdbc-security-domain.describe=Comma separated list of domains to be used to login into Teiid using JDBC connection
+security-domain.describe=Comma separated list of domains to be used to login into Teiid
admin-security-domain.describe=security domain to be used with Admin API (please do not change this, as this should be same as profile service)
max-sessions-allowed.describe=Maximum number of sessions allowed by the system (default 5000)
sessions-expiration-timelimit.describe=Max allowed time before the session is terminated by the system, 0 indicates unlimited (default 0)
-allow-env-function=Allow the execution of ENV function. (default false)
+allow-env-function.describe=Allow the execution of ENV function. (default false)
#buffer-manager
useDisk.describe=Use disk for buffer management
@@ -179,3 +183,5 @@
RuntimeEngineDeployer.execute-query.vdb-version.describe=vdb version
RuntimeEngineDeployer.execute-query.sql-query.describe=sql query to execute
RuntimeEngineDeployer.execute-query.timeout-in-milli.describe=timeout
+
+socket-binding.not_defined=Teiid socket binding not defined for JDBC or ODBC port.
Modified: branches/as7/jboss-integration/src/main/resources/schema/jboss-teiid.xsd
===================================================================
--- branches/as7/jboss-integration/src/main/resources/schema/jboss-teiid.xsd 2011-07-09 00:08:35 UTC (rev 3304)
+++ branches/as7/jboss-integration/src/main/resources/schema/jboss-teiid.xsd 2011-07-11 03:06:57 UTC (rev 3305)
@@ -47,11 +47,6 @@
<xs:documentation>Use disk for buffer management</xs:documentation>
</xs:annotation>
</xs:element>
- <xs:element name="diskDirectory" type="xs:string" minOccurs="0" maxOccurs="1">
- <xs:annotation>
- <xs:documentation>Directory location for the buffer files</xs:documentation>
- </xs:annotation>
- </xs:element>
<xs:element name="processorBatchSize" type="xs:int" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation>The max row count of a batch sent internally within the query processor. Should be <= the connectorBatchSize. (default 512)</xs:documentation>
@@ -103,7 +98,6 @@
</xs:annotation>
</xs:element>
</xs:sequence>
- <xs:attribute name="enabled" type="xs:boolean" />
</xs:complexType>
<xs:complexType name="cache-config">
<xs:sequence>
@@ -139,7 +133,6 @@
</xs:annotation>
</xs:element>
</xs:sequence>
- <xs:attribute name="enabled" type="xs:boolean" default="true"/>
</xs:complexType>
<xs:complexType name="runtime-engine-type">
<xs:sequence>
@@ -226,16 +219,11 @@
<xs:documentation>Set to true for the engine to detect local change events. Should be disabled if using external change data capture tools. (default true)</xs:documentation>
</xs:annotation>
</xs:element>
- <xs:element name="jdbc-security-domain" type="xs:string" minOccurs="0" maxOccurs="1">
+ <xs:element name="security-domain" type="xs:string" minOccurs="0" maxOccurs="1">
<xs:annotation>
- <xs:documentation>Comma separated list of domains to be used to login into Teiid using JDBC connection</xs:documentation>
+ <xs:documentation>Comma separated list of domains to be used to login into Teiid</xs:documentation>
</xs:annotation>
</xs:element>
- <xs:element name="admin-security-domain" type="xs:string" minOccurs="0" maxOccurs="1">
- <xs:annotation>
- <xs:documentation>Security domain to be used with Admin API</xs:documentation>
- </xs:annotation>
- </xs:element>
<xs:element name="max-sessions-allowed" type="xs:int" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation>Maximum number of sessions allowed by the system (default 5000)</xs:documentation>
@@ -289,7 +277,6 @@
</xs:annotation>
</xs:element>
</xs:sequence>
- <xs:attribute name="jndi-name" type="xs:string" />
</xs:complexType>
<xs:complexType name="socket-config">
@@ -322,7 +309,6 @@
</xs:annotation>
</xs:element>
</xs:sequence>
- <xs:attribute name="enabled" type="xs:boolean" default="true"/>
</xs:complexType>
<xs:complexType name="ssl-config">
Modified: branches/as7/jboss-integration/src/test/java/org/teiid/adminapi/jboss/TestAdminObjectBuilder.java
===================================================================
--- branches/as7/jboss-integration/src/test/java/org/teiid/adminapi/jboss/TestAdminObjectBuilder.java 2011-07-09 00:08:35 UTC (rev 3304)
+++ branches/as7/jboss-integration/src/test/java/org/teiid/adminapi/jboss/TestAdminObjectBuilder.java 2011-07-11 03:06:57 UTC (rev 3305)
@@ -21,27 +21,18 @@
*/
package org.teiid.adminapi.jboss;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
-import org.jboss.managed.api.ManagedObject;
-import org.jboss.managed.api.factory.ManagedObjectFactory;
-import org.jboss.managed.plugins.factory.ManagedObjectFactoryBuilder;
+import org.jboss.dmr.ModelNode;
import org.junit.Test;
import org.teiid.adminapi.DataPolicy;
import org.teiid.adminapi.Model;
import org.teiid.adminapi.Translator;
-import org.teiid.adminapi.impl.DataPolicyMetadata;
-import org.teiid.adminapi.impl.ModelMetaData;
-import org.teiid.adminapi.impl.TranslatorMetaData;
-import org.teiid.adminapi.impl.VDBMetaData;
+import org.teiid.adminapi.impl.*;
import org.teiid.adminapi.impl.DataPolicyMetadata.PermissionMetaData;
import org.teiid.translator.ExecutionFactory;
@@ -78,7 +69,7 @@
vdb.addModel(modelTwo);
- TranslatorMetaData t1 = new TranslatorMetaData();
+ VDBTranslatorMetaData t1 = new VDBTranslatorMetaData();
t1.setName("oracleOverride");
t1.setType("oracle");
t1.addProperty("my-property", "my-value");
@@ -106,9 +97,8 @@
vdb.addDataPolicy(roleOne);
// convert to managed object and build the VDB out of MO
- ManagedObjectFactory mof = ManagedObjectFactoryBuilder.create();
- ManagedObject mo = mof.initManagedObject(vdb, null, null);
- vdb = AdminObjectBuilder.buildAO(mo, VDBMetaData.class);
+ ModelNode node = MetadataMapper.wrap(vdb, new ModelNode());
+ vdb = MetadataMapper.unwrap(node);
assertEquals("myVDB", vdb.getName());
assertEquals("vdb description", vdb.getDescription());
@@ -172,19 +162,18 @@
@Test
public void testTranslator() {
- TranslatorMetaData tm = new TranslatorMetaData();
+ VDBTranslatorMetaData tm = new VDBTranslatorMetaData();
tm.setExecutionFactoryClass(ExecutionFactory.class);
tm.setName("Oracle");
tm.addProperty("ExtensionTranslationClassName", "org.teiid.translator.jdbc.oracle.OracleSQLTranslator");
// convert to managed object and build the VDB out of MO
- ManagedObjectFactory mof = ManagedObjectFactoryBuilder.create();
- ManagedObject mo = mof.initManagedObject(tm, null, null);
- tm = AdminObjectBuilder.buildAO(mo, TranslatorMetaData.class);
+ ModelNode node = MetadataMapper.VDBTranslatorMetaDataMapper.wrap(tm, new ModelNode());
+ VDBTranslatorMetaData tm1 = MetadataMapper.VDBTranslatorMetaDataMapper.unwrap(node);
- assertEquals("Oracle", tm.getName());
- assertEquals(ExecutionFactory.class.getName(), tm.getPropertyValue(Translator.EXECUTION_FACTORY_CLASS));
- assertEquals("org.teiid.translator.jdbc.oracle.OracleSQLTranslator", tm.getPropertyValue("ExtensionTranslationClassName"));
+ assertEquals("Oracle", tm1.getName());
+ assertEquals(ExecutionFactory.class.getName(), tm1.getPropertyValue(Translator.EXECUTION_FACTORY_CLASS));
+ assertEquals("org.teiid.translator.jdbc.oracle.OracleSQLTranslator", tm1.getPropertyValue("ExtensionTranslationClassName"));
}
}
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-07-09 00:08:35 UTC (rev 3304)
+++ branches/as7/jboss-integration/src/test/java/org/teiid/jboss/TestTeiidConfiguration.java 2011-07-11 03:06:57 UTC (rev 3305)
@@ -27,9 +27,9 @@
import java.io.*;
import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Locale;
+import java.util.*;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLInputFactory;
@@ -44,19 +44,22 @@
import junit.framework.Assert;
import org.jboss.as.controller.*;
-import org.jboss.as.controller.client.OperationBuilder;
import org.jboss.as.controller.descriptions.DescriptionProvider;
import org.jboss.as.controller.descriptions.common.CommonProviders;
+import org.jboss.as.controller.operations.common.Util;
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.SubsystemMarshallingContext;
-import org.jboss.as.controller.registry.ModelNodeRegistration;
+import org.jboss.as.controller.registry.ManagementResourceRegistration;
+import org.jboss.as.controller.registry.Resource;
import org.jboss.dmr.ModelNode;
import org.jboss.dmr.ModelType;
import org.jboss.dmr.Property;
+import org.jboss.msc.service.*;
import org.jboss.staxmapper.XMLElementWriter;
import org.jboss.staxmapper.XMLMapper;
+import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.teiid.core.util.ObjectConverterUtil;
@@ -66,6 +69,12 @@
@SuppressWarnings("nls")
public class TestTeiidConfiguration {
+ static final DescriptionProvider NULL_PROVIDER = new DescriptionProvider() {
+ @Override
+ public ModelNode getModelDescription(final Locale locale) {
+ return new ModelNode();
+ }
+ };
static ModelNode profileAddress = new ModelNode();
static {
profileAddress.add("profile", "test");
@@ -109,7 +118,7 @@
assertEquals(1, updates.size());
for (ModelNode update : updates) {
try {
- controller.executeForResult(update);
+ executeForResult(update);
} catch (OperationFailedException e) {
throw new RuntimeException(e.getFailureDescription().toString());
}
@@ -121,38 +130,59 @@
assertEquals("true", bufferService.require("useDisk").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\">" +
+ " </query-engine>" +
+ "</subsystem>");
+ assertEquals(1, updates.size());
+ for (ModelNode update : updates) {
+ try {
+ executeForResult(update);
+ } catch (OperationFailedException e) {
+ throw new RuntimeException(e.getFailureDescription().toString());
+ }
+ }
+
+ ModelNode subsystem = model.require("profile").require("test").require("subsystem").require("teiid");
+ }
+
private ModelNode model;
- private TestController controller;
+
+ private ServiceContainer container;
+ private ModelController controller;
+
@Before
- public void setup() throws Exception {
- model = new ModelNode();
- controller = new TestController();
- model.get("profile", "test", "subsystem");
+ public void setupController() throws InterruptedException {
+ container = ServiceContainer.Factory.create("test");
+ ServiceTarget target = container.subTarget();
+ ControlledProcessState processState = new ControlledProcessState(true);
+ ModelControllerService svc = new ModelControllerService(container, processState);
+ ServiceBuilder<ModelController> builder = target.addService(ServiceName.of("ModelController"), svc);
+ builder.install();
+ svc.latch.await();
+ controller = svc.getValue();
+ ModelNode setup = Util.getEmptyOperation("setup", new ModelNode());
+ controller.execute(setup, null, null, null);
+ processState.setRunning();
+ }
- final ModelNodeRegistration testProfileRegistration = controller.getRegistry().registerSubModel(PathElement.pathElement("profile", "*"), new DescriptionProvider() {
-
- @Override
- public ModelNode getModelDescription(Locale locale) {
- ModelNode node = new ModelNode();
- node.get(DESCRIPTION).set("A named set of subsystem configs");
- node.get(ATTRIBUTES, NAME, TYPE).set(ModelType.STRING);
- node.get(ATTRIBUTES, NAME, DESCRIPTION).set("The name of the profile");
- node.get(ATTRIBUTES, NAME, REQUIRED).set(true);
- node.get(ATTRIBUTES, NAME, MIN_LENGTH).set(1);
- node.get(CHILDREN, SUBSYSTEM, DESCRIPTION).set("The subsystems that make up the profile");
- node.get(CHILDREN, SUBSYSTEM, MIN_OCCURS).set(1);
- node.get(CHILDREN, SUBSYSTEM, MODEL_DESCRIPTION);
- return node;
+ @After
+ public void shutdownServiceContainer() {
+ if (container != null) {
+ container.shutdown();
+ try {
+ container.awaitTermination(5, TimeUnit.SECONDS);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
}
- });
-
- TestNewExtensionContext context = new TestNewExtensionContext(testProfileRegistration);
- TeiidExtension extension = new TeiidExtension();
- extension.initialize(context);
- Assert.assertNotNull(context.createdRegistration);
-
- }
+ finally {
+ container = null;
+ }
+ }
+ }
static List<ModelNode> createSubSystem(String xmlContent) throws XMLStreamException {
@@ -179,10 +209,10 @@
}
static class TestNewExtensionContext implements ExtensionContext {
- final ModelNodeRegistration testProfileRegistration;
- ModelNodeRegistration createdRegistration;
+ final ManagementResourceRegistration testProfileRegistration;
+ ManagementResourceRegistration createdRegistration;
- TestNewExtensionContext(ModelNodeRegistration testProfileRegistration) {
+ TestNewExtensionContext(ManagementResourceRegistration testProfileRegistration) {
this.testProfileRegistration = testProfileRegistration;
}
@@ -190,7 +220,7 @@
public SubsystemRegistration registerSubsystem(final String name) throws IllegalArgumentException {
return new SubsystemRegistration() {
@Override
- public ModelNodeRegistration registerSubsystemModel(final DescriptionProvider descriptionProvider) {
+ public ManagementResourceRegistration registerSubsystemModel(final DescriptionProvider descriptionProvider) {
if (descriptionProvider == null) {
throw new IllegalArgumentException("descriptionProvider is null");
}
@@ -200,7 +230,7 @@
}
@Override
- public ModelNodeRegistration registerDeploymentModel(final DescriptionProvider descriptionProvider) {
+ public ManagementResourceRegistration registerDeploymentModel(final DescriptionProvider descriptionProvider) {
throw new IllegalStateException("Not implemented");
}
@@ -212,69 +242,134 @@
}
}
- class TestController extends BasicModelController {
+ private static final DescriptionProvider profileDescriptionProvider = new DescriptionProvider() {
- protected TestController() {
- super(model, new ConfigurationPersister() {
+ @Override
+ public ModelNode getModelDescription(Locale locale) {
+ ModelNode node = new ModelNode();
+ node.get(DESCRIPTION).set("A named set of subsystem configs");
+ node.get(ATTRIBUTES, NAME, TYPE).set(ModelType.STRING);
+ node.get(ATTRIBUTES, NAME, DESCRIPTION).set("The name of the profile");
+ node.get(ATTRIBUTES, NAME, REQUIRED).set(true);
+ node.get(ATTRIBUTES, NAME, MIN_LENGTH).set(1);
+ node.get(CHILDREN, SUBSYSTEM, DESCRIPTION).set("The subsystems that make up the profile");
+ node.get(CHILDREN, SUBSYSTEM, MIN_OCCURS).set(1);
+ node.get(CHILDREN, SUBSYSTEM, MODEL_DESCRIPTION);
+ return node;
+ }
+ };
+
+ public class ModelControllerService extends AbstractControllerService {
+
+ private final CountDownLatch latch = new CountDownLatch(1);
+
+ ModelControllerService(final ServiceContainer serviceContainer, final ControlledProcessState processState) {
+ super(OperationContext.Type.SERVER, new TestConfigurationPersister(), processState, NULL_PROVIDER, null);
+ }
+
+ @Override
+ public void start(StartContext context) throws StartException {
+ super.start(context);
+ latch.countDown();
+ }
+
+ protected void finishBoot() throws ConfigurationPersistenceException {
+// controller.finshBoot();
+// configurationPersister.successfulBoot();
+ }
+
+ protected void initModel(Resource rootResource, ManagementResourceRegistration rootRegistration) {
+ rootRegistration.registerOperationHandler(READ_RESOURCE_OPERATION, GlobalOperationHandlers.READ_RESOURCE, CommonProviders.READ_RESOURCE_PROVIDER, true);
+ rootRegistration.registerOperationHandler(READ_ATTRIBUTE_OPERATION, GlobalOperationHandlers.READ_ATTRIBUTE, CommonProviders.READ_ATTRIBUTE_PROVIDER, true);
+ rootRegistration.registerOperationHandler(READ_RESOURCE_DESCRIPTION_OPERATION, GlobalOperationHandlers.READ_RESOURCE_DESCRIPTION, CommonProviders.READ_RESOURCE_DESCRIPTION_PROVIDER, true);
+ rootRegistration.registerOperationHandler(READ_CHILDREN_NAMES_OPERATION, GlobalOperationHandlers.READ_CHILDREN_NAMES, CommonProviders.READ_CHILDREN_NAMES_PROVIDER, true);
+ rootRegistration.registerOperationHandler(READ_CHILDREN_TYPES_OPERATION, GlobalOperationHandlers.READ_CHILDREN_TYPES, CommonProviders.READ_CHILDREN_TYPES_PROVIDER, true);
+ rootRegistration.registerOperationHandler(READ_CHILDREN_RESOURCES_OPERATION, GlobalOperationHandlers.READ_CHILDREN_RESOURCES, CommonProviders.READ_CHILDREN_RESOURCES_PROVIDER, true);
+ rootRegistration.registerOperationHandler(READ_OPERATION_NAMES_OPERATION, GlobalOperationHandlers.READ_OPERATION_NAMES, CommonProviders.READ_OPERATION_NAMES_PROVIDER, true);
+ rootRegistration.registerOperationHandler(READ_OPERATION_DESCRIPTION_OPERATION, GlobalOperationHandlers.READ_OPERATION_DESCRIPTION, CommonProviders.READ_OPERATION_PROVIDER, true);
+ rootRegistration.registerOperationHandler(WRITE_ATTRIBUTE_OPERATION, GlobalOperationHandlers.WRITE_ATTRIBUTE, CommonProviders.WRITE_ATTRIBUTE_PROVIDER, true);
+
+ rootRegistration.registerOperationHandler("setup", new OperationStepHandler() {
@Override
- public void store(ModelNode model) throws ConfigurationPersistenceException {
+ public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
+ context.createResource(PathAddress.EMPTY_ADDRESS.append(PathElement.pathElement("profile", "test")));
+ context.completeStep();
}
+ }, new DescriptionProvider() {
@Override
- public void marshallAsXml(ModelNode model, OutputStream output) throws ConfigurationPersistenceException {
+ public ModelNode getModelDescription(Locale locale) {
+ return new ModelNode();
}
+ });
+
+ ManagementResourceRegistration profileRegistration = rootRegistration.registerSubModel(PathElement.pathElement("profile"), profileDescriptionProvider);
+ TestNewExtensionContext context = new TestNewExtensionContext(profileRegistration);
+ TeiidExtension extension = new TeiidExtension();
+ extension.initialize(context);
+ Assert.assertNotNull(context.createdRegistration);
+ }
+
+ }
+
+ private class TestConfigurationPersister implements ConfigurationPersister{
+
+ @Override
+ public PersistenceResource store(final ModelNode model, Set<PathAddress> affectedAddresses) throws ConfigurationPersistenceException {
+ return new PersistenceResource() {
@Override
- public List<ModelNode> load() throws ConfigurationPersistenceException {
- return null;
+ public void commit() {
+ TestTeiidConfiguration.this.model = model;
}
+
@Override
- public void successfulBoot() throws ConfigurationPersistenceException {
+ public void rollback() {
}
- @Override
- public String snapshot() {
- return null;
- }
- @Override
- public SnapshotInfo listSnapshots() {
- return NULL_SNAPSHOT_INFO;
- }
- @Override
- public void deleteSnapshot(String name) {
- }
- }, new DescriptionProvider() {
- @Override
- public ModelNode getModelDescription(Locale locale) {
- ModelNode node = new ModelNode();
- node.get(DESCRIPTION).set("The root node of the test management API");
- node.get(CHILDREN, PROFILE, DESCRIPTION).set("A list of profiles");
- node.get(CHILDREN, PROFILE, MIN_OCCURS).set(1);
- node.get(CHILDREN, PROFILE, MODEL_DESCRIPTION);
- return node;
- }
- });
+ };
+ }
- getRegistry().registerOperationHandler(READ_RESOURCE_DESCRIPTION_OPERATION, GlobalOperationHandlers.READ_RESOURCE_DESCRIPTION, CommonProviders.READ_RESOURCE_DESCRIPTION_PROVIDER, true);
+ @Override
+ public void marshallAsXml(ModelNode model, OutputStream output) throws ConfigurationPersistenceException {
}
@Override
- protected ModelNodeRegistration getRegistry() {
- return super.getRegistry();
+ public List<ModelNode> load() throws ConfigurationPersistenceException {
+ return Collections.emptyList();
}
- /**
- * Override to get the actual result from the response.
- */
- public ModelNode executeForResult(ModelNode operation) throws OperationFailedException {
- ModelNode rsp = super.execute(OperationBuilder.Factory.create(operation).build());
- if (FAILED.equals(rsp.get(OUTCOME).asString())) {
- throw new OperationFailedException(rsp.get(FAILURE_DESCRIPTION));
- }
- return rsp.get(RESULT);
+ @Override
+ public void successfulBoot() throws ConfigurationPersistenceException {
}
+
+ @Override
+ public String snapshot() {
+ return null;
+ }
+
+ @Override
+ public SnapshotInfo listSnapshots() {
+ return NULL_SNAPSHOT_INFO;
+ }
+
+ @Override
+ public void deleteSnapshot(String name) {
+ }
}
+
+ /**
+ * Override to get the actual result from the response.
+ */
+ public ModelNode executeForResult(ModelNode operation) throws OperationFailedException {
+ ModelNode rsp = controller.execute(operation, null, null, null);
+ if (FAILED.equals(rsp.get(OUTCOME).asString())) {
+ throw new OperationFailedException(rsp.get(FAILURE_DESCRIPTION));
+ }
+ return rsp.get(RESULT);
+ }
@Test
public void testSubSystemDescription() throws IOException {
- QueryEngineDescription tsd = new QueryEngineDescription();
- assertEquals(ObjectConverterUtil.convertToString(new FileReader("src/test/resources/teiid-model-config.txt")), tsd.getModelDescription(null).toString());
+ ModelNode node = new ModelNode();
+ QueryEngineDescription.getQueryEngineDescription(node, ATTRIBUTES, IntegrationPlugin.getResourceBundle(null));
+ assertEquals(ObjectConverterUtil.convertToString(new FileReader("src/test/resources/teiid-model-config.txt")), node.toString());
}
}
Modified: branches/as7/jboss-integration/src/test/resources/teiid-model-config.txt
===================================================================
--- branches/as7/jboss-integration/src/test/resources/teiid-model-config.txt 2011-07-09 00:08:35 UTC (rev 3304)
+++ branches/as7/jboss-integration/src/test/resources/teiid-model-config.txt 2011-07-11 03:06:57 UTC (rev 3305)
@@ -1,678 +1,550 @@
{
- "description" => "teiid subsystem",
- "head-comment-allowed" => true,
- "tail-comment-allowed" => true,
- "namespace" => "urn:jboss:domain:teiid:1.0",
- "children" => {"query-engine" => {
- "attributes" => {
- "jndi-name" => {
- "type" => STRING,
- "description" => "JNDI name of the Teiid Query Engine",
- "required" => true,
- "max-occurs" => 1,
- "default" => "teiid/engine-deployer"
- },
- "maxThreads" => {
- "type" => INT,
- "description" => "Process pool maximum thread count. (default 64)",
- "required" => false,
- "max-occurs" => 1,
- "default" => 64
- },
- "maxActivePlans" => {
- "type" => INT,
- "description" => "Max active plans (default 20). Increase this value on highly concurrent systems - but ensure that the underlying pools can handle the increased load without timeouts.",
- "required" => false,
- "max-occurs" => 1,
- "default" => 20
- },
- "userRequestSourceConcurrency" => {
- "type" => INT,
- "description" => "Max source query concurrency per user request (default 0). 0 indicates use the default calculated value based on max active plans and max threads - approximately 2*(max threads)/(max active plans). ",
- "required" => false,
- "max-occurs" => 1,
- "default" => 0
- },
- "timeSliceInMilli" => {
- "type" => INT,
- "description" => "Query processor time slice, in milliseconds. (default 2000)",
- "required" => false,
- "max-occurs" => 1,
- "default" => 2000
- },
- "maxRowsFetchSize" => {
- "type" => INT,
- "description" => "Maximum allowed fetch size, set via JDBC. User requested value ignored above this value. (default 20480)",
- "required" => false,
- "max-occurs" => 1,
- "default" => 20480
- },
- "lobChunkSizeInKB" => {
- "type" => INT,
- "description" => "The max lob chunk size in KB transferred each time when processing blobs, clobs (100KB default)",
- "required" => false,
- "max-occurs" => 1,
- "default" => 100
- },
- "useDataRoles" => {
- "type" => BOOLEAN,
- "description" => "Turn on role checking based upon the data roles defined in VDBs. (default true)",
- "required" => false,
- "max-occurs" => 1,
- "default" => true
- },
- "allowCreateTemporaryTablesByDefault" => {
- "type" => BOOLEAN,
- "description" => "Sets whether temporary table usage is allowed by default with data roles enabled. If false, the user must have a role that grants creates temporary table rights to use temporary tables. (default true)",
- "required" => false,
- "max-occurs" => 1,
- "default" => true
- },
- "allowFunctionCallsByDefault" => {
- "type" => BOOLEAN,
- "description" => "Sets whether functions may be called by default with data roles enabled. If false, a specific permission must exist to call the function. (default true)",
- "required" => false,
- "max-occurs" => 1,
- "default" => true
- },
- "queryThresholdInSecs" => {
- "type" => INT,
- "description" => "Long running query threshold, after which a alert can be generated by tooling if configured",
- "required" => false,
- "max-occurs" => 1,
- "default" => 600
- },
- "maxSourceRows" => {
- "type" => INT,
- "description" => "Maximum rows allowed from a source query. -1 indicates no limit. (default -1)",
- "required" => false,
- "max-occurs" => 1,
- "default" => -1
- },
- "exceptionOnMaxSourceRows" => {
- "type" => BOOLEAN,
- "description" => "Indicates if an exception should be thrown if the specified value for Maximum Source Rows is exceeded; only up to the maximum rows will be consumed. (default true)",
- "required" => false,
- "max-occurs" => 1,
- "default" => true
- },
- "maxODBCLobSizeAllowed" => {
- "type" => INT,
- "description" => "Maximum size of lob allowed through ODBC connection in bytes (default 5MB)",
- "required" => false,
- "max-occurs" => 1,
- "default" => 5242880
- },
- "eventDistributorName" => {
- "type" => STRING,
- "description" => "The JNDI name of the Teiid Event Distributor",
- "required" => false,
- "max-occurs" => 1,
- "default" => "teiid/event-distributor"
- },
- "detectingChangeEvents" => {
- "type" => BOOLEAN,
- "description" => "Set to true for the engine to detect local change events. Should be disabled if using external change data capture tools. (default true)",
- "required" => false,
- "max-occurs" => 1,
- "default" => true
- },
- "jdbc-security-domain" => {
- "type" => STRING,
- "description" => "Comma separated list of domains to be used to login into Teiid using JDBC connection",
- "required" => false,
- "max-occurs" => 1
- },
- "admin-security-domain" => {
- "type" => STRING,
- "description" => "security domain to be used with Admin API (please do not change this, as this should be same as profile service)",
- "required" => false,
- "max-occurs" => 1
- },
- "max-sessions-allowed" => {
- "type" => INT,
- "description" => "Maximum number of sessions allowed by the system (default 5000)",
- "required" => false,
- "max-occurs" => 1,
- "default" => 5000
- },
- "sessions-expiration-timelimit" => {
- "type" => INT,
- "description" => "Max allowed time before the session is terminated by the system, 0 indicates unlimited (default 0)",
- "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
- }
+ "attributes" => {
+ "jndi-name" => {
+ "type" => STRING,
+ "description" => "JNDI name of the Teiid Query Engine",
+ "required" => true,
+ "max-occurs" => 1,
+ "default" => "teiid/engine-deployer"
},
- "children" => {
- "buffer-service" => {
- "type" => OBJECT,
- "description" => "Buffer Manager Configuration",
- "required" => false,
- "max-occurs" => 1,
- "min-occurs" => 1,
- "attributes" => {
- "useDisk" => {
- "type" => BOOLEAN,
- "description" => "Use disk for buffer management",
- "required" => false,
- "max-occurs" => 1,
- "default" => true
- },
- "diskDirectory" => {
- "type" => STRING,
- "description" => "Directory location for the buffer files",
- "required" => true,
- "max-occurs" => 1
- },
- "processorBatchSize" => {
- "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
- },
- "connectorBatchSize" => {
- "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
- },
- "maxReserveBatchColumns" => {
- "type" => INT,
- "description" => "The number of batch columns to allow in buffer memory. -1 means to automatically calculate a value (default -1). See the admin guide for more.",
- "required" => false,
- "max-occurs" => 1,
- "default" => -1
- },
- "maxProcessingBatchesColumns" => {
- "type" => INT,
- "description" => "The number of batch columns guaranteed to a processing operation. -1 means to automatically calculate a value (default -1). See the admin guide for more.",
- "required" => false,
- "max-occurs" => 1,
- "default" => -1
- },
- "maxFileSize" => {
- "type" => INT,
- "description" => "Max File size in MB (default 2GB)",
- "required" => false,
- "max-occurs" => 1,
- "default" => 2048
- },
- "maxBufferSpace" => {
- "type" => INT,
- "description" => "Max storage space, in MB, to be used for buffer files (default 50G)",
- "required" => false,
- "max-occurs" => 1,
- "default" => 51200
- },
- "maxOpenFiles" => {
- "type" => INT,
- "description" => "Max open buffer files (default 64)",
- "required" => false,
- "max-occurs" => 1,
- "default" => 64
- }
+ "thread-group-async" => {
+ "type" => STRING,
+ "description" => "Thread Pool to be used with Asynchronous operations in Teiid",
+ "required" => false,
+ "max-occurs" => 1,
+ "default" => "teiid-async"
+ },
+ "maxThreads" => {
+ "type" => INT,
+ "description" => "Process pool maximum thread count. (default 64)",
+ "required" => false,
+ "max-occurs" => 1,
+ "default" => 64
+ },
+ "maxActivePlans" => {
+ "type" => INT,
+ "description" => "Max active plans (default 20). Increase this value on highly concurrent systems - but ensure that the underlying pools can handle the increased load without timeouts.",
+ "required" => false,
+ "max-occurs" => 1,
+ "default" => 20
+ },
+ "userRequestSourceConcurrency" => {
+ "type" => INT,
+ "description" => "Max source query concurrency per user request (default 0). 0 indicates use the default calculated value based on max active plans and max threads - approximately 2*(max threads)/(max active plans). ",
+ "required" => false,
+ "max-occurs" => 1,
+ "default" => 0
+ },
+ "timeSliceInMilli" => {
+ "type" => INT,
+ "description" => "Query processor time slice, in milliseconds. (default 2000)",
+ "required" => false,
+ "max-occurs" => 1,
+ "default" => 2000
+ },
+ "maxRowsFetchSize" => {
+ "type" => INT,
+ "description" => "Maximum allowed fetch size, set via JDBC. User requested value ignored above this value. (default 20480)",
+ "required" => false,
+ "max-occurs" => 1,
+ "default" => 20480
+ },
+ "lobChunkSizeInKB" => {
+ "type" => INT,
+ "description" => "The max lob chunk size in KB transferred each time when processing blobs, clobs (100KB default)",
+ "required" => false,
+ "max-occurs" => 1,
+ "default" => 100
+ },
+ "useDataRoles" => {
+ "type" => BOOLEAN,
+ "description" => "Turn on role checking based upon the data roles defined in VDBs. (default true)",
+ "required" => false,
+ "max-occurs" => 1,
+ "default" => true
+ },
+ "allowCreateTemporaryTablesByDefault" => {
+ "type" => BOOLEAN,
+ "description" => "Sets whether temporary table usage is allowed by default with data roles enabled. If false, the user must have a role that grants creates temporary table rights to use temporary tables. (default true)",
+ "required" => false,
+ "max-occurs" => 1,
+ "default" => true
+ },
+ "allowFunctionCallsByDefault" => {
+ "type" => BOOLEAN,
+ "description" => "Sets whether functions may be called by default with data roles enabled. If false, a specific permission must exist to call the function. (default true)",
+ "required" => false,
+ "max-occurs" => 1,
+ "default" => true
+ },
+ "queryThresholdInSecs" => {
+ "type" => INT,
+ "description" => "Long running query threshold, after which a alert can be generated by tooling if configured",
+ "required" => false,
+ "max-occurs" => 1,
+ "default" => 600
+ },
+ "maxSourceRows" => {
+ "type" => INT,
+ "description" => "Maximum rows allowed from a source query. -1 indicates no limit. (default -1)",
+ "required" => false,
+ "max-occurs" => 1,
+ "default" => -1
+ },
+ "exceptionOnMaxSourceRows" => {
+ "type" => BOOLEAN,
+ "description" => "Indicates if an exception should be thrown if the specified value for Maximum Source Rows is exceeded; only up to the maximum rows will be consumed. (default true)",
+ "required" => false,
+ "max-occurs" => 1,
+ "default" => true
+ },
+ "maxODBCLobSizeAllowed" => {
+ "type" => INT,
+ "description" => "Maximum size of lob allowed through ODBC connection in bytes (default 5MB)",
+ "required" => false,
+ "max-occurs" => 1,
+ "default" => 5242880
+ },
+ "eventDistributorName" => {
+ "type" => STRING,
+ "description" => "The JNDI name of the Teiid Event Distributor",
+ "required" => false,
+ "max-occurs" => 1,
+ "default" => "teiid/event-distributor"
+ },
+ "detectingChangeEvents" => {
+ "type" => BOOLEAN,
+ "description" => "Set to true for the engine to detect local change events. Should be disabled if using external change data capture tools. (default true)",
+ "required" => false,
+ "max-occurs" => 1,
+ "default" => true
+ },
+ "security-domain" => {
+ "type" => STRING,
+ "description" => "Comma separated list of domains to be used to login into Teiid",
+ "required" => false,
+ "max-occurs" => 1
+ },
+ "max-sessions-allowed" => {
+ "type" => INT,
+ "description" => "Maximum number of sessions allowed by the system (default 5000)",
+ "required" => false,
+ "max-occurs" => 1,
+ "default" => 5000
+ },
+ "sessions-expiration-timelimit" => {
+ "type" => INT,
+ "description" => "Max allowed time before the session is terminated by the system, 0 indicates unlimited (default 0)",
+ "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" => {
+ "useDisk" => {
+ "type" => BOOLEAN,
+ "description" => "Use disk for buffer management",
+ "required" => false,
+ "max-occurs" => 1,
+ "default" => true
+ },
+ "diskDirectory" => {
+ "type" => STRING,
+ "description" => "Directory location for the buffer files",
+ "required" => true,
+ "max-occurs" => 1
+ },
+ "processorBatchSize" => {
+ "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
+ },
+ "connectorBatchSize" => {
+ "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
+ },
+ "maxReserveBatchColumns" => {
+ "type" => INT,
+ "description" => "The number of batch columns to allow in buffer memory. -1 means to automatically calculate a value (default -1). See the admin guide for more.",
+ "required" => false,
+ "max-occurs" => 1,
+ "default" => -1
+ },
+ "maxProcessingBatchesColumns" => {
+ "type" => INT,
+ "description" => "The number of batch columns guaranteed to a processing operation. -1 means to automatically calculate a value (default -1). See the admin guide for more.",
+ "required" => false,
+ "max-occurs" => 1,
+ "default" => -1
+ },
+ "maxFileSize" => {
+ "type" => INT,
+ "description" => "Max File size in MB (default 2GB)",
+ "required" => false,
+ "max-occurs" => 1,
+ "default" => 2048
+ },
+ "maxBufferSpace" => {
+ "type" => INT,
+ "description" => "Max storage space, in MB, to be used for buffer files (default 50G)",
+ "required" => false,
+ "max-occurs" => 1,
+ "default" => 51200
+ },
+ "maxOpenFiles" => {
+ "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" => {
- "enabled" => {
- "type" => BOOLEAN,
- "description" => "enabled",
- "required" => false,
- "max-occurs" => 1,
- "default" => true
- },
- "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"
- }
+ }
+ },
+ "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" => {
- "enabled" => {
- "type" => BOOLEAN,
- "description" => "enabled",
- "required" => false,
- "max-occurs" => 1,
- "default" => true
- },
- "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"
- }
+ }
+ },
+ "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 ",
- "required" => false,
- "max-occurs" => 1,
- "min-occurs" => 1,
- "attributes" => {
- "enabled" => {
- "type" => BOOLEAN,
- "description" => "enabled",
- "required" => false,
- "max-occurs" => 1,
- "default" => true
- },
- "maxSocketThreads" => {
- "type" => INT,
- "description" => "Max number of threads dedicated to initial request processing. Zero indicates the system default of max available processors. (default 0) Setting this value above the max available processors is not recommended.",
- "required" => false,
- "max-occurs" => 1,
- "default" => 0
- },
- "inputBufferSize" => {
- "type" => INT,
- "description" => "SO_RCVBUF size, 0 indicates that system default should be used (default 0)",
- "required" => false,
- "max-occurs" => 1,
- "default" => 0
- },
- "outputBufferSize" => {
- "type" => INT,
- "description" => "SO_SNDBUF size, 0 indicates that system default should be used (default 0)",
- "required" => false,
- "max-occurs" => 1,
- "default" => 0
- },
- "socket-binding" => {
- "type" => INT,
- "description" => "Socket binding for the profile",
- "required" => true,
- "max-occurs" => 1
- },
- "mode" => {
- "type" => STRING,
- "description" => "can be one of disabled, login, or enabled disabled = no transport or message level security will be used; login = only the login traffic will be encrypted at a message level using 128 bit AES with an ephemerial DH key exchange. No other config values are needed in this mode; enabled = traffic will be secured using this configuration.",
- "required" => false,
- "max-occurs" => 1,
- "default" => "login"
- },
- "keystoreFilename" => {
- "type" => STRING,
- "description" => "Keystore File Name",
- "required" => false,
- "max-occurs" => 1
- },
- "keystorePassword" => {
- "type" => STRING,
- "description" => "Keystore password",
- "required" => false,
- "max-occurs" => 1
- },
- "keystoreType" => {
- "type" => STRING,
- "description" => "Keystore type",
- "required" => false,
- "max-occurs" => 1,
- "default" => "JKS"
- },
- "sslProtocol" => {
- "type" => BOOLEAN,
- "description" => "SSL protocol used",
- "required" => false,
- "max-occurs" => 1,
- "default" => false
- },
- "keymanagementAlgorithm" => {
- "type" => STRING,
- "description" => "Use key management algorithm",
- "required" => false,
- "max-occurs" => 1,
- "default" => "false"
- },
- "truststoreFilename" => {
- "type" => STRING,
- "description" => "Truststore Name",
- "required" => false,
- "max-occurs" => 1
- },
- "truststorePassword" => {
- "type" => STRING,
- "description" => "Truststore Password",
- "required" => false,
- "max-occurs" => 1
- },
- "authenticationMode" => {
- "type" => STRING,
- "description" => "Authentication Mode (1-way, 2-way, anonymous)",
- "required" => false,
- "max-occurs" => 1,
- "default" => "anonymous"
- }
+ }
+ },
+ "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 ",
+ "required" => false,
+ "max-occurs" => 1,
+ "min-occurs" => 1,
+ "attributes" => {
+ "enabled" => {
+ "type" => BOOLEAN,
+ "description" => "enabled",
+ "required" => false,
+ "max-occurs" => 1,
+ "default" => true
},
- "children" => {"ssl" => {
- "type" => OBJECT,
- "description" => "SSL",
+ "maxSocketThreads" => {
+ "type" => INT,
+ "description" => "Max number of threads dedicated to initial request processing. Zero indicates the system default of max available processors. (default 0) Setting this value above the max available processors is not recommended.",
"required" => false,
"max-occurs" => 1,
- "min-occurs" => 0
- }}
+ "default" => 0
+ },
+ "inputBufferSize" => {
+ "type" => INT,
+ "description" => "SO_RCVBUF size, 0 indicates that system default should be used (default 0)",
+ "required" => false,
+ "max-occurs" => 1,
+ "default" => 0
+ },
+ "outputBufferSize" => {
+ "type" => INT,
+ "description" => "SO_SNDBUF size, 0 indicates that system default should be used (default 0)",
+ "required" => false,
+ "max-occurs" => 1,
+ "default" => 0
+ },
+ "socket-binding" => {
+ "type" => INT,
+ "description" => "Socket binding for the profile",
+ "required" => true,
+ "max-occurs" => 1
+ },
+ "mode" => {
+ "type" => STRING,
+ "description" => "can be one of disabled, login, or enabled disabled = no transport or message level security will be used; login = only the login traffic will be encrypted at a message level using 128 bit AES with an ephemerial DH key exchange. No other config values are needed in this mode; enabled = traffic will be secured using this configuration.",
+ "required" => false,
+ "max-occurs" => 1,
+ "default" => "login"
+ },
+ "keystoreFilename" => {
+ "type" => STRING,
+ "description" => "Keystore File Name",
+ "required" => false,
+ "max-occurs" => 1
+ },
+ "keystorePassword" => {
+ "type" => STRING,
+ "description" => "Keystore password",
+ "required" => false,
+ "max-occurs" => 1
+ },
+ "keystoreType" => {
+ "type" => STRING,
+ "description" => "Keystore type",
+ "required" => false,
+ "max-occurs" => 1,
+ "default" => "JKS"
+ },
+ "sslProtocol" => {
+ "type" => BOOLEAN,
+ "description" => "SSL protocol used",
+ "required" => false,
+ "max-occurs" => 1,
+ "default" => false
+ },
+ "keymanagementAlgorithm" => {
+ "type" => STRING,
+ "description" => "Use key management algorithm",
+ "required" => false,
+ "max-occurs" => 1,
+ "default" => "false"
+ },
+ "truststoreFilename" => {
+ "type" => STRING,
+ "description" => "Truststore Name",
+ "required" => false,
+ "max-occurs" => 1
+ },
+ "truststorePassword" => {
+ "type" => STRING,
+ "description" => "Truststore Password",
+ "required" => false,
+ "max-occurs" => 1
+ },
+ "authenticationMode" => {
+ "type" => STRING,
+ "description" => "Authentication Mode (1-way, 2-way, anonymous)",
+ "required" => false,
+ "max-occurs" => 1,
+ "default" => "anonymous"
+ }
},
- "admin" => {
+ "children" => {"ssl" => {
"type" => OBJECT,
- "description" => "Remote Admin Access Configuration",
+ "description" => "SSL",
"required" => false,
"max-occurs" => 1,
- "min-occurs" => 1,
- "attributes" => {
- "enabled" => {
- "type" => BOOLEAN,
- "description" => "enabled",
- "required" => false,
- "max-occurs" => 1,
- "default" => true
- },
- "maxSocketThreads" => {
- "type" => INT,
- "description" => "Max number of threads dedicated to initial request processing. Zero indicates the system default of max available processors. (default 0) Setting this value above the max available processors is not recommended.",
- "required" => false,
- "max-occurs" => 1,
- "default" => 0
- },
- "inputBufferSize" => {
- "type" => INT,
- "description" => "SO_RCVBUF size, 0 indicates that system default should be used (default 0)",
- "required" => false,
- "max-occurs" => 1,
- "default" => 0
- },
- "outputBufferSize" => {
- "type" => INT,
- "description" => "SO_SNDBUF size, 0 indicates that system default should be used (default 0)",
- "required" => false,
- "max-occurs" => 1,
- "default" => 0
- },
- "socket-binding" => {
- "type" => INT,
- "description" => "Socket binding for the profile",
- "required" => true,
- "max-occurs" => 1
- },
- "mode" => {
- "type" => STRING,
- "description" => "can be one of disabled, login, or enabled disabled = no transport or message level security will be used; login = only the login traffic will be encrypted at a message level using 128 bit AES with an ephemerial DH key exchange. No other config values are needed in this mode; enabled = traffic will be secured using this configuration.",
- "required" => false,
- "max-occurs" => 1,
- "default" => "login"
- },
- "keystoreFilename" => {
- "type" => STRING,
- "description" => "Keystore File Name",
- "required" => false,
- "max-occurs" => 1
- },
- "keystorePassword" => {
- "type" => STRING,
- "description" => "Keystore password",
- "required" => false,
- "max-occurs" => 1
- },
- "keystoreType" => {
- "type" => STRING,
- "description" => "Keystore type",
- "required" => false,
- "max-occurs" => 1,
- "default" => "JKS"
- },
- "sslProtocol" => {
- "type" => BOOLEAN,
- "description" => "SSL protocol used",
- "required" => false,
- "max-occurs" => 1,
- "default" => false
- },
- "keymanagementAlgorithm" => {
- "type" => STRING,
- "description" => "Use key management algorithm",
- "required" => false,
- "max-occurs" => 1,
- "default" => "false"
- },
- "truststoreFilename" => {
- "type" => STRING,
- "description" => "Truststore Name",
- "required" => false,
- "max-occurs" => 1
- },
- "truststorePassword" => {
- "type" => STRING,
- "description" => "Truststore Password",
- "required" => false,
- "max-occurs" => 1
- },
- "authenticationMode" => {
- "type" => STRING,
- "description" => "Authentication Mode (1-way, 2-way, anonymous)",
- "required" => false,
- "max-occurs" => 1,
- "default" => "anonymous"
- }
+ "min-occurs" => 0
+ }}
+ },
+ "odbc" => {
+ "type" => OBJECT,
+ "description" => "ODBC Access Configuration",
+ "required" => false,
+ "max-occurs" => 1,
+ "min-occurs" => 1,
+ "attributes" => {
+ "enabled" => {
+ "type" => BOOLEAN,
+ "description" => "enabled",
+ "required" => false,
+ "max-occurs" => 1,
+ "default" => true
},
- "children" => {"ssl" => {
- "type" => OBJECT,
- "description" => "SSL",
+ "maxSocketThreads" => {
+ "type" => INT,
+ "description" => "Max number of threads dedicated to initial request processing. Zero indicates the system default of max available processors. (default 0) Setting this value above the max available processors is not recommended.",
"required" => false,
"max-occurs" => 1,
- "min-occurs" => 0
- }}
+ "default" => 0
+ },
+ "inputBufferSize" => {
+ "type" => INT,
+ "description" => "SO_RCVBUF size, 0 indicates that system default should be used (default 0)",
+ "required" => false,
+ "max-occurs" => 1,
+ "default" => 0
+ },
+ "outputBufferSize" => {
+ "type" => INT,
+ "description" => "SO_SNDBUF size, 0 indicates that system default should be used (default 0)",
+ "required" => false,
+ "max-occurs" => 1,
+ "default" => 0
+ },
+ "socket-binding" => {
+ "type" => INT,
+ "description" => "Socket binding for the profile",
+ "required" => true,
+ "max-occurs" => 1
+ },
+ "mode" => {
+ "type" => STRING,
+ "description" => "can be one of disabled, login, or enabled disabled = no transport or message level security will be used; login = only the login traffic will be encrypted at a message level using 128 bit AES with an ephemerial DH key exchange. No other config values are needed in this mode; enabled = traffic will be secured using this configuration.",
+ "required" => false,
+ "max-occurs" => 1,
+ "default" => "login"
+ },
+ "keystoreFilename" => {
+ "type" => STRING,
+ "description" => "Keystore File Name",
+ "required" => false,
+ "max-occurs" => 1
+ },
+ "keystorePassword" => {
+ "type" => STRING,
+ "description" => "Keystore password",
+ "required" => false,
+ "max-occurs" => 1
+ },
+ "keystoreType" => {
+ "type" => STRING,
+ "description" => "Keystore type",
+ "required" => false,
+ "max-occurs" => 1,
+ "default" => "JKS"
+ },
+ "sslProtocol" => {
+ "type" => BOOLEAN,
+ "description" => "SSL protocol used",
+ "required" => false,
+ "max-occurs" => 1,
+ "default" => false
+ },
+ "keymanagementAlgorithm" => {
+ "type" => STRING,
+ "description" => "Use key management algorithm",
+ "required" => false,
+ "max-occurs" => 1,
+ "default" => "false"
+ },
+ "truststoreFilename" => {
+ "type" => STRING,
+ "description" => "Truststore Name",
+ "required" => false,
+ "max-occurs" => 1
+ },
+ "truststorePassword" => {
+ "type" => STRING,
+ "description" => "Truststore Password",
+ "required" => false,
+ "max-occurs" => 1
+ },
+ "authenticationMode" => {
+ "type" => STRING,
+ "description" => "Authentication Mode (1-way, 2-way, anonymous)",
+ "required" => false,
+ "max-occurs" => 1,
+ "default" => "anonymous"
+ }
},
- "odbc" => {
+ "children" => {"ssl" => {
"type" => OBJECT,
- "description" => "ODBC Access Configuration",
+ "description" => "SSL",
"required" => false,
"max-occurs" => 1,
- "min-occurs" => 1,
- "attributes" => {
- "enabled" => {
- "type" => BOOLEAN,
- "description" => "enabled",
- "required" => false,
- "max-occurs" => 1,
- "default" => true
- },
- "maxSocketThreads" => {
- "type" => INT,
- "description" => "Max number of threads dedicated to initial request processing. Zero indicates the system default of max available processors. (default 0) Setting this value above the max available processors is not recommended.",
- "required" => false,
- "max-occurs" => 1,
- "default" => 0
- },
- "inputBufferSize" => {
- "type" => INT,
- "description" => "SO_RCVBUF size, 0 indicates that system default should be used (default 0)",
- "required" => false,
- "max-occurs" => 1,
- "default" => 0
- },
- "outputBufferSize" => {
- "type" => INT,
- "description" => "SO_SNDBUF size, 0 indicates that system default should be used (default 0)",
- "required" => false,
- "max-occurs" => 1,
- "default" => 0
- },
- "socket-binding" => {
- "type" => INT,
- "description" => "Socket binding for the profile",
- "required" => true,
- "max-occurs" => 1
- },
- "mode" => {
- "type" => STRING,
- "description" => "can be one of disabled, login, or enabled disabled = no transport or message level security will be used; login = only the login traffic will be encrypted at a message level using 128 bit AES with an ephemerial DH key exchange. No other config values are needed in this mode; enabled = traffic will be secured using this configuration.",
- "required" => false,
- "max-occurs" => 1,
- "default" => "login"
- },
- "keystoreFilename" => {
- "type" => STRING,
- "description" => "Keystore File Name",
- "required" => false,
- "max-occurs" => 1
- },
- "keystorePassword" => {
- "type" => STRING,
- "description" => "Keystore password",
- "required" => false,
- "max-occurs" => 1
- },
- "keystoreType" => {
- "type" => STRING,
- "description" => "Keystore type",
- "required" => false,
- "max-occurs" => 1,
- "default" => "JKS"
- },
- "sslProtocol" => {
- "type" => BOOLEAN,
- "description" => "SSL protocol used",
- "required" => false,
- "max-occurs" => 1,
- "default" => false
- },
- "keymanagementAlgorithm" => {
- "type" => STRING,
- "description" => "Use key management algorithm",
- "required" => false,
- "max-occurs" => 1,
- "default" => "false"
- },
- "truststoreFilename" => {
- "type" => STRING,
- "description" => "Truststore Name",
- "required" => false,
- "max-occurs" => 1
- },
- "truststorePassword" => {
- "type" => STRING,
- "description" => "Truststore Password",
- "required" => false,
- "max-occurs" => 1
- },
- "authenticationMode" => {
- "type" => STRING,
- "description" => "Authentication Mode (1-way, 2-way, anonymous)",
- "required" => false,
- "max-occurs" => 1,
- "default" => "anonymous"
- }
- },
- "children" => {"ssl" => {
- "type" => OBJECT,
- "description" => "SSL",
- "required" => false,
- "max-occurs" => 1,
- "min-occurs" => 0
- }}
- }
+ "min-occurs" => 0
+ }}
}
- }}
+ }
}
\ No newline at end of file
Modified: branches/as7/jboss-integration/src/test/resources/teiid-sample-config.xml
===================================================================
--- branches/as7/jboss-integration/src/test/resources/teiid-sample-config.xml 2011-07-09 00:08:35 UTC (rev 3304)
+++ branches/as7/jboss-integration/src/test/resources/teiid-sample-config.xml 2011-07-11 03:06:57 UTC (rev 3305)
@@ -17,7 +17,7 @@
<eventDistributorName>teiid/event-distributor</eventDistributorName>
<detectingChangeEvents>true</detectingChangeEvents>
- <jdbc-security-domain>teiid-security</jdbc-security-domain>
+ <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>
@@ -34,12 +34,12 @@
<maxOpenFiles>64</maxOpenFiles>
</buffer-service>
- <distributed-cache-factory enabled="true">
+ <distributed-cache-factory>
<cache-service-jndi-name>java:TeiidCacheManager</cache-service-jndi-name>
<resultsetCacheName>teiid-resultset-cache</resultsetCacheName>
</distributed-cache-factory>
- <resultset-cache enabled="true">
+ <resultset-cache>
<maxEntries>1024</maxEntries>
<maxAgeInSeconds>7200</maxAgeInSeconds>
<maxStaleness>60</maxStaleness>
@@ -53,14 +53,14 @@
<maxStaleness>0</maxStaleness>
</preparedplan-cache>
- <jdbc enabled="true">
+ <jdbc>
<maxSocketThreads>0</maxSocketThreads>
<inputBufferSize>0</inputBufferSize>
<outputBufferSize>0</outputBufferSize>
<socket-binding>teiid-jdbc</socket-binding>
</jdbc>
- <odbc enabled="true">
+ <odbc>
<maxSocketThreads>0</maxSocketThreads>
<inputBufferSize>0</inputBufferSize>
<outputBufferSize>0</outputBufferSize>
Modified: branches/as7/pom.xml
===================================================================
--- branches/as7/pom.xml 2011-07-09 00:08:35 UTC (rev 3304)
+++ branches/as7/pom.xml 2011-07-11 03:06:57 UTC (rev 3305)
@@ -10,7 +10,7 @@
<properties>
<ant.version>1.7.0</ant.version>
<site.url>http://www.jboss.org/teiid</site.url>
- <jbossas-version>7.0.0.Beta4-SNAPSHOT</jbossas-version>
+ <jbossas-version>7.0.0.CR1</jbossas-version>
</properties>
<scm>
<connection>scm:svn:https://anonsvn.jboss.org/repos/teiid/trunk</connection>
@@ -383,18 +383,18 @@
<dependency>
<groupId>org.jboss</groupId>
<artifactId>jboss-dmr</artifactId>
- <version>1.0.0.Beta5</version>
+ <version>1.0.0.Beta6</version>
</dependency>
<dependency>
<groupId>org.jboss.msc</groupId>
<artifactId>jboss-msc</artifactId>
- <version>1.0.0.Beta8</version>
+ <version>1.0.0.CR2</version>
</dependency>
<dependency>
<groupId>org.jboss</groupId>
<artifactId>jboss-vfs</artifactId>
- <version>3.0.0.GA</version>
+ <version>3.0.1.GA</version>
<exclusions>
<exclusion>
<groupId>org.jboss.logging</groupId>
@@ -409,7 +409,7 @@
<dependency>
<groupId>org.picketbox</groupId>
<artifactId>picketbox</artifactId>
- <version>4.0.0.Beta3</version>
+ <version>4.0.0.CR1</version>
</dependency>
<dependency>
<groupId>org.jboss.as</groupId>
@@ -425,7 +425,17 @@
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-security</artifactId>
<version>${jbossas-version}</version>
- </dependency>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-controller-client</artifactId>
+ <version>${jbossas-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-cli</artifactId>
+ <version>${jbossas-version}</version>
+ </dependency>
<!--
<dependency>
@@ -506,11 +516,15 @@
<module>client</module>
<module>engine</module>
<module>connectors</module>
+ <!--
<module>console</module>
+ -->
<module>metadata</module>
<module>runtime</module>
<module>adminshell</module>
+ <!--
<module>cache-jbosscache</module>
+ -->
<module>hibernate-dialect</module>
<module>jboss-integration</module>
<module>test-integration</module>
Modified: branches/as7/runtime/pom.xml
===================================================================
--- branches/as7/runtime/pom.xml 2011-07-09 00:08:35 UTC (rev 3304)
+++ branches/as7/runtime/pom.xml 2011-07-11 03:06:57 UTC (rev 3305)
@@ -57,6 +57,7 @@
<dependency>
<groupId>org.jboss.netty</groupId>
<artifactId>netty</artifactId>
+ <scope>provided</scope>
</dependency>
<dependency>
@@ -64,27 +65,13 @@
<artifactId>connector-api</artifactId>
<scope>provided</scope>
</dependency>
+
<dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-common-core</artifactId>
- <scope>provided</scope>
- </dependency>
- <!-- This dependecy must be removed later into jboss-integration -->
- <dependency>
<groupId>org.jboss.as</groupId>
- <artifactId>jboss-as-server</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-vfs</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.as</groupId>
<artifactId>jboss-as-security</artifactId>
<scope>provided</scope>
- </dependency>
+ </dependency>
+
<!--
<dependency>
<groupId>org.jboss.cache</groupId>
Modified: branches/as7/runtime/src/main/java/org/teiid/deployers/VDBDependencyProcessor.java
===================================================================
--- branches/as7/runtime/src/main/java/org/teiid/deployers/VDBDependencyProcessor.java 2011-07-09 00:08:35 UTC (rev 3304)
+++ branches/as7/runtime/src/main/java/org/teiid/deployers/VDBDependencyProcessor.java 2011-07-11 03:06:57 UTC (rev 3305)
@@ -85,7 +85,7 @@
for (ModelMetaData model: vdb.getModelMetaDatas().values()) {
for (String source:model.getSourceNames()) {
- moduleSpecification.addDependency(new ModuleDependency(moduleLoader, ModuleIdentifier.create(model.getSourceTranslatorName(source)), false, false, false));
+ moduleSpecification.addLocalDependency(new ModuleDependency(moduleLoader, ModuleIdentifier.create(model.getSourceTranslatorName(source)), false, false, false));
}
}
} catch (ModuleLoadException e) {
Modified: branches/as7/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java
===================================================================
--- branches/as7/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java 2011-07-09 00:08:35 UTC (rev 3304)
+++ branches/as7/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java 2011-07-11 03:06:57 UTC (rev 3305)
@@ -146,8 +146,12 @@
deploymentUnit.removeAttachment(TeiidAttachments.UDF_METADATA);
deploymentUnit.removeAttachment(TeiidAttachments.METADATA_STORE);
- // add transformation metadata to the repository.
- this.vdbRepository.addVDB(deployment, store, visibilityMap, udf, cmr);
+ try {
+ // add transformation metadata to the repository.
+ this.vdbRepository.addVDB(deployment, store, visibilityMap, udf, cmr);
+ } catch (VirtualDatabaseException e) {
+ throw new DeploymentUnitProcessingException(e);
+ }
boolean valid = true;
synchronized (deployment) {
@@ -260,12 +264,14 @@
VDBMetaData deployment = deploymentUnit.getAttachment(TeiidAttachments.VDB_METADATA);
VirtualFile file = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT).getRoot();
- if (this.vdbRepository != null) {
+ if (this.vdbRepository != null && deployment != null) {
this.vdbRepository.removeVDB(deployment.getName(), deployment.getVersion());
+ deployment.setRemoved(true);
}
- deployment.setRemoved(true);
- deleteMetadataStore(file);
+ if (file != null) {
+ deleteMetadataStore(file);
+ }
LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("vdb_undeployed", deployment)); //$NON-NLS-1$
}
Modified: branches/as7/runtime/src/main/java/org/teiid/deployers/VDBRepository.java
===================================================================
--- branches/as7/runtime/src/main/java/org/teiid/deployers/VDBRepository.java 2011-07-09 00:08:35 UTC (rev 3304)
+++ branches/as7/runtime/src/main/java/org/teiid/deployers/VDBRepository.java 2011-07-11 03:06:57 UTC (rev 3305)
@@ -26,7 +26,6 @@
import java.util.concurrent.ConcurrentSkipListMap;
import java.util.concurrent.CopyOnWriteArrayList;
-import org.jboss.as.server.deployment.DeploymentUnitProcessingException;
import org.teiid.adminapi.AdminException;
import org.teiid.adminapi.AdminProcessingException;
import org.teiid.adminapi.impl.VDBMetaData;
@@ -61,14 +60,14 @@
return metadataRepository;
}
- public void addVDB(VDBMetaData vdb, MetadataStoreGroup stores, LinkedHashMap<String, Resource> visibilityMap, UDFMetaData udf, ConnectorManagerRepository cmr) throws DeploymentUnitProcessingException {
+ public void addVDB(VDBMetaData vdb, MetadataStoreGroup stores, LinkedHashMap<String, Resource> visibilityMap, UDFMetaData udf, ConnectorManagerRepository cmr) throws VirtualDatabaseException {
if (getVDB(vdb.getName(), vdb.getVersion()) != null) {
- throw new DeploymentUnitProcessingException(RuntimePlugin.Util.getString("duplicate_vdb", vdb.getName(), vdb.getVersion())); //$NON-NLS-1$
+ throw new VirtualDatabaseException(RuntimePlugin.Util.getString("duplicate_vdb", vdb.getName(), vdb.getVersion())); //$NON-NLS-1$
}
// get the system VDB metadata store
if (this.systemStore == null) {
- throw new DeploymentUnitProcessingException(RuntimePlugin.Util.getString("system_vdb_load_error")); //$NON-NLS-1$
+ throw new VirtualDatabaseException(RuntimePlugin.Util.getString("system_vdb_load_error")); //$NON-NLS-1$
}
if (this.odbcEnabled && odbcStore == null) {
Modified: branches/as7/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java
===================================================================
--- branches/as7/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java 2011-07-09 00:08:35 UTC (rev 3304)
+++ branches/as7/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java 2011-07-11 03:06:57 UTC (rev 3305)
@@ -70,9 +70,9 @@
private Map<String, SessionMetadata> sessionCache = new ConcurrentHashMap<String, SessionMetadata>();
private Timer sessionMonitor = new Timer("SessionMonitor", true); //$NON-NLS-1$
private Map<String, SecurityDomainContext> securityDomainMap;
- private LinkedList<String> securityDomainNames;
-
- public SessionServiceImpl(LinkedList<String> domainNames, Map<String, SecurityDomainContext> domains) {
+ private List<String> securityDomainNames;
+
+ public void setSecurityDomains(List<String> domainNames, Map<String, SecurityDomainContext> domains) {
this.securityDomainNames = domainNames;
this.securityDomainMap = domains;
}
Modified: branches/as7/runtime/src/main/java/org/teiid/transport/LocalServerConnection.java
===================================================================
--- branches/as7/runtime/src/main/java/org/teiid/transport/LocalServerConnection.java 2011-07-09 00:08:35 UTC (rev 3304)
+++ branches/as7/runtime/src/main/java/org/teiid/transport/LocalServerConnection.java 2011-07-11 03:06:57 UTC (rev 3305)
@@ -49,7 +49,7 @@
public class LocalServerConnection implements ServerConnection {
- private static final String TEIID_RUNTIME = "teiid/engine-deployer"; //$NON-NLS-1$
+ public static final String TEIID_RUNTIME = "teiid/engine-deployer"; //$NON-NLS-1$
private LogonResult result;
private boolean shutdown;
Modified: branches/as7/runtime/src/main/java/org/teiid/transport/SocketConfiguration.java
===================================================================
--- branches/as7/runtime/src/main/java/org/teiid/transport/SocketConfiguration.java 2011-07-09 00:08:35 UTC (rev 3304)
+++ branches/as7/runtime/src/main/java/org/teiid/transport/SocketConfiguration.java 2011-07-11 03:06:57 UTC (rev 3305)
@@ -35,7 +35,6 @@
private int portNumber;
private InetAddress hostAddress;
private SSLConfiguration sslConfiguration;
- private boolean enabled;
private String hostName;
private String name;
private String socketBinding;
@@ -91,14 +90,6 @@
}
}
- public boolean getEnabled() {
- return enabled;
- }
-
- public void setEnabled(boolean enabled) {
- this.enabled = enabled;
- }
-
public int getOutputBufferSize() {
return outputBufferSize;
}
Modified: branches/as7/runtime/src/test/java/org/teiid/deployers/TestObjectSerializer.java
===================================================================
--- branches/as7/runtime/src/test/java/org/teiid/deployers/TestObjectSerializer.java 2011-07-09 00:08:35 UTC (rev 3304)
+++ branches/as7/runtime/src/test/java/org/teiid/deployers/TestObjectSerializer.java 2011-07-11 03:06:57 UTC (rev 3305)
@@ -34,7 +34,7 @@
public class TestObjectSerializer {
@Test public void testLoadSafe() throws Exception {
- ObjectSerializer os = new ObjectSerializer();
+ 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));
Modified: branches/as7/runtime/src/test/java/org/teiid/deployers/TestTranslatorUtil.java
===================================================================
--- branches/as7/runtime/src/test/java/org/teiid/deployers/TestTranslatorUtil.java 2011-07-09 00:08:35 UTC (rev 3304)
+++ branches/as7/runtime/src/test/java/org/teiid/deployers/TestTranslatorUtil.java 2011-07-11 03:06:57 UTC (rev 3305)
@@ -21,10 +21,10 @@
*/
package org.teiid.deployers;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
import org.junit.Test;
-import org.teiid.adminapi.impl.TranslatorMetaData;
+import org.teiid.adminapi.impl.VDBTranslatorMetaData;
import org.teiid.translator.ExecutionFactory;
import org.teiid.translator.Translator;
import org.teiid.translator.TranslatorProperty;
@@ -34,7 +34,7 @@
@Test
public void testBuildExecutionFactory() throws Exception {
- TranslatorMetaData tm = new TranslatorMetaData();
+ VDBTranslatorMetaData tm = new VDBTranslatorMetaData();
tm.addProperty("MyProperty", "correctly-assigned");
tm.setExecutionFactoryClass(MyTranslator.class);
@@ -45,7 +45,7 @@
}
@Test public void testBuildExecutionFactoryCaseInsensitive() throws Exception {
- TranslatorMetaData tm = new TranslatorMetaData();
+ VDBTranslatorMetaData tm = new VDBTranslatorMetaData();
tm.addProperty("myproperty", "correctly-assigned");
tm.setExecutionFactoryClass(MyTranslator.class);
Modified: branches/as7/runtime/src/test/java/org/teiid/services/TestMembershipServiceImpl.java
===================================================================
--- branches/as7/runtime/src/test/java/org/teiid/services/TestMembershipServiceImpl.java 2011-07-09 00:08:35 UTC (rev 3304)
+++ branches/as7/runtime/src/test/java/org/teiid/services/TestMembershipServiceImpl.java 2011-07-11 03:06:57 UTC (rev 3305)
@@ -23,22 +23,20 @@
package org.teiid.services;
import java.security.Principal;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
+import java.util.*;
import javax.security.auth.Subject;
-import javax.security.auth.callback.CallbackHandler;
-import javax.security.auth.login.LoginContext;
-import javax.security.auth.login.LoginException;
import junit.framework.TestCase;
+import org.jboss.as.security.plugins.SecurityDomainContext;
+import org.jboss.security.AuthenticationManager;
+import org.jboss.security.SimplePrincipal;
import org.mockito.Mockito;
import org.teiid.security.Credentials;
import org.teiid.security.SecurityHelper;
-
+@SuppressWarnings("nls")
public class TestMembershipServiceImpl extends TestCase {
@@ -63,28 +61,27 @@
SecurityHelper sh = Mockito.mock(SecurityHelper.class);
Mockito.stub(sh.getSubjectInContext("passthrough")).toReturn(subject); //$NON-NLS-1$
- TeiidLoginContext membershipService = new TeiidLoginContext(sh) {
- public LoginContext createLoginContext(String domain, CallbackHandler handler) throws LoginException {
- LoginContext context = Mockito.mock(LoginContext.class);
- return context;
- }
- protected LoginContext createLoginContext(String domain, Subject subject) throws LoginException {
- LoginContext context = Mockito.mock(LoginContext.class);
- return context;
- }
- };
+ TeiidLoginContext membershipService = new TeiidLoginContext(sh);
return membershipService;
}
public void testAuthenticate() throws Exception {
+ Credentials credentials = new Credentials("pass1".toCharArray());
TeiidLoginContext ms = createMembershipService();
List<String> domains = new ArrayList<String>();
domains.add("testFile"); //$NON-NLS-1$
- ms.authenticateUser("user1", new Credentials("pass1".toCharArray()), null, domains, false); //$NON-NLS-1$ //$NON-NLS-2$
+ Map<String, SecurityDomainContext> securityDomainMap = new HashMap<String, SecurityDomainContext>();
+ SecurityDomainContext securityContext = Mockito.mock(SecurityDomainContext.class);
+ AuthenticationManager authManager = Mockito.mock(AuthenticationManager.class);
+ Mockito.stub(authManager.isValid(new SimplePrincipal("user1"), credentials, new Subject())).toReturn(true);
+ Mockito.stub(securityContext.getAuthenticationManager()).toReturn(authManager);
+ securityDomainMap.put("testFile", securityContext); //$NON-NLS-1$
- Mockito.verify(ms.getLoginContext()).login();
+ ms.authenticateUser("user1", credentials, null, domains,securityDomainMap, false); //$NON-NLS-1$ //$NON-NLS-2$
+ Mockito.verify(authManager).isValid(new SimplePrincipal("user1"), credentials, new Subject());
+
assertEquals("user1@testFile", ms.getUserName()); //$NON-NLS-1$
}
@@ -93,7 +90,8 @@
TeiidLoginContext ms = createMembershipService();
List<String> domains = new ArrayList<String>();
domains.add("passthrough"); //$NON-NLS-1$
- ms.authenticateUser("user1", new Credentials("pass1".toCharArray()), null, domains, true); //$NON-NLS-1$ //$NON-NLS-2$
+ Map<String, SecurityDomainContext> securityDomainMap = new HashMap<String, SecurityDomainContext>();
+ ms.authenticateUser("user1", new Credentials("pass1".toCharArray()), null, domains, securityDomainMap, true); //$NON-NLS-1$ //$NON-NLS-2$
assertEquals("alreadylogged@passthrough", ms.getUserName()); //$NON-NLS-1$
}
Modified: branches/as7/runtime/src/test/java/org/teiid/services/TestSessionServiceImpl.java
===================================================================
--- branches/as7/runtime/src/test/java/org/teiid/services/TestSessionServiceImpl.java 2011-07-09 00:08:35 UTC (rev 3304)
+++ branches/as7/runtime/src/test/java/org/teiid/services/TestSessionServiceImpl.java 2011-07-11 03:06:57 UTC (rev 3305)
@@ -3,13 +3,14 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Properties;
+import java.util.*;
-import javax.security.auth.login.LoginContext;
+import javax.security.auth.Subject;
import javax.security.auth.login.LoginException;
+import org.jboss.as.security.plugins.SecurityDomainContext;
+import org.jboss.security.AuthenticationManager;
+import org.jboss.security.SimplePrincipal;
import org.junit.Test;
import org.mockito.Mockito;
import org.teiid.adminapi.VDB.Status;
@@ -20,8 +21,6 @@
import org.teiid.dqp.service.SessionServiceException;
import org.teiid.security.Credentials;
import org.teiid.security.SecurityHelper;
-import org.teiid.services.TeiidLoginContext;
-import org.teiid.services.SessionServiceImpl;
@SuppressWarnings("nls")
public class TestSessionServiceImpl {
@@ -29,21 +28,28 @@
public void validateSession(boolean securityEnabled) throws Exception {
final TeiidLoginContext impl = Mockito.mock(TeiidLoginContext.class);
Mockito.stub(impl.getUserName()).toReturn("steve@somedomain");
- Mockito.stub(impl.getLoginContext()).toReturn(Mockito.mock(LoginContext.class));
final ArrayList<String> domains = new ArrayList<String>();
domains.add("somedomain");
SessionServiceImpl ssi = new SessionServiceImpl() {
@Override
- protected TeiidLoginContext authenticate(String userName, Credentials credentials, String applicationName, List<String> domains, SecurityHelper helper, boolean passthough)
+ protected TeiidLoginContext authenticate(String userName, Credentials credentials, String applicationName, List<String> domains, Map<String, SecurityDomainContext> securityDomainMap, SecurityHelper helper, boolean passthough)
throws LoginException {
- impl.authenticateUser(userName, credentials, applicationName, domains, passthough);
+ impl.authenticateUser(userName, credentials, applicationName, domains, securityDomainMap, passthough);
return impl;
}
};
- ssi.setSecurityDomains("somedomain");
+ Map<String, SecurityDomainContext> securityDomainMap = new HashMap<String, SecurityDomainContext>();
+ SecurityDomainContext securityContext = Mockito.mock(SecurityDomainContext.class);
+ AuthenticationManager authManager = Mockito.mock(AuthenticationManager.class);
+ Credentials credentials = new Credentials("pass1".toCharArray());
+ Mockito.stub(authManager.isValid(new SimplePrincipal("user1"), credentials, new Subject())).toReturn(true);
+ Mockito.stub(securityContext.getAuthenticationManager()).toReturn(authManager);
+ securityDomainMap.put("somedomain", securityContext); //$NON-NLS-1$
+ ssi.setSecurityDomains(Arrays.asList("somedomain"), securityDomainMap);
+
try {
ssi.validateSession(String.valueOf(1));
fail("exception expected"); //$NON-NLS-1$
@@ -51,9 +57,9 @@
}
- SessionMetadata info = ssi.createSession("steve", null, "foo", new Properties(), false, true); //$NON-NLS-1$ //$NON-NLS-2$
+ SessionMetadata info = ssi.createSession("steve", null, "foo", new Properties(), true); //$NON-NLS-1$ //$NON-NLS-2$
if (securityEnabled) {
- Mockito.verify(impl).authenticateUser("steve", null, "foo", domains, false);
+ Mockito.verify(impl).authenticateUser("steve", null, "foo", domains, securityDomainMap, false);
}
String id1 = info.getSessionId();
Modified: branches/as7/runtime/src/test/java/org/teiid/transport/TestLogonImpl.java
===================================================================
--- branches/as7/runtime/src/test/java/org/teiid/transport/TestLogonImpl.java 2011-07-09 00:08:35 UTC (rev 3304)
+++ branches/as7/runtime/src/test/java/org/teiid/transport/TestLogonImpl.java 2011-07-11 03:06:57 UTC (rev 3305)
@@ -53,7 +53,7 @@
session.setSessionId(String.valueOf(1));
session.setSessionToken(new SessionToken(1, userName));
- Mockito.stub(ssi.createSession(userName, null, applicationName,p, false, true)).toReturn(session);
+ Mockito.stub(ssi.createSession(userName, null, applicationName,p, true)).toReturn(session);
LogonImpl impl = new LogonImpl(ssi, "fakeCluster"); //$NON-NLS-1$
Modified: branches/as7/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java
===================================================================
--- branches/as7/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java 2011-07-09 00:08:35 UTC (rev 3304)
+++ branches/as7/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java 2011-07-11 03:06:57 UTC (rev 3305)
@@ -25,7 +25,6 @@
import java.util.LinkedHashMap;
import java.util.Properties;
-import org.jboss.deployers.spi.DeploymentException;
import org.mockito.Mockito;
import org.teiid.adminapi.AdminException;
import org.teiid.adminapi.VDB;
@@ -38,6 +37,7 @@
import org.teiid.client.security.ILogon;
import org.teiid.deployers.MetadataStoreGroup;
import org.teiid.deployers.VDBRepository;
+import org.teiid.deployers.VirtualDatabaseException;
import org.teiid.dqp.internal.datamgr.ConnectorManager;
import org.teiid.dqp.internal.datamgr.ConnectorManagerRepository;
import org.teiid.dqp.internal.datamgr.FakeTransactionService;
@@ -147,7 +147,7 @@
stores.addStore(metadata);
this.repo.addVDB(vdbMetaData, stores, entries, null, cmr);
this.repo.finishDeployment(vdbName, 1);
- } catch (DeploymentException e) {
+ } catch (VirtualDatabaseException e) {
throw new RuntimeException(e);
}
}
Deleted: branches/as7/test-integration/db/src/test/java/org/teiid/adminapi/jboss/TestConnectorBindings.java
===================================================================
--- branches/as7/test-integration/db/src/test/java/org/teiid/adminapi/jboss/TestConnectorBindings.java 2011-07-09 00:08:35 UTC (rev 3304)
+++ branches/as7/test-integration/db/src/test/java/org/teiid/adminapi/jboss/TestConnectorBindings.java 2011-07-11 03:06:57 UTC (rev 3305)
@@ -1,387 +0,0 @@
-package org.teiid.adminapi.jboss;
-
-
-import static junit.framework.Assert.*;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.sql.Connection;
-import java.util.Collection;
-import java.util.List;
-import java.util.Properties;
-import java.util.Set;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.teiid.adminapi.Admin;
-import org.teiid.adminapi.AdminException;
-import org.teiid.adminapi.AdminFactory;
-import org.teiid.adminapi.DataPolicy;
-import org.teiid.adminapi.Model;
-import org.teiid.adminapi.PropertyDefinition;
-import org.teiid.adminapi.Request;
-import org.teiid.adminapi.Session;
-import org.teiid.adminapi.Transaction;
-import org.teiid.adminapi.Translator;
-import org.teiid.adminapi.VDB;
-import org.teiid.adminapi.VDB.ConnectionType;
-import org.teiid.core.util.UnitTestUtil;
-
-@Ignore
-@SuppressWarnings("nls")
-public class TestConnectorBindings extends BaseConnection {
- static ServerDatasourceConnection ds;
- static Admin admin;
- private static final String VERSION = "-7.0.0-SNAPSHOT";
-
- @Before
- public void setUp() throws Exception {
- //if (!Bootstrap.getInstance().isStarted()) Bootstrap.getInstance().bootstrap();
- ds = new ServerDatasourceConnection();
- //admin = AdminProvider.getRemote( "jnp://localhost:1099", "javaduke", "anotherduke");
- admin = AdminFactory.getInstance().createAdmin("admin", "admin".toCharArray(), "mms://127.0.0.1:31443"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
- installVDB();
- }
-
- @After
- public void tearDown() {
- admin.close();
- }
-
- //@AfterClass
- public static void end() throws Exception {
- admin = AdminFactory.getInstance().createAdmin("admin", "admin".toCharArray(), "mm://localhost:31443"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
- VDB vdb = admin.getVDB("TransactionsRevisited", 1); //$NON-NLS-1$
- if (vdb != null) {
- admin.deleteVDB("TransactionsRevisited", 1); //$NON-NLS-1$
- }
- admin.close();
- }
-
- @Test public void testVDBDeploy() throws Exception {
-
- VDB vdb = admin.getVDB("TransactionsRevisited", 1); //$NON-NLS-1$
- if (vdb != null) {
- admin.deleteVDB("TransactionsRevisited", 1); //$NON-NLS-1$
- }
-
- installVDB();
-
- assertNotNull(admin.getVDB("TransactionsRevisited", 1)); //$NON-NLS-1$
-
- Set<VDB> vdbs = admin.getVDBs();
- assertTrue(vdbs.size() >= 1);
-
- admin.deleteVDB("TransactionsRevisited", 1); //$NON-NLS-1$
-
- assertNull(admin.getVDB("TransactionsRevisited", 1)); //$NON-NLS-1$
- }
-
- @Test
- public void testChangeConnectionType() throws Exception {
- VDB vdb = admin.getVDB("TransactionsRevisited", 1);
- assertNotNull(vdb); //$NON-NLS-1$
-
- ConnectionType ct = vdb.getConnectionType();
- assertEquals(ConnectionType.BY_VERSION, ct);
-
- admin.changeVDBConnectionType("TransactionsRevisited", 1, ConnectionType.ANY);
-
- vdb = admin.getVDB("TransactionsRevisited", 1);
-
- ct = vdb.getConnectionType();
- assertEquals(ConnectionType.ANY, ct);
- }
-
- @Test public void testGetVDB() throws Exception {
- VDB vdb = admin.getVDB("TransactionsRevisited", 1);
- assertNotNull(vdb); //$NON-NLS-1$
-
- assertEquals("TransactionsRevisited", vdb.getName());
- assertEquals(1, vdb.getVersion());
- assertEquals("A VDB to test transactions", vdb.getDescription());
- //assertEquals("sample-value", vdb.getPropertyValue("sample"));
- assertEquals(VDB.Status.INACTIVE, vdb.getStatus());
-
- // test model
- List<Model> models = vdb.getModels();
- assertEquals(4, models.size());
- Model model = null;
- for (Model m:models) {
- if (m.getName().equals("pm1")) {
- model = m;
- break;
- }
- }
- assertNotNull(model);
- assertEquals(Model.Type.PHYSICAL, model.getModelType());
- assertEquals("sample-value", model.getPropertyValue("sample"));
- List<String> sourceNames = model.getSourceNames();
- assertEquals(1, sourceNames.size());
- assertEquals("mysql", model.getSourceTranslatorName(sourceNames.get(0)));
- assertEquals("java:mysql-connector-binding", model.getSourceConnectionJndiName(sourceNames.get(0)));
- assertTrue(model.isSource());
- //assertTrue(model.isSupportsMultiSourceBindings());
- assertTrue(model.isVisible());
-
- // test data policies
- List<DataPolicy> policies = vdb.getDataPolicies();
- assertEquals(1, policies.size());
- assertEquals("policy1", policies.get(0).getName());
- assertEquals("roleOne described", policies.get(0).getDescription());
-
- List<DataPolicy.DataPermission> permissions = policies.get(0).getPermissions();
- assertEquals(2, permissions.size());
-
- for(DataPolicy.DataPermission permission: permissions) {
- if (permission.getResourceName().equals("myTable.T1")) {
- assertTrue(permission.getAllowRead());
- assertFalse(permission.getAllowCreate());
- assertFalse(permission.getAllowDelete());
- assertFalse(permission.getAllowUpdate());
- }
- else if (permission.getResourceName().equals("myTable.T2")) {
- assertFalse(permission.getAllowRead());
- assertFalse(permission.getAllowCreate());
- assertTrue(permission.getAllowDelete());
- assertFalse(permission.getAllowUpdate());
- }
- else {
- fail("there are only two types of permissions");
- }
- }
-
- }
-
-
- @Test public void testSessions() throws Exception{
- Connection c = ds.getConnection("TransactionsRevisited"); // to create the session
- Collection<Session> sessions = admin.getSessions();
-
- int size = sessions.size();
- assertTrue( size >= 1);
-
- Session found = null;
- for (Session s: sessions) {
- if (s.getUserName().equals("admin@teiid-security")) {
- found = s;
- break;
- }
- }
-
- assertNotNull(found);
-
- admin.terminateSession(found.getSessionId());
-
- sessions = admin.getSessions();
- assertTrue(sessions.size() == (size-1));
- c.close();
- }
-
-
- @Test public void testRequests() throws Exception {
- Runnable work = new Runnable() {
- public void run() {
- for (int i = 0; i < 5; i++) {
- try {
- execute(ds, "TransactionsRevisited", "select * from pm1.g1"); //$NON-NLS-1$ //$NON-NLS-2$
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
- };
- Thread t = new Thread(work);
- t.start();
-
- // can not really stop and take reading here..
- try {
- Collection<Request> requests = admin.getRequests();
- assertTrue(requests.size() >= 0);
- }finally {
- t.join();
- }
-
- String sessionId = null;
- Collection<Session> sessions = admin.getSessions();
- for (Session s:sessions) {
- sessionId = s.getSessionId();
- }
-
- t = new Thread(work);
- t.start();
-
- try {
- Collection<Request> requests = admin.getRequestsForSession(sessionId);
- assertTrue(requests.size() >= 0);
- } finally {
- t.join();
- }
- }
-
- @Test
- public void testCache() throws Exception {
- Collection<String> caches = admin.getCacheTypes();
- assertEquals(3, caches.size());
-
- admin.clearCache("CODE_TABLE_CACHE"); //$NON-NLS-1$
- }
-
- @Ignore
- @Test
- public void testTransactions() throws Exception {
- Runnable work = new Runnable() {
- public void run() {
- try {
- for (int i = 0; i < 10; i++) {
- int v = i+200;
- execute(ds, "TransactionsRevisited", "insert into vm.g1 (pm1e1, pm1e2, pm2e1, pm2e2) values("+v+",'"+v+"',"+v+",'"+v+"')"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
- }
- execute(ds, "TransactionsRevisited", "delete from vm.g1 where pm1e1 >= 200"); //$NON-NLS-1$ //$NON-NLS-2$
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- };
-
- Thread t = new Thread(work);
- t.start();
- Thread.sleep(2000);
- try {
- Collection<Transaction> txns = admin.getTransactions();
- assertTrue(txns.size() >= 0);
- } finally {
- t.join();
- }
- }
-
- private static void installVDB() throws AdminException, FileNotFoundException {
- VDB vdb = admin.getVDB("TransactionsRevisited", 1); //$NON-NLS-1$
- if (vdb == null) {
- File f = UnitTestUtil.getTestDataFile("TransactionsRevisited.vdb"); //$NON-NLS-1$
- FileInputStream fis = new FileInputStream(f);
- admin.deployVDB(f.getName(), fis);
- try {
- fis.close();
- } catch (IOException e) {
- }
- }
- }
-
- @Test
- public void testTranslatorTemplateProperties() throws Exception {
- Collection<PropertyDefinition> defs = admin.getTemplatePropertyDefinitions("translator-jdbc"+VERSION); //$NON-NLS-1$
- for (PropertyDefinition pd:defs) {
- System.out.println(pd.getName()+":"+pd.getPropertyTypeClassName()+":"+pd.getDefaultValue());
- if (pd.getName().equals("ExtensionTranslationClassName")) { //$NON-NLS-1$
- assertEquals("Extension SQL Translation Class", pd.getDisplayName()); //$NON-NLS-1$
- assertEquals(false, pd.isAdvanced());
- assertEquals(true, pd.isRequired());
- assertEquals(false, pd.isMasked());
- assertEquals(true, pd.isModifiable());
-
- assertEquals(12, pd.getAllowedValues().size());
- System.out.println(pd.getAllowedValues());
- }
- }
- }
-
- @Test
- public void testGetTemplate() throws Exception {
- Translator translator = admin.getTranslator("oracle");
- for (String key:translator.getProperties().stringPropertyNames()) {
- System.out.println(key+"="+translator.getPropertyValue(key));
- }
- assertEquals("org.teiid.translator.jdbc.oracle.OracleSQLTranslator", translator.getPropertyValue("ExtensionTranslationClassName")); //$NON-NLS-1$
- assertEquals(false, translator.getPropertyValue("XaCapable"));
- }
-
- @Test public void testAssignConnectorBinding() throws Exception {
- admin.assignToModel("TransactionsRevisited", 1, "pm1", "mysql", "mysql", "jndi:FOO"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
-
- boolean checked = false;
- VDB vdb = admin.getVDB("TransactionsRevisited", 1); //$NON-NLS-1$
- List<Model> models = vdb.getModels();
- for (Model model:models) {
- if (model.getName().equals("pm1")) { //$NON-NLS-1$
- List<String> sources = model.getSourceNames();
- for (String source:sources) {
- if (source.equals("mysql")) { //$NON-NLS-1$
- assertEquals("jndi:FOO", model.getSourceConnectionJndiName(source)); //$NON-NLS-1$
- checked = true;
- }
- }
- }
- }
-
- assertTrue("Test not veryfied", checked); //$NON-NLS-1$
- }
-
-
- @Test public void testAddRoleNames() throws Exception {
- installVDB();
- admin.addDataRoleMapping("TransactionsRevisited", 1, "policy1", "managers"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-
- VDB vdb = admin.getVDB("TransactionsRevisited", 1); //$NON-NLS-1$
- List<DataPolicy> policies = vdb.getDataPolicies();
- assertTrue (!policies.isEmpty());
- for (DataPolicy policy:policies) {
- if (policy.getName().equals("policy1")) { //$NON-NLS-1$
- List<String> sources = policy.getMappedRoleNames();
- assertTrue(sources.contains("managers"));
- }
- }
-
- // remove the role
- admin.removeDataRoleMapping("TransactionsRevisited", 1, "policy1", "managers");
-
- vdb = admin.getVDB("TransactionsRevisited", 1); //$NON-NLS-1$
- policies = vdb.getDataPolicies();
- assertTrue (!policies.isEmpty());
-
- for (DataPolicy policy:policies) {
- if (policy.getName().equals("policy1")) { //$NON-NLS-1$
- List<String> sources = policy.getMappedRoleNames();
- assertFalse(sources.contains("managers"));
- }
- }
-
- // remove non-existent role name
- admin.removeDataRoleMapping("TransactionsRevisited", 1, "policy1", "FOO");
- }
-
- @Test
- public void testCreateDataSource() throws Exception {
-
- Properties p = new Properties();
- p.setProperty("DatabaseName", "txntest");
- p.setProperty("PortNumber", "3306");
- p.setProperty("ServerName", "localhost");
- p.setProperty("additional-ds-properties", "foo=bar, t= x");
- p.setProperty("user-name", "rareddy");
- p.setProperty("password", "mm");
- p.setProperty("xa-datasource-class", "com.mysql.jdbc.jdbc2.optional.MysqlXADataSource");
-
- admin.createDataSource("test-mysql","connector-jdbc-xa", p); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- @Test
- public void testCreateDriverSource() throws Exception {
-
- Properties p = new Properties();
- p.setProperty("connection-url", "jdbc:mysql://localhost:3306/txntest");
- p.setProperty("additional-connection-properties", "foo=bar, t= x");
- p.setProperty("user-name", "rareddy");
- p.setProperty("password", "mm");
- p.setProperty("driver-class", "com.mysql.jdbc.Driver");
-
- admin.createDataSource("test-mysql-driver","connector-jdbc", p); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
-}
13 years, 8 months
teiid SVN: r3304 - in branches/7.4.x/client/src: test/java/org/teiid/jdbc and 1 other directory.
by teiid-commits@lists.jboss.org
Author: van.halbert
Date: 2011-07-08 20:08:35 -0400 (Fri, 08 Jul 2011)
New Revision: 3304
Modified:
branches/7.4.x/client/src/main/java/org/teiid/jdbc/JDBCURL.java
branches/7.4.x/client/src/test/java/org/teiid/jdbc/TestConnection.java
branches/7.4.x/client/src/test/java/org/teiid/jdbc/TestTeiidDriver.java
Log:
TEIID-1651 missed adding the jdbc4spec property to JDBC URL set of properties
Modified: branches/7.4.x/client/src/main/java/org/teiid/jdbc/JDBCURL.java
===================================================================
--- branches/7.4.x/client/src/main/java/org/teiid/jdbc/JDBCURL.java 2011-07-06 18:34:49 UTC (rev 3303)
+++ branches/7.4.x/client/src/main/java/org/teiid/jdbc/JDBCURL.java 2011-07-09 00:08:35 UTC (rev 3304)
@@ -58,7 +58,8 @@
ExecutionProperties.PROP_XML_FORMAT,
ExecutionProperties.PROP_XML_VALIDATION,
EmbeddedProfile.USE_CALLING_THREAD,
- ExecutionProperties.DISABLE_LOCAL_TRANSACTIONS)));
+ ExecutionProperties.DISABLE_LOCAL_TRANSACTIONS,
+ ExecutionProperties.JDBC4COLUMNNAMEANDLABELSEMANTICS)));
public static final Set<String> KNOWN_PROPERTIES = getKnownProperties();
Modified: branches/7.4.x/client/src/test/java/org/teiid/jdbc/TestConnection.java
===================================================================
--- branches/7.4.x/client/src/test/java/org/teiid/jdbc/TestConnection.java 2011-07-06 18:34:49 UTC (rev 3303)
+++ branches/7.4.x/client/src/test/java/org/teiid/jdbc/TestConnection.java 2011-07-09 00:08:35 UTC (rev 3304)
@@ -22,7 +22,8 @@
package org.teiid.jdbc;
-import static org.mockito.Mockito.*;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.stub;
import java.sql.SQLException;
import java.util.Properties;
@@ -38,8 +39,6 @@
import org.teiid.client.util.ResultsFuture;
import org.teiid.client.xa.XATransactionException;
import org.teiid.client.xa.XidImpl;
-import org.teiid.jdbc.BaseDataSource;
-import org.teiid.jdbc.ConnectionImpl;
import org.teiid.net.ServerConnection;
@@ -48,13 +47,28 @@
protected static final String STD_DATABASE_NAME = "QT_Ora9DS"; //$NON-NLS-1$
protected static final int STD_DATABASE_VERSION = 1;
- static String serverUrl = "jdbc:metamatrix:QT_Ora9DS@mm://localhost:7001;version=1;user=metamatrixadmin;password=mm"; //$NON-NLS-1$
+ static String serverUrl = "jdbc:teiid:QT_Ora9DS@mm://localhost:7001;version=1;user=metamatrixadmin;password=mm"; //$NON-NLS-1$
public TestConnection(String name) {
super(name);
}
+ static class InnerDriver extends TeiidDriver {
+ String iurl = null;
+ public InnerDriver(String url) {
+ iurl = url;
+ }
+
+ public void parseUrl(Properties props) throws SQLException {
+ super.parseURL(iurl, props);
+ }
+ }
+
public static ConnectionImpl getMMConnection() {
+ return getMMConnection(serverUrl);
+ }
+
+ public static ConnectionImpl getMMConnection(String url) {
ServerConnection mock = mock(ServerConnection.class);
DQP dqp = mock(DQP.class);
try {
@@ -79,13 +93,20 @@
} catch (XATransactionException e) {
throw new RuntimeException(e);
}
+
+ Properties props = new Properties();
+
+ try {
+ new InnerDriver(url).parseUrl(props);
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
stub(mock.getService(DQP.class)).toReturn(dqp);
- Properties props = new Properties();
- props.setProperty(BaseDataSource.VDB_NAME, STD_DATABASE_NAME);
- props.setProperty(BaseDataSource.VDB_VERSION, String.valueOf(STD_DATABASE_VERSION));
- props.setProperty(BaseDataSource.USER_NAME, "metamatrixadmin"); //$NON-NLS-1$
- stub(mock.getLogonResult()).toReturn(new LogonResult(new SessionToken(1, "metamatrixadmin"), STD_DATABASE_NAME,STD_DATABASE_VERSION , "fake")); //$NON-NLS-1$
- return new ConnectionImpl(mock, props, serverUrl);
+
+ stub(mock.getLogonResult()).toReturn(new LogonResult(new SessionToken(1, "admin"), STD_DATABASE_NAME,STD_DATABASE_VERSION , "fake")); //$NON-NLS-1$
+ return new ConnectionImpl(mock, props, url);
}
public void testGetMetaData() throws Exception {
@@ -103,7 +124,7 @@
/** test getUserName() through DriverManager */
public void testGetUserName2() throws Exception {
- assertEquals("Actual userName is not equal to the expected one. ", "metamatrixadmin", getMMConnection().getUserName()); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals("Actual userName is not equal to the expected one. ", "admin", getMMConnection().getUserName()); //$NON-NLS-1$ //$NON-NLS-2$
}
/** test isReadOnly default value on Connection */
@@ -129,4 +150,27 @@
// error expected
}
}
+
+ /**
+ * Test the default of the JDBC4 spec semantics is true
+ */
+ public void testDefaultSpec() throws Exception {
+ assertEquals("true",
+ (getMMConnection().getExecutionProperties().getProperty(ExecutionProperties.JDBC4COLUMNNAMEANDLABELSEMANTICS) == null ? "true" : "false"));
+ }
+
+ /**
+ * Test turning off the JDBC 4 semantics
+ */
+ public void testTurnOnSpec() throws Exception {
+ assertEquals("true", getMMConnection(serverUrl + ";useJDBC4ColumnNameAndLabelSemantics=true").getExecutionProperties().getProperty(ExecutionProperties.JDBC4COLUMNNAMEANDLABELSEMANTICS));
+ }
+
+ /**
+ * Test turning off the JDBC 4 semantics
+ */
+ public void testTurnOffSpec() throws Exception {
+ assertEquals("false", getMMConnection(serverUrl + ";useJDBC4ColumnNameAndLabelSemantics=false").getExecutionProperties().getProperty(ExecutionProperties.JDBC4COLUMNNAMEANDLABELSEMANTICS));
+ }
+
}
Modified: branches/7.4.x/client/src/test/java/org/teiid/jdbc/TestTeiidDriver.java
===================================================================
--- branches/7.4.x/client/src/test/java/org/teiid/jdbc/TestTeiidDriver.java 2011-07-06 18:34:49 UTC (rev 3303)
+++ branches/7.4.x/client/src/test/java/org/teiid/jdbc/TestTeiidDriver.java 2011-07-09 00:08:35 UTC (rev 3304)
@@ -138,7 +138,7 @@
@Test public void testGetPropertyInfo1() throws Exception {
DriverPropertyInfo info[] = drv.getPropertyInfo("jdbc:teiid:vdb@mm://localhost:12345;applicationName=x", null); //$NON-NLS-1$
- assertEquals(20, info.length);
+ assertEquals(21, info.length);
assertEquals(false, info[0].required);
assertEquals("ApplicationName", info[0].name); //$NON-NLS-1$
assertEquals("x", info[0].value); //$NON-NLS-1$
13 years, 8 months
teiid SVN: r3303 - branches/7.1.1.CP3/jboss-integration/src/main/java/org/teiid/jboss/deployers.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2011-07-06 14:34:49 -0400 (Wed, 06 Jul 2011)
New Revision: 3303
Modified:
branches/7.1.1.CP3/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
Log:
TEIID-1493: If the same VDB vesion is added and removed recently, the code was not flushing the cache contents; however in the case of startup, there will be no-entries in the recently removed map, the cache entries will be dumped for all the VDBs, thus invalidate the distributed cache entries. Here TEIID-1256 being reverted as this was wrong assumption from before of the behavior required. Removing the clearing of the cache entries entirely. Actually I am little confused about the intent of the map to keep track of the recently removed vdbs, as this doing opposite to what is documented in terms of the active connections.
Modified: branches/7.1.1.CP3/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
===================================================================
--- branches/7.1.1.CP3/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2011-07-05 13:43:39 UTC (rev 3302)
+++ branches/7.1.1.CP3/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2011-07-06 18:34:49 UTC (rev 3303)
@@ -62,7 +62,6 @@
import org.teiid.adminapi.AdminComponentException;
import org.teiid.adminapi.AdminException;
import org.teiid.adminapi.AdminProcessingException;
-import org.teiid.adminapi.Admin.Cache;
import org.teiid.adminapi.impl.CacheStatisticsMetadata;
import org.teiid.adminapi.impl.DQPManagement;
import org.teiid.adminapi.impl.RequestMetadata;
@@ -240,10 +239,6 @@
} catch (SessionServiceException e) {
//ignore
}
-
- // dump the caches.
- dqpCore.clearCache(Cache.PREPARED_PLAN_CACHE.toString(), name, version);
- dqpCore.clearCache(Cache.QUERY_SERVICE_RESULT_SET_CACHE.toString(), name, version);
}
});
}
13 years, 8 months
teiid SVN: r3302 - branches/7.4.x/documentation/client-developers-guide/src/main/docbook/en-US/content.
by teiid-commits@lists.jboss.org
Author: van.halbert
Date: 2011-07-05 09:43:39 -0400 (Tue, 05 Jul 2011)
New Revision: 3302
Modified:
branches/7.4.x/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-connection.xml
branches/7.4.x/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-extensions.xml
Log:
TEIID-1651 Added backward compatibility support so that pre JDBC 4, the use of an 'Alias' can still be obtained via the ResultSetMetadata.getColumnName. In JDBC 4, you will need to call ResultSetMetadata.getColumnLabel. To enable backward support, add the property: useJDBC4ColumnNameAndLabelSemantics=false to the url connection string
Modified: branches/7.4.x/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-connection.xml
===================================================================
--- branches/7.4.x/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-connection.xml 2011-07-04 19:09:19 UTC (rev 3301)
+++ branches/7.4.x/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-connection.xml 2011-07-05 13:43:39 UTC (rev 3302)
@@ -242,6 +242,22 @@
</entry>
<entry>Default query timeout in seconds. Must be >= 0. 0 indicates no timeout. Can be overriden by <code>Statement.setQueryTimeout</code>. Default 0.</entry>
</row>
+ <row>
+ <entry>
+ <code>useJDBC4ColumnNameAndLabelSemantics</code>
+ </entry>
+ <entry>
+ <code>boolean</code>
+ </entry>
+ <entry>
+ <para>A change was made in JDBC4 so that when an 'Alias' is used it will
+ now be returned as the label. Prior to this, it was returned as
+ the name. Setting this property to false will enable
+ backwards compatibility when JDBC3 and older support is still required.
+ </para>
+ </entry>
+ </row>
+
</tbody>
</tgroup>
</table>
Modified: branches/7.4.x/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-extensions.xml
===================================================================
--- branches/7.4.x/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-extensions.xml 2011-07-04 19:09:19 UTC (rev 3301)
+++ branches/7.4.x/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-extensions.xml 2011-07-05 13:43:39 UTC (rev 3302)
@@ -170,6 +170,18 @@
<para>Same as the connection property.</para>
</entry>
</row>
+ <row>
+ <entry>
+ <code>JDBC4COLUMNNAMEANDLABELSEMANTICS / useJDBC4ColumnNameAndLabelSemantics</code>
+ </entry>
+ <entry>
+ <para>A change was made in JDBC4 so that when an 'Alias' is used it will.
+ now be returned as the label. Prior to this, it was returned as
+ the name. Setting this property to false will enable
+ backwards compatibility when JDBC3 and older support is still required.
+ </para>
+ </entry>
+ </row>
</tbody>
</tgroup>
</table>
13 years, 8 months
teiid SVN: r3301 - in branches/as7: client/src/main/java/org/teiid/adminapi and 17 other directories.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2011-07-04 15:09:19 -0400 (Mon, 04 Jul 2011)
New Revision: 3301
Added:
branches/as7/client/src/main/java/org/teiid/adminapi/AdminPlugin.java
branches/as7/client/src/main/java/org/teiid/adminapi/impl/MetadataMapper.java
branches/as7/client/src/main/resources/org/teiid/adminapi/
branches/as7/client/src/main/resources/org/teiid/adminapi/i18n.properties
branches/as7/client/src/test/resources/vdb-describe.txt
Removed:
branches/as7/client/src/main/java/org/teiid/adminapi/impl/CacheStatisticsMetadataMapper.java
branches/as7/client/src/main/java/org/teiid/adminapi/impl/RequestMetadataMapper.java
branches/as7/client/src/main/java/org/teiid/adminapi/impl/SessionMetadataMapper.java
branches/as7/client/src/main/java/org/teiid/adminapi/impl/TransactionMetadataMapper.java
branches/as7/client/src/main/java/org/teiid/adminapi/impl/TranslatorMetaData.java
branches/as7/client/src/main/java/org/teiid/adminapi/impl/TranslatorPropertyFactory.java
branches/as7/client/src/main/java/org/teiid/adminapi/impl/WorkerPoolStatisticsMetadataMapper.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineModelHandler.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidSubsystemDescription.java
branches/as7/runtime/src/test/java/org/teiid/deployers/TestManagedPropertyUtil.java
branches/as7/runtime/src/test/java/org/teiid/deployers/TestTranslatorMetadata.java
Modified:
branches/as7/client/src/main/java/org/teiid/adminapi/impl/CacheStatisticsMetadata.java
branches/as7/client/src/main/java/org/teiid/adminapi/impl/DataPolicyMetadata.java
branches/as7/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java
branches/as7/client/src/main/java/org/teiid/adminapi/impl/PropertyMetadata.java
branches/as7/client/src/main/java/org/teiid/adminapi/impl/RequestMetadata.java
branches/as7/client/src/main/java/org/teiid/adminapi/impl/SessionMetadata.java
branches/as7/client/src/main/java/org/teiid/adminapi/impl/SourceMappingMetadata.java
branches/as7/client/src/main/java/org/teiid/adminapi/impl/TransactionMetadata.java
branches/as7/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java
branches/as7/client/src/main/java/org/teiid/adminapi/impl/VDBTranslatorMetaData.java
branches/as7/client/src/main/java/org/teiid/adminapi/impl/WorkerPoolStatisticsMetadata.java
branches/as7/client/src/main/java/org/teiid/net/TeiidURL.java
branches/as7/client/src/main/java/org/teiid/net/socket/SocketServerConnection.java
branches/as7/client/src/test/java/org/teiid/adminapi/impl/TestRequestMetadata.java
branches/as7/client/src/test/java/org/teiid/adminapi/impl/TestSessionMetadata.java
branches/as7/client/src/test/java/org/teiid/adminapi/impl/TestTransactionMetadata.java
branches/as7/client/src/test/java/org/teiid/adminapi/impl/TestVDBMetaData.java
branches/as7/engine/src/main/java/org/teiid/dqp/internal/datamgr/TranslatorRepository.java
branches/as7/engine/src/main/java/org/teiid/dqp/internal/process/DQPWorkContext.java
branches/as7/jboss-integration/pom.xml
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/OperationsConstants.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineAdd.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineOperationHandler.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidExtension.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
branches/as7/pom.xml
branches/as7/runtime/pom.xml
branches/as7/runtime/src/main/java/org/teiid/deployers/TranslatorUtil.java
branches/as7/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java
branches/as7/runtime/src/main/java/org/teiid/services/TeiidLoginContext.java
branches/as7/runtime/src/main/java/org/teiid/transport/LogonImpl.java
Log:
created model nodes for all the admin api and vdb stuff
Added: branches/as7/client/src/main/java/org/teiid/adminapi/AdminPlugin.java
===================================================================
--- branches/as7/client/src/main/java/org/teiid/adminapi/AdminPlugin.java (rev 0)
+++ branches/as7/client/src/main/java/org/teiid/adminapi/AdminPlugin.java 2011-07-04 19:09:19 UTC (rev 3301)
@@ -0,0 +1,32 @@
+/*
+ * 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.adminapi;
+
+import java.util.ResourceBundle;
+
+import org.teiid.core.BundleUtil;
+
+public class AdminPlugin {
+ public static final String PLUGIN_ID = "org.teiid.adminapi" ; //$NON-NLS-1$
+ public static final BundleUtil Util = new BundleUtil(PLUGIN_ID, PLUGIN_ID + ".i18n", ResourceBundle.getBundle(PLUGIN_ID + ".i18n")); //$NON-NLS-1$ //$NON-NLS-2$
+}
Property changes on: branches/as7/client/src/main/java/org/teiid/adminapi/AdminPlugin.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: branches/as7/client/src/main/java/org/teiid/adminapi/impl/CacheStatisticsMetadata.java
===================================================================
--- branches/as7/client/src/main/java/org/teiid/adminapi/impl/CacheStatisticsMetadata.java 2011-07-01 20:26:47 UTC (rev 3300)
+++ branches/as7/client/src/main/java/org/teiid/adminapi/impl/CacheStatisticsMetadata.java 2011-07-04 19:09:19 UTC (rev 3301)
@@ -21,11 +21,8 @@
*/
package org.teiid.adminapi.impl;
-import org.jboss.managed.api.annotation.ManagementProperty;
-import org.jboss.metatype.api.annotations.MetaMapping;
import org.teiid.adminapi.CacheStatistics;
-(a)MetaMapping(CacheStatisticsMetadataMapper.class)
public class CacheStatisticsMetadata extends AdminObjectImpl implements CacheStatistics{
private static final long serialVersionUID = -3514505497661004560L;
@@ -35,7 +32,6 @@
private int requestCount;
@Override
- @ManagementProperty(description="Number of total requests made to the cache", readOnly=true)
public int getRequestCount() {
return requestCount;
}
@@ -45,13 +41,11 @@
}
@Override
- @ManagementProperty(description="Cache hit ratio", readOnly=true)
public double getHitRatio() {
return this.hitRatio;
}
@Override
- @ManagementProperty(description="Total number of cache entries", readOnly=true)
public int getTotalEntries() {
return this.totalEntries;
}
Deleted: branches/as7/client/src/main/java/org/teiid/adminapi/impl/CacheStatisticsMetadataMapper.java
===================================================================
--- branches/as7/client/src/main/java/org/teiid/adminapi/impl/CacheStatisticsMetadataMapper.java 2011-07-01 20:26:47 UTC (rev 3300)
+++ branches/as7/client/src/main/java/org/teiid/adminapi/impl/CacheStatisticsMetadataMapper.java 2011-07-04 19:09:19 UTC (rev 3301)
@@ -1,58 +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.adminapi.impl;
-
-import org.jboss.dmr.ModelNode;
-import org.jboss.dmr.ModelType;
-
-public class CacheStatisticsMetadataMapper {
- private static final String HITRATIO = "hitRatio"; //$NON-NLS-1$
- private static final String TOTAL_ENTRIES = "totalEntries"; //$NON-NLS-1$
- private static final String REQUEST_COUNT = "requestCount"; //$NON-NLS-1$
-
-
- public static ModelNode wrap(CacheStatisticsMetadata object) {
- if (object == null)
- return null;
-
- ModelNode cache = new ModelNode();
- cache.get(ModelNodeConstants.TYPE).set(ModelType.OBJECT);
-
- cache.get(TOTAL_ENTRIES).set(object.getTotalEntries());
- cache.get(HITRATIO).set(object.getHitRatio());
- cache.get(REQUEST_COUNT).set(object.getRequestCount());
-
- return cache;
- }
-
- public static CacheStatisticsMetadata unwrap(ModelNode node) {
- if (node == null)
- return null;
-
- CacheStatisticsMetadata cache = new CacheStatisticsMetadata();
- cache.setTotalEntries(node.get(TOTAL_ENTRIES).asInt());
- cache.setHitRatio(node.get(HITRATIO).asDouble());
- cache.setRequestCount(node.get(REQUEST_COUNT).asInt());
- return cache;
- }
-
-}
Modified: branches/as7/client/src/main/java/org/teiid/adminapi/impl/DataPolicyMetadata.java
===================================================================
--- branches/as7/client/src/main/java/org/teiid/adminapi/impl/DataPolicyMetadata.java 2011-07-01 20:26:47 UTC (rev 3300)
+++ branches/as7/client/src/main/java/org/teiid/adminapi/impl/DataPolicyMetadata.java 2011-07-04 19:09:19 UTC (rev 3301)
@@ -25,16 +25,8 @@
import java.util.ArrayList;
import java.util.List;
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.*;
-import org.jboss.managed.api.annotation.ManagementObject;
-import org.jboss.managed.api.annotation.ManagementObjectID;
-import org.jboss.managed.api.annotation.ManagementProperties;
-import org.jboss.managed.api.annotation.ManagementProperty;
import org.teiid.adminapi.DataPolicy;
@@ -44,7 +36,6 @@
"permissions",
"mappedRoleNames"
})
-(a)ManagementObject(properties=ManagementProperties.EXPLICIT)
public class DataPolicyMetadata implements DataPolicy, Serializable {
private static final long serialVersionUID = -4119646357275977190L;
@@ -70,8 +61,6 @@
protected List<String> mappedRoleNames = new ArrayList<String>();
@Override
- @ManagementProperty(description="Policy Name")
- @ManagementObjectID(type="policy")
public String getName() {
return name;
}
@@ -81,7 +70,6 @@
}
@Override
- @ManagementProperty(description="Policy Description")
public String getDescription() {
return description;
}
@@ -91,7 +79,6 @@
}
@Override
- @ManagementProperty(description="Permissions in a Data Policy", managed=true)
public List<DataPermission> getPermissions() {
return new ArrayList<DataPermission>(this.permissions.getMap().values());
}
@@ -110,7 +97,6 @@
}
@Override
- @ManagementProperty(description="Mapped Container role names mapped to this policy")
public List<String> getMappedRoleNames() {
return mappedRoleNames;
}
@@ -150,7 +136,6 @@
"allowExecute",
"allowAlter"
})
- @ManagementObject(properties=ManagementProperties.EXPLICIT)
public static class PermissionMetaData implements DataPermission, Serializable {
private static final long serialVersionUID = 7034744531663164277L;
@@ -170,8 +155,6 @@
protected Boolean allowAlter;
@Override
- @ManagementProperty(description="Resource Name, for which permission defined")
- //@ManagementObjectID(type="permission")
@XmlElement(name = "resource-name", required = true)
public String getResourceName() {
return resourceName;
@@ -182,7 +165,6 @@
}
@Override
- @ManagementProperty(description="Allows Create")
public Boolean getAllowCreate() {
return allowCreate;
}
@@ -192,7 +174,6 @@
}
@Override
- @ManagementProperty(description="Allows Read")
public Boolean getAllowRead() {
return allowRead;
}
@@ -202,7 +183,6 @@
}
@Override
- @ManagementProperty(description="Allows Update")
public Boolean getAllowUpdate() {
return allowUpdate;
}
@@ -212,7 +192,6 @@
}
@Override
- @ManagementProperty(description="Allows Delete")
public Boolean getAllowDelete() {
return allowDelete;
}
@@ -265,13 +244,11 @@
}
@Override
- @ManagementProperty(description="Allows Alter")
public Boolean getAllowAlter() {
return allowAlter;
}
@Override
- @ManagementProperty(description="Allows Execute")
public Boolean getAllowExecute() {
return allowExecute;
}
@@ -303,7 +280,6 @@
}
@Override
- @ManagementProperty(description="Indicates if the role is mapped to any authenticated user.")
public boolean isAnyAuthenticated() {
return this.anyAuthenticated;
}
Added: branches/as7/client/src/main/java/org/teiid/adminapi/impl/MetadataMapper.java
===================================================================
--- branches/as7/client/src/main/java/org/teiid/adminapi/impl/MetadataMapper.java (rev 0)
+++ branches/as7/client/src/main/java/org/teiid/adminapi/impl/MetadataMapper.java 2011-07-04 19:09:19 UTC (rev 3301)
@@ -0,0 +1,1074 @@
+/*
+ * 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.adminapi.impl;
+
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.dmr.ModelNode;
+import org.jboss.dmr.ModelType;
+import org.teiid.adminapi.AdminPlugin;
+import org.teiid.adminapi.DataPolicy;
+import org.teiid.adminapi.Model;
+import org.teiid.adminapi.Translator;
+import org.teiid.adminapi.Request.ProcessingState;
+import org.teiid.adminapi.Request.ThreadState;
+import org.teiid.adminapi.VDB.ConnectionType;
+import org.teiid.adminapi.VDB.Status;
+import org.teiid.adminapi.impl.DataPolicyMetadata.PermissionMetaData;
+import org.teiid.adminapi.impl.ModelMetaData.ValidationError;
+
+
+public class MetadataMapper {
+ private static final String VDBNAME = "vdb-name"; //$NON-NLS-1$
+ private static final String CONNECTIONTYPE = "connection-type"; //$NON-NLS-1$
+ private static final String STATUS = "status"; //$NON-NLS-1$
+ private static final String VERSION = "vdb-version"; //$NON-NLS-1$
+ private static final String URL = "url"; //$NON-NLS-1$
+ private static final String MODELS = "models"; //$NON-NLS-1$
+ private static final String OVERRIDE_TRANSLATORS = "override-translators"; //$NON-NLS-1$
+ private static final String DESCRIPTION = "description"; //$NON-NLS-1$
+ private static final String PROPERTIES = "properties"; //$NON-NLS-1$
+ private static final String DYNAMIC = "dynamic"; //$NON-NLS-1$
+ private static final String DATA_POLICIES = "data-policies"; //$NON-NLS-1$
+
+
+ public static ModelNode wrap(VDBMetaData vdb) {
+ if (vdb == null) {
+ return null;
+ }
+ ModelNode node = new ModelNode();
+ node.get(ModelNodeConstants.TYPE).set(ModelType.OBJECT);
+
+ node.get(VDBNAME).set(vdb.getName());
+ node.get(CONNECTIONTYPE).set(vdb.getConnectionType().toString());
+ node.get(STATUS).set(vdb.getStatus().toString());
+ node.get(VERSION).set(vdb.getVersion());
+ if (vdb.getUrl() != null) {
+ }
+ if (vdb.getDescription() != null) {
+ node.get(DESCRIPTION).set(vdb.getDescription());
+ }
+ node.get(DYNAMIC).set(vdb.isDynamic());
+
+ //PROPERTIES
+ List<PropertyMetadata> properties = vdb.getJAXBProperties();
+ if (properties!= null && !properties.isEmpty()) {
+ ModelNode propsNode = node.get(CHILDREN, PROPERTIES);
+ for (PropertyMetadata prop:properties) {
+ propsNode.add(PropertyMetaDataMapper.wrap(prop));
+ }
+ }
+
+ // MODELS
+ Map<String, ModelMetaData> models = vdb.getModelMetaDatas();
+ if (models != null && !models.isEmpty()) {
+ ModelNode modelNodes = node.get(CHILDREN, MODELS);
+ for(ModelMetaData model:models.values()) {
+ modelNodes.add(ModelMetadataMapper.wrap(model));
+ }
+ }
+
+ // OVERRIDE_TRANSLATORS
+ List<Translator> translators = vdb.getOverrideTranslators();
+ if (translators != null && !translators.isEmpty()) {
+ ModelNode translatorNodes = node.get(CHILDREN, OVERRIDE_TRANSLATORS);
+ for (Translator translator:translators) {
+ translatorNodes.add(VDBTranslatorMetaDataMapper.wrap((VDBTranslatorMetaData)translator));
+ }
+ }
+
+ // DATA_POLICIES
+ List<DataPolicy> policies = vdb.getDataPolicies();
+ if (policies != null && !policies.isEmpty()) {
+ ModelNode dataPoliciesNodes = node.get(CHILDREN, DATA_POLICIES);
+ for (DataPolicy policy:policies) {
+ dataPoliciesNodes.add(DataPolicyMetadataMapper.wrap((DataPolicyMetadata)policy));
+ }
+ }
+ return node;
+ }
+
+ public static VDBMetaData unwrap(ModelNode node) {
+ if (node == null)
+ return null;
+
+ VDBMetaData vdb = new VDBMetaData();
+ if (node.has(VDBNAME)) {
+ vdb.setName(node.get(VDBNAME).asString());
+ }
+ if (node.has(CONNECTIONTYPE)) {
+ vdb.setConnectionType(node.get(CONNECTIONTYPE).asString());
+ }
+ if (node.has(STATUS)) {
+ vdb.setStatus(node.get(STATUS).asString());
+ }
+ if (node.has(VERSION)) {
+ vdb.setVersion(node.get(VERSION).asInt());
+ }
+ if (node.has(URL)) {
+ vdb.setUrl(node.get(URL).asString());
+ }
+ if(node.has(DESCRIPTION)) {
+ vdb.setDescription(node.get(DESCRIPTION).asString());
+ }
+ if (node.has(DYNAMIC)) {
+ vdb.setDynamic(node.get(DYNAMIC).asBoolean());
+ }
+
+ //PROPERTIES
+ if (node.get(CHILDREN, PROPERTIES).isDefined()) {
+ List<ModelNode> propNodes = node.get(CHILDREN, PROPERTIES).asList();
+ for (ModelNode propNode:propNodes) {
+ PropertyMetadata prop = PropertyMetaDataMapper.unwrap(propNode);
+ if (prop != null) {
+ vdb.addProperty(prop.getName(), prop.getValue());
+ }
+ }
+ }
+
+ // MODELS
+ if (node.get(CHILDREN, MODELS).isDefined()) {
+ List<ModelNode> modelNodes = node.get(CHILDREN, MODELS).asList();
+ for(ModelNode modelNode:modelNodes) {
+ ModelMetaData model = ModelMetadataMapper.unwrap(modelNode);
+ if (model != null) {
+ vdb.addModel(model);
+ }
+ }
+ }
+
+ // OVERRIDE_TRANSLATORS
+ if (node.get(CHILDREN, OVERRIDE_TRANSLATORS).isDefined()) {
+ List<ModelNode> translatorNodes = node.get(CHILDREN, OVERRIDE_TRANSLATORS).asList();
+ for (ModelNode translatorNode:translatorNodes) {
+ VDBTranslatorMetaData translator = VDBTranslatorMetaDataMapper.unwrap(translatorNode);
+ if (translator != null) {
+ vdb.addOverideTranslator(translator);
+ }
+ }
+ }
+
+ // DATA_POLICIES
+ if (node.get(CHILDREN, DATA_POLICIES).isDefined()) {
+ List<ModelNode> policiesNodes = node.get(CHILDREN, DATA_POLICIES).asList();
+ for (ModelNode policyNode:policiesNodes) {
+ DataPolicyMetadata policy = DataPolicyMetadataMapper.unwrap(policyNode);
+ if (policy != null) {
+ vdb.addDataPolicy(policy);
+ }
+
+ }
+ }
+ return vdb;
+ }
+
+ public static ModelNode describe(ModelNode node) {
+ node.get(TYPE).set(ModelType.OBJECT);
+ addAttribute(node, VDBNAME, ModelType.STRING, true);
+
+ ModelNode connectionsAllowed = new ModelNode();
+ connectionsAllowed.add(ConnectionType.NONE.toString());
+ connectionsAllowed.add(ConnectionType.ANY.toString());
+ connectionsAllowed.add(ConnectionType.BY_VERSION.toString());
+ addAttribute(node, CONNECTIONTYPE, ModelType.STRING, false).get(ALLOWED).set(connectionsAllowed);
+
+ ModelNode statusAllowed = new ModelNode();
+ statusAllowed.add(Status.ACTIVE.toString());
+ statusAllowed.add(Status.INACTIVE.toString());
+ addAttribute(node, STATUS, ModelType.STRING, true).get(ALLOWED).set(statusAllowed);
+
+ addAttribute(node, VERSION, ModelType.INT, true);
+ addAttribute(node, URL, ModelType.STRING, false);
+ addAttribute(node, DESCRIPTION, ModelType.STRING, false);
+ addAttribute(node, DYNAMIC, ModelType.BOOLEAN, false);
+
+ ModelNode props = node.get(CHILDREN, PROPERTIES);
+ props.get(DESCRIPTION).set(AdminPlugin.Util.getString(PROPERTIES+DOT_DESC));
+ PropertyMetaDataMapper.describe(props);
+
+ ModelNode models = node.get(CHILDREN, MODELS);
+ ModelMetadataMapper.describe(models);
+ models.get(DESCRIPTION).set(AdminPlugin.Util.getString(MODELS+DOT_DESC));
+ models.get(MIN_OCCURS).set(1);
+
+ ModelNode translators = node.get(CHILDREN, OVERRIDE_TRANSLATORS);
+ translators.get(DESCRIPTION).set(AdminPlugin.Util.getString(OVERRIDE_TRANSLATORS+DOT_DESC));
+ VDBTranslatorMetaDataMapper.describe(translators);
+
+ ModelNode dataPolicies = node.get(CHILDREN, DATA_POLICIES);
+ dataPolicies.get(DESCRIPTION).set(AdminPlugin.Util.getString(DATA_POLICIES+DOT_DESC));
+ DataPolicyMetadataMapper.describe(dataPolicies);
+ return node;
+ }
+
+ /**
+ * model metadata mapper
+ */
+ public static class ModelMetadataMapper {
+ private static final String MODEL_NAME = "model-name"; //$NON-NLS-1$
+ private static final String DESCRIPTION = "description"; //$NON-NLS-1$
+ private static final String VISIBLE = "visible"; //$NON-NLS-1$
+ private static final String MODEL_TYPE = "model-type"; //$NON-NLS-1$
+ private static final String MODELPATH = "model-path"; //$NON-NLS-1$
+ private static final String PROPERTIES = "properties"; //$NON-NLS-1$
+ private static final String SOURCE_MAPPINGS = "source-mappings"; //$NON-NLS-1$
+ private static final String VALIDITY_ERRORS = "validity-errors"; //$NON-NLS-1$
+
+ public static ModelNode wrap(ModelMetaData model) {
+ if (model == null) {
+ return null;
+ }
+ ModelNode node = new ModelNode();
+ node.get(TYPE).set(ModelType.OBJECT);
+
+ node.get(MODEL_NAME).set(model.getName());
+ if (model.getDescription() != null) {
+ node.get(DESCRIPTION).set(model.getDescription());
+ }
+ node.get(VISIBLE).set(model.isVisible());
+ node.get(MODEL_TYPE).set(model.getModelType().toString());
+ if (model.getPath() != null) {
+ node.get(MODELPATH).set(model.getPath());
+ }
+
+ List<PropertyMetadata> properties = model.getJAXBProperties();
+ if (properties!= null && !properties.isEmpty()) {
+ ModelNode propsNode = node.get(CHILDREN, PROPERTIES);
+ for (PropertyMetadata prop:properties) {
+ propsNode.add(PropertyMetaDataMapper.wrap(prop));
+ }
+ }
+
+ List<SourceMappingMetadata> sources = model.getSourceMappings();
+ if (sources != null && !sources.isEmpty()) {
+ ModelNode sourceMappingNode = node.get(CHILDREN, SOURCE_MAPPINGS);
+ for(SourceMappingMetadata source:sources) {
+ sourceMappingNode.add(SourceMappingMetadataMapper.wrap(source));
+ }
+ }
+
+ List<ValidationError> errors = model.getErrors();
+ if (errors != null && !errors.isEmpty()) {
+ ModelNode errorsNode = node.get(CHILDREN, VALIDITY_ERRORS);
+ for (ValidationError error:errors) {
+ errorsNode.add(ValidationErrorMapper.wrap(error));
+ }
+ }
+ return node;
+ }
+
+ public static ModelMetaData unwrap(ModelNode node) {
+ if (node == null) {
+ return null;
+ }
+
+ ModelMetaData model = new ModelMetaData();
+ if (node.has(MODEL_NAME)) {
+ model.setName(node.get(MODEL_NAME).asString());
+ }
+ if (node.has(DESCRIPTION)) {
+ model.setDescription(node.get(DESCRIPTION).asString());
+ }
+ if (node.has(VISIBLE)) {
+ model.setVisible(node.get(VISIBLE).asBoolean());
+ }
+ if(node.has(MODEL_TYPE)) {
+ model.setModelType(node.get(MODEL_TYPE).asString());
+ }
+ if(node.has(MODELPATH)) {
+ model.setPath(node.get(MODELPATH).asString());
+ }
+
+ if (node.get(CHILDREN, PROPERTIES).isDefined()) {
+ List<ModelNode> propNodes = node.get(CHILDREN, PROPERTIES).asList();
+ for (ModelNode propNode:propNodes) {
+ PropertyMetadata prop = PropertyMetaDataMapper.unwrap(propNode);
+ if (prop != null) {
+ model.addProperty(prop.getName(), prop.getValue());
+ }
+ }
+ }
+
+ if (node.get(CHILDREN, SOURCE_MAPPINGS).isDefined()) {
+ List<ModelNode> sourceMappingNodes = node.get(CHILDREN, SOURCE_MAPPINGS).asList();
+ for (ModelNode sourceMapping:sourceMappingNodes) {
+ SourceMappingMetadata source = SourceMappingMetadataMapper.unwrap(sourceMapping);
+ if (source != null) {
+ model.addSourceMapping(source);
+ }
+ }
+ }
+
+ if (node.get(CHILDREN, VALIDITY_ERRORS).isDefined()) {
+ List<ModelNode> errorNodes = node.get(CHILDREN, VALIDITY_ERRORS).asList();
+ for(ModelNode errorNode:errorNodes) {
+ ValidationError error = ValidationErrorMapper.unwrap(errorNode);
+ if (error != null) {
+ model.addError(error);
+ }
+ }
+ }
+ return model;
+ }
+
+ public static ModelNode describe(ModelNode node) {
+ node.get(TYPE).set(ModelType.OBJECT);
+
+ ModelNode modelTypes = new ModelNode();
+ modelTypes.add(Model.Type.PHYSICAL.toString());
+ modelTypes.add(Model.Type.VIRTUAL.toString());
+ modelTypes.add(Model.Type.FUNCTION.toString());
+ modelTypes.add(Model.Type.OTHER.toString());
+ addAttribute(node, MODEL_NAME, ModelType.STRING, true).get(ALLOWED).set(modelTypes);
+
+ addAttribute(node, DESCRIPTION, ModelType.STRING, false);
+ addAttribute(node, VISIBLE, ModelType.BOOLEAN, false);
+ addAttribute(node, MODEL_TYPE, ModelType.STRING, true);
+ addAttribute(node, MODELPATH, ModelType.STRING, false);
+
+ ModelNode props = node.get(CHILDREN, PROPERTIES);
+ props.get(DESCRIPTION).set(AdminPlugin.Util.getString(PROPERTIES+DOT_DESC));
+ PropertyMetaDataMapper.describe(props);
+
+ ModelNode source = node.get(CHILDREN, SOURCE_MAPPINGS);
+ source.get(DESCRIPTION).set(AdminPlugin.Util.getString(SOURCE_MAPPINGS+DOT_DESC));
+ SourceMappingMetadataMapper.describe(source);
+
+ ModelNode errors = node.get(CHILDREN, VALIDITY_ERRORS);
+ errors.get(DESCRIPTION).set(AdminPlugin.Util.getString(VALIDITY_ERRORS+DOT_DESC));
+ ValidationErrorMapper.describe(errors);
+
+ return node;
+ }
+ }
+
+ /**
+ * validation error mapper
+ */
+ public static class ValidationErrorMapper {
+ private static final String ERROR_PATH = "error-path"; //$NON-NLS-1$
+ private static final String SEVERITY = "severity"; //$NON-NLS-1$
+ private static final String MESSAGE = "message"; //$NON-NLS-1$
+
+ public static ModelNode wrap(ValidationError error) {
+ if (error == null) {
+ return null;
+ }
+
+ ModelNode node = new ModelNode();
+ node.get(TYPE).set(ModelType.OBJECT);
+ if (error.getPath() != null) {
+ node.get(ERROR_PATH).set(error.getPath());
+ }
+ node.get(SEVERITY).set(error.getSeverity());
+ node.get(MESSAGE).set(error.getValue());
+
+ return node;
+ }
+
+ public static ValidationError unwrap(ModelNode node) {
+ if (node == null) {
+ return null;
+ }
+
+ ValidationError error = new ValidationError();
+ if (node.has(ERROR_PATH)) {
+ error.setPath(node.get(ERROR_PATH).asString());
+ }
+ if (node.has(SEVERITY)) {
+ error.setSeverity(node.get(SEVERITY).asString());
+ }
+ if(node.has(MESSAGE)) {
+ error.setValue(node.get(MESSAGE).asString());
+ }
+ return error;
+ }
+
+ public static ModelNode describe(ModelNode node) {
+ node.get(TYPE).set(ModelType.OBJECT);
+ addAttribute(node, ERROR_PATH, ModelType.STRING, false);
+ addAttribute(node, SEVERITY, ModelType.STRING, true);
+ addAttribute(node, MESSAGE, ModelType.STRING, true);
+ return node;
+ }
+ }
+
+ /**
+ * Source Mapping Metadata mapper
+ */
+ public static class SourceMappingMetadataMapper {
+ private static final String SOURCE_NAME = "source-name"; //$NON-NLS-1$
+ private static final String JNDI_NAME = "jndi-name"; //$NON-NLS-1$
+ private static final String TRANSLATOR_NAME = "translator-name"; //$NON-NLS-1$
+
+ public static ModelNode wrap(SourceMappingMetadata source) {
+ if (source == null) {
+ return null;
+ }
+
+ ModelNode node = new ModelNode();
+ node.get(TYPE).set(ModelType.OBJECT);
+
+ node.get(SOURCE_NAME).set(source.getName());
+ node.get(JNDI_NAME).set(source.getConnectionJndiName());
+ node.get(TRANSLATOR_NAME).set(source.getTranslatorName());
+ return node;
+ }
+
+ public static SourceMappingMetadata unwrap(ModelNode node) {
+ if (node == null) {
+ return null;
+ }
+ SourceMappingMetadata source = new SourceMappingMetadata();
+ if (node.has(SOURCE_NAME)) {
+ source.setName(node.get(SOURCE_NAME).asString());
+ }
+ if (node.has(JNDI_NAME)) {
+ source.setConnectionJndiName(node.get(JNDI_NAME).asString());
+ }
+ if (node.has(TRANSLATOR_NAME)) {
+ source.setTranslatorName(node.get(TRANSLATOR_NAME).asString());
+ }
+ return source;
+ }
+
+ public static ModelNode describe(ModelNode node) {
+ node.get(TYPE).set(ModelType.OBJECT);
+ addAttribute(node, SOURCE_NAME, ModelType.STRING, true);
+ addAttribute(node, JNDI_NAME, ModelType.STRING, true);
+ addAttribute(node, TRANSLATOR_NAME, ModelType.STRING, true);
+ return node;
+ }
+ }
+
+ /**
+ * Source Mapping Metadata mapper
+ */
+ public static class VDBTranslatorMetaDataMapper {
+ private static final String TRANSLATOR_NAME = "translator-name"; //$NON-NLS-1$
+ private static final String BASETYPE = "base-type"; //$NON-NLS-1$
+ private static final String DESCRIPTION = "description"; //$NON-NLS-1$
+ private static final String PROPERTIES = "properties"; //$NON-NLS-1$
+ private static final String MODULE_NAME = "module-name"; //$NON-NLS-1$
+
+ public static ModelNode wrap(VDBTranslatorMetaData translator) {
+ if (translator == null) {
+ return null;
+ }
+ ModelNode node = new ModelNode();
+ node.get(TYPE).set(ModelType.OBJECT);
+
+ node.get(TRANSLATOR_NAME).set(translator.getName());
+ node.get(BASETYPE).set(translator.getType());
+ if (translator.getDescription() != null) {
+ node.get(DESCRIPTION).set(translator.getDescription());
+ }
+
+ if (translator.getModuleName() != null) {
+ node.get(MODULE_NAME).set(translator.getModuleName());
+ }
+
+ List<PropertyMetadata> properties = translator.getJAXBProperties();
+ if (properties!= null && !properties.isEmpty()) {
+ ModelNode propsNode = node.get(CHILDREN, PROPERTIES);
+ for (PropertyMetadata prop:properties) {
+ propsNode.add(PropertyMetaDataMapper.wrap(prop));
+ }
+ }
+ return node;
+ }
+
+ public static VDBTranslatorMetaData unwrap(ModelNode node) {
+ if (node == null) {
+ return null;
+ }
+ VDBTranslatorMetaData translator = new VDBTranslatorMetaData();
+ if (node.has(TRANSLATOR_NAME)) {
+ translator.setName(node.get(TRANSLATOR_NAME).asString());
+ }
+ if (node.has(BASETYPE)) {
+ translator.setType(node.get(BASETYPE).asString());
+ }
+ if (node.has(DESCRIPTION)) {
+ translator.setDescription(node.get(DESCRIPTION).asString());
+ }
+ if (node.has(MODULE_NAME)) {
+ translator.setModuleName(node.get(MODULE_NAME).asString());
+ }
+
+ if (node.get(CHILDREN,PROPERTIES).isDefined()) {
+ List<ModelNode> propNodes = node.get(CHILDREN, PROPERTIES).asList();
+ for (ModelNode propNode:propNodes) {
+ PropertyMetadata prop = PropertyMetaDataMapper.unwrap(propNode);
+ if (prop != null) {
+ translator.addProperty(prop.getName(), prop.getValue());
+ }
+ }
+ }
+ return translator;
+ }
+
+ public static ModelNode describe(ModelNode node) {
+ node.get(TYPE).set(ModelType.OBJECT);
+ addAttribute(node, TRANSLATOR_NAME, ModelType.STRING, true);
+ addAttribute(node, BASETYPE, ModelType.STRING, true);
+ addAttribute(node, DESCRIPTION, ModelType.STRING, false);
+ addAttribute(node, MODULE_NAME, ModelType.STRING, false);
+
+ ModelNode props = node.get(CHILDREN, PROPERTIES);
+ props.get(DESCRIPTION).set(AdminPlugin.Util.getString(PROPERTIES+DOT_DESC));
+ PropertyMetaDataMapper.describe(props);
+ return node;
+ }
+ }
+
+ /**
+ * Property Metadata mapper
+ */
+ public static class PropertyMetaDataMapper {
+ private static final String PROPERTY_NAME = "property-name"; //$NON-NLS-1$
+ private static final String PROPERTY_VALUE = "property-value"; //$NON-NLS-1$
+
+ public static ModelNode wrap(PropertyMetadata property) {
+ if (property == null) {
+ return null;
+ }
+ ModelNode node = new ModelNode();
+ node.get(ModelNodeConstants.TYPE).set(ModelType.OBJECT);
+
+ node.get(PROPERTY_NAME).set(property.getName());
+ node.get(PROPERTY_VALUE).set(property.getValue());
+
+ return node;
+ }
+
+ public static PropertyMetadata unwrap(ModelNode node) {
+ if(node == null) {
+ return null;
+ }
+ PropertyMetadata property = new PropertyMetadata();
+ if (node.has(PROPERTY_NAME)) {
+ property.setName(node.get(PROPERTY_NAME).asString());
+ }
+ if(node.has(PROPERTY_VALUE)) {
+ property.setValue(node.get(PROPERTY_VALUE).asString());
+ }
+ return property;
+ }
+
+ public static ModelNode describe(ModelNode node) {
+ node.get(TYPE).set(ModelType.OBJECT);
+ addAttribute(node, PROPERTY_NAME, ModelType.STRING, true);
+ addAttribute(node, PROPERTY_VALUE, ModelType.STRING, true);
+ return node;
+ }
+ }
+
+ /**
+ * DataPolicy Metadata mapper
+ */
+ public static class DataPolicyMetadataMapper {
+ private static final String POLICY_NAME = "policy-name"; //$NON-NLS-1$
+ private static final String DATA_PERMISSIONS = "data-permissions"; //$NON-NLS-1$
+ private static final String MAPPED_ROLE_NAMES = "mapped-role-names"; //$NON-NLS-1$
+ private static final String ALLOW_CREATE_TEMP_TABLES = "allow-create-temp-tables"; //$NON-NLS-1$
+ private static final String ANY_AUTHENTICATED = "any-authenticated"; //$NON-NLS-1$
+
+ public static ModelNode wrap(DataPolicyMetadata policy) {
+ if (policy == null) {
+ return null;
+ }
+ ModelNode node = new ModelNode();
+ node.get(ModelNodeConstants.TYPE).set(ModelType.OBJECT);
+
+ node.get(POLICY_NAME).set(policy.getName());
+ if (policy.getDescription() != null) {
+ node.get(DESCRIPTION).set(policy.getDescription());
+ }
+ if (policy.isAllowCreateTemporaryTables() != null) {
+ node.get(ALLOW_CREATE_TEMP_TABLES).set(policy.isAllowCreateTemporaryTables());
+ }
+ node.get(ANY_AUTHENTICATED).set(policy.isAnyAuthenticated());
+
+ //DATA_PERMISSIONS
+ List<DataPolicy.DataPermission> permissions = policy.getPermissions();
+ if (permissions != null && !permissions.isEmpty()) {
+ ModelNode permissionNodes = node.get(CHILDREN, DATA_PERMISSIONS);
+ for (DataPolicy.DataPermission dataPermission:permissions) {
+ permissionNodes.add(PermissionMetaDataMapper.wrap((PermissionMetaData)dataPermission));
+ }
+ }
+
+ //MAPPED_ROLE_NAMES
+ if (policy.getMappedRoleNames() != null && !policy.getMappedRoleNames().isEmpty()) {
+ ModelNode mappedRoleNodes = node.get(CHILDREN, MAPPED_ROLE_NAMES);
+ for (String role:policy.getMappedRoleNames()) {
+ mappedRoleNodes.add(role);
+ }
+ }
+ return node;
+ }
+
+ public static DataPolicyMetadata unwrap(ModelNode node) {
+ if(node == null) {
+ return null;
+ }
+ DataPolicyMetadata policy = new DataPolicyMetadata();
+ if (node.has(POLICY_NAME)) {
+ policy.setName(node.get(POLICY_NAME).asString());
+ }
+ if (node.has(DESCRIPTION)) {
+ policy.setDescription(node.get(DESCRIPTION).asString());
+ }
+ if (node.has(ALLOW_CREATE_TEMP_TABLES)) {
+ policy.setAllowCreateTemporaryTables(node.get(ALLOW_CREATE_TEMP_TABLES).asBoolean());
+ }
+ if (node.has(ANY_AUTHENTICATED)) {
+ policy.setAnyAuthenticated(node.get(ANY_AUTHENTICATED).asBoolean());
+ }
+
+ //DATA_PERMISSIONS
+ if (node.get(CHILDREN, DATA_PERMISSIONS).isDefined()) {
+ List<ModelNode> permissionNodes = node.get(CHILDREN, DATA_PERMISSIONS).asList();
+ for (ModelNode permissionNode:permissionNodes) {
+ PermissionMetaData permission = PermissionMetaDataMapper.unwrap(permissionNode);
+ if (permission != null) {
+ policy.addPermission(permission);
+ }
+ }
+ }
+
+ //MAPPED_ROLE_NAMES
+ if (node.get(CHILDREN, MAPPED_ROLE_NAMES).isDefined()) {
+ List<ModelNode> roleNameNodes = node.get(CHILDREN, MAPPED_ROLE_NAMES).asList();
+ for (ModelNode roleNameNode:roleNameNodes) {
+ policy.addMappedRoleName(roleNameNode.asString());
+ }
+ }
+ return policy;
+ }
+
+ public static ModelNode describe(ModelNode node) {
+ node.get(TYPE).set(ModelType.OBJECT);
+ addAttribute(node, POLICY_NAME, ModelType.STRING, true);
+ addAttribute(node, DESCRIPTION, ModelType.STRING, false);
+ addAttribute(node, ALLOW_CREATE_TEMP_TABLES, ModelType.BOOLEAN, false);
+ addAttribute(node, ANY_AUTHENTICATED, ModelType.BOOLEAN, false);
+
+ ModelNode permissions = node.get(CHILDREN, DATA_PERMISSIONS);
+ PropertyMetaDataMapper.describe(permissions);
+ permissions.get(DESCRIPTION).set(AdminPlugin.Util.getString(DATA_PERMISSIONS+DOT_DESC));
+ permissions.get(MIN_OCCURS).set(1);
+
+ ModelNode roleNames = node.get(CHILDREN, MAPPED_ROLE_NAMES);
+ roleNames.get(TYPE).set(ModelType.LIST);
+ roleNames.get(DESCRIPTION).set(AdminPlugin.Util.getString(MAPPED_ROLE_NAMES+DOT_DESC));
+ roleNames.get("value-type").set(ModelType.STRING); //$NON-NLS-1$
+ return node;
+ }
+ }
+
+ public static class PermissionMetaDataMapper{
+ private static final String RESOURCE_NAME = "resource-name"; //$NON-NLS-1$
+ private static final String ALLOW_CREATE = "allow-create"; //$NON-NLS-1$
+ private static final String ALLOW_DELETE = "allow-delete"; //$NON-NLS-1$
+ private static final String ALLOW_UPADTE = "allow-update"; //$NON-NLS-1$
+ private static final String ALLOW_READ = "allow-read"; //$NON-NLS-1$
+ private static final String ALLOW_EXECUTE = "allow-execute"; //$NON-NLS-1$
+ private static final String ALLOW_ALTER = "allow-alter"; //$NON-NLS-1$
+
+
+
+ public static ModelNode wrap(PermissionMetaData permission) {
+ if (permission == null) {
+ return null;
+ }
+
+ ModelNode node = new ModelNode();
+ node.get(ModelNodeConstants.TYPE).set(ModelType.OBJECT);
+
+ node.get(RESOURCE_NAME).set(permission.getResourceName());
+ if (permission.getAllowCreate() != null) {
+ node.get(ALLOW_CREATE).set(permission.getAllowCreate().booleanValue());
+ }
+ if (permission.getAllowDelete() != null) {
+ node.get(ALLOW_DELETE).set(permission.getAllowDelete().booleanValue());
+ }
+ if (permission.getAllowUpdate() != null) {
+ node.get(ALLOW_UPADTE).set(permission.getAllowUpdate().booleanValue());
+ }
+ if (permission.getAllowRead() != null) {
+ node.get(ALLOW_READ).set(permission.getAllowRead().booleanValue());
+ }
+ if (permission.getAllowExecute() != null) {
+ node.get(ALLOW_EXECUTE).set(permission.getAllowExecute().booleanValue());
+ }
+ if(permission.getAllowAlter() != null) {
+ node.get(ALLOW_ALTER).set(permission.getAllowAlter().booleanValue());
+ }
+ return node;
+ }
+
+ public static PermissionMetaData unwrap(ModelNode node) {
+ if (node == null) {
+ return null;
+ }
+
+ PermissionMetaData permission = new PermissionMetaData();
+ if (node.get(RESOURCE_NAME) != null) {
+ permission.setResourceName(node.get(RESOURCE_NAME).asString());
+ }
+ if (node.has(ALLOW_CREATE)) {
+ permission.setAllowCreate(node.get(ALLOW_CREATE).asBoolean());
+ }
+ if (node.has(ALLOW_DELETE)) {
+ permission.setAllowDelete(node.get(ALLOW_DELETE).asBoolean());
+ }
+ if (node.has(ALLOW_UPADTE)) {
+ permission.setAllowUpdate(node.get(ALLOW_UPADTE).asBoolean());
+ }
+ if (node.has(ALLOW_READ)) {
+ permission.setAllowRead(node.get(ALLOW_READ).asBoolean());
+ }
+ if (node.has(ALLOW_EXECUTE)) {
+ permission.setAllowExecute(node.get(ALLOW_EXECUTE).asBoolean());
+ }
+ if (node.has(ALLOW_ALTER)) {
+ permission.setAllowAlter(node.get(ALLOW_ALTER).asBoolean());
+ }
+ return permission;
+ }
+ public static ModelNode describe(ModelNode node) {
+ addAttribute(node, RESOURCE_NAME, ModelType.STRING, true);
+ addAttribute(node, ALLOW_CREATE, ModelType.BOOLEAN, false);
+ addAttribute(node, ALLOW_DELETE, ModelType.BOOLEAN, false);
+ addAttribute(node, ALLOW_UPADTE, ModelType.BOOLEAN, false);
+ addAttribute(node, ALLOW_READ, ModelType.BOOLEAN, false);
+ addAttribute(node, ALLOW_EXECUTE, ModelType.BOOLEAN, false);
+ addAttribute(node, ALLOW_ALTER, ModelType.BOOLEAN, false);
+ return node;
+ }
+ }
+
+ public static class CacheStatisticsMetadataMapper {
+ private static final String HITRATIO = "hitRatio"; //$NON-NLS-1$
+ private static final String TOTAL_ENTRIES = "totalEntries"; //$NON-NLS-1$
+ private static final String REQUEST_COUNT = "requestCount"; //$NON-NLS-1$
+
+ public static ModelNode wrap(CacheStatisticsMetadata object) {
+ if (object == null)
+ return null;
+
+ ModelNode cache = new ModelNode();
+ cache.get(ModelNodeConstants.TYPE).set(ModelType.OBJECT);
+
+ cache.get(TOTAL_ENTRIES).set(object.getTotalEntries());
+ cache.get(HITRATIO).set(object.getHitRatio());
+ cache.get(REQUEST_COUNT).set(object.getRequestCount());
+
+ return cache;
+ }
+
+ public static CacheStatisticsMetadata unwrap(ModelNode node) {
+ if (node == null)
+ return null;
+
+ CacheStatisticsMetadata cache = new CacheStatisticsMetadata();
+ cache.setTotalEntries(node.get(TOTAL_ENTRIES).asInt());
+ cache.setHitRatio(node.get(HITRATIO).asDouble());
+ cache.setRequestCount(node.get(REQUEST_COUNT).asInt());
+ return cache;
+ }
+
+ public static ModelNode describe(ModelNode node) {
+ node.get(TYPE).set(ModelType.OBJECT);
+ addAttribute(node, TOTAL_ENTRIES, ModelType.STRING, true);
+ addAttribute(node, HITRATIO, ModelType.STRING, true);
+ addAttribute(node, REQUEST_COUNT, ModelType.STRING, true);
+ return node;
+ }
+ }
+
+ public static class RequestMetadataMapper {
+ private static final String TRANSACTION_ID = "transaction-id"; //$NON-NLS-1$
+ private static final String NODE_ID = "node-id"; //$NON-NLS-1$
+ private static final String SOURCE_REQUEST = "source-request"; //$NON-NLS-1$
+ private static final String COMMAND = "command"; //$NON-NLS-1$
+ private static final String START_TIME = "start-time"; //$NON-NLS-1$
+ private static final String SESSION_ID = "session-id"; //$NON-NLS-1$
+ private static final String EXECUTION_ID = "execution-id"; //$NON-NLS-1$
+ private static final String STATE = "processing-state"; //$NON-NLS-1$
+ private static final String THREAD_STATE = "thread-state"; //$NON-NLS-1$
+
+
+ public static ModelNode wrap(RequestMetadata object) {
+ if (object == null) {
+ return null;
+ }
+ ModelNode request = new ModelNode();
+ request.get(ModelNodeConstants.TYPE).set(ModelType.OBJECT);
+
+ request.get(EXECUTION_ID).set(object.getExecutionId());
+ request.get(SESSION_ID).set(object.getSessionId());
+ request.get(START_TIME).set(object.getStartTime());
+ request.get(COMMAND).set(object.getCommand());
+ request.get(SOURCE_REQUEST).set(object.sourceRequest());
+ if (object.getNodeId() != null) {
+ request.get(NODE_ID).set(object.getNodeId());
+ }
+ if (object.getTransactionId() != null) {
+ request.get(TRANSACTION_ID).set(object.getTransactionId());
+ }
+ request.get(STATE).set(object.getState().name());
+ request.get(THREAD_STATE).set(object.getThreadState().name());
+ return request;
+ }
+
+ public static RequestMetadata unwrap(ModelNode node) {
+ if (node == null)
+ return null;
+
+ RequestMetadata request = new RequestMetadata();
+ request.setExecutionId(node.get(EXECUTION_ID).asLong());
+ request.setSessionId(node.get(SESSION_ID).asString());
+ request.setStartTime(node.get(START_TIME).asLong());
+ request.setCommand(node.get(COMMAND).asString());
+ request.setSourceRequest(node.get(SOURCE_REQUEST).asBoolean());
+ if (node.has(NODE_ID)) {
+ request.setNodeId(node.get(NODE_ID).asInt());
+ }
+ if (node.has(TRANSACTION_ID)) {
+ request.setTransactionId(node.get(TRANSACTION_ID).asString());
+ }
+ request.setState(ProcessingState.valueOf(node.get(STATE).asString()));
+ request.setThreadState(ThreadState.valueOf(node.get(THREAD_STATE).asString()));
+ return request;
+ }
+
+ public static ModelNode describe(ModelNode node) {
+ node.get(TYPE).set(ModelType.OBJECT);
+ addAttribute(node, EXECUTION_ID, ModelType.LONG, true);
+ addAttribute(node, SESSION_ID, ModelType.STRING, true);
+ addAttribute(node, START_TIME, ModelType.LONG, true);
+ addAttribute(node, COMMAND, ModelType.STRING, true);
+ addAttribute(node, SOURCE_REQUEST, ModelType.BOOLEAN, true);
+ addAttribute(node, NODE_ID, ModelType.INT, false);
+ addAttribute(node, TRANSACTION_ID, ModelType.STRING, false);
+ addAttribute(node, STATE, ModelType.STRING, true);
+ addAttribute(node, THREAD_STATE, ModelType.STRING, true);
+ return node;
+ }
+ }
+
+ public static class SessionMetadataMapper {
+ private static final String SECURITY_DOMAIN = "security-domain"; //$NON-NLS-1$
+ private static final String VDB_VERSION = "vdb-version"; //$NON-NLS-1$
+ private static final String VDB_NAME = "vdb-name"; //$NON-NLS-1$
+ private static final String USER_NAME = "user-name"; //$NON-NLS-1$
+ private static final String SESSION_ID = "session-id"; //$NON-NLS-1$
+ private static final String LAST_PING_TIME = "last-ping-time"; //$NON-NLS-1$
+ private static final String IP_ADDRESS = "ip-address"; //$NON-NLS-1$
+ private static final String CLIENT_HOST_NAME = "client-host-address"; //$NON-NLS-1$
+ private static final String CREATED_TIME = "created-time"; //$NON-NLS-1$
+ private static final String APPLICATION_NAME = "application-name"; //$NON-NLS-1$
+
+
+ public static ModelNode wrap(SessionMetadata session) {
+ if (session == null) {
+ return null;
+ }
+ ModelNode node = new ModelNode();
+ node.get(ModelNodeConstants.TYPE).set(ModelType.OBJECT);
+
+ if (session.getApplicationName() != null) {
+ node.get(APPLICATION_NAME).set(session.getApplicationName());
+ }
+ node.get(CREATED_TIME).set(session.getCreatedTime());
+ node.get(CLIENT_HOST_NAME).set(session.getClientHostName());
+ node.get(IP_ADDRESS).set(session.getIPAddress());
+ node.get(LAST_PING_TIME).set(session.getLastPingTime());
+ node.get(SESSION_ID).set(session.getSessionId());
+ node.get(USER_NAME).set(session.getUserName());
+ node.get(VDB_NAME).set(session.getVDBName());
+ node.get(VDB_VERSION).set(session.getVDBVersion());
+ if (session.getSecurityDomain() != null){
+ node.get(SECURITY_DOMAIN).set(session.getSecurityDomain());
+ }
+ return node;
+ }
+
+ public static SessionMetadata unwrap(ModelNode node) {
+ if (node == null)
+ return null;
+
+ SessionMetadata session = new SessionMetadata();
+ if (node.has(APPLICATION_NAME)) {
+ session.setApplicationName(node.get(APPLICATION_NAME).asString());
+ }
+ session.setCreatedTime(node.get(CREATED_TIME).asLong());
+ session.setClientHostName(node.get(CLIENT_HOST_NAME).asString());
+ session.setIPAddress(node.get(IP_ADDRESS).asString());
+ session.setLastPingTime(node.get(LAST_PING_TIME).asLong());
+ session.setSessionId(node.get(SESSION_ID).asString());
+ session.setUserName(node.get(USER_NAME).asString());
+ session.setVDBName(node.get(VDB_NAME).asString());
+ session.setVDBVersion(node.get(VDB_VERSION).asInt());
+ if (node.has(SECURITY_DOMAIN)) {
+ session.setSecurityDomain(node.get(SECURITY_DOMAIN).asString());
+ }
+ return session;
+ }
+
+ public static ModelNode describe(ModelNode node) {
+ node.get(TYPE).set(ModelType.OBJECT);
+ addAttribute(node, APPLICATION_NAME, ModelType.STRING, false);
+ addAttribute(node, CREATED_TIME, ModelType.LONG, true);
+ addAttribute(node, CLIENT_HOST_NAME, ModelType.LONG, true);
+ addAttribute(node, IP_ADDRESS, ModelType.STRING, true);
+ addAttribute(node, LAST_PING_TIME, ModelType.LONG, true);
+ addAttribute(node, SESSION_ID, ModelType.STRING, true);
+ addAttribute(node, USER_NAME, ModelType.STRING, true);
+ addAttribute(node, VDB_NAME, ModelType.STRING, true);
+ addAttribute(node, VDB_VERSION, ModelType.INT, true);
+ addAttribute(node, SECURITY_DOMAIN, ModelType.STRING, false);
+ return node;
+ }
+ }
+
+ public static class TransactionMetadataMapper {
+ private static final String ID = "txn-id"; //$NON-NLS-1$
+ private static final String SCOPE = "txn-scope"; //$NON-NLS-1$
+ private static final String CREATED_TIME = "txn-created-time"; //$NON-NLS-1$
+ private static final String ASSOCIATED_SESSION = "session-id"; //$NON-NLS-1$
+
+ public static ModelNode wrap(TransactionMetadata object) {
+ if (object == null)
+ return null;
+
+ ModelNode transaction = new ModelNode();
+ transaction.get(ModelNodeConstants.TYPE).set(ModelType.OBJECT);
+ transaction.get(ASSOCIATED_SESSION).set(object.getAssociatedSession());
+ transaction.get(CREATED_TIME).set(object.getCreatedTime());
+ transaction.get(SCOPE).set(object.getScope());
+ transaction.get(ID).set(object.getId());
+
+ return transaction;
+ }
+
+ public static TransactionMetadata unwrap(ModelNode node) {
+ if (node == null)
+ return null;
+
+ TransactionMetadata transaction = new TransactionMetadata();
+ transaction.setAssociatedSession(node.get(ASSOCIATED_SESSION).asString());
+ transaction.setCreatedTime(node.get(CREATED_TIME).asLong());
+ transaction.setScope(node.get(SCOPE).asString());
+ transaction.setId(node.get(ID).asString());
+ return transaction;
+ }
+
+ public static ModelNode describe(ModelNode node) {
+ node.get(TYPE).set(ModelType.OBJECT);
+ addAttribute(node, ASSOCIATED_SESSION, ModelType.STRING, true);
+ addAttribute(node, CREATED_TIME, ModelType.LONG, true);
+ addAttribute(node, SCOPE, ModelType.LONG, true);
+ addAttribute(node, ID, ModelType.STRING, true);
+ return node;
+ }
+ }
+
+ public static class WorkerPoolStatisticsMetadataMapper {
+ private static final String MAX_THREADS = "max-threads"; //$NON-NLS-1$
+ private static final String HIGHEST_QUEUED = "highest-queued"; //$NON-NLS-1$
+ private static final String QUEUED = "queued"; //$NON-NLS-1$
+ private static final String QUEUE_NAME = "queue-name"; //$NON-NLS-1$
+ private static final String TOTAL_SUBMITTED = "total-submitted"; //$NON-NLS-1$
+ private static final String TOTAL_COMPLETED = "total-completed"; //$NON-NLS-1$
+ private static final String HIGHEST_ACTIVE_THREADS = "highest-active-threads"; //$NON-NLS-1$
+ private static final String ACTIVE_THREADS = "active-threads"; //$NON-NLS-1$
+
+
+ public static ModelNode wrap(WorkerPoolStatisticsMetadata object) {
+ if (object == null)
+ return null;
+ ModelNode transaction = new ModelNode();
+ transaction.get(ModelNodeConstants.TYPE).set(ModelType.OBJECT);
+
+ transaction.get(ACTIVE_THREADS).set(object.getActiveThreads());
+ transaction.get(HIGHEST_ACTIVE_THREADS).set(object.getHighestActiveThreads());
+ transaction.get(TOTAL_COMPLETED).set(object.getTotalCompleted());
+ transaction.get(TOTAL_SUBMITTED).set(object.getTotalSubmitted());
+ transaction.get(QUEUE_NAME).set(object.getQueueName());
+ transaction.get(QUEUED).set(object.getQueued());
+ transaction.get(HIGHEST_QUEUED).set(object.getHighestQueued());
+ transaction.get(MAX_THREADS).set(object.getMaxThreads());
+
+ return transaction;
+ }
+
+ public static WorkerPoolStatisticsMetadata unwrapMetaValue(ModelNode node) {
+ if (node == null)
+ return null;
+
+ WorkerPoolStatisticsMetadata stats = new WorkerPoolStatisticsMetadata();
+ stats.setActiveThreads(node.get(ACTIVE_THREADS).asInt());
+ stats.setHighestActiveThreads(node.get(HIGHEST_ACTIVE_THREADS).asInt());
+ stats.setTotalCompleted(node.get(TOTAL_COMPLETED).asLong());
+ stats.setTotalSubmitted(node.get(TOTAL_SUBMITTED).asLong());
+ stats.setQueueName(node.get(QUEUE_NAME).asString());
+ stats.setQueued(node.get(QUEUED).asInt());
+ stats.setHighestQueued(node.get(HIGHEST_QUEUED).asInt());
+ stats.setMaxThreads(node.get(MAX_THREADS).asInt());
+ return stats;
+ }
+
+ public static ModelNode describe(ModelNode node) {
+ node.get(TYPE).set(ModelType.OBJECT);
+ addAttribute(node, ACTIVE_THREADS, ModelType.INT, true);
+ addAttribute(node, HIGHEST_ACTIVE_THREADS, ModelType.INT, true);
+ addAttribute(node, TOTAL_COMPLETED, ModelType.LONG, true);
+ addAttribute(node, TOTAL_SUBMITTED, ModelType.LONG, true);
+ addAttribute(node, QUEUE_NAME, ModelType.STRING, true);
+ addAttribute(node, QUEUED, ModelType.INT, true);
+ addAttribute(node, HIGHEST_QUEUED, ModelType.INT, true);
+ addAttribute(node, MAX_THREADS, ModelType.INT, true);
+ return node;
+ }
+ }
+
+ private static final String CHILDREN = "children"; //$NON-NLS-1$
+ private static final String ATTRIBUTES = "attributes"; //$NON-NLS-1$
+ private static final String DOT_DESC = ".describe"; //$NON-NLS-1$
+ private static final String TYPE = "type"; //$NON-NLS-1$
+ private static final String MIN_OCCURS = "min-occurs"; //$NON-NLS-1$
+ private static final String REQUIRED = "required"; //$NON-NLS-1$
+ private static final String ALLOWED = "allowed"; //$NON-NLS-1$
+ static ModelNode addAttribute(ModelNode node, String name, ModelType dataType, boolean required) {
+ node.get(ATTRIBUTES, name, TYPE).set(dataType);
+ node.get(ATTRIBUTES, name, DESCRIPTION).set(AdminPlugin.Util.getString(name+DOT_DESC));
+ node.get(ATTRIBUTES, name, REQUIRED).set(required);
+ return node;
+ }
+}
+
+
Property changes on: branches/as7/client/src/main/java/org/teiid/adminapi/impl/MetadataMapper.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: branches/as7/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java
===================================================================
--- branches/as7/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java 2011-07-01 20:26:47 UTC (rev 3300)
+++ branches/as7/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java 2011-07-04 19:09:19 UTC (rev 3301)
@@ -28,17 +28,8 @@
import java.util.LinkedList;
import java.util.List;
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-import javax.xml.bind.annotation.XmlValue;
+import javax.xml.bind.annotation.*;
-import org.jboss.managed.api.annotation.ManagementObject;
-import org.jboss.managed.api.annotation.ManagementObjectID;
-import org.jboss.managed.api.annotation.ManagementProperties;
-import org.jboss.managed.api.annotation.ManagementProperty;
import org.teiid.adminapi.Model;
import org.teiid.adminapi.impl.ModelMetaData.ValidationError.Severity;
@@ -50,7 +41,6 @@
"sources",
"errors"
})
-(a)ManagementObject(properties=ManagementProperties.EXPLICIT)
public class ModelMetaData extends AdminObjectImpl implements Model {
private static final int DEFAULT_ERROR_HISTORY = 10;
@@ -82,9 +72,7 @@
@XmlElement(name = "validation-error")
protected List<ValidationError> errors;
- @ManagementProperty(description="Model Name")
@XmlAttribute(name = "name", required = true)
- @ManagementObjectID(type="models")
public String getName() {
return super.getName();
}
@@ -95,7 +83,6 @@
}
@Override
- @ManagementProperty(description = "Model description")
public String getDescription() {
return description;
}
@@ -105,19 +92,16 @@
}
@Override
- @ManagementProperty(description = "Is Model Source model")
public boolean isSource() {
return getModelType() == Model.Type.PHYSICAL;
}
@Override
- @ManagementProperty(description = "Is Model Visible")
public boolean isVisible() {
return this.visible;
}
@Override
- @ManagementProperty(description = "Model Type")
public Type getModelType() {
try {
return Type.valueOf(modelType.toUpperCase());
@@ -126,7 +110,6 @@
}
}
- @ManagementProperty(description = "Path to model file inside the archive")
public String getPath() {
return path;
}
@@ -136,7 +119,6 @@
}
@Override
- @ManagementProperty(description = "Does Model supports multi-source bindings")
public boolean isSupportsMultiSourceBindings() {
String supports = getPropertyValue(SUPPORTS_MULTI_SOURCE_BINDINGS_KEY);
return Boolean.parseBoolean(supports);
@@ -144,7 +126,6 @@
@Override
@XmlElement(name = "property", type = PropertyMetadata.class)
- @ManagementProperty(description = "Model Properties", managed=true)
public List<PropertyMetadata> getJAXBProperties(){
return super.getJAXBProperties();
}
@@ -169,7 +150,6 @@
this.visible = value;
}
- @ManagementProperty(description = "Source Mappings (defined by user)", managed=true)
public List<SourceMappingMetadata> getSourceMappings(){
return new ArrayList<SourceMappingMetadata>(this.sources.getMap().values());
}
@@ -205,9 +185,12 @@
public void addSourceMapping(String name, String translatorName, String connJndiName) {
this.sources.getMap().put(name, new SourceMappingMetadata(name, translatorName, connJndiName));
+ }
+
+ public void addSourceMapping(SourceMappingMetadata source) {
+ this.sources.getMap().put(source.getName(), new SourceMappingMetadata(source.getName(), source.getTranslatorName(), source.getConnectionJndiName()));
}
- @ManagementProperty(description = "Model Validity Errors", readOnly=true, managed=true)
public List<ValidationError> getErrors(){
return getValidationErrors(Severity.ERROR);
}
@@ -241,6 +224,18 @@
return ve;
}
+ public synchronized ValidationError addError(ValidationError ve) {
+ if (this.errors == null) {
+ this.errors = new LinkedList<ValidationError>();
+ }
+ this.errors.add(ve);
+ if (this.errors.size() > DEFAULT_ERROR_HISTORY) {
+ this.errors.remove(0);
+ }
+ return ve;
+ }
+
+
public synchronized boolean removeError(ValidationError remove) {
if (this.errors == null) {
return false;
@@ -256,7 +251,6 @@
@XmlType(name = "", propOrder = {
"value"
})
- @ManagementObject(properties=ManagementProperties.EXPLICIT)
public static class ValidationError implements Serializable{
private static final long serialVersionUID = 2044197069467559527L;
@@ -278,7 +272,6 @@
this.value = msg;
}
- @ManagementProperty (description="Error Message")
public String getValue() {
return value;
}
@@ -287,7 +280,6 @@
this.value = value;
}
- @ManagementProperty (description="Severity")
public String getSeverity() {
return severity;
}
@@ -296,7 +288,6 @@
this.severity = severity;
}
- @ManagementProperty (description="Path")
public String getPath() {
return path;
}
Modified: branches/as7/client/src/main/java/org/teiid/adminapi/impl/PropertyMetadata.java
===================================================================
--- branches/as7/client/src/main/java/org/teiid/adminapi/impl/PropertyMetadata.java 2011-07-01 20:26:47 UTC (rev 3300)
+++ branches/as7/client/src/main/java/org/teiid/adminapi/impl/PropertyMetadata.java 2011-07-04 19:09:19 UTC (rev 3301)
@@ -29,10 +29,6 @@
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;
-import org.jboss.managed.api.annotation.ManagementObject;
-import org.jboss.managed.api.annotation.ManagementProperties;
-import org.jboss.managed.api.annotation.ManagementProperty;
-
/**
* <pre>
* <complexType name="property">
@@ -49,7 +45,6 @@
*/
@XmlAccessorType(XmlAccessType.NONE)
@XmlType(name = "property")
-(a)ManagementObject(properties=ManagementProperties.EXPLICIT)
public class PropertyMetadata implements Serializable{
private static final long serialVersionUID = -5040224539939758816L;
@@ -66,12 +61,10 @@
this.value = value;
}
- @ManagementProperty(description="property key")
public String getName() {
return name;
}
- @ManagementProperty(description="property value")
public String getValue() {
return value;
}
Modified: branches/as7/client/src/main/java/org/teiid/adminapi/impl/RequestMetadata.java
===================================================================
--- branches/as7/client/src/main/java/org/teiid/adminapi/impl/RequestMetadata.java 2011-07-01 20:26:47 UTC (rev 3300)
+++ branches/as7/client/src/main/java/org/teiid/adminapi/impl/RequestMetadata.java 2011-07-04 19:09:19 UTC (rev 3301)
@@ -24,14 +24,11 @@
import java.util.Date;
-import org.jboss.managed.api.annotation.ManagementProperty;
-import org.jboss.metatype.api.annotations.MetaMapping;
import org.teiid.adminapi.Request;
import org.teiid.core.util.HashCodeUtil;
-(a)MetaMapping(RequestMetadataMapper.class)
public class RequestMetadata extends AdminObjectImpl implements Request {
private static final long serialVersionUID = -2779106368517784259L;
@@ -47,7 +44,6 @@
private ThreadState threadState = ThreadState.RUNNING;
@Override
- @ManagementProperty(description="Unique Identifier for Request", readOnly=true)
public long getExecutionId() {
return executionId;
}
@@ -57,7 +53,6 @@
}
@Override
- @ManagementProperty(description="State of the Request", readOnly=true)
public ProcessingState getState() {
return processingState;
}
@@ -76,7 +71,6 @@
}
@Override
- @ManagementProperty(description="Session ID", readOnly=true)
public String getSessionId() {
return this.sessionId;
}
@@ -86,7 +80,6 @@
}
@Override
- @ManagementProperty(description="Start time for the request", readOnly=true)
public long getStartTime() {
return this.startTime;
}
@@ -96,7 +89,6 @@
}
@Override
- @ManagementProperty(description="Executing Command", readOnly=true)
public String getCommand() {
return this.command;
}
@@ -106,7 +98,6 @@
}
@Override
- @ManagementProperty(description="Is this Connector level request", readOnly=true)
public boolean sourceRequest() {
return sourceRequest;
}
@@ -116,7 +107,6 @@
}
@Override
- @ManagementProperty(description="Node Id", readOnly=true)
public Integer getNodeId() {
return this.nodeID;
}
@@ -126,7 +116,6 @@
}
@Override
- @ManagementProperty(description="Get Transaction XID if transaction involved", readOnly=true)
public String getTransactionId() {
return this.transactionId;
}
Deleted: branches/as7/client/src/main/java/org/teiid/adminapi/impl/RequestMetadataMapper.java
===================================================================
--- branches/as7/client/src/main/java/org/teiid/adminapi/impl/RequestMetadataMapper.java 2011-07-01 20:26:47 UTC (rev 3300)
+++ branches/as7/client/src/main/java/org/teiid/adminapi/impl/RequestMetadataMapper.java 2011-07-04 19:09:19 UTC (rev 3301)
@@ -1,79 +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.adminapi.impl;
-
-import org.jboss.dmr.ModelNode;
-import org.jboss.dmr.ModelType;
-import org.teiid.adminapi.Request.ProcessingState;
-import org.teiid.adminapi.Request.ThreadState;
-
-public class RequestMetadataMapper {
- private static final String TRANSACTION_ID = "transactionId"; //$NON-NLS-1$
- private static final String NODE_ID = "nodeId"; //$NON-NLS-1$
- private static final String SOURCE_REQUEST = "sourceRequest"; //$NON-NLS-1$
- private static final String COMMAND = "command"; //$NON-NLS-1$
- private static final String START_TIME = "startTime"; //$NON-NLS-1$
- private static final String SESSION_ID = "sessionId"; //$NON-NLS-1$
- private static final String EXECUTION_ID = "executionId"; //$NON-NLS-1$
- private static final String STATE = "processingState"; //$NON-NLS-1$
- private static final String THREAD_STATE = "threadState"; //$NON-NLS-1$
-
-
- public static ModelNode wrap(RequestMetadata object) {
-
- if (object == null) {
- return null;
- }
-
- ModelNode request = new ModelNode();
- request.get(ModelNodeConstants.TYPE).set(ModelType.OBJECT);
-
- request.get(EXECUTION_ID).set(object.getExecutionId());
- request.get(SESSION_ID).set(object.getSessionId());
- request.get(START_TIME).set(object.getStartTime());
- request.get(COMMAND).set(object.getCommand());
- request.get(SOURCE_REQUEST).set(object.sourceRequest());
- request.get(NODE_ID).set(object.getNodeId());
- request.get(TRANSACTION_ID).set(object.getTransactionId());
- request.get(STATE).set(object.getState().name());
- request.get(THREAD_STATE).set(object.getThreadState().name());
- return request;
- }
-
- public static RequestMetadata unwrap(ModelNode node) {
- if (node == null)
- return null;
-
- RequestMetadata request = new RequestMetadata();
- request.setExecutionId(node.get(EXECUTION_ID).asLong());
- request.setSessionId(node.get(SESSION_ID).asString());
- request.setStartTime(node.get(START_TIME).asLong());
- request.setCommand(node.get(COMMAND).asString());
- request.setSourceRequest(node.get(SOURCE_REQUEST).asBoolean());
- request.setNodeId(node.get(NODE_ID).asInt());
- request.setTransactionId(node.get(TRANSACTION_ID).asString());
- request.setState(ProcessingState.valueOf(node.get(STATE).asString()));
- request.setThreadState(ThreadState.valueOf(node.get(THREAD_STATE).asString()));
- return request;
- }
-
-}
Modified: branches/as7/client/src/main/java/org/teiid/adminapi/impl/SessionMetadata.java
===================================================================
--- branches/as7/client/src/main/java/org/teiid/adminapi/impl/SessionMetadata.java 2011-07-01 20:26:47 UTC (rev 3300)
+++ branches/as7/client/src/main/java/org/teiid/adminapi/impl/SessionMetadata.java 2011-07-04 19:09:19 UTC (rev 3301)
@@ -24,10 +24,7 @@
import java.util.Date;
import javax.security.auth.Subject;
-import javax.security.auth.login.LoginContext;
-import org.jboss.managed.api.annotation.ManagementProperty;
-import org.jboss.metatype.api.annotations.MetaMapping;
import org.teiid.adminapi.Session;
import org.teiid.client.security.SessionToken;
@@ -36,7 +33,6 @@
/**
* Add and delete properties also in the Mapper class for correct wrapping for profile service.
*/
-(a)MetaMapping(SessionMetadataMapper.class)
public class SessionMetadata extends AdminObjectImpl implements Session {
private static final long serialVersionUID = 918638989081830034L;
@@ -54,12 +50,11 @@
//server session state
private transient VDBMetaData vdb;
private transient SessionToken sessionToken;
- private transient LoginContext loginContext;
+ private transient Subject subject;
private transient Object securityContext;
private transient boolean embedded;
@Override
- @ManagementProperty(description="Application assosiated with Session", readOnly=true)
public String getApplicationName() {
return this.applicationName;
}
@@ -69,7 +64,6 @@
}
@Override
- @ManagementProperty(description="When session created", readOnly=true)
public long getCreatedTime() {
return this.createdTime;
}
@@ -79,7 +73,6 @@
}
@Override
- @ManagementProperty(description="Host name from where the session created", readOnly=true)
public String getClientHostName() {
return this.clientHostName;
}
@@ -89,7 +82,6 @@
}
@Override
- @ManagementProperty(description="IP address from where session is created", readOnly=true)
public String getIPAddress() {
return this.ipAddress;
}
@@ -99,7 +91,6 @@
}
@Override
- @ManagementProperty(description="Last ping time", readOnly=true)
public long getLastPingTime() {
return this.lastPingTime;
}
@@ -109,7 +100,6 @@
}
@Override
- @ManagementProperty(description="Session ID", readOnly=true)
public String getSessionId() {
return this.sessionId;
}
@@ -119,7 +109,6 @@
}
@Override
- @ManagementProperty(description="User name assosiated with session", readOnly=true)
public String getUserName() {
return this.userName;
}
@@ -129,7 +118,6 @@
}
@Override
- @ManagementProperty(description="VDB name assosiated with session", readOnly=true)
public String getVDBName() {
return this.vdbName;
}
@@ -139,7 +127,6 @@
}
@Override
- @ManagementProperty(description="VDB version name assosiated with session", readOnly=true)
public int getVDBVersion() {
return this.vdbVersion;
}
@@ -149,7 +136,6 @@
}
@Override
- @ManagementProperty(description="Security Domain that session logged into", readOnly=true)
public String getSecurityDomain() {
return this.securityDomain;
}
@@ -190,14 +176,10 @@
this.sessionToken = sessionToken;
}
- public LoginContext getLoginContext() {
- return loginContext;
+ public void setSubject(Subject subject) {
+ this.subject = subject;
}
- public void setLoginContext(LoginContext loginContext) {
- this.loginContext = loginContext;
- }
-
public Object getSecurityContext() {
return securityContext;
}
@@ -207,7 +189,7 @@
}
public Subject getSubject() {
- return this.loginContext.getSubject();
+ return this.subject;
}
public void setEmbedded(boolean embedded) {
Deleted: branches/as7/client/src/main/java/org/teiid/adminapi/impl/SessionMetadataMapper.java
===================================================================
--- branches/as7/client/src/main/java/org/teiid/adminapi/impl/SessionMetadataMapper.java 2011-07-01 20:26:47 UTC (rev 3300)
+++ branches/as7/client/src/main/java/org/teiid/adminapi/impl/SessionMetadataMapper.java 2011-07-04 19:09:19 UTC (rev 3301)
@@ -1,80 +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.adminapi.impl;
-
-import org.jboss.dmr.ModelNode;
-import org.jboss.dmr.ModelType;
-
-
-public class SessionMetadataMapper {
- private static final String SECURITY_DOMAIN = "securityDomain"; //$NON-NLS-1$
- private static final String VDB_VERSION = "VDBVersion"; //$NON-NLS-1$
- private static final String VDB_NAME = "VDBName"; //$NON-NLS-1$
- private static final String USER_NAME = "userName"; //$NON-NLS-1$
- private static final String SESSION_ID = "sessionId"; //$NON-NLS-1$
- private static final String LAST_PING_TIME = "lastPingTime"; //$NON-NLS-1$
- private static final String IP_ADDRESS = "IPAddress"; //$NON-NLS-1$
- private static final String CLIENT_HOST_NAME = "clientHostName"; //$NON-NLS-1$
- private static final String CREATED_TIME = "createdTime"; //$NON-NLS-1$
- private static final String APPLICATION_NAME = "applicationName"; //$NON-NLS-1$
-
-
- public static ModelNode wrap(SessionMetadata object) {
- if (object == null) {
- return null;
- }
- ModelNode session = new ModelNode();
- session.get(ModelNodeConstants.TYPE).set(ModelType.OBJECT);
-
- session.get(APPLICATION_NAME).set(object.getApplicationName());
- session.get(CREATED_TIME).set(object.getCreatedTime());
- session.get(CLIENT_HOST_NAME).set(object.getClientHostName());
- session.get(IP_ADDRESS).set(object.getIPAddress());
- session.get(LAST_PING_TIME).set(object.getLastPingTime());
- session.get(SESSION_ID).set(object.getSessionId());
- session.get(USER_NAME).set(object.getUserName());
- session.get(VDB_NAME).set(object.getVDBName());
- session.get(VDB_VERSION).set(object.getVDBVersion());
- session.get(SECURITY_DOMAIN).set(object.getSecurityDomain());
-
- return session;
- }
-
- public static SessionMetadata unwrap(ModelNode node) {
- if (node == null)
- return null;
-
- SessionMetadata session = new SessionMetadata();
- session.setApplicationName(node.get(APPLICATION_NAME).asString());
- session.setCreatedTime(node.get(CREATED_TIME).asLong());
- session.setClientHostName(node.get(CLIENT_HOST_NAME).asString());
- session.setIPAddress(node.get(IP_ADDRESS).asString());
- session.setLastPingTime(node.get(LAST_PING_TIME).asLong());
- session.setSessionId(node.get(SESSION_ID).asString());
- session.setUserName(node.get(USER_NAME).asString());
- session.setVDBName(node.get(VDB_NAME).asString());
- session.setVDBVersion(node.get(VDB_VERSION).asInt());
- session.setSecurityDomain(node.get(SECURITY_DOMAIN).asString());
- return session;
- }
-
-}
Modified: branches/as7/client/src/main/java/org/teiid/adminapi/impl/SourceMappingMetadata.java
===================================================================
--- branches/as7/client/src/main/java/org/teiid/adminapi/impl/SourceMappingMetadata.java 2011-07-01 20:26:47 UTC (rev 3300)
+++ branches/as7/client/src/main/java/org/teiid/adminapi/impl/SourceMappingMetadata.java 2011-07-04 19:09:19 UTC (rev 3301)
@@ -29,14 +29,8 @@
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;
-import org.jboss.managed.api.annotation.ManagementObject;
-import org.jboss.managed.api.annotation.ManagementObjectID;
-import org.jboss.managed.api.annotation.ManagementProperties;
-import org.jboss.managed.api.annotation.ManagementProperty;
-
@XmlAccessorType(XmlAccessType.NONE)
@XmlType(name = "")
-(a)ManagementObject(properties=ManagementProperties.EXPLICIT)
public class SourceMappingMetadata implements Serializable {
private static final long serialVersionUID = -4417878417697685794L;
@@ -57,8 +51,6 @@
this.jndiName = connJndiName;
}
- @ManagementProperty (description="Source Name")
- @ManagementObjectID(type="source")
public String getName() {
return name;
}
@@ -67,7 +59,6 @@
this.name = name;
}
- @ManagementProperty (description="JNDI Name of the resource to assosiate with Source name")
public String getConnectionJndiName() {
// this default could be controlled if needed.
if (this.jndiName == null) {
@@ -80,7 +71,6 @@
this.jndiName = jndiName;
}
- @ManagementProperty (description="Translator Name")
public String getTranslatorName() {
return translatorName;
}
Modified: branches/as7/client/src/main/java/org/teiid/adminapi/impl/TransactionMetadata.java
===================================================================
--- branches/as7/client/src/main/java/org/teiid/adminapi/impl/TransactionMetadata.java 2011-07-01 20:26:47 UTC (rev 3300)
+++ branches/as7/client/src/main/java/org/teiid/adminapi/impl/TransactionMetadata.java 2011-07-04 19:09:19 UTC (rev 3301)
@@ -24,12 +24,9 @@
import java.util.Date;
-import org.jboss.managed.api.annotation.ManagementProperty;
-import org.jboss.metatype.api.annotations.MetaMapping;
import org.teiid.adminapi.Transaction;
-(a)MetaMapping(TransactionMetadataMapper.class)
public class TransactionMetadata extends AdminObjectImpl implements Transaction {
private static final long serialVersionUID = -8588785315218789068L;
@@ -39,7 +36,6 @@
private long createdTime;
@Override
- @ManagementProperty(description="Session ID", readOnly=true)
public String getAssociatedSession() {
return associatedSession;
}
@@ -49,7 +45,6 @@
}
@Override
- @ManagementProperty(description="Scope", readOnly=true)
public String getScope() {
return scope;
}
@@ -59,7 +54,6 @@
}
@Override
- @ManagementProperty(description="ID", readOnly=true)
public String getId() {
return id;
}
@@ -69,7 +63,6 @@
}
@Override
- @ManagementProperty(description="Transaction created time", readOnly=true)
public long getCreatedTime() {
return createdTime;
}
Deleted: branches/as7/client/src/main/java/org/teiid/adminapi/impl/TransactionMetadataMapper.java
===================================================================
--- branches/as7/client/src/main/java/org/teiid/adminapi/impl/TransactionMetadataMapper.java 2011-07-01 20:26:47 UTC (rev 3300)
+++ branches/as7/client/src/main/java/org/teiid/adminapi/impl/TransactionMetadataMapper.java 2011-07-04 19:09:19 UTC (rev 3301)
@@ -1,60 +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.adminapi.impl;
-
-import org.jboss.dmr.ModelNode;
-import org.jboss.dmr.ModelType;
-
-public class TransactionMetadataMapper {
- private static final String ID = "id"; //$NON-NLS-1$
- private static final String SCOPE = "scope"; //$NON-NLS-1$
- private static final String CREATED_TIME = "createdTime"; //$NON-NLS-1$
- private static final String ASSOCIATED_SESSION = "associatedSession"; //$NON-NLS-1$
-
- public static ModelNode wrap(TransactionMetadata object) {
- if (object == null)
- return null;
-
- ModelNode transaction = new ModelNode();
- transaction.get(ModelNodeConstants.TYPE).set(ModelType.OBJECT);
-
- transaction.get(ASSOCIATED_SESSION).set(object.getAssociatedSession());
- transaction.get(CREATED_TIME).set(object.getCreatedTime());
- transaction.get(SCOPE).set(object.getScope());
- transaction.get(ID).set(object.getId());
-
- return transaction;
- }
-
- public static TransactionMetadata unwrap(ModelNode node) {
- if (node == null)
- return null;
-
- TransactionMetadata transaction = new TransactionMetadata();
- transaction.setAssociatedSession(node.get(ASSOCIATED_SESSION).asString());
- transaction.setCreatedTime(node.get(CREATED_TIME).asLong());
- transaction.setScope(node.get(SCOPE).asString());
- transaction.setId(node.get(ID).asString());
- return transaction;
- }
-}
Deleted: branches/as7/client/src/main/java/org/teiid/adminapi/impl/TranslatorMetaData.java
===================================================================
--- branches/as7/client/src/main/java/org/teiid/adminapi/impl/TranslatorMetaData.java 2011-07-01 20:26:47 UTC (rev 3300)
+++ branches/as7/client/src/main/java/org/teiid/adminapi/impl/TranslatorMetaData.java 2011-07-04 19:09:19 UTC (rev 3301)
@@ -1,32 +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.adminapi.impl;
-
-import org.jboss.managed.api.annotation.ManagementComponent;
-import org.jboss.managed.api.annotation.ManagementObject;
-import org.jboss.managed.api.annotation.ManagementProperties;
-
-@ManagementObject(componentType=@ManagementComponent(type="teiid",subtype="translator"), properties=ManagementProperties.EXPLICIT)
-public class TranslatorMetaData extends VDBTranslatorMetaData{
- private static final long serialVersionUID = 116875548438603151L;
- public static final String TRANSLATOR_PREFIX = "translator-"; //$NON-NLS-1$
-}
Deleted: branches/as7/client/src/main/java/org/teiid/adminapi/impl/TranslatorPropertyFactory.java
===================================================================
--- branches/as7/client/src/main/java/org/teiid/adminapi/impl/TranslatorPropertyFactory.java 2011-07-01 20:26:47 UTC (rev 3300)
+++ branches/as7/client/src/main/java/org/teiid/adminapi/impl/TranslatorPropertyFactory.java 2011-07-04 19:09:19 UTC (rev 3301)
@@ -1,109 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.teiid.adminapi.impl;
-
-import java.io.ObjectStreamException;
-import java.io.Serializable;
-
-import org.jboss.beans.info.spi.BeanInfo;
-import org.jboss.beans.info.spi.PropertyInfo;
-import org.jboss.managed.api.Fields;
-import org.jboss.managed.api.ManagedObject;
-import org.jboss.managed.api.factory.ManagedObjectFactory;
-import org.jboss.managed.plugins.ManagedPropertyImpl;
-import org.jboss.managed.spi.factory.InstanceClassFactory;
-import org.jboss.metatype.api.types.MapCompositeMetaType;
-import org.jboss.metatype.api.types.MetaType;
-import org.jboss.metatype.api.types.SimpleMetaType;
-import org.jboss.metatype.api.values.MetaValue;
-
-
-public class TranslatorPropertyFactory extends ManagedPropertyImpl {
- private ManagedObjectFactory moFactory;
- private MapCompositeMetaType type;
-
- public TranslatorPropertyFactory(String s) {
- super(s);
- }
-
- public TranslatorPropertyFactory(Fields fields) {
- super(fields);
- type = new MapCompositeMetaType(SimpleMetaType.STRING);
- setField(Fields.META_TYPE, null);
- }
-
- public TranslatorPropertyFactory(ManagedObject managedObject, Fields fields) {
- super(managedObject, fields);
- type = new MapCompositeMetaType(SimpleMetaType.STRING);
- setField(Fields.META_TYPE, null);
- }
-
- public MetaType getMetaType() {
- return type;
- }
-
- public void setField(String fieldName, Serializable value) {
- if (Fields.META_TYPE.equals(fieldName))
- value = type;
- super.setField(fieldName, value);
- }
-
- /**
- * Write the value back to the attachment if there is a PropertyInfo in the
- * Fields.PROPERTY_INFO field.
- */
- @Override
- @SuppressWarnings("unchecked")
- public void setValue(MetaValue value) {
- super.setValue(value);
-
- PropertyInfo propertyInfo = getField(Fields.PROPERTY_INFO,PropertyInfo.class);
- if (propertyInfo != null) {
- Object attachment = getManagedObject().getAttachment();
- if (attachment != null) {
- MetaValue metaValue = value;
- InstanceClassFactory icf = getMOFactory().getInstanceClassFactory(attachment.getClass());
- BeanInfo beanInfo = propertyInfo.getBeanInfo();
- icf.setValue(beanInfo, this, attachment, metaValue);
- }
- }
- }
-
- private ManagedObjectFactory getMOFactory() {
- if (moFactory == null)
- moFactory = ManagedObjectFactory.getInstance();
- return moFactory;
- }
-
- /**
- * Expose only plain ManangedPropertyImpl.
- *
- * @return simpler ManagedPropertyImpl
- * @throws java.io.ObjectStreamException
- * for any error
- */
- private Object writeReplace() throws ObjectStreamException {
- ManagedPropertyImpl managedProperty = new ManagedPropertyImpl(getManagedObject(), getFields());
- managedProperty.setTargetManagedObject(getTargetManagedObject());
- return managedProperty;
- }
-}
Modified: branches/as7/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java
===================================================================
--- branches/as7/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java 2011-07-01 20:26:47 UTC (rev 3300)
+++ branches/as7/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java 2011-07-04 19:09:19 UTC (rev 3301)
@@ -22,24 +22,10 @@
package org.teiid.adminapi.impl;
import java.net.URL;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.*;
-import org.jboss.managed.api.annotation.ManagementComponent;
-import org.jboss.managed.api.annotation.ManagementObject;
-import org.jboss.managed.api.annotation.ManagementObjectID;
-import org.jboss.managed.api.annotation.ManagementProperties;
-import org.jboss.managed.api.annotation.ManagementProperty;
import org.teiid.adminapi.DataPolicy;
import org.teiid.adminapi.Model;
import org.teiid.adminapi.Translator;
@@ -48,7 +34,6 @@
import org.teiid.core.util.StringUtil;
-@ManagementObject(componentType=@ManagementComponent(type="teiid",subtype="vdb"), properties=ManagementProperties.EXPLICIT)
@XmlAccessorType(XmlAccessType.NONE)
@XmlType(name = "", propOrder = {
"description",
@@ -110,14 +95,11 @@
private ConnectionType connectionType = VDB.ConnectionType.BY_VERSION;
private boolean removed;
- @ManagementProperty(description="Name of the VDB")
@XmlAttribute(name = "name", required = true)
public String getName() {
return super.getName();
}
- @ManagementProperty(description="Full Name of the VDB")
- @ManagementObjectID(type="vdb")
public String getFullName() {
return getName() + VERSION_DELIM + getVersion();
}
@@ -136,7 +118,6 @@
}
@Override
- @ManagementProperty(description="Collections Allowed")
public ConnectionType getConnectionType() {
return this.connectionType;
}
@@ -145,8 +126,11 @@
this.connectionType = allowConnections;
}
+ public void setConnectionType(String allowConnections) {
+ this.connectionType = ConnectionType.valueOf(allowConnections);
+ }
+
@Override
- @ManagementProperty(description="VDB Status")
public Status getStatus() {
return this.status;
}
@@ -155,8 +139,12 @@
this.status = s;
}
+ public void setStatus(String s) {
+ this.status = Status.valueOf(s);
+ }
+
+
@Override
- @ManagementProperty(description="VDB version")
public int getVersion() {
return this.version;
}
@@ -166,7 +154,6 @@
}
@Override
- @ManagementProperty(description = "The VDB file url")
public String getUrl() {
return this.fileUrl;
}
@@ -194,7 +181,6 @@
}
@Override
- @ManagementProperty(description="Models in a VDB", managed=true)
public List<Model> getModels(){
return new ArrayList<Model>(this.models.getMap().values());
}
@@ -220,7 +206,6 @@
}
@Override
- @ManagementProperty(description="Translators in a VDB", managed=true)
public List<Translator> getOverrideTranslators() {
return new ArrayList<Translator>(this.translators.getMap().values());
}
@@ -231,8 +216,11 @@
}
}
+ public void addOverideTranslator(VDBTranslatorMetaData t) {
+ this.translators.getMap().put(t.getName(), t);
+ }
+
@Override
- @ManagementProperty(description = "Description")
public String getDescription() {
return this.description;
}
@@ -242,7 +230,6 @@
}
@Override
- @ManagementProperty(description = "VDB validity errors", readOnly=true)
public List<String> getValidityErrors(){
List<String> allErrors = new ArrayList<String>();
for (ModelMetaData model:this.models.getMap().values()) {
@@ -259,7 +246,6 @@
}
@Override
- @ManagementProperty(description = "Is VDB Valid", readOnly=true)
public boolean isValid() {
if (!getValidityErrors().isEmpty()) {
return false;
@@ -310,12 +296,10 @@
// This one manages the JAXB binding
@Override
@XmlElement(name = "property", type = PropertyMetadata.class)
- @ManagementProperty(description = "VDB Properties", managed=true)
public List<PropertyMetadata> getJAXBProperties(){
return super.getJAXBProperties();
}
- @ManagementProperty(description="Is this a Dynamic VDB")
public boolean isDynamic() {
return dynamic;
}
@@ -325,7 +309,6 @@
}
@Override
- @ManagementProperty(description="Data Policies in a VDB", managed=true)
public List<DataPolicy> getDataPolicies(){
return new ArrayList<DataPolicy>(this.dataPolicies.getMap().values());
}
Modified: branches/as7/client/src/main/java/org/teiid/adminapi/impl/VDBTranslatorMetaData.java
===================================================================
--- branches/as7/client/src/main/java/org/teiid/adminapi/impl/VDBTranslatorMetaData.java 2011-07-01 20:26:47 UTC (rev 3300)
+++ branches/as7/client/src/main/java/org/teiid/adminapi/impl/VDBTranslatorMetaData.java 2011-07-04 19:09:19 UTC (rev 3301)
@@ -28,16 +28,10 @@
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
-import org.jboss.managed.api.annotation.ManagementObject;
-import org.jboss.managed.api.annotation.ManagementObjectID;
-import org.jboss.managed.api.annotation.ManagementProperties;
-import org.jboss.managed.api.annotation.ManagementProperty;
-import org.jboss.managed.api.annotation.ManagementPropertyFactory;
import org.teiid.adminapi.Translator;
@XmlAccessorType(XmlAccessType.NONE)
-(a)ManagementObject(properties=ManagementProperties.EXPLICIT)
public class VDBTranslatorMetaData extends AdminObjectImpl implements Translator {
private static final long serialVersionUID = -3454161477587996138L;
private String type;
@@ -46,8 +40,6 @@
private String moduleName;
@Override
- @ManagementProperty(description="Name of the Translator", mandatory = true)
- @ManagementObjectID(type="translator")
public String getName() {
return super.getName();
}
@@ -58,7 +50,6 @@
}
@Override
- @ManagementProperty(description="Base type of Translator", mandatory = true)
public String getType() {
return type;
}
@@ -70,8 +61,6 @@
@Override
@XmlElement(name = "property", type = PropertyMetadata.class)
- @ManagementProperty(name="property", description = "Translator Properties", managed=true)
- @ManagementPropertyFactory(TranslatorPropertyFactory.class)
public List<PropertyMetadata> getJAXBProperties(){
return super.getJAXBProperties();
}
@@ -89,7 +78,6 @@
addProperty(EXECUTION_FACTORY_CLASS, clazz.getName());
}
- @ManagementProperty(description="Translator Description")
public String getDescription() {
return this.description;
}
Modified: branches/as7/client/src/main/java/org/teiid/adminapi/impl/WorkerPoolStatisticsMetadata.java
===================================================================
--- branches/as7/client/src/main/java/org/teiid/adminapi/impl/WorkerPoolStatisticsMetadata.java 2011-07-01 20:26:47 UTC (rev 3300)
+++ branches/as7/client/src/main/java/org/teiid/adminapi/impl/WorkerPoolStatisticsMetadata.java 2011-07-04 19:09:19 UTC (rev 3301)
@@ -22,14 +22,11 @@
package org.teiid.adminapi.impl;
-import org.jboss.managed.api.annotation.ManagementProperty;
-import org.jboss.metatype.api.annotations.MetaMapping;
import org.teiid.adminapi.WorkerPoolStatistics;
/**
* This class is a holder for all the statistics gathered about a worker pool.
*/
-(a)MetaMapping(WorkerPoolStatisticsMetadataMapper.class)
public class WorkerPoolStatisticsMetadata extends AdminObjectImpl implements WorkerPoolStatistics {
private static final long serialVersionUID = -4917902925523802295L;
@@ -44,49 +41,41 @@
private long totalCompleted;
@Override
- @ManagementProperty(description="Number of Active Threads", readOnly=true)
public int getActiveThreads() {
return activeThreads;
}
@Override
- @ManagementProperty(description="Highest active threads", readOnly=true)
public int getHighestActiveThreads() {
return highestActiveThreads;
}
@Override
- @ManagementProperty(description="Total Completed Tasks", readOnly=true)
public long getTotalCompleted() {
return totalCompleted;
}
@Override
- @ManagementProperty(description="Total submitted Tasks", readOnly=true)
public long getTotalSubmitted() {
return totalSubmitted;
}
@Override
- @ManagementProperty(description="Queue Name", readOnly=true)
public String getQueueName() {
return getName();
}
@Override
- @ManagementProperty(description="Currently Queued Tasks", readOnly=true)
public int getQueued() {
return queued;
}
@Override
- @ManagementProperty(description="Highest Queued Tasks", readOnly=true)
public int getHighestQueued() {
return highestQueued;
}
@Override
- @ManagementProperty(description="Max Threads", readOnly=true)
public int getMaxThreads() {
return maxThreads;
}
Deleted: branches/as7/client/src/main/java/org/teiid/adminapi/impl/WorkerPoolStatisticsMetadataMapper.java
===================================================================
--- branches/as7/client/src/main/java/org/teiid/adminapi/impl/WorkerPoolStatisticsMetadataMapper.java 2011-07-01 20:26:47 UTC (rev 3300)
+++ branches/as7/client/src/main/java/org/teiid/adminapi/impl/WorkerPoolStatisticsMetadataMapper.java 2011-07-04 19:09:19 UTC (rev 3301)
@@ -1,72 +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.adminapi.impl;
-
-import org.jboss.dmr.ModelNode;
-import org.jboss.dmr.ModelType;
-
-public class WorkerPoolStatisticsMetadataMapper {
- private static final String MAX_THREADS = "maxThreads"; //$NON-NLS-1$
- private static final String HIGHEST_QUEUED = "highestQueued"; //$NON-NLS-1$
- private static final String QUEUED = "queued"; //$NON-NLS-1$
- private static final String QUEUE_NAME = "queueName"; //$NON-NLS-1$
- private static final String TOTAL_SUBMITTED = "totalSubmitted"; //$NON-NLS-1$
- private static final String TOTAL_COMPLETED = "totalCompleted"; //$NON-NLS-1$
- private static final String HIGHEST_ACTIVE_THREADS = "highestActiveThreads"; //$NON-NLS-1$
- private static final String ACTIVE_THREADS = "activeThreads"; //$NON-NLS-1$
-
-
- public static ModelNode wrap(WorkerPoolStatisticsMetadata object) {
- if (object == null)
- return null;
- ModelNode transaction = new ModelNode();
- transaction.get(ModelNodeConstants.TYPE).set(ModelType.OBJECT);
-
- transaction.get(ACTIVE_THREADS).set(object.getActiveThreads());
- transaction.get(HIGHEST_ACTIVE_THREADS).set(object.getHighestActiveThreads());
- transaction.get(TOTAL_COMPLETED).set(object.getTotalCompleted());
- transaction.get(TOTAL_SUBMITTED).set(object.getTotalSubmitted());
- transaction.get(QUEUE_NAME).set(object.getQueueName());
- transaction.get(QUEUED).set(object.getQueued());
- transaction.get(HIGHEST_QUEUED).set(object.getHighestQueued());
- transaction.get(MAX_THREADS).set(object.getMaxThreads());
-
- return transaction;
- }
-
- public static WorkerPoolStatisticsMetadata unwrapMetaValue(ModelNode node) {
- if (node == null)
- return null;
-
- WorkerPoolStatisticsMetadata stats = new WorkerPoolStatisticsMetadata();
- stats.setActiveThreads(node.get(ACTIVE_THREADS).asInt());
- stats.setHighestActiveThreads(node.get(HIGHEST_ACTIVE_THREADS).asInt());
- stats.setTotalCompleted(node.get(TOTAL_COMPLETED).asLong());
- stats.setTotalSubmitted(node.get(TOTAL_SUBMITTED).asLong());
- stats.setQueueName(node.get(QUEUE_NAME).asString());
- stats.setQueued(node.get(QUEUED).asInt());
- stats.setHighestQueued(node.get(HIGHEST_QUEUED).asInt());
- stats.setMaxThreads(node.get(MAX_THREADS).asInt());
- return stats;
- }
-}
Modified: branches/as7/client/src/main/java/org/teiid/net/TeiidURL.java
===================================================================
--- branches/as7/client/src/main/java/org/teiid/net/TeiidURL.java 2011-07-01 20:26:47 UTC (rev 3300)
+++ branches/as7/client/src/main/java/org/teiid/net/TeiidURL.java 2011-07-04 19:09:19 UTC (rev 3301)
@@ -78,8 +78,6 @@
// constant for password part of url
public static final String PASSWORD = "password"; //$NON-NLS-1$
- public static final String ADMIN = "admin"; //$NON-NLS-1$
-
public static final String PASSTHROUGH_AUTHENTICATION = "PassthroughAuthentication"; //$NON-NLS-1$
}
Modified: branches/as7/client/src/main/java/org/teiid/net/socket/SocketServerConnection.java
===================================================================
--- branches/as7/client/src/main/java/org/teiid/net/socket/SocketServerConnection.java 2011-07-01 20:26:47 UTC (rev 3300)
+++ branches/as7/client/src/main/java/org/teiid/net/socket/SocketServerConnection.java 2011-07-04 19:09:19 UTC (rev 3301)
@@ -90,7 +90,6 @@
//ILogon that is allowed to failover
this.logon = this.getService(ILogon.class);
this.failOver = Boolean.valueOf(connProps.getProperty(TeiidURL.CONNECTION.AUTO_FAILOVER)).booleanValue();
- this.failOver |= Boolean.valueOf(connProps.getProperty(TeiidURL.CONNECTION.ADMIN)).booleanValue();
selectServerInstance(false);
}
Added: branches/as7/client/src/main/resources/org/teiid/adminapi/i18n.properties
===================================================================
--- branches/as7/client/src/main/resources/org/teiid/adminapi/i18n.properties (rev 0)
+++ branches/as7/client/src/main/resources/org/teiid/adminapi/i18n.properties 2011-07-04 19:09:19 UTC (rev 3301)
@@ -0,0 +1,65 @@
+description.describe=Description
+vdb-name.describe=The Virtual Database Name
+model-name.describe=Name of the model
+model-path.describe=Path to model file inside the archive
+translator-name.describe=Name of the Translator
+connection-type.describe=Allowable Connections: 1) NONE - disallow new connections 2) BY VERSION - allow connections only if the version is specified or if this is the earliest 'BY VERSION' vdb and there are no vdbs marked as 'ANY' 3) ANY - allow connections with or without a version specified. If multiple versions of same VDB are deployed, connect to one specified with ANY, or if there are multiple VDBs with ANY then connect to the latest version with ANY
+status.describe=The Virtual Database Status
+vdb-version.describe=The Virtual Database Version
+url.describe=The Virtual Database URL
+dynamic.describe=Dynamic Virtual Database
+property-name.describe=Name
+property-value.describe=Property value
+visible.describe=Visibility of the model
+model-type.describe=Type of the Model(PHYSICAL, VIRTUAL, FUNCTION, OTHER)
+source-name.describe=Source name for this model
+jndi-name.describe=Connection JNDI Name
+translator-name.describe=Name of the translator
+error-path.describe=Path to the error in the Virtual Database
+severity.describe=Severity
+message.describe=Error message
+base-type.describe=Translator Base Type
+module-name.describe=Translator's Module name
+allow-create-temp-tables.describe=Allows create of temporary table
+any-authenticated.describe=Indicates if the role is mapped to any authenticated user
+policy-name.describe=Resource Name, for which permission defined
+properties.describe=properties
+source-mappings.describe=Model to source mapping
+validity-errors.describe=Model validation errors
+models.describe=Models inside a virtual database
+override-translators.describe=Overridden translators for the Virtual Database
+data-policies.describe=Data access policies defined for the Virtual Database
+data-permissions.describe=Permissions defined for data access
+mapped-role-names.describe=Policy name to role name mapping
+
+execution-id.describe=Unique Identifier for Request
+session-id.describe=Session Identifier
+start-time.describe=Start time for the request
+command.describe=Executing Command
+source-request.describe=Is this Connector level request
+node-id.describe=Node Identifier
+transaction-id.describe=Get Transaction XID if transaction involved
+processing-state.describe=State of the Request
+thread-state.describe=Thread state
+
+application-name.describe=Application assosiated with Session
+created-time.describe=When session created
+client-host-address.describe=Host name from where the session created
+ip-address.describe=IP address from where session is created
+last-ping-time.describe=Last ping time
+user-name.describe=User name associated with session
+security-domain.describe=Security domain that session used for login
+
+
+txn-created-time.describe=Transaction created time
+txn-scope.describe=Transaction scope (Request, Local, Global)
+txn-id.describe=Transaction Identifier (XID)
+
+max-threads.describe=Max Threads
+highest-queued.describe=Highest Queued Tasks
+queued.describe=Currently Queued Tasks
+queue-name.describe=Queue Name
+total-submitted.describe=Total submitted Tasks
+total-completed.describe=Total Completed Tasks
+highest-active-threads.describe=Highest active threads
+active-threads.describe=Number of Active Threads
\ No newline at end of file
Property changes on: branches/as7/client/src/main/resources/org/teiid/adminapi/i18n.properties
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: branches/as7/client/src/test/java/org/teiid/adminapi/impl/TestRequestMetadata.java
===================================================================
--- branches/as7/client/src/test/java/org/teiid/adminapi/impl/TestRequestMetadata.java 2011-07-01 20:26:47 UTC (rev 3300)
+++ branches/as7/client/src/test/java/org/teiid/adminapi/impl/TestRequestMetadata.java 2011-07-04 19:09:19 UTC (rev 3301)
@@ -22,24 +22,113 @@
package org.teiid.adminapi.impl;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
-import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.dmr.ModelNode;
import org.junit.Test;
import org.teiid.adminapi.Request.ProcessingState;
-
+import org.teiid.adminapi.Request.ThreadState;
+@SuppressWarnings("nls")
public class TestRequestMetadata {
@Test public void testMapping() {
- RequestMetadata request = new RequestMetadata();
- request.setState(ProcessingState.PROCESSING);
+ RequestMetadata request = buildRequest();
- RequestMetadataMapper rmm = new RequestMetadataMapper();
- MetaValue mv = rmm.createMetaValue(rmm.getMetaType(), request);
+ ModelNode node = MetadataMapper.RequestMetadataMapper.wrap(request);
- RequestMetadata request1 = rmm.unwrapMetaValue(mv);
+ RequestMetadata actual = MetadataMapper.RequestMetadataMapper.unwrap(node);
- assertEquals(request.getState(), request1.getState());
+ assertEquals(request, actual);
+ assertEquals(request.getState(), actual.getState());
}
+ private RequestMetadata buildRequest() {
+ RequestMetadata request = new RequestMetadata();
+ request.setState(ProcessingState.PROCESSING);
+ request.setCommand("select * from foo"); //$NON-NLS-1$
+ request.setExecutionId(1234);
+ request.setName("request-name"); //$NON-NLS-1$
+ request.setSessionId("session-id");//$NON-NLS-1$
+ request.setSourceRequest(false);
+ request.setStartTime(12345L);
+ request.setTransactionId("transaction-id");//$NON-NLS-1$
+ request.setThreadState(ThreadState.RUNNING);
+ //request.setNodeId(1);
+ return request;
+ }
+
+ public static final String desc = "{\n" +
+ " \"type\" : {\n" +
+ " \"TYPE_MODEL_VALUE\" : \"OBJECT\"\n" +
+ " },\n" +
+ " \"attributes\" : {\n" +
+ " \"execution-id\" : {\n" +
+ " \"type\" : {\n" +
+ " \"TYPE_MODEL_VALUE\" : \"LONG\"\n" +
+ " },\n" +
+ " \"description\" : \"Unique Identifier for Request\",\n" +
+ " \"required\" : true\n" +
+ " },\n" +
+ " \"session-id\" : {\n" +
+ " \"type\" : {\n" +
+ " \"TYPE_MODEL_VALUE\" : \"STRING\"\n" +
+ " },\n" +
+ " \"description\" : \"Session Identifier\",\n" +
+ " \"required\" : true\n" +
+ " },\n" +
+ " \"start-time\" : {\n" +
+ " \"type\" : {\n" +
+ " \"TYPE_MODEL_VALUE\" : \"LONG\"\n" +
+ " },\n" +
+ " \"description\" : \"Start time for the request\",\n" +
+ " \"required\" : true\n" +
+ " },\n" +
+ " \"command\" : {\n" +
+ " \"type\" : {\n" +
+ " \"TYPE_MODEL_VALUE\" : \"STRING\"\n" +
+ " },\n" +
+ " \"description\" : \"Executing Command\",\n" +
+ " \"required\" : true\n" +
+ " },\n" +
+ " \"source-request\" : {\n" +
+ " \"type\" : {\n" +
+ " \"TYPE_MODEL_VALUE\" : \"BOOLEAN\"\n" +
+ " },\n" +
+ " \"description\" : \"Is this Connector level request\",\n" +
+ " \"required\" : true\n" +
+ " },\n" +
+ " \"node-id\" : {\n" +
+ " \"type\" : {\n" +
+ " \"TYPE_MODEL_VALUE\" : \"INT\"\n" +
+ " },\n" +
+ " \"description\" : \"Node Identifier\",\n" +
+ " \"required\" : false\n" +
+ " },\n" +
+ " \"transaction-id\" : {\n" +
+ " \"type\" : {\n" +
+ " \"TYPE_MODEL_VALUE\" : \"STRING\"\n" +
+ " },\n" +
+ " \"description\" : \"Get Transaction XID if transaction involved\",\n" +
+ " \"required\" : false\n" +
+ " },\n" +
+ " \"processing-state\" : {\n" +
+ " \"type\" : {\n" +
+ " \"TYPE_MODEL_VALUE\" : \"STRING\"\n" +
+ " },\n" +
+ " \"description\" : \"State of the Request\",\n" +
+ " \"required\" : true\n" +
+ " },\n" +
+ " \"thread-state\" : {\n" +
+ " \"type\" : {\n" +
+ " \"TYPE_MODEL_VALUE\" : \"STRING\"\n" +
+ " },\n" +
+ " \"description\" : \"Thread state\",\n" +
+ " \"required\" : true\n" +
+ " }\n" +
+ " }\n" +
+ "}";
+ @Test public void testDescribe() {
+ assertEquals(desc, MetadataMapper.RequestMetadataMapper.describe(new ModelNode()).toJSONString(false));
+ }
+
}
Modified: branches/as7/client/src/test/java/org/teiid/adminapi/impl/TestSessionMetadata.java
===================================================================
--- branches/as7/client/src/test/java/org/teiid/adminapi/impl/TestSessionMetadata.java 2011-07-01 20:26:47 UTC (rev 3300)
+++ branches/as7/client/src/test/java/org/teiid/adminapi/impl/TestSessionMetadata.java 2011-07-04 19:09:19 UTC (rev 3301)
@@ -22,9 +22,9 @@
package org.teiid.adminapi.impl;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
-import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.dmr.ModelNode;
import org.junit.Test;
@SuppressWarnings("nls")
@@ -34,13 +34,104 @@
SessionMetadata session = new SessionMetadata();
session.setSessionId("test");
session.setApplicationName("foo");
- SessionMetadataMapper smm = new SessionMetadataMapper();
- MetaValue mv = smm.createMetaValue(smm.getMetaType(), session);
+ session.setClientHostName("localhost");
+ session.setCreatedTime(1234);
+ session.setIPAddress("127.0.0.1");
+ session.setVDBName("vdb-name");
+ session.setVDBVersion(2);
+ session.setSecurityContext("auth-domain");
+ session.setUserName("user");
+
+ ModelNode node = MetadataMapper.SessionMetadataMapper.wrap(session);
- SessionMetadata session1 = smm.unwrapMetaValue(mv);
+ SessionMetadata session1 = MetadataMapper.SessionMetadataMapper.unwrap(node);
assertEquals(session.getSessionId(), session1.getSessionId());
assertEquals(session.getApplicationName(), session1.getApplicationName());
+
}
-
+
+ private static final String describe = "{\n" +
+ " \"type\" : {\n" +
+ " \"TYPE_MODEL_VALUE\" : \"OBJECT\"\n" +
+ " },\n" +
+ " \"attributes\" : {\n" +
+ " \"application-name\" : {\n" +
+ " \"type\" : {\n" +
+ " \"TYPE_MODEL_VALUE\" : \"STRING\"\n" +
+ " },\n" +
+ " \"description\" : \"Application assosiated with Session\",\n" +
+ " \"required\" : false\n" +
+ " },\n" +
+ " \"created-time\" : {\n" +
+ " \"type\" : {\n" +
+ " \"TYPE_MODEL_VALUE\" : \"LONG\"\n" +
+ " },\n" +
+ " \"description\" : \"When session created\",\n" +
+ " \"required\" : true\n" +
+ " },\n" +
+ " \"client-host-address\" : {\n" +
+ " \"type\" : {\n" +
+ " \"TYPE_MODEL_VALUE\" : \"LONG\"\n" +
+ " },\n" +
+ " \"description\" : \"Host name from where the session created\",\n" +
+ " \"required\" : true\n" +
+ " },\n" +
+ " \"ip-address\" : {\n" +
+ " \"type\" : {\n" +
+ " \"TYPE_MODEL_VALUE\" : \"STRING\"\n" +
+ " },\n" +
+ " \"description\" : \"IP address from where session is created\",\n" +
+ " \"required\" : true\n" +
+ " },\n" +
+ " \"last-ping-time\" : {\n" +
+ " \"type\" : {\n" +
+ " \"TYPE_MODEL_VALUE\" : \"LONG\"\n" +
+ " },\n" +
+ " \"description\" : \"Last ping time\",\n" +
+ " \"required\" : true\n" +
+ " },\n" +
+ " \"session-id\" : {\n" +
+ " \"type\" : {\n" +
+ " \"TYPE_MODEL_VALUE\" : \"STRING\"\n" +
+ " },\n" +
+ " \"description\" : \"Session Identifier\",\n" +
+ " \"required\" : true\n" +
+ " },\n" +
+ " \"user-name\" : {\n" +
+ " \"type\" : {\n" +
+ " \"TYPE_MODEL_VALUE\" : \"STRING\"\n" +
+ " },\n" +
+ " \"description\" : \"User name associated with session\",\n" +
+ " \"required\" : true\n" +
+ " },\n" +
+ " \"vdb-name\" : {\n" +
+ " \"type\" : {\n" +
+ " \"TYPE_MODEL_VALUE\" : \"STRING\"\n" +
+ " },\n" +
+ " \"description\" : \"The Virtual Database Name\",\n" +
+ " \"required\" : true\n" +
+ " },\n" +
+ " \"vdb-version\" : {\n" +
+ " \"type\" : {\n" +
+ " \"TYPE_MODEL_VALUE\" : \"INT\"\n" +
+ " },\n" +
+ " \"description\" : \"The Virtual Database Version\",\n" +
+ " \"required\" : true\n" +
+ " },\n" +
+ " \"security-domain\" : {\n" +
+ " \"type\" : {\n" +
+ " \"TYPE_MODEL_VALUE\" : \"STRING\"\n" +
+ " },\n" +
+ " \"description\" : \"Security domain that session used for login\",\n" +
+ " \"required\" : false\n" +
+ " }\n" +
+ " }\n" +
+ "}";
+
+ @Test public void testDescribe() {
+ ModelNode n = MetadataMapper.SessionMetadataMapper.describe(new ModelNode());
+ //System.out.println(n.toJSONString(false));
+ assertEquals(describe, n.toJSONString(false));
+ }
}
Modified: branches/as7/client/src/test/java/org/teiid/adminapi/impl/TestTransactionMetadata.java
===================================================================
--- branches/as7/client/src/test/java/org/teiid/adminapi/impl/TestTransactionMetadata.java 2011-07-01 20:26:47 UTC (rev 3300)
+++ branches/as7/client/src/test/java/org/teiid/adminapi/impl/TestTransactionMetadata.java 2011-07-04 19:09:19 UTC (rev 3301)
@@ -22,9 +22,9 @@
package org.teiid.adminapi.impl;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
-import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.dmr.ModelNode;
import org.junit.Test;
@SuppressWarnings("nls")
@@ -33,13 +33,60 @@
@Test public void testMapping() {
TransactionMetadata tm = new TransactionMetadata();
tm.setAssociatedSession("x");
-
- TransactionMetadataMapper tmm = new TransactionMetadataMapper();
- MetaValue mv = tmm.createMetaValue(tmm.getMetaType(), tm);
+ tm.setCreatedTime(1234);
+ tm.setId("tnx-id");
+ tm.setScope("scope");
- TransactionMetadata tm1 = tmm.unwrapMetaValue(mv);
+ ModelNode node = MetadataMapper.TransactionMetadataMapper.wrap(tm);
+ TransactionMetadata tm1 = MetadataMapper.TransactionMetadataMapper.unwrap(node);
+
assertEquals(tm.getAssociatedSession(), tm1.getAssociatedSession());
+
+ assertEquals(tm.getCreatedTime(), tm1.getCreatedTime());
+ assertEquals(tm.getId(), tm1.getId());
+ assertEquals(tm.getScope(), tm1.getScope());
}
+ private static final String describe = "{\n" +
+ " \"type\" : {\n" +
+ " \"TYPE_MODEL_VALUE\" : \"OBJECT\"\n" +
+ " },\n" +
+ " \"attributes\" : {\n" +
+ " \"session-id\" : {\n" +
+ " \"type\" : {\n" +
+ " \"TYPE_MODEL_VALUE\" : \"STRING\"\n" +
+ " },\n" +
+ " \"description\" : \"Session Identifier\",\n" +
+ " \"required\" : true\n" +
+ " },\n" +
+ " \"txn-created-time\" : {\n" +
+ " \"type\" : {\n" +
+ " \"TYPE_MODEL_VALUE\" : \"LONG\"\n" +
+ " },\n" +
+ " \"description\" : \"Transaction created time\",\n" +
+ " \"required\" : true\n" +
+ " },\n" +
+ " \"txn-scope\" : {\n" +
+ " \"type\" : {\n" +
+ " \"TYPE_MODEL_VALUE\" : \"LONG\"\n" +
+ " },\n" +
+ " \"description\" : \"Transaction scope (Request, Local, Global)\",\n" +
+ " \"required\" : true\n" +
+ " },\n" +
+ " \"txn-id\" : {\n" +
+ " \"type\" : {\n" +
+ " \"TYPE_MODEL_VALUE\" : \"STRING\"\n" +
+ " },\n" +
+ " \"description\" : \"Transaction Identifier (XID)\",\n" +
+ " \"required\" : true\n" +
+ " }\n" +
+ " }\n" +
+ "}";
+ @Test
+ public void testDescribe() {
+ ModelNode n = MetadataMapper.TransactionMetadataMapper.describe(new ModelNode());
+ //System.out.println(n.toJSONString(false));
+ assertEquals(describe, n.toJSONString(false));
+ }
}
Modified: branches/as7/client/src/test/java/org/teiid/adminapi/impl/TestVDBMetaData.java
===================================================================
--- branches/as7/client/src/test/java/org/teiid/adminapi/impl/TestVDBMetaData.java 2011-07-01 20:26:47 UTC (rev 3300)
+++ branches/as7/client/src/test/java/org/teiid/adminapi/impl/TestVDBMetaData.java 2011-07-04 19:09:19 UTC (rev 3301)
@@ -21,14 +21,9 @@
*/
package org.teiid.adminapi.impl;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.*;
-import java.io.StringReader;
-import java.io.StringWriter;
+import java.io.*;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
@@ -42,12 +37,15 @@
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
+import org.jboss.dmr.ModelNode;
import org.junit.Test;
import org.teiid.adminapi.DataPolicy;
import org.teiid.adminapi.Model;
import org.teiid.adminapi.Translator;
import org.teiid.adminapi.impl.DataPolicyMetadata.PermissionMetaData;
+import org.teiid.core.util.ObjectConverterUtil;
import org.teiid.core.util.PropertiesUtils;
+import org.teiid.core.util.UnitTestUtil;
@SuppressWarnings("nls")
public class TestVDBMetaData {
@@ -55,61 +53,8 @@
@Test
public void testMarshellUnmarshell() throws Exception {
- VDBMetaData vdb = new VDBMetaData();
- vdb.setName("myVDB"); //$NON-NLS-1$
- vdb.setDescription("vdb description"); //$NON-NLS-1$
- vdb.setVersion(1);
- vdb.addProperty("vdb-property", "vdb-value"); //$NON-NLS-1$ //$NON-NLS-2$
+ VDBMetaData vdb = buildVDB();
- ModelMetaData modelOne = new ModelMetaData();
- modelOne.setName("model-one"); //$NON-NLS-1$
- modelOne.addSourceMapping("s1", "translator", "java:mybinding"); //$NON-NLS-1$ //$NON-NLS-2$
- modelOne.setModelType(Model.Type.PHYSICAL); //$NON-NLS-1$
- modelOne.addProperty("model-prop", "model-value"); //$NON-NLS-1$ //$NON-NLS-2$
- modelOne.addProperty("model-prop", "model-value-override"); //$NON-NLS-1$ //$NON-NLS-2$
- modelOne.setVisible(false);
- modelOne.addError("ERROR", "There is an error in VDB"); //$NON-NLS-1$ //$NON-NLS-2$
- modelOne.setDescription("model description");
-
- vdb.addModel(modelOne);
-
- ModelMetaData modelTwo = new ModelMetaData();
- modelTwo.setName("model-two"); //$NON-NLS-1$
- modelTwo.addSourceMapping("s1", "translator", "java:binding-one"); //$NON-NLS-1$ //$NON-NLS-2$
- modelTwo.addSourceMapping("s2", "translator", "java:binding-two"); //$NON-NLS-1$ //$NON-NLS-2$
- modelTwo.setModelType(Model.Type.VIRTUAL); //$NON-NLS-1$
- modelTwo.addProperty("model-prop", "model-value"); //$NON-NLS-1$ //$NON-NLS-2$
-
- vdb.addModel(modelTwo);
-
- TranslatorMetaData t1 = new TranslatorMetaData();
- t1.setName("oracleOverride");
- t1.setType("oracle");
- t1.setDescription("hello world");
- t1.addProperty("my-property", "my-value");
- List<Translator> list = new ArrayList<Translator>();
- list.add(t1);
- vdb.setOverrideTranslators(list);
-
- DataPolicyMetadata roleOne = new DataPolicyMetadata();
- roleOne.setName("roleOne"); //$NON-NLS-1$
- roleOne.setDescription("roleOne described"); //$NON-NLS-1$
- roleOne.setAllowCreateTemporaryTables(true);
- PermissionMetaData perm1 = new PermissionMetaData();
- perm1.setResourceName("myTable.T1"); //$NON-NLS-1$
- perm1.setAllowRead(true);
- roleOne.addPermission(perm1);
-
- PermissionMetaData perm2 = new PermissionMetaData();
- perm2.setResourceName("myTable.T2"); //$NON-NLS-1$
- perm2.setAllowRead(false);
- perm2.setAllowDelete(true);
- roleOne.addPermission(perm2);
-
- roleOne.setMappedRoleNames(Arrays.asList("ROLE1", "ROLE2")); //$NON-NLS-1$ //$NON-NLS-2$
-
- vdb.addDataPolicy(roleOne);
-
SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
Schema schema = schemaFactory.newSchema(VDBMetaData.class.getResource("/vdb-deployer.xsd")); //$NON-NLS-1$
JAXBContext jc = JAXBContext.newInstance(new Class<?>[] {VDBMetaData.class});
@@ -127,6 +72,12 @@
un.setSchema(schema);
vdb = (VDBMetaData)un.unmarshal(new StringReader(sw.toString()));
+ validateVDB(vdb);
+ }
+
+ private void validateVDB(VDBMetaData vdb) {
+ ModelMetaData modelOne;
+ ModelMetaData modelTwo;
assertEquals("myVDB", vdb.getName()); //$NON-NLS-1$
assertEquals("vdb description", vdb.getDescription()); //$NON-NLS-1$
assertEquals(1, vdb.getVersion());
@@ -187,6 +138,65 @@
}
}
}
+
+ private VDBMetaData buildVDB() {
+ VDBMetaData vdb = new VDBMetaData();
+ vdb.setName("myVDB"); //$NON-NLS-1$
+ vdb.setDescription("vdb description"); //$NON-NLS-1$
+ vdb.setVersion(1);
+ vdb.addProperty("vdb-property", "vdb-value"); //$NON-NLS-1$ //$NON-NLS-2$
+ vdb.addProperty("vdb-property2", "vdb-value2"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ ModelMetaData modelOne = new ModelMetaData();
+ modelOne.setName("model-one"); //$NON-NLS-1$
+ modelOne.addSourceMapping("s1", "translator", "java:mybinding"); //$NON-NLS-1$ //$NON-NLS-2$
+ modelOne.setModelType(Model.Type.PHYSICAL); //$NON-NLS-1$
+ modelOne.addProperty("model-prop", "model-value"); //$NON-NLS-1$ //$NON-NLS-2$
+ modelOne.addProperty("model-prop", "model-value-override"); //$NON-NLS-1$ //$NON-NLS-2$
+ modelOne.setVisible(false);
+ modelOne.addError("ERROR", "There is an error in VDB"); //$NON-NLS-1$ //$NON-NLS-2$
+ modelOne.setDescription("model description");
+
+ vdb.addModel(modelOne);
+
+ ModelMetaData modelTwo = new ModelMetaData();
+ modelTwo.setName("model-two"); //$NON-NLS-1$
+ modelTwo.addSourceMapping("s1", "translator", "java:binding-one"); //$NON-NLS-1$ //$NON-NLS-2$
+ modelTwo.addSourceMapping("s2", "translator", "java:binding-two"); //$NON-NLS-1$ //$NON-NLS-2$
+ modelTwo.setModelType(Model.Type.VIRTUAL); //$NON-NLS-1$
+ modelTwo.addProperty("model-prop", "model-value"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ vdb.addModel(modelTwo);
+
+ VDBTranslatorMetaData t1 = new VDBTranslatorMetaData();
+ t1.setName("oracleOverride");
+ t1.setType("oracle");
+ t1.setDescription("hello world");
+ t1.addProperty("my-property", "my-value");
+ List<Translator> list = new ArrayList<Translator>();
+ list.add(t1);
+ vdb.setOverrideTranslators(list);
+
+ DataPolicyMetadata roleOne = new DataPolicyMetadata();
+ roleOne.setName("roleOne"); //$NON-NLS-1$
+ roleOne.setDescription("roleOne described"); //$NON-NLS-1$
+ roleOne.setAllowCreateTemporaryTables(true);
+ PermissionMetaData perm1 = new PermissionMetaData();
+ perm1.setResourceName("myTable.T1"); //$NON-NLS-1$
+ perm1.setAllowRead(true);
+ roleOne.addPermission(perm1);
+
+ PermissionMetaData perm2 = new PermissionMetaData();
+ perm2.setResourceName("myTable.T2"); //$NON-NLS-1$
+ perm2.setAllowRead(false);
+ perm2.setAllowDelete(true);
+ roleOne.addPermission(perm2);
+
+ roleOne.setMappedRoleNames(Arrays.asList("ROLE1", "ROLE2")); //$NON-NLS-1$ //$NON-NLS-2$
+
+ vdb.addDataPolicy(roleOne);
+ return vdb;
+ }
@Test
public void testAdminMOCreation() {
@@ -203,4 +213,20 @@
vdb.setUrl(new URL("file:///x/foo.2.vdb"));
assertEquals(2, vdb.getVersion());
}
+
+ @Test public void testVDBMetaDataMapper() {
+ VDBMetaData vdb = buildVDB();
+
+ ModelNode node = MetadataMapper.wrap(vdb);
+
+ vdb = MetadataMapper.unwrap(node);
+ validateVDB(vdb);
+ }
+
+ @Test
+ public void testVDBMetaDataDescribe() throws Exception {
+ ModelNode node = MetadataMapper.describe(new ModelNode());
+ String actual = node.toJSONString(false);
+ assertEquals(ObjectConverterUtil.convertFileToString(new File(UnitTestUtil.getTestDataPath() + "/vdb-describe.txt")), actual);
+ }
}
Added: branches/as7/client/src/test/resources/vdb-describe.txt
===================================================================
--- branches/as7/client/src/test/resources/vdb-describe.txt (rev 0)
+++ branches/as7/client/src/test/resources/vdb-describe.txt 2011-07-04 19:09:19 UTC (rev 3301)
@@ -0,0 +1,344 @@
+{
+ "type" : {
+ "TYPE_MODEL_VALUE" : "OBJECT"
+ },
+ "attributes" : {
+ "vdb-name" : {
+ "type" : {
+ "TYPE_MODEL_VALUE" : "STRING"
+ },
+ "description" : "The Virtual Database Name",
+ "required" : true
+ },
+ "connection-type" : {
+ "type" : {
+ "TYPE_MODEL_VALUE" : "STRING"
+ },
+ "description" : "Allowable Connections: 1) NONE - disallow new connections 2) BY VERSION - allow connections only if the version is specified or if this is the earliest 'BY VERSION' vdb and there are no vdbs marked as 'ANY' 3) ANY - allow connections with or without a version specified. If multiple versions of same VDB are deployed, connect to one specified with ANY, or if there are multiple VDBs with ANY then connect to the latest version with ANY ",
+ "required" : false
+ },
+ "status" : {
+ "type" : {
+ "TYPE_MODEL_VALUE" : "STRING"
+ },
+ "description" : "The Virtual Database Status",
+ "required" : true
+ },
+ "version" : {
+ "type" : {
+ "TYPE_MODEL_VALUE" : "INT"
+ },
+ "description" : "The Virtual Database Version",
+ "required" : true
+ },
+ "url" : {
+ "type" : {
+ "TYPE_MODEL_VALUE" : "STRING"
+ },
+ "description" : "The Virtual Database URL",
+ "required" : false
+ },
+ "description" : {
+ "type" : {
+ "TYPE_MODEL_VALUE" : "STRING"
+ },
+ "description" : "Description",
+ "required" : false
+ },
+ "dynamic" : {
+ "type" : {
+ "TYPE_MODEL_VALUE" : "BOOLEAN"
+ },
+ "description" : "Dynamic Virtual Database",
+ "required" : false
+ }
+ },
+ "allowed" : [
+ "ACTIVE",
+ "INACTIVE"
+ ],
+ "children" : {
+ "properties" : {
+ "description" : "properties",
+ "type" : {
+ "TYPE_MODEL_VALUE" : "OBJECT"
+ },
+ "attributes" : {
+ "property-name" : {
+ "type" : {
+ "TYPE_MODEL_VALUE" : "STRING"
+ },
+ "description" : "Name",
+ "required" : true
+ },
+ "property-value" : {
+ "type" : {
+ "TYPE_MODEL_VALUE" : "STRING"
+ },
+ "description" : "Property value",
+ "required" : true
+ }
+ }
+ },
+ "models" : {
+ "type" : {
+ "TYPE_MODEL_VALUE" : "OBJECT"
+ },
+ "attributes" : {
+ "model-name" : {
+ "type" : {
+ "TYPE_MODEL_VALUE" : "STRING"
+ },
+ "description" : "Name of the model",
+ "required" : true
+ },
+ "description" : {
+ "type" : {
+ "TYPE_MODEL_VALUE" : "STRING"
+ },
+ "description" : "Description",
+ "required" : false
+ },
+ "visible" : {
+ "type" : {
+ "TYPE_MODEL_VALUE" : "BOOLEAN"
+ },
+ "description" : "Visibility of the model",
+ "required" : false
+ },
+ "model-type" : {
+ "type" : {
+ "TYPE_MODEL_VALUE" : "STRING"
+ },
+ "description" : "Type of the Model(PHYSICAL, VIRTUAL, FUNCTION, OTHER)",
+ "required" : true
+ },
+ "model-path" : {
+ "type" : {
+ "TYPE_MODEL_VALUE" : "STRING"
+ },
+ "description" : "Path to model file inside the archive",
+ "required" : false
+ }
+ },
+ "allowed" : [
+ "PHYSICAL",
+ "VIRTUAL",
+ "FUNCTION",
+ "OTHER"
+ ],
+ "children" : {
+ "properties" : {
+ "description" : "properties",
+ "type" : {
+ "TYPE_MODEL_VALUE" : "OBJECT"
+ },
+ "attributes" : {
+ "property-name" : {
+ "type" : {
+ "TYPE_MODEL_VALUE" : "STRING"
+ },
+ "description" : "Name",
+ "required" : true
+ },
+ "property-value" : {
+ "type" : {
+ "TYPE_MODEL_VALUE" : "STRING"
+ },
+ "description" : "Property value",
+ "required" : true
+ }
+ }
+ },
+ "source-mappings" : {
+ "description" : "Model to source mapping",
+ "type" : {
+ "TYPE_MODEL_VALUE" : "OBJECT"
+ },
+ "attributes" : {
+ "source-name" : {
+ "type" : {
+ "TYPE_MODEL_VALUE" : "STRING"
+ },
+ "description" : "Source name for this model",
+ "required" : true
+ },
+ "jndi-name" : {
+ "type" : {
+ "TYPE_MODEL_VALUE" : "STRING"
+ },
+ "description" : "Connection JNDI Name",
+ "required" : true
+ },
+ "translator-name" : {
+ "type" : {
+ "TYPE_MODEL_VALUE" : "STRING"
+ },
+ "description" : "Name of the translator",
+ "required" : true
+ }
+ }
+ },
+ "validity-errors" : {
+ "description" : "Model validation errors",
+ "type" : {
+ "TYPE_MODEL_VALUE" : "OBJECT"
+ },
+ "attributes" : {
+ "error-path" : {
+ "type" : {
+ "TYPE_MODEL_VALUE" : "STRING"
+ },
+ "description" : "Path to the error in the Virtual Database",
+ "required" : false
+ },
+ "severity" : {
+ "type" : {
+ "TYPE_MODEL_VALUE" : "STRING"
+ },
+ "description" : "Severity",
+ "required" : true
+ },
+ "message" : {
+ "type" : {
+ "TYPE_MODEL_VALUE" : "STRING"
+ },
+ "description" : "Error message",
+ "required" : true
+ }
+ }
+ }
+ },
+ "description" : "Models inside a virtual database",
+ "min-occurs" : 1
+ },
+ "override-translators" : {
+ "description" : "Overridden translators for the Virtual Database",
+ "type" : {
+ "TYPE_MODEL_VALUE" : "OBJECT"
+ },
+ "attributes" : {
+ "translator-name" : {
+ "type" : {
+ "TYPE_MODEL_VALUE" : "STRING"
+ },
+ "description" : "Name of the translator",
+ "required" : true
+ },
+ "base-type" : {
+ "type" : {
+ "TYPE_MODEL_VALUE" : "STRING"
+ },
+ "description" : "Translator Base Type",
+ "required" : true
+ },
+ "description" : {
+ "type" : {
+ "TYPE_MODEL_VALUE" : "STRING"
+ },
+ "description" : "Description",
+ "required" : false
+ },
+ "module-name" : {
+ "type" : {
+ "TYPE_MODEL_VALUE" : "STRING"
+ },
+ "description" : "Translator's Module name",
+ "required" : false
+ }
+ },
+ "children" : {"properties" : {
+ "description" : "properties",
+ "type" : {
+ "TYPE_MODEL_VALUE" : "OBJECT"
+ },
+ "attributes" : {
+ "property-name" : {
+ "type" : {
+ "TYPE_MODEL_VALUE" : "STRING"
+ },
+ "description" : "Name",
+ "required" : true
+ },
+ "property-value" : {
+ "type" : {
+ "TYPE_MODEL_VALUE" : "STRING"
+ },
+ "description" : "Property value",
+ "required" : true
+ }
+ }
+ }}
+ },
+ "data-policies" : {
+ "description" : "Data access policies defined for the Virtual Database",
+ "type" : {
+ "TYPE_MODEL_VALUE" : "OBJECT"
+ },
+ "attributes" : {
+ "policy-name" : {
+ "type" : {
+ "TYPE_MODEL_VALUE" : "STRING"
+ },
+ "description" : "Resource Name, for which permission defined",
+ "required" : true
+ },
+ "description" : {
+ "type" : {
+ "TYPE_MODEL_VALUE" : "STRING"
+ },
+ "description" : "Description",
+ "required" : false
+ },
+ "allow-create-temp-tables" : {
+ "type" : {
+ "TYPE_MODEL_VALUE" : "BOOLEAN"
+ },
+ "description" : "Allows create of temporary table",
+ "required" : false
+ },
+ "any-authenticated" : {
+ "type" : {
+ "TYPE_MODEL_VALUE" : "BOOLEAN"
+ },
+ "description" : "Indicates if the role is mapped to any authenticated user",
+ "required" : false
+ }
+ },
+ "children" : {
+ "data-permissions" : {
+ "type" : {
+ "TYPE_MODEL_VALUE" : "OBJECT"
+ },
+ "attributes" : {
+ "property-name" : {
+ "type" : {
+ "TYPE_MODEL_VALUE" : "STRING"
+ },
+ "description" : "Name",
+ "required" : true
+ },
+ "property-value" : {
+ "type" : {
+ "TYPE_MODEL_VALUE" : "STRING"
+ },
+ "description" : "Property value",
+ "required" : true
+ }
+ },
+ "description" : "Permissions defined for data access",
+ "min-occurs" : 1
+ },
+ "mapped-role-names" : {
+ "type" : {
+ "TYPE_MODEL_VALUE" : "LIST"
+ },
+ "description" : "Policy name to role name mapping",
+ "value-type" : {
+ "TYPE_MODEL_VALUE" : "STRING"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
Property changes on: branches/as7/client/src/test/resources/vdb-describe.txt
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: branches/as7/engine/src/main/java/org/teiid/dqp/internal/datamgr/TranslatorRepository.java
===================================================================
--- branches/as7/engine/src/main/java/org/teiid/dqp/internal/datamgr/TranslatorRepository.java 2011-07-01 20:26:47 UTC (rev 3300)
+++ branches/as7/engine/src/main/java/org/teiid/dqp/internal/datamgr/TranslatorRepository.java 2011-07-04 19:09:19 UTC (rev 3301)
@@ -23,6 +23,8 @@
package org.teiid.dqp.internal.datamgr;
import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@@ -48,4 +50,7 @@
return this.translatorRepo.remove(name);
}
+ public List<VDBTranslatorMetaData> getTranslators(){
+ return new ArrayList<VDBTranslatorMetaData>(translatorRepo.values());
+ }
}
\ No newline at end of file
Modified: branches/as7/engine/src/main/java/org/teiid/dqp/internal/process/DQPWorkContext.java
===================================================================
--- branches/as7/engine/src/main/java/org/teiid/dqp/internal/process/DQPWorkContext.java 2011-07-01 20:26:47 UTC (rev 3300)
+++ branches/as7/engine/src/main/java/org/teiid/dqp/internal/process/DQPWorkContext.java 2011-07-04 19:09:19 UTC (rev 3301)
@@ -105,8 +105,8 @@
}
public Subject getSubject() {
- if (session.getLoginContext() != null) {
- return session.getLoginContext().getSubject();
+ if (session.getSubject() != null) {
+ return session.getSubject();
}
return null;
}
Modified: branches/as7/jboss-integration/pom.xml
===================================================================
--- branches/as7/jboss-integration/pom.xml 2011-07-01 20:26:47 UTC (rev 3300)
+++ branches/as7/jboss-integration/pom.xml 2011-07-04 19:09:19 UTC (rev 3301)
@@ -94,7 +94,11 @@
<artifactId>jboss-as-connector</artifactId>
<scope>provided</scope>
</dependency>
-
+ <dependency>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-security</artifactId>
+ <scope>provided</scope>
+ </dependency>
<!--
<dependency>
<groupId>org.jboss</groupId>
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/OperationsConstants.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/OperationsConstants.java 2011-07-01 20:26:47 UTC (rev 3300)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/OperationsConstants.java 2011-07-04 19:09:19 UTC (rev 3301)
@@ -35,5 +35,6 @@
public static final String TARGET_VDBVERSION = "target-vdb-version";//$NON-NLS-1$
public static final String SQL_QUERY = "sql-query";//$NON-NLS-1$
public static final String TIMEOUT_IN_MILLI = "timeout-in-milli";//$NON-NLS-1$
+ public static final String TRANSLATOR_NAME = "translator-name"; //$NON-NLS-1$
}
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineAdd.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineAdd.java 2011-07-01 20:26:47 UTC (rev 3300)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineAdd.java 2011-07-04 19:09:19 UTC (rev 3301)
@@ -31,11 +31,13 @@
import org.jboss.as.controller.*;
import org.jboss.as.controller.operations.common.Util;
+import org.jboss.as.security.plugins.SecurityDomainContext;
import org.jboss.as.server.BootOperationContext;
import org.jboss.as.server.BootOperationHandler;
import org.jboss.as.server.deployment.Phase;
import org.jboss.as.server.services.net.SocketBinding;
import org.jboss.dmr.ModelNode;
+import org.jboss.msc.inject.ConcurrentMapInjector;
import org.jboss.msc.service.*;
import org.teiid.cache.CacheConfiguration;
import org.teiid.cache.CacheFactory;
@@ -43,9 +45,10 @@
import org.teiid.deployers.*;
import org.teiid.dqp.internal.datamgr.TranslatorRepository;
import org.teiid.jboss.deployers.RuntimeEngineDeployer;
+import org.teiid.logging.LogConstants;
+import org.teiid.logging.LogManager;
import org.teiid.query.function.SystemFunctionManager;
import org.teiid.services.BufferServiceImpl;
-import org.teiid.services.SessionServiceImpl;
import org.teiid.transport.ClientServiceRegistry;
import org.teiid.transport.SSLConfiguration;
import org.teiid.transport.SocketConfiguration;
@@ -79,9 +82,6 @@
TranslatorRepositoryService translatorService = new TranslatorRepositoryService(translatorRepo);
target.addService(TeiidServiceNames.TRANSLATOR_REPO, translatorService);
- final SessionServiceImpl sessionService = buildSessionService(queryEngineNode);
- sessionService.setVDBRepository(vdbRepo);
-
final BufferServiceImpl bufferManager = buildBufferManager(queryEngineNode.get(Configuration.BUFFER_SERVICE));
CacheFactory cacheFactory = getCacheFactory(queryEngineNode.get(Configuration.CACHE_FACORY));
@@ -100,16 +100,16 @@
RuntimeEngineDeployer engine = buildQueryEngine(queryEngineNode);
engine.setJdbcSocketConfiguration(jdbc);
engine.setOdbcSocketConfiguration(odbc);
- engine.setSessionService(sessionService);
engine.setBufferService(bufferManager);
engine.setVDBRepository(vdbRepo);
engine.setCacheFactory(cacheFactory);
engine.setResultsetCacheConfig(resultsetCache);
engine.setPreparedPlanCacheConfig(preparePlanCache);
engine.setSecurityHelper(new JBossSecurityHelper());
+ engine.setTranslatorRepository(translatorRepo);
- ServiceBuilder<ClientServiceRegistry> serviceBuilder = target.addService(RuntimeEngineDeployer.SERVICE_NAME, engine);
+ ServiceBuilder<ClientServiceRegistry> serviceBuilder = target.addService(TeiidServiceNames.ENGINE, 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$
@@ -117,18 +117,27 @@
serviceBuilder.addDependency(ServiceName.JBOSS.append("thread", "executor", asyncExecutor), Executor.class, engine.threadPoolInjector); //$NON-NLS-1$ //$NON-NLS-2$
serviceBuilder.addDependency(ServiceName.JBOSS.append("binding", jdbc.getSocketBinding()), SocketBinding.class, engine.jdbcSocketBindingInjector); //$NON-NLS-1$
serviceBuilder.addDependency(ServiceName.JBOSS.append("binding", odbc.getSocketBinding()), SocketBinding.class, engine.odbcSocketBindingInjector); //$NON-NLS-1$
+
+ // add security domains
+ String domainNameOrder = queryEngineNode.get(Configuration.JDBC_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$
+ for (String domainName : domainNames) {
+ serviceBuilder.addDependency(ServiceName.JBOSS.append("security", "security-domain", domainName), SecurityDomainContext.class, new ConcurrentMapInjector<String,SecurityDomainContext>(engine.securityDomains, domainName)); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+
serviceBuilder.addListener(new AbstractServiceListener<Object>() {
@Override
public void serviceStarting(ServiceController<?> serviceController) {
vdbRepo.start();
- sessionService.start();
bufferManager.start();
}
@Override
public void serviceStopped(ServiceController<?> serviceController) {
bufferManager.stop();
- sessionService.stop();
}
@Override
@@ -213,25 +222,18 @@
}
if (node.get(Configuration.DETECTING_CHANGE_EVENTS) != null) {
engine.setDetectingChangeEvents(node.get(Configuration.DETECTING_CHANGE_EVENTS).asBoolean());
- }
+ }
+ if (node.get(Configuration.SESSION_EXPIRATION_TIME_LIMIT) != null) {
+ engine.setSessionExpirationTimeLimit(node.get(Configuration.SESSION_EXPIRATION_TIME_LIMIT).asInt());
+ }
+ if (node.get(Configuration.MAX_SESSIONS_ALLOWED) != null) {
+ engine.setSessionMaxLimit(node.get(Configuration.MAX_SESSIONS_ALLOWED).asInt());
+ }
+
return engine;
}
- private SessionServiceImpl buildSessionService(ModelNode node) {
- SessionServiceImpl sessionService = new SessionServiceImpl();
- if (node.get(Configuration.JDBC_SECURITY_DOMAIN) != null) {
- sessionService.setSecurityDomains(node.get(Configuration.JDBC_SECURITY_DOMAIN).asString());
- }
- if (node.get(Configuration.SESSION_EXPIRATION_TIME_LIMIT) != null) {
- sessionService.setSessionExpirationTimeLimit(node.get(Configuration.SESSION_EXPIRATION_TIME_LIMIT).asInt());
- }
- if (node.get(Configuration.MAX_SESSIONS_ALLOWED) != null) {
- sessionService.setSessionMaxLimit(node.get(Configuration.MAX_SESSIONS_ALLOWED).asInt());
- }
- return sessionService;
- }
-
private VDBRepository buildVDBRepository(ModelNode node) {
SystemFunctionManager systemFunctionManager = new SystemFunctionManager();
if (node.get(Configuration.ALLOW_ENV_FUNCTION) != null) {
Deleted: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineModelHandler.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineModelHandler.java 2011-07-01 20:26:47 UTC (rev 3300)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineModelHandler.java 2011-07-04 19:09:19 UTC (rev 3301)
@@ -1,480 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.teiid.jboss;
-
-import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.*;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.Locale;
-import java.util.ResourceBundle;
-
-import org.jboss.as.controller.*;
-import org.jboss.as.controller.descriptions.DescriptionProvider;
-import org.jboss.dmr.ModelNode;
-import org.jboss.dmr.ModelType;
-import org.jboss.msc.service.ServiceController;
-import org.teiid.adminapi.AdminException;
-import org.teiid.adminapi.impl.*;
-import org.teiid.jboss.deployers.RuntimeEngineDeployer;
-
-abstract class QueryEngineModelHandler implements OperationHandler, DescriptionProvider {
- private static final String DESCRIBE = ".describe"; //$NON-NLS-1$
-
- private String operationName;
-
- protected QueryEngineModelHandler(String operationName){
- this.operationName = operationName;
- }
-
- @Override
- public OperationResult execute(final OperationContext context, final ModelNode operation, final ResultHandler resultHandler) throws OperationFailedException {
-
- final RuntimeOperationContext runtimeContext = context.getRuntimeContext();
- if (runtimeContext != null) {
- runtimeContext.setRuntimeTask(new RuntimeTask() {
-
- @Override
- public void execute(RuntimeTaskContext context) throws OperationFailedException {
- ServiceController<?> sc = context.getServiceRegistry().getRequiredService(RuntimeEngineDeployer.SERVICE_NAME);
- RuntimeEngineDeployer engine = RuntimeEngineDeployer.class.cast(sc.getValue());
-
- resultHandler.handleResultFragment(ResultHandler.EMPTY_LOCATION, executeOperation(engine, operation));
- }});
- }
-
- resultHandler.handleResultComplete();
- return new BasicOperationResult();
- }
-
- @Override
- public ModelNode getModelDescription(final Locale locale) {
- final ResourceBundle bundle = IntegrationPlugin.getResourceBundle(locale);
- final ModelNode operation = new ModelNode();
- operation.get(OPERATION_NAME).set(this.operationName);
- operation.get(DESCRIPTION).set(bundle.getString(getBundleOperationName()+DESCRIBE));
- describeParameters(operation, bundle);
- return operation;
- }
-
- protected String getBundleOperationName() {
- return RuntimeEngineDeployer.class.getSimpleName()+"."+this.operationName; //$NON-NLS-1$
- }
-
- protected String getParameterDescription(ResourceBundle bundle, String parmName) {
- return bundle.getString(RuntimeEngineDeployer.class.getSimpleName()+"."+this.operationName+"."+parmName+DESCRIBE); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- abstract protected ModelNode executeOperation(RuntimeEngineDeployer engine, ModelNode operation) throws OperationFailedException;
-
- protected void describeParameters(@SuppressWarnings("unused") ModelNode operationNode, @SuppressWarnings("unused")ResourceBundle bundle) {
- }
-}
-
-class GetRuntimeVersion extends QueryEngineModelHandler{
- protected GetRuntimeVersion(String operationName) {
- super(operationName);
- }
- @Override
- protected ModelNode executeOperation(RuntimeEngineDeployer engine, ModelNode operation) throws OperationFailedException{
- ModelNode node = new ModelNode();
- node.set(engine.getRuntimeVersion());
- return node;
- }
-}
-
-class GetActiveSessionsCount extends QueryEngineModelHandler{
- protected GetActiveSessionsCount(String operationName) {
- super(operationName);
- }
- @Override
- protected ModelNode executeOperation(RuntimeEngineDeployer engine, ModelNode operation) throws OperationFailedException{
- ModelNode node = new ModelNode();
- try {
- node.set(String.valueOf(engine.getActiveSessionsCount()));
- } catch (AdminException e) {
- // TODO: handle exception in model node terms
- }
- return node;
- }
-}
-
-class GetActiveSessions extends QueryEngineModelHandler{
- protected GetActiveSessions(String operationName) {
- super(operationName);
- }
- @Override
- protected ModelNode executeOperation(RuntimeEngineDeployer engine, ModelNode operation) throws OperationFailedException{
- ModelNode node = new ModelNode();
- node.get(TYPE).set(ModelType.LIST);
-
- try {
- Collection<SessionMetadata> sessions = engine.getActiveSessions();
- for (SessionMetadata session:sessions) {
- node.add(SessionMetadataMapper.wrap(session));
- }
- } catch (AdminException e) {
- // TODO: handle exception in model node terms
- }
- return node;
- }
-}
-
-class GetRequestsPerSession extends QueryEngineModelHandler{
- protected GetRequestsPerSession(String operationName) {
- super(operationName);
- }
- @Override
- protected ModelNode executeOperation(RuntimeEngineDeployer engine, ModelNode operation) throws OperationFailedException{
- ModelNode node = new ModelNode();
- node.get(TYPE).set(ModelType.LIST);
-
- List<RequestMetadata> requests = engine.getRequestsForSession(operation.get(OperationsConstants.SESSION).asString());
- for (RequestMetadata request:requests) {
- node.add(RequestMetadataMapper.wrap(request));
- }
- return node;
- }
-
- protected void describeParameters(ModelNode operationNode, ResourceBundle bundle) {
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.SESSION, TYPE).set(ModelType.STRING);
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.SESSION, REQUIRED).set(true);
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.SESSION, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.SESSION));
-
- //TODO: define response??
- }
-}
-
-class GetRequestsPerVDB extends QueryEngineModelHandler{
- protected GetRequestsPerVDB(String operationName) {
- super(operationName);
- }
- @Override
- protected ModelNode executeOperation(RuntimeEngineDeployer engine, ModelNode operation) throws OperationFailedException{
- ModelNode node = new ModelNode();
- node.get(TYPE).set(ModelType.LIST);
-
- try {
- String vdbName = operation.get(OperationsConstants.VDB_NAME).asString();
- int vdbVersion = operation.get(OperationsConstants.VDB_VERSION).asInt();
- List<RequestMetadata> requests = engine.getRequestsUsingVDB(vdbName,vdbVersion);
- for (RequestMetadata request:requests) {
- node.add(RequestMetadataMapper.wrap(request));
- }
- } catch (AdminException e) {
- // TODO: handle exception in model node terms
- }
- return node;
- }
-
- protected void describeParameters(ModelNode operationNode, ResourceBundle bundle) {
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.VDB_NAME, TYPE).set(ModelType.STRING);
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.VDB_NAME, REQUIRED).set(true);
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.VDB_NAME, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.VDB_NAME));
-
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.VDB_VERSION, TYPE).set(ModelType.INT);
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.VDB_VERSION, REQUIRED).set(true);
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.VDB_VERSION, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.VDB_VERSION));
-
- //TODO: define response??
- }
-}
-
-class GetLongRunningQueries extends QueryEngineModelHandler{
- protected GetLongRunningQueries(String operationName) {
- super(operationName);
- }
- @Override
- protected ModelNode executeOperation(RuntimeEngineDeployer engine, ModelNode operation) throws OperationFailedException{
- ModelNode node = new ModelNode();
- node.get(TYPE).set(ModelType.LIST);
-
- List<RequestMetadata> requests = engine.getLongRunningRequests();
- for (RequestMetadata request:requests) {
- node.add(RequestMetadataMapper.wrap(request));
- }
- return node;
- }
-}
-
-class TerminateSession extends QueryEngineModelHandler{
- protected TerminateSession(String operationName) {
- super(operationName);
- }
- @Override
- protected ModelNode executeOperation(RuntimeEngineDeployer engine, ModelNode operation) throws OperationFailedException{
- ModelNode node = new ModelNode();
- engine.terminateSession(operation.get(OperationsConstants.SESSION).asString());
- return node;
- }
-
- protected void describeParameters(ModelNode operationNode, ResourceBundle bundle) {
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.SESSION, TYPE).set(ModelType.STRING);
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.SESSION, REQUIRED).set(true);
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.SESSION, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.SESSION));
- }
-}
-
-class CancelQuery extends QueryEngineModelHandler{
- protected CancelQuery(String operationName) {
- super(operationName);
- }
- @Override
- protected ModelNode executeOperation(RuntimeEngineDeployer engine, ModelNode operation) throws OperationFailedException{
- ModelNode node = new ModelNode();
- try {
- engine.cancelRequest(operation.get(OperationsConstants.SESSION).asString(), operation.get(OperationsConstants.EXECUTION_ID).asLong());
- } catch (AdminException e) {
- // TODO: handle exception in model node terms
- }
- return node;
- }
-
- protected void describeParameters(ModelNode operationNode, ResourceBundle bundle) {
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.SESSION, TYPE).set(ModelType.STRING);
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.SESSION, REQUIRED).set(true);
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.SESSION, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.SESSION));
-
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.EXECUTION_ID, TYPE).set(ModelType.LONG);
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.EXECUTION_ID, REQUIRED).set(true);
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.EXECUTION_ID, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.EXECUTION_ID));
- }
-}
-
-class CacheTypes extends QueryEngineModelHandler{
- protected CacheTypes(String operationName) {
- super(operationName);
- }
- @Override
- protected ModelNode executeOperation(RuntimeEngineDeployer engine, ModelNode operation) throws OperationFailedException {
- ModelNode node = new ModelNode();
- node.get(TYPE).set(ModelType.LIST);
- Collection<String> types = engine.getCacheTypes();
- for (String type:types) {
- node.add(type);
- }
- return node;
- }
-}
-
-class ClearCache extends QueryEngineModelHandler{
-
- protected ClearCache(String operationName) {
- super(operationName);
- }
- @Override
- protected ModelNode executeOperation(RuntimeEngineDeployer engine, ModelNode operation) throws OperationFailedException {
- ModelNode node = new ModelNode();
- String cacheType = operation.get(OperationsConstants.CACHE_TYPE).asString();
-
- if (operation.get(OperationsConstants.VDB_NAME) != null && operation.get(OperationsConstants.VDB_VERSION) != null) {
- String vdbName = operation.get(OperationsConstants.VDB_NAME).asString();
- int vdbVersion = operation.get(OperationsConstants.VDB_VERSION).asInt();
- engine.clearCache(cacheType, vdbName, vdbVersion);
- }
- else {
- engine.clearCache(cacheType);
- }
- return node;
- }
-
- protected void describeParameters(ModelNode operationNode, ResourceBundle bundle) {
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.CACHE_TYPE, TYPE).set(ModelType.STRING);
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.CACHE_TYPE, REQUIRED).set(true);
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.CACHE_TYPE, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.CACHE_TYPE));
-
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.VDB_NAME, TYPE).set(ModelType.STRING);
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.VDB_NAME, REQUIRED).set(false);
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.VDB_NAME, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.VDB_NAME));
-
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.VDB_VERSION, TYPE).set(ModelType.INT);
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.VDB_VERSION, REQUIRED).set(false);
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.VDB_VERSION, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.VDB_VERSION));
-
- }
-}
-
-class CacheStatistics extends QueryEngineModelHandler{
-
- protected CacheStatistics(String operationName) {
- super(operationName);
- }
- @Override
- protected ModelNode executeOperation(RuntimeEngineDeployer engine, ModelNode operation) throws OperationFailedException {
- String cacheType = operation.get(OperationsConstants.CACHE_TYPE).asString();
- CacheStatisticsMetadata stats = engine.getCacheStatistics(cacheType);
- return CacheStatisticsMetadataMapper.wrap(stats);
- }
-
- protected void describeParameters(ModelNode operationNode, ResourceBundle bundle) {
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.CACHE_TYPE, TYPE).set(ModelType.STRING);
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.CACHE_TYPE, REQUIRED).set(true);
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.CACHE_TYPE, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.CACHE_TYPE));
- }
-}
-
-class WorkerPoolStatistics extends QueryEngineModelHandler{
-
- protected WorkerPoolStatistics(String operationName) {
- super(operationName);
- }
- @Override
- protected ModelNode executeOperation(RuntimeEngineDeployer engine, ModelNode operation) throws OperationFailedException {
- WorkerPoolStatisticsMetadata stats = engine.getWorkerPoolStatistics();
- return WorkerPoolStatisticsMetadataMapper.wrap(stats);
- }
-}
-
-class ActiveTransactions extends QueryEngineModelHandler{
-
- protected ActiveTransactions(String operationName) {
- super(operationName);
- }
- @Override
- protected ModelNode executeOperation(RuntimeEngineDeployer engine, ModelNode operation) throws OperationFailedException {
- Collection<TransactionMetadata> txns = engine.getTransactions();
-
- ModelNode node = new ModelNode();
- node.get(TYPE).set(ModelType.LIST);
-
- for (TransactionMetadata txn:txns) {
- node.add(TransactionMetadataMapper.wrap(txn));
- }
-
- return node;
- }
-}
-
-class TerminateTransaction extends QueryEngineModelHandler{
-
- protected TerminateTransaction(String operationName) {
- super(operationName);
- }
- @Override
- protected ModelNode executeOperation(RuntimeEngineDeployer engine, ModelNode operation) throws OperationFailedException {
- String xid = operation.get(OperationsConstants.XID).asString();
- try {
- engine.terminateTransaction(xid);
- } catch (AdminException e) {
- // TODO: Handle exception
- }
- return new ModelNode();
- }
-
- protected void describeParameters(ModelNode operationNode, ResourceBundle bundle) {
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.XID, TYPE).set(ModelType.STRING);
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.XID, REQUIRED).set(true);
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.XID, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.XID));
- }
-}
-
-class MergeVDBs extends QueryEngineModelHandler{
-
- protected MergeVDBs(String operationName) {
- super(operationName);
- }
- @Override
- protected ModelNode executeOperation(RuntimeEngineDeployer engine, ModelNode operation) throws OperationFailedException {
- String sourceVDBName = operation.get(OperationsConstants.SOURCE_VDBNAME).asString();
- int sourceVDBversion = operation.get(OperationsConstants.SOURCE_VDBVERSION).asInt();
- String targetVDBName = operation.get(OperationsConstants.TARGET_VDBNAME).asString();
- int targetVDBversion = operation.get(OperationsConstants.TARGET_VDBVERSION).asInt();
- try {
- engine.mergeVDBs(sourceVDBName, sourceVDBversion, targetVDBName, targetVDBversion);
- } catch (AdminException e) {
- throw new OperationFailedException(new ModelNode().set(e.getMessage()));
- }
- return new ModelNode();
- }
-
- protected void describeParameters(ModelNode operationNode, ResourceBundle bundle) {
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.SOURCE_VDBNAME, TYPE).set(ModelType.STRING);
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.SOURCE_VDBNAME, REQUIRED).set(true);
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.SOURCE_VDBNAME, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.XID));
-
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.SOURCE_VDBVERSION, TYPE).set(ModelType.STRING);
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.SOURCE_VDBVERSION, REQUIRED).set(true);
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.SOURCE_VDBVERSION, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.XID));
-
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.TARGET_VDBNAME, TYPE).set(ModelType.STRING);
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.TARGET_VDBNAME, REQUIRED).set(true);
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.TARGET_VDBNAME, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.XID));
-
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.TARGET_VDBVERSION, TYPE).set(ModelType.STRING);
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.TARGET_VDBVERSION, REQUIRED).set(true);
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.TARGET_VDBVERSION, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.XID));
- }
-}
-
-class ExecuteQuery extends QueryEngineModelHandler{
-
- protected ExecuteQuery(String operationName) {
- super(operationName);
- }
- @Override
- protected ModelNode executeOperation(RuntimeEngineDeployer engine, ModelNode operation) throws OperationFailedException {
- String vdbName = operation.get(OperationsConstants.VDB_NAME).asString();
- int vdbVersion = operation.get(OperationsConstants.VDB_VERSION).asInt();
- String sql = operation.get(OperationsConstants.SQL_QUERY).asString();
- int timeout = operation.get(OperationsConstants.TIMEOUT_IN_MILLI).asInt();
- ModelNode node = new ModelNode();
- try {
- node.get(TYPE).set(ModelType.LIST);
-
- List<List> results = engine.executeQuery(vdbName, vdbVersion, sql, timeout);
- List colNames = results.get(0);
- for (int rowNum = 1; rowNum < results.size(); rowNum++) {
-
- List row = results.get(rowNum);
- ModelNode rowNode = new ModelNode();
- rowNode.get(TYPE).set(ModelType.OBJECT);
-
- for (int colNum = 0; colNum < colNames.size(); colNum++) {
- //TODO: support in native types instead of string here.
- rowNode.get(ATTRIBUTES, colNames.get(colNum).toString()).set(row.get(colNum).toString());
- }
- node.add(rowNode);
- }
- } catch (AdminException e) {
- throw new OperationFailedException(new ModelNode().set(e.getMessage()));
- }
- return node;
- }
-
- protected void describeParameters(ModelNode operationNode, ResourceBundle bundle) {
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.VDB_NAME, TYPE).set(ModelType.STRING);
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.VDB_NAME, REQUIRED).set(true);
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.VDB_NAME, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.XID));
-
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.VDB_VERSION, TYPE).set(ModelType.STRING);
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.VDB_VERSION, REQUIRED).set(true);
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.VDB_VERSION, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.XID));
-
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.SQL_QUERY, TYPE).set(ModelType.STRING);
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.SQL_QUERY, REQUIRED).set(true);
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.SQL_QUERY, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.XID));
-
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.TIMEOUT_IN_MILLI, TYPE).set(ModelType.STRING);
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.TIMEOUT_IN_MILLI, REQUIRED).set(true);
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.TIMEOUT_IN_MILLI, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.XID));
- }
-}
\ No newline at end of file
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineOperationHandler.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineOperationHandler.java 2011-07-01 20:26:47 UTC (rev 3300)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineOperationHandler.java 2011-07-04 19:09:19 UTC (rev 3301)
@@ -55,7 +55,7 @@
@Override
public void execute(RuntimeTaskContext context) throws OperationFailedException {
- ServiceController<?> sc = context.getServiceRegistry().getRequiredService(RuntimeEngineDeployer.SERVICE_NAME);
+ ServiceController<?> sc = context.getServiceRegistry().getRequiredService(TeiidServiceNames.ENGINE);
RuntimeEngineDeployer engine = RuntimeEngineDeployer.class.cast(sc.getValue());
resultHandler.handleResultFragment(ResultHandler.EMPTY_LOCATION, executeOperation(engine, operation));
@@ -80,6 +80,10 @@
return RuntimeEngineDeployer.class.getSimpleName()+"."+this.operationName; //$NON-NLS-1$
}
+ protected String getReplyName() {
+ return getBundleOperationName()+".reply"+DESCRIBE; //$NON-NLS-1$
+ }
+
protected String getParameterDescription(ResourceBundle bundle, String parmName) {
return bundle.getString(RuntimeEngineDeployer.class.getSimpleName()+"."+this.operationName+"."+parmName+DESCRIBE); //$NON-NLS-1$ //$NON-NLS-2$
}
@@ -130,7 +134,7 @@
try {
Collection<SessionMetadata> sessions = engine.getActiveSessions();
for (SessionMetadata session:sessions) {
- node.add(SessionMetadataMapper.wrap(session));
+ node.add(MetadataMapper.SessionMetadataMapper.wrap(session));
}
} catch (AdminException e) {
// TODO: handle exception in model node terms
@@ -150,7 +154,7 @@
List<RequestMetadata> requests = engine.getRequestsForSession(operation.get(OperationsConstants.SESSION).asString());
for (RequestMetadata request:requests) {
- node.add(RequestMetadataMapper.wrap(request));
+ node.add(MetadataMapper.RequestMetadataMapper.wrap(request));
}
return node;
}
@@ -178,7 +182,7 @@
int vdbVersion = operation.get(OperationsConstants.VDB_VERSION).asInt();
List<RequestMetadata> requests = engine.getRequestsUsingVDB(vdbName,vdbVersion);
for (RequestMetadata request:requests) {
- node.add(RequestMetadataMapper.wrap(request));
+ node.add(MetadataMapper.RequestMetadataMapper.wrap(request));
}
} catch (AdminException e) {
// TODO: handle exception in model node terms
@@ -210,7 +214,7 @@
List<RequestMetadata> requests = engine.getLongRunningRequests();
for (RequestMetadata request:requests) {
- node.add(RequestMetadataMapper.wrap(request));
+ node.add(MetadataMapper.RequestMetadataMapper.wrap(request));
}
return node;
}
@@ -322,7 +326,7 @@
protected ModelNode executeOperation(RuntimeEngineDeployer engine, ModelNode operation) throws OperationFailedException {
String cacheType = operation.get(OperationsConstants.CACHE_TYPE).asString();
CacheStatisticsMetadata stats = engine.getCacheStatistics(cacheType);
- return CacheStatisticsMetadataMapper.wrap(stats);
+ return MetadataMapper.CacheStatisticsMetadataMapper.wrap(stats);
}
protected void describeParameters(ModelNode operationNode, ResourceBundle bundle) {
@@ -340,7 +344,7 @@
@Override
protected ModelNode executeOperation(RuntimeEngineDeployer engine, ModelNode operation) throws OperationFailedException {
WorkerPoolStatisticsMetadata stats = engine.getWorkerPoolStatistics();
- return WorkerPoolStatisticsMetadataMapper.wrap(stats);
+ return MetadataMapper.WorkerPoolStatisticsMetadataMapper.wrap(stats);
}
}
@@ -357,7 +361,7 @@
node.get(TYPE).set(ModelType.LIST);
for (TransactionMetadata txn:txns) {
- node.add(TransactionMetadataMapper.wrap(txn));
+ node.add(MetadataMapper.TransactionMetadataMapper.wrap(txn));
}
return node;
@@ -409,19 +413,19 @@
protected void describeParameters(ModelNode operationNode, ResourceBundle bundle) {
operationNode.get(REQUEST_PROPERTIES, OperationsConstants.SOURCE_VDBNAME, TYPE).set(ModelType.STRING);
operationNode.get(REQUEST_PROPERTIES, OperationsConstants.SOURCE_VDBNAME, REQUIRED).set(true);
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.SOURCE_VDBNAME, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.XID));
+ operationNode.get(REQUEST_PROPERTIES, OperationsConstants.SOURCE_VDBNAME, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.SOURCE_VDBNAME));
operationNode.get(REQUEST_PROPERTIES, OperationsConstants.SOURCE_VDBVERSION, TYPE).set(ModelType.STRING);
operationNode.get(REQUEST_PROPERTIES, OperationsConstants.SOURCE_VDBVERSION, REQUIRED).set(true);
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.SOURCE_VDBVERSION, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.XID));
+ operationNode.get(REQUEST_PROPERTIES, OperationsConstants.SOURCE_VDBVERSION, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.SOURCE_VDBVERSION));
operationNode.get(REQUEST_PROPERTIES, OperationsConstants.TARGET_VDBNAME, TYPE).set(ModelType.STRING);
operationNode.get(REQUEST_PROPERTIES, OperationsConstants.TARGET_VDBNAME, REQUIRED).set(true);
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.TARGET_VDBNAME, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.XID));
+ operationNode.get(REQUEST_PROPERTIES, OperationsConstants.TARGET_VDBNAME, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.TARGET_VDBNAME));
operationNode.get(REQUEST_PROPERTIES, OperationsConstants.TARGET_VDBVERSION, TYPE).set(ModelType.STRING);
operationNode.get(REQUEST_PROPERTIES, OperationsConstants.TARGET_VDBVERSION, REQUIRED).set(true);
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.TARGET_VDBVERSION, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.XID));
+ operationNode.get(REQUEST_PROPERTIES, OperationsConstants.TARGET_VDBVERSION, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.TARGET_VDBVERSION));
}
}
@@ -463,18 +467,110 @@
protected void describeParameters(ModelNode operationNode, ResourceBundle bundle) {
operationNode.get(REQUEST_PROPERTIES, OperationsConstants.VDB_NAME, TYPE).set(ModelType.STRING);
operationNode.get(REQUEST_PROPERTIES, OperationsConstants.VDB_NAME, REQUIRED).set(true);
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.VDB_NAME, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.XID));
+ operationNode.get(REQUEST_PROPERTIES, OperationsConstants.VDB_NAME, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.VDB_NAME));
operationNode.get(REQUEST_PROPERTIES, OperationsConstants.VDB_VERSION, TYPE).set(ModelType.STRING);
operationNode.get(REQUEST_PROPERTIES, OperationsConstants.VDB_VERSION, REQUIRED).set(true);
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.VDB_VERSION, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.XID));
+ operationNode.get(REQUEST_PROPERTIES, OperationsConstants.VDB_VERSION, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.VDB_VERSION));
operationNode.get(REQUEST_PROPERTIES, OperationsConstants.SQL_QUERY, TYPE).set(ModelType.STRING);
operationNode.get(REQUEST_PROPERTIES, OperationsConstants.SQL_QUERY, REQUIRED).set(true);
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.SQL_QUERY, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.XID));
+ operationNode.get(REQUEST_PROPERTIES, OperationsConstants.SQL_QUERY, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.SQL_QUERY));
operationNode.get(REQUEST_PROPERTIES, OperationsConstants.TIMEOUT_IN_MILLI, TYPE).set(ModelType.STRING);
operationNode.get(REQUEST_PROPERTIES, OperationsConstants.TIMEOUT_IN_MILLI, REQUIRED).set(true);
- operationNode.get(REQUEST_PROPERTIES, OperationsConstants.TIMEOUT_IN_MILLI, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.XID));
+ operationNode.get(REQUEST_PROPERTIES, OperationsConstants.TIMEOUT_IN_MILLI, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.TIMEOUT_IN_MILLI));
}
+}
+
+class GetVDB extends QueryEngineOperationHandler{
+
+ protected GetVDB(String operationName) {
+ super(operationName);
+ }
+ @Override
+ protected ModelNode executeOperation(RuntimeEngineDeployer engine, ModelNode operation) throws OperationFailedException {
+ String vdbName = operation.get(OperationsConstants.VDB_NAME).asString();
+ int vdbVersion = operation.get(OperationsConstants.VDB_VERSION).asInt();
+
+ VDBMetaData vdb = engine.getVDB(vdbName, vdbVersion);
+ return MetadataMapper.wrap(vdb);
+ }
+
+ protected void describeParameters(ModelNode operationNode, ResourceBundle bundle) {
+ operationNode.get(REQUEST_PROPERTIES, OperationsConstants.VDB_NAME, TYPE).set(ModelType.STRING);
+ operationNode.get(REQUEST_PROPERTIES, OperationsConstants.VDB_NAME, REQUIRED).set(true);
+ operationNode.get(REQUEST_PROPERTIES, OperationsConstants.VDB_NAME, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.VDB_NAME));
+
+ operationNode.get(REQUEST_PROPERTIES, OperationsConstants.VDB_VERSION, TYPE).set(ModelType.STRING);
+ operationNode.get(REQUEST_PROPERTIES, OperationsConstants.VDB_VERSION, REQUIRED).set(true);
+ operationNode.get(REQUEST_PROPERTIES, OperationsConstants.VDB_VERSION, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.VDB_VERSION));
+ }
+}
+
+class GetVDBs extends QueryEngineOperationHandler{
+
+ protected GetVDBs(String operationName) {
+ super(operationName);
+ }
+ @Override
+ protected ModelNode executeOperation(RuntimeEngineDeployer engine, ModelNode operation) throws OperationFailedException {
+ List<VDBMetaData> vdbs = engine.getVDBs();
+ ModelNode node = new ModelNode();
+ node.get(TYPE).set(ModelType.LIST);
+
+ for (VDBMetaData vdb:vdbs) {
+ node.add(MetadataMapper.wrap(vdb));
+ }
+ return node;
+ }
+
+}
+
+class GetTranslators extends QueryEngineOperationHandler{
+
+ protected GetTranslators(String operationName) {
+ super(operationName);
+ }
+ @Override
+ protected ModelNode executeOperation(RuntimeEngineDeployer engine, ModelNode operation) throws OperationFailedException {
+ List<VDBTranslatorMetaData> translators = engine.getTranslators();
+ ModelNode node = new ModelNode();
+ node.get(TYPE).set(ModelType.OBJECT);
+
+ for (VDBTranslatorMetaData t:translators) {
+ node.add(MetadataMapper.VDBTranslatorMetaDataMapper.wrap(t));
+ }
+ return node;
+ }
+
+ protected void describeParameters(ModelNode operationNode, ResourceBundle bundle) {
+ operationNode.get(REPLY_PROPERTIES, TYPE).set(ModelType.LIST);
+ operationNode.get(REPLY_PROPERTIES, VALUE_TYPE).set(ModelType.OBJECT);
+ operationNode.get(REPLY_PROPERTIES, DESCRIPTION).set(bundle.getString(getReplyName()));
+ }
+}
+
+class GetTranslator extends QueryEngineOperationHandler{
+
+ protected GetTranslator(String operationName) {
+ super(operationName);
+ }
+
+ @Override
+ protected ModelNode executeOperation(RuntimeEngineDeployer engine, ModelNode operation) throws OperationFailedException {
+ String translatorName = operation.get(OperationsConstants.TRANSLATOR_NAME).asString();
+
+ VDBTranslatorMetaData translator = engine.getTranslator(translatorName);
+ return MetadataMapper.VDBTranslatorMetaDataMapper.wrap(translator);
+ }
+
+ protected void describeParameters(ModelNode operationNode, ResourceBundle bundle) {
+ operationNode.get(REQUEST_PROPERTIES, OperationsConstants.TRANSLATOR_NAME, TYPE).set(ModelType.STRING);
+ operationNode.get(REQUEST_PROPERTIES, OperationsConstants.TRANSLATOR_NAME, REQUIRED).set(true);
+ operationNode.get(REQUEST_PROPERTIES, OperationsConstants.TRANSLATOR_NAME, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.TRANSLATOR_NAME));
+
+ operationNode.get(REPLY_PROPERTIES, TYPE).set(ModelType.OBJECT);
+ operationNode.get(REPLY_PROPERTIES, DESCRIPTION).set(bundle.getString(getReplyName()));
+ }
}
\ No newline at end of file
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-07-01 20:26:47 UTC (rev 3300)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidExtension.java 2011-07-04 19:09:19 UTC (rev 3301)
@@ -57,6 +57,8 @@
private static final String TERMINATE_TRANSACTION = "terminate-transaction";
private static final String MERGE_VDBS = "merge-vdbs";
private static final String EXECUTE_QUERY = "execute-query";
+ private static final String GETVDBS = "getVDBs";
+ private static final String GETVDB = "getVDB";
public static final String SUBSYSTEM_NAME = "teiid"; //$NON-NLS-1$
private static TeiidSubsystemParser parser = new TeiidSubsystemParser();
@@ -159,7 +161,13 @@
subsystem.registerOperationHandler(MERGE_VDBS, op, op);
op = new ExecuteQuery(EXECUTE_QUERY);
- subsystem.registerOperationHandler(EXECUTE_QUERY, op, op);
+ subsystem.registerOperationHandler(EXECUTE_QUERY, op, op);
+
+ op = new GetVDBs(GETVDBS);
+ subsystem.registerOperationHandler(GETVDBS, op, op);
+
+ op = new GetVDB(GETVDB);
+ subsystem.registerOperationHandler(GETVDB, op, op);
}
@Override
Deleted: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidSubsystemDescription.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidSubsystemDescription.java 2011-07-01 20:26:47 UTC (rev 3300)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidSubsystemDescription.java 2011-07-04 19:09:19 UTC (rev 3301)
@@ -1,209 +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 java.util.Locale;
-import java.util.ResourceBundle;
-
-import org.jboss.as.controller.descriptions.DescriptionProvider;
-import org.jboss.as.controller.descriptions.ModelDescriptionConstants;
-import org.jboss.dmr.ModelNode;
-import org.jboss.dmr.ModelType;
-
-public class TeiidSubsystemDescription implements DescriptionProvider {
- private static final String DESC = ".describe"; //$NON-NLS-1$
-
- @Override
- public ModelNode getModelDescription(Locale locale) {
- final ResourceBundle bundle = IntegrationPlugin.getResourceBundle(locale);
-
- ModelNode node = new ModelNode();
- node.get(ModelDescriptionConstants.DESCRIPTION).set("teiid subsystem"); //$NON-NLS-1$
- node.get(ModelDescriptionConstants.HEAD_COMMENT_ALLOWED).set(true);
- node.get(ModelDescriptionConstants.TAIL_COMMENT_ALLOWED).set(true);
- node.get(ModelDescriptionConstants.NAMESPACE).set(Namespace.CURRENT.getUri());
-
- getQueryEngineDescription(node.get(CHILDREN, Configuration.QUERY_ENGINE), ATTRIBUTES, bundle);
- return node;
- }
-
- static void addAttribute(ModelNode node, String name, String type, String description, ModelType dataType, boolean required, String defaultValue) {
- node.get(type, name, TYPE).set(dataType);
- node.get(type, name, DESCRIPTION).set(description);
- node.get(type, name, REQUIRED).set(required);
- node.get(type, name, MAX_OCCURS).set(1);
- if (defaultValue != null) {
- if (ModelType.INT.equals(dataType)) {
- node.get(type, name, DEFAULT).set(Integer.parseInt(defaultValue));
- }
- else if (ModelType.BOOLEAN.equals(dataType)) {
- node.get(type, name, DEFAULT).set(Boolean.parseBoolean(defaultValue));
- }
- else {
- node.get(type, name, DEFAULT).set(defaultValue);
- }
- }
- //TODO: add "allowed" values
- }
-
- static void getQueryEngineDescription(ModelNode node, String type, ResourceBundle bundle) {
- addAttribute(node, Configuration.JNDI_NAME, type, bundle.getString(Configuration.JNDI_NAME+DESC), ModelType.STRING, true, "teiid/engine-deployer"); //$NON-NLS-1$
- addAttribute(node, Configuration.MAX_THREADS, type, bundle.getString(Configuration.MAX_THREADS+DESC), ModelType.INT, false, "64"); //$NON-NLS-1$
- addAttribute(node, Configuration.MAX_ACTIVE_PLANS, type, bundle.getString(Configuration.MAX_ACTIVE_PLANS+DESC), ModelType.INT, false, "20"); //$NON-NLS-1$
- addAttribute(node, Configuration.USER_REQUEST_SOURCE_CONCURRENCY, type, bundle.getString(Configuration.USER_REQUEST_SOURCE_CONCURRENCY+DESC), ModelType.INT, false, "0"); //$NON-NLS-1$
- addAttribute(node, Configuration.TIME_SLICE_IN_MILLI, type, bundle.getString(Configuration.TIME_SLICE_IN_MILLI+DESC), ModelType.INT, false, "2000"); //$NON-NLS-1$
- addAttribute(node, Configuration.MAX_ROWS_FETCH_SIZE, type, bundle.getString(Configuration.MAX_ROWS_FETCH_SIZE+DESC), ModelType.INT, false, "20480"); //$NON-NLS-1$
- addAttribute(node, Configuration.LOB_CHUNK_SIZE_IN_KB, type, bundle.getString(Configuration.LOB_CHUNK_SIZE_IN_KB+DESC), ModelType.INT, false, "100"); //$NON-NLS-1$
- addAttribute(node, Configuration.USE_DATA_ROLES, type, bundle.getString(Configuration.USE_DATA_ROLES+DESC), ModelType.BOOLEAN, false, "true"); //$NON-NLS-1$
- addAttribute(node, Configuration.ALLOW_CREATE_TEMPORY_TABLES_BY_DEFAULT, type, bundle.getString(Configuration.ALLOW_CREATE_TEMPORY_TABLES_BY_DEFAULT+DESC), ModelType.BOOLEAN, false, "true"); //$NON-NLS-1$
- addAttribute(node, Configuration.ALLOW_FUNCTION_CALLS_BY_DEFAULT, type, bundle.getString(Configuration.ALLOW_FUNCTION_CALLS_BY_DEFAULT+DESC), ModelType.BOOLEAN, false, "true"); //$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.JDBC_SECURITY_DOMAIN, type, bundle.getString(Configuration.JDBC_SECURITY_DOMAIN+DESC), ModelType.STRING, false, null);
- addAttribute(node, Configuration.MAX_SESSIONS_ALLOWED, type, bundle.getString(Configuration.MAX_SESSIONS_ALLOWED+DESC), ModelType.INT, false, "5000"); //$NON-NLS-1$
- addAttribute(node, Configuration.SESSION_EXPIRATION_TIME_LIMIT, type, bundle.getString(Configuration.SESSION_EXPIRATION_TIME_LIMIT+DESC), ModelType.INT, false, "0"); //$NON-NLS-1$
-
- addAttribute(node, Configuration.ALLOW_ENV_FUNCTION, type, bundle.getString(Configuration.ALLOW_ENV_FUNCTION+DESC), ModelType.BOOLEAN, false, "false"); //$NON-NLS-1$
-
- //Buffer Manager stuff
- ModelNode bufferNode = node.get(CHILDREN, Configuration.BUFFER_SERVICE);
- bufferNode.get(TYPE).set(ModelType.OBJECT);
- bufferNode.get(DESCRIPTION).set(bundle.getString(Configuration.BUFFER_SERVICE+DESC));
- bufferNode.get(REQUIRED).set(false);
- bufferNode.get(MAX_OCCURS).set(1);
- bufferNode.get(MIN_OCCURS).set(1);
- getBufferDescription(bufferNode, type, bundle);
-
- // result-set-cache
- ModelNode rsCacheNode = node.get(CHILDREN, Configuration.RESULTSET_CACHE);
- rsCacheNode.get(TYPE).set(ModelType.OBJECT);
- rsCacheNode.get(DESCRIPTION).set(bundle.getString(Configuration.RESULTSET_CACHE+DESC));
- rsCacheNode.get(REQUIRED).set(false);
- rsCacheNode.get(MAX_OCCURS).set(1);
- rsCacheNode.get(MIN_OCCURS).set(1);
- getResultsetCacheDescription(rsCacheNode, type, bundle);
-
- // preparedplan-set-cache
- ModelNode preparedPlanCacheNode = node.get(CHILDREN, Configuration.PREPAREDPLAN_CACHE);
- preparedPlanCacheNode.get(TYPE).set(ModelType.OBJECT);
- preparedPlanCacheNode.get(DESCRIPTION).set(bundle.getString(Configuration.PREPAREDPLAN_CACHE+DESC));
- preparedPlanCacheNode.get(REQUIRED).set(false);
- preparedPlanCacheNode.get(MAX_OCCURS).set(1);
- preparedPlanCacheNode.get(MIN_OCCURS).set(1);
- getResultsetCacheDescription(preparedPlanCacheNode, type, bundle);
-
- //distributed-cache
- ModelNode distributedCacheNode = node.get(CHILDREN, Configuration.CACHE_FACORY);
- distributedCacheNode.get(TYPE).set(ModelType.OBJECT);
- distributedCacheNode.get(DESCRIPTION).set(bundle.getString(Configuration.CACHE_FACORY+DESC));
- distributedCacheNode.get(REQUIRED).set(false);
- distributedCacheNode.get(MAX_OCCURS).set(1);
- distributedCacheNode.get(MIN_OCCURS).set(1);
- getDistributedCacheDescription(preparedPlanCacheNode, type, bundle);
-
- //jdbc
- ModelNode jdbcSocketNode = node.get(CHILDREN, Configuration.JDBC);
- jdbcSocketNode.get(TYPE).set(ModelType.OBJECT);
- jdbcSocketNode.get(DESCRIPTION).set(bundle.getString(Configuration.JDBC+DESC));
- jdbcSocketNode.get(REQUIRED).set(false);
- jdbcSocketNode.get(MAX_OCCURS).set(1);
- jdbcSocketNode.get(MIN_OCCURS).set(1);
- getSocketConfig(jdbcSocketNode, type, bundle);
-
- //odbc
- ModelNode odbcSocketNode = node.get(CHILDREN, Configuration.ODBC);
- odbcSocketNode.get(TYPE).set(ModelType.OBJECT);
- odbcSocketNode.get(DESCRIPTION).set(bundle.getString(Configuration.ODBC+DESC));
- odbcSocketNode.get(REQUIRED).set(false);
- odbcSocketNode.get(MAX_OCCURS).set(1);
- odbcSocketNode.get(MIN_OCCURS).set(1);
- getSocketConfig(odbcSocketNode, type, bundle);
- }
-
- private static void getDistributedCacheDescription(ModelNode node, String type, ResourceBundle bundle) {
- addAttribute(node, Configuration.ENABLED, type, bundle.getString(Configuration.ENABLED+DESC), ModelType.BOOLEAN, false, "true"); //$NON-NLS-1$
- addAttribute(node, Configuration.CACHE_SERVICE_JNDI_NAME, type, bundle.getString(Configuration.CACHE_SERVICE_JNDI_NAME+DESC), ModelType.STRING, false, "java:TeiidCacheManager"); //$NON-NLS-1$
- addAttribute(node, Configuration.RESULTSET_CACHE_NAME, type, bundle.getString(Configuration.RESULTSET_CACHE_NAME+DESC), ModelType.STRING, false, "teiid-resultset-cache"); //$NON-NLS-1$
- }
-
- private static void getBufferDescription(ModelNode node, String type, ResourceBundle bundle) {
- addAttribute(node, Configuration.USE_DISK, type, bundle.getString(Configuration.USE_DISK+DESC), ModelType.BOOLEAN, false, "true"); //$NON-NLS-1$
- addAttribute(node, Configuration.DISK_DIRECTORY, type, bundle.getString(Configuration.DISK_DIRECTORY+DESC), ModelType.STRING, true, null);
- addAttribute(node, Configuration.PROCESSOR_BATCH_SIZE, type, bundle.getString(Configuration.PROCESSOR_BATCH_SIZE+DESC), ModelType.INT, false, "512"); //$NON-NLS-1$
- addAttribute(node, Configuration.CONNECTOR_BATCH_SIZE, type, bundle.getString(Configuration.CONNECTOR_BATCH_SIZE+DESC), ModelType.INT, false, "1024"); //$NON-NLS-1$
- addAttribute(node, Configuration.MAX_RESERVE_BATCH_COLUMNS, type, bundle.getString(Configuration.MAX_RESERVE_BATCH_COLUMNS+DESC), ModelType.INT, false, "-1"); //$NON-NLS-1$
- addAttribute(node, Configuration.MAX_PROCESSING_BATCH_COLUMNS, type, bundle.getString(Configuration.MAX_PROCESSING_BATCH_COLUMNS+DESC), ModelType.INT, false, "-1"); //$NON-NLS-1$
- addAttribute(node, Configuration.MAX_FILE_SIZE, type, bundle.getString(Configuration.MAX_FILE_SIZE+DESC), ModelType.INT, false, "2048"); //$NON-NLS-1$
- addAttribute(node, Configuration.MAX_BUFFER_SPACE, type, bundle.getString(Configuration.MAX_BUFFER_SPACE+DESC), ModelType.INT, false, "51200"); //$NON-NLS-1$
- addAttribute(node, Configuration.MAX_OPEN_FILES, type, bundle.getString(Configuration.MAX_OPEN_FILES+DESC), ModelType.INT, false, "64"); //$NON-NLS-1$
- }
-
- static void getResultsetCacheDescription(ModelNode node, String type, ResourceBundle bundle) {
- addAttribute(node, Configuration.ENABLED, type, bundle.getString(Configuration.ENABLED+DESC), ModelType.BOOLEAN, false, "true"); //$NON-NLS-1$
- addAttribute(node, Configuration.MAX_ENTRIES, type, bundle.getString(Configuration.MAX_ENTRIES+DESC), ModelType.INT, false, "1024"); //$NON-NLS-1$
- addAttribute(node, Configuration.MAX_AGE_IN_SECS, type, bundle.getString(Configuration.MAX_AGE_IN_SECS+DESC), ModelType.INT, false, "7200");//$NON-NLS-1$
- addAttribute(node, Configuration.MAX_STALENESS, type, bundle.getString(Configuration.MAX_STALENESS+DESC), ModelType.INT, false, "60");//$NON-NLS-1$
- addAttribute(node, Configuration.CACHE_TYPE, type, bundle.getString(Configuration.CACHE_TYPE+DESC), ModelType.STRING, false, "EXPIRATION"); //$NON-NLS-1$
- addAttribute(node, Configuration.CACHE_LOCATION, type, bundle.getString(Configuration.CACHE_LOCATION+DESC), ModelType.STRING, false, "resultset"); //$NON-NLS-1$
- }
-
- static void getPreparedPalnCacheDescription(ModelNode node, String type, ResourceBundle bundle) {
- addAttribute(node, Configuration.ENABLED, type, bundle.getString(Configuration.ENABLED+DESC), ModelType.BOOLEAN, false, "true"); //$NON-NLS-1$
- addAttribute(node, Configuration.MAX_ENTRIES, type, bundle.getString(Configuration.MAX_ENTRIES+DESC), ModelType.INT, false, "512"); //$NON-NLS-1$
- addAttribute(node, Configuration.MAX_AGE_IN_SECS, type, bundle.getString(Configuration.MAX_AGE_IN_SECS+DESC), ModelType.INT, false, "28800");//$NON-NLS-1$
- addAttribute(node, Configuration.MAX_STALENESS, type, bundle.getString(Configuration.MAX_STALENESS+DESC), ModelType.INT, false, "0");//$NON-NLS-1$
- addAttribute(node, Configuration.CACHE_TYPE, type, bundle.getString(Configuration.CACHE_TYPE+DESC), ModelType.STRING, false, "LRU"); //$NON-NLS-1$
- addAttribute(node, Configuration.CACHE_LOCATION, type, bundle.getString(Configuration.CACHE_LOCATION+DESC), ModelType.STRING, false, "preparedplan"); //$NON-NLS-1$
- }
-
- static void getSocketConfig(ModelNode node, String type, ResourceBundle bundle) {
- addAttribute(node, Configuration.SOCKET_ENABLED, type, bundle.getString(Configuration.SOCKET_ENABLED+DESC), ModelType.BOOLEAN, false, "true"); //$NON-NLS-1$
- addAttribute(node, Configuration.MAX_SOCKET_THREAD_SIZE, type, bundle.getString(Configuration.MAX_SOCKET_THREAD_SIZE+DESC), ModelType.INT, false, "0"); //$NON-NLS-1$
- addAttribute(node, Configuration.IN_BUFFER_SIZE, type, bundle.getString(Configuration.IN_BUFFER_SIZE+DESC), ModelType.INT, false, "0"); //$NON-NLS-1$
- addAttribute(node, Configuration.OUT_BUFFER_SIZE, type, bundle.getString(Configuration.OUT_BUFFER_SIZE+DESC), ModelType.INT, false, "0"); //$NON-NLS-1$
- addAttribute(node, Configuration.SOCKET_BINDING, type, bundle.getString(Configuration.SOCKET_BINDING+DESC), ModelType.INT, true, null);
-
- ModelNode sslNode = node.get(CHILDREN, Configuration.SSL);
- sslNode.get(TYPE).set(ModelType.OBJECT);
- sslNode.get(DESCRIPTION).set(bundle.getString(Configuration.SSL+DESC));
- sslNode.get(REQUIRED).set(false);
- sslNode.get(MAX_OCCURS).set(1);
- sslNode.get(MIN_OCCURS).set(0);
- addAttribute(node, Configuration.SSL_MODE, type, bundle.getString(Configuration.SSL_MODE+DESC), ModelType.STRING, false, "login"); //$NON-NLS-1$
- addAttribute(node, Configuration.KEY_STORE_FILE, type, bundle.getString(Configuration.KEY_STORE_FILE+DESC), ModelType.STRING, false, null);
- addAttribute(node, Configuration.KEY_STORE_PASSWD, type, bundle.getString(Configuration.KEY_STORE_PASSWD+DESC), ModelType.STRING, false, null);
- addAttribute(node, Configuration.KEY_STORE_TYPE, type, bundle.getString(Configuration.KEY_STORE_TYPE+DESC), ModelType.STRING, false, "JKS"); //$NON-NLS-1$
- addAttribute(node, Configuration.SSL_PROTOCOL, type, bundle.getString(Configuration.SSL_PROTOCOL+DESC), ModelType.BOOLEAN, false, "SSLv3"); //$NON-NLS-1$
- addAttribute(node, Configuration.KEY_MANAGEMENT_ALG, type, bundle.getString(Configuration.KEY_MANAGEMENT_ALG+DESC), ModelType.STRING, false, "false"); //$NON-NLS-1$
- addAttribute(node, Configuration.TRUST_FILE, type, bundle.getString(Configuration.TRUST_FILE+DESC), ModelType.STRING, false, null);
- addAttribute(node, Configuration.TRUST_PASSWD, type, bundle.getString(Configuration.TRUST_PASSWD+DESC), ModelType.STRING, false, null);
- addAttribute(node, Configuration.AUTH_MODE, type, bundle.getString(Configuration.AUTH_MODE+DESC), ModelType.STRING, false, "anonymous"); //$NON-NLS-1$
- }
-}
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2011-07-01 20:26:47 UTC (rev 3300)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2011-07-04 19:09:19 UTC (rev 3301)
@@ -30,10 +30,7 @@
import java.sql.SQLException;
import java.sql.SQLXML;
import java.util.*;
-import java.util.concurrent.Callable;
-import java.util.concurrent.Executor;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
+import java.util.concurrent.*;
import javax.naming.InitialContext;
import javax.naming.NamingException;
@@ -42,12 +39,13 @@
import javax.security.auth.login.LoginException;
import javax.transaction.TransactionManager;
+import org.jboss.as.security.plugins.SecurityDomainContext;
import org.jboss.as.server.services.net.SocketBinding;
import org.jboss.msc.service.Service;
-import org.jboss.msc.service.ServiceName;
import org.jboss.msc.service.StartContext;
import org.jboss.msc.service.StopContext;
import org.jboss.msc.value.InjectedValue;
+import org.jboss.netty.util.internal.ConcurrentHashMap;
import org.jboss.util.naming.Util;
import org.teiid.adminapi.AdminComponentException;
import org.teiid.adminapi.AdminException;
@@ -70,6 +68,7 @@
import org.teiid.core.util.LRUCache;
import org.teiid.deployers.VDBLifeCycleListener;
import org.teiid.deployers.VDBRepository;
+import org.teiid.dqp.internal.datamgr.TranslatorRepository;
import org.teiid.dqp.internal.process.*;
import org.teiid.dqp.service.BufferService;
import org.teiid.dqp.service.SessionService;
@@ -91,14 +90,14 @@
import org.teiid.query.processor.DdlPlan;
import org.teiid.query.tempdata.TempTableStore;
import org.teiid.security.SecurityHelper;
+import org.teiid.services.SessionServiceImpl;
import org.teiid.transport.*;
import org.teiid.vdb.runtime.VDBKey;
public class RuntimeEngineDeployer extends DQPConfiguration implements DQPManagement, Serializable , ClientServiceRegistry, EventDistributor, EventDistributorFactory, Service<ClientServiceRegistry> {
private static final long serialVersionUID = -4676205340262775388L;
- public static final ServiceName SERVICE_NAME = ServiceName.JBOSS.append("teiid", "runtime"); //$NON-NLS-1$ //$NON-NLS-2$
-
+
private transient SocketConfiguration jdbcSocketConfiguration;
private transient SocketConfiguration odbcSocketConfiguration;
private transient SocketListener jdbcSocket;
@@ -106,16 +105,19 @@
private transient TransactionServerImpl transactionServerImpl = new TransactionServerImpl();
private transient DQPCore dqpCore = new DQPCore();
- private transient SessionService sessionService;
+ private transient SessionServiceImpl sessionService;
private transient ILogon logon;
private transient ClientServiceRegistryImpl csr = new ClientServiceRegistryImpl();
private transient VDBRepository vdbRepository;
+ private transient TranslatorRepository translatorRepository;
private transient String jndiName;
private String eventDistributorName;
private transient EventDistributor eventDistributor;
-
+ private long sessionMaxLimit = SessionService.DEFAULT_MAX_SESSIONS;
+ private long sessionExpirationTimeLimit = SessionService.DEFAULT_SESSION_EXPIRATION;
+
// TODO: remove public?
public final InjectedValue<WorkManager> workManagerInjector = new InjectedValue<WorkManager>();
public final InjectedValue<XATerminator> xaTerminatorInjector = new InjectedValue<XATerminator>();
@@ -123,7 +125,10 @@
public final InjectedValue<Executor> threadPoolInjector = new InjectedValue<Executor>();
public final InjectedValue<SocketBinding> jdbcSocketBindingInjector = new InjectedValue<SocketBinding>();
public final InjectedValue<SocketBinding> odbcSocketBindingInjector = new InjectedValue<SocketBinding>();
+ public final ConcurrentMap<String, SecurityDomainContext> securityDomains = new ConcurrentHashMap<String, SecurityDomainContext>();
+ private LinkedList<String> securityDomainNames = new LinkedList<String>();
+
public RuntimeEngineDeployer() {
// TODO: this does not belong here
LogManager.setLogListener(new Log4jListener());
@@ -146,6 +151,14 @@
setXATerminator(xaTerminatorInjector.getValue());
setTransactionManager(txnManagerInjector.getValue());
+ this.sessionService = new SessionServiceImpl(this.securityDomainNames, this.securityDomains);
+ this.sessionService.setSessionExpirationTimeLimit(this.sessionExpirationTimeLimit);
+ this.sessionService.setSessionMaxLimit(this.sessionMaxLimit);
+ this.sessionService.setDqp(this.dqpCore);
+ this.sessionService.setVDBRepository(this.vdbRepository);
+ this.sessionService.start();
+
+
this.jdbcSocketConfiguration.setHostAddress(this.jdbcSocketBindingInjector.getValue().getAddress());
this.jdbcSocketConfiguration.setPortNumber(this.jdbcSocketBindingInjector.getValue().getPort());
this.odbcSocketConfiguration.setHostAddress(this.odbcSocketBindingInjector.getValue().getAddress());
@@ -284,6 +297,9 @@
this.odbcSocket.stop();
this.odbcSocket = null;
}
+
+ this.sessionService.stop();
+
LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.getString("engine_stopped", new Date(System.currentTimeMillis()).toString())); //$NON-NLS-1$
}
@@ -332,12 +348,7 @@
public void setWorkManager(WorkManager mgr) {
this.transactionServerImpl.setWorkManager(mgr);
}
-
- public void setSessionService(SessionService service) {
- this.sessionService = service;
- service.setDqp(this.dqpCore);
- }
-
+
public void setBufferService(BufferService service) {
this.dqpCore.setBufferService(service);
}
@@ -474,7 +485,7 @@
SessionMetadata session = null;
try {
- session = this.sessionService.createSession(user, null, "JOPR", properties, false, false); //$NON-NLS-1$
+ session = this.sessionService.createSession(user, null, "JOPR", properties, false); //$NON-NLS-1$
} catch (SessionServiceException e1) {
throw new AdminProcessingException(e1);
} catch (LoginException e1) {
@@ -745,4 +756,35 @@
return ApplicationInfo.getInstance().getBuildNumber();
}
+ public void setSessionMaxLimit(long limit) {
+ this.sessionMaxLimit = limit;
+ }
+
+ public void setSessionExpirationTimeLimit(long limit) {
+ this.sessionExpirationTimeLimit = limit;
+ }
+
+ public void addSecurityDomain(String domain) {
+ this.securityDomainNames.add(domain);
+ }
+
+ public List<VDBMetaData> getVDBs(){
+ return this.vdbRepository.getVDBs();
+ }
+
+ public VDBMetaData getVDB(String vdbName, int version){
+ return this.vdbRepository.getVDB(vdbName, version);
+ }
+
+ public List<VDBTranslatorMetaData> getTranslators(){
+ return this.translatorRepository.getTranslators();
+ }
+
+ public VDBTranslatorMetaData getTranslator(String translatorName) {
+ return (VDBTranslatorMetaData)this.translatorRepository.getTranslatorMetaData(translatorName);
+ }
+
+ public void setTranslatorRepository(TranslatorRepository translatorRepo) {
+ this.translatorRepository = translatorRepo;
+ }
}
Modified: branches/as7/pom.xml
===================================================================
--- branches/as7/pom.xml 2011-07-01 20:26:47 UTC (rev 3300)
+++ branches/as7/pom.xml 2011-07-04 19:09:19 UTC (rev 3301)
@@ -420,7 +420,13 @@
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-connector</artifactId>
<version>${jbossas-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-security</artifactId>
+ <version>${jbossas-version}</version>
</dependency>
+
<!--
<dependency>
<groupId>jgroups</groupId>
Modified: branches/as7/runtime/pom.xml
===================================================================
--- branches/as7/runtime/pom.xml 2011-07-01 20:26:47 UTC (rev 3300)
+++ branches/as7/runtime/pom.xml 2011-07-04 19:09:19 UTC (rev 3301)
@@ -80,6 +80,11 @@
<artifactId>jboss-vfs</artifactId>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-security</artifactId>
+ <scope>provided</scope>
+ </dependency>
<!--
<dependency>
<groupId>org.jboss.cache</groupId>
Modified: branches/as7/runtime/src/main/java/org/teiid/deployers/TranslatorUtil.java
===================================================================
--- branches/as7/runtime/src/main/java/org/teiid/deployers/TranslatorUtil.java 2011-07-01 20:26:47 UTC (rev 3300)
+++ branches/as7/runtime/src/main/java/org/teiid/deployers/TranslatorUtil.java 2011-07-04 19:09:19 UTC (rev 3301)
@@ -31,7 +31,6 @@
import org.jboss.as.server.deployment.DeploymentUnitProcessingException;
import org.teiid.adminapi.Translator;
-import org.teiid.adminapi.impl.TranslatorMetaData;
import org.teiid.adminapi.impl.VDBTranslatorMetaData;
import org.teiid.core.TeiidException;
import org.teiid.core.TeiidRuntimeException;
@@ -92,7 +91,7 @@
public static ExecutionFactory buildExecutionFactory(Translator data) throws DeploymentUnitProcessingException {
ExecutionFactory executionFactory;
try {
- String executionClass = data.getPropertyValue(TranslatorMetaData.EXECUTION_FACTORY_CLASS);
+ String executionClass = data.getPropertyValue(VDBTranslatorMetaData.EXECUTION_FACTORY_CLASS);
Object o = ReflectionHelper.create(executionClass, null, Thread.currentThread().getContextClassLoader());
if(!(o instanceof ExecutionFactory)) {
throw new DeploymentUnitProcessingException(RuntimePlugin.Util.getString("invalid_class", executionClass));//$NON-NLS-1$
Modified: branches/as7/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java
===================================================================
--- branches/as7/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java 2011-07-01 20:26:47 UTC (rev 3300)
+++ branches/as7/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java 2011-07-04 19:09:19 UTC (rev 3301)
@@ -25,9 +25,10 @@
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
-import javax.security.auth.login.LoginContext;
+import javax.security.auth.Subject;
import javax.security.auth.login.LoginException;
+import org.jboss.as.security.plugins.SecurityDomainContext;
import org.teiid.adminapi.VDB;
import org.teiid.adminapi.VDB.ConnectionType;
import org.teiid.adminapi.impl.SessionMetadata;
@@ -52,8 +53,6 @@
* This class serves as the primary implementation of the Session Service.
*/
public class SessionServiceImpl implements SessionService {
- public static final String SECURITY_DOMAINS = "securitydomains"; //$NON-NLS-1$
-
/*
* Configuration state
*/
@@ -70,8 +69,13 @@
private Map<String, SessionMetadata> sessionCache = new ConcurrentHashMap<String, SessionMetadata>();
private Timer sessionMonitor = new Timer("SessionMonitor", true); //$NON-NLS-1$
- private LinkedList<String> securityDomains = new LinkedList<String>();
+ private Map<String, SecurityDomainContext> securityDomainMap;
+ private LinkedList<String> securityDomainNames;
+ public SessionServiceImpl(LinkedList<String> domainNames, Map<String, SecurityDomainContext> domains) {
+ this.securityDomainNames = domainNames;
+ this.securityDomainMap = domains;
+ }
// -----------------------------------------------------------------------------------
// S E R V I C E - R E L A T E D M E T H O D S
@@ -111,16 +115,6 @@
LogManager.logWarning(LogConstants.CTX_SECURITY,e,"Exception terminitating session"); //$NON-NLS-1$
}
}
-
- // try to log out of the context.
- try {
- LoginContext context = info.getLoginContext();
- if (context != null) {
- context.logout();
- }
- } catch (LoginException e) {
- LogManager.logWarning(LogConstants.CTX_SECURITY,e,"Exception terminitating session"); //$NON-NLS-1$
- }
}
@Override
@@ -129,10 +123,10 @@
ArgCheck.isNotNull(applicationName);
ArgCheck.isNotNull(properties);
- LoginContext loginContext = null;
String securityDomain = "none"; //$NON-NLS-1$
Object securityContext = null;
- List<String> domains = this.securityDomains;
+ Subject subject = null;
+ List<String> domains = this.securityDomainNames;
// Validate VDB and version if logging on to server product...
VDBMetaData vdb = null;
@@ -150,11 +144,11 @@
// Authenticate user...
// if not authenticated, this method throws exception
boolean onlyAllowPassthrough = Boolean.valueOf(properties.getProperty(TeiidURL.CONNECTION.PASSTHROUGH_AUTHENTICATION, "false")); //$NON-NLS-1$
- TeiidLoginContext membership = authenticate(userName, credentials, applicationName, domains, this.securityHelper, onlyAllowPassthrough);
- loginContext = membership.getLoginContext();
+ TeiidLoginContext membership = authenticate(userName, credentials, applicationName, domains, this.securityDomainMap, this.securityHelper, onlyAllowPassthrough);
userName = membership.getUserName();
securityDomain = membership.getSecurityDomain();
securityContext = membership.getSecurityContext();
+ subject = membership.getSubject();
}
long creationTime = System.currentTimeMillis();
@@ -175,7 +169,7 @@
}
// these are local no need for monitoring.
- newSession.setLoginContext(loginContext);
+ newSession.setSubject(subject);
newSession.setSecurityContext(securityContext);
newSession.setVdb(vdb);
LogManager.logDetail(LogConstants.CTX_SECURITY, new Object[] {"Logon successful for \"", userName, "\" - created SessionID \"", newSession.getSessionToken().getSessionID(), "\"" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
@@ -223,10 +217,10 @@
return vdb;
}
- protected TeiidLoginContext authenticate(String userName, Credentials credentials, String applicationName, List<String> domains, SecurityHelper helper, boolean onlyallowPassthrough)
+ protected TeiidLoginContext authenticate(String userName, Credentials credentials, String applicationName, List<String> domains, Map<String, SecurityDomainContext> securityDomainMap, SecurityHelper helper, boolean onlyallowPassthrough)
throws LoginException {
TeiidLoginContext membership = new TeiidLoginContext(helper);
- membership.authenticateUser(userName, credentials, applicationName, domains, onlyallowPassthrough);
+ membership.authenticateUser(userName, credentials, applicationName, domains, securityDomainMap, onlyallowPassthrough);
return membership;
}
@@ -315,17 +309,6 @@
this.sessionExpirationTimeLimit = limit;
}
- public void setSecurityDomains(String domainNameOrder) {
- 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$
- for (String domainName : domainNames) {
- this.securityDomains.addLast(domainName);
- }
- }
- }
-
public void start() {
this.sessionMonitor.schedule(new TimerTask() {
@Override
Modified: branches/as7/runtime/src/main/java/org/teiid/services/TeiidLoginContext.java
===================================================================
--- branches/as7/runtime/src/main/java/org/teiid/services/TeiidLoginContext.java 2011-07-01 20:26:47 UTC (rev 3300)
+++ branches/as7/runtime/src/main/java/org/teiid/services/TeiidLoginContext.java 2011-07-04 19:09:19 UTC (rev 3301)
@@ -22,24 +22,16 @@
package org.teiid.services;
-import java.io.IOException;
import java.security.Principal;
import java.security.acl.Group;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
+import java.util.*;
import javax.security.auth.Subject;
-import javax.security.auth.callback.Callback;
-import javax.security.auth.callback.CallbackHandler;
-import javax.security.auth.callback.NameCallback;
-import javax.security.auth.callback.PasswordCallback;
-import javax.security.auth.callback.UnsupportedCallbackException;
-import javax.security.auth.login.LoginContext;
import javax.security.auth.login.LoginException;
+import org.jboss.as.security.plugins.SecurityDomainContext;
+import org.jboss.security.AuthenticationManager;
+import org.jboss.security.SimplePrincipal;
import org.teiid.logging.LogConstants;
import org.teiid.logging.LogManager;
import org.teiid.runtime.RuntimePlugin;
@@ -54,10 +46,10 @@
*/
public class TeiidLoginContext {
public static final String AT = "@"; //$NON-NLS-1$
- private LoginContext loginContext;
+ private Subject subject;
private String userName;
private String securitydomain;
- private Object credentials;
+ private Object securityContext;
private SecurityHelper securityHelper;
public TeiidLoginContext(SecurityHelper helper) {
@@ -65,7 +57,7 @@
}
public void authenticateUser(String username, final Credentials credential,
- String applicationName, List<String> domains, boolean onlyallowPassthrough)
+ String applicationName, List<String> domains, Map<String, SecurityDomainContext> securityDomainMap, boolean onlyallowPassthrough)
throws LoginException {
LogManager.logDetail(LogConstants.CTX_SECURITY, new Object[] {"authenticateUser", username, applicationName}); //$NON-NLS-1$
@@ -78,7 +70,8 @@
if (existing != null) {
this.userName = getUserName(existing)+AT+domain;
this.securitydomain = domain;
- this.loginContext = createLoginContext(domain, existing);
+ this.subject = existing;
+ this.securityContext = this.securityHelper.getSecurityContext(domain);
return;
}
}
@@ -89,40 +82,23 @@
// If username specifies a domain (user@domain) only that domain is authenticated against.
// If username specifies no domain, then all domains are tried in order.
for (String domain:getDomainsForUser(domains, username)) {
-
- try {
- CallbackHandler handler = new CallbackHandler() {
- @Override
- public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
- for (int i = 0; i < callbacks.length; i++) {
- if (callbacks[i] instanceof NameCallback) {
- NameCallback nc = (NameCallback)callbacks[i];
- nc.setName(baseUsername);
- } else if (callbacks[i] instanceof PasswordCallback) {
- PasswordCallback pc = (PasswordCallback)callbacks[i];
- char[] password = null;
- if (credential != null) {
- password = credential.getCredentialsAsCharArray();
- }
- pc.setPassword(password);
- credentials = password;
- } else {
- throw new UnsupportedCallbackException(callbacks[i], "Unrecognized Callback"); //$NON-NLS-1$
- }
- }
- }
- };
-
- // this is the configured login for teiid
- this.loginContext = createLoginContext(domain,handler);
- this.loginContext.login();
- this.userName = baseUsername+AT+domain;
- this.securitydomain = domain;
- LogManager.logDetail(LogConstants.CTX_SECURITY, new Object[] {"Logon successful for \"", username, "\""}); //$NON-NLS-1$ //$NON-NLS-2$
- return;
- } catch (LoginException e) {
- LogManager.logDetail(LogConstants.CTX_SECURITY,e, e.getMessage());
- }
+ // this is the configured login for teiid
+ SecurityDomainContext securityDomainContext = securityDomainMap.get(domain);
+ if (securityDomainContext != null) {
+ AuthenticationManager authManager = securityDomainContext.getAuthenticationManager();
+ if (authManager != null) {
+ Principal userPrincipal = new SimplePrincipal(username);
+ Subject subject = new Subject();
+ boolean isValid = authManager.isValid(userPrincipal, credential, subject);
+ if (isValid) {
+ this.userName = baseUsername+AT+domain;
+ this.securitydomain = domain;
+ this.securityContext = this.securityHelper.createSecurityContext(this.securitydomain, userPrincipal, credential, subject);
+ LogManager.logDetail(LogConstants.CTX_SECURITY, new Object[] {"Logon successful for \"", username, "\""}); //$NON-NLS-1$ //$NON-NLS-2$
+ return;
+ }
+ }
+ }
}
throw new LoginException(RuntimePlugin.Util.getString("SessionServiceImpl.The_username_0_and/or_password_are_incorrect", username )); //$NON-NLS-1$
}
@@ -137,19 +113,7 @@
}
return null;
}
-
- protected LoginContext createLoginContext(String domain, CallbackHandler handler) throws LoginException {
- return new LoginContext(domain, handler);
- }
-
- protected LoginContext createLoginContext(String domain, Subject subject) throws LoginException {
- return new LoginContext(domain, subject);
- }
- public LoginContext getLoginContext() {
- return this.loginContext;
- }
-
public String getUserName() {
return this.userName;
}
@@ -158,23 +122,12 @@
return this.securitydomain;
}
+ public Subject getSubject() {
+ return this.subject;
+ }
+
public Object getSecurityContext() {
- Object sc = null;
- if (this.loginContext != null) {
- sc = this.securityHelper.getSecurityContext(this.securitydomain);
- if ( sc == null){
- Subject subject = this.loginContext.getSubject();
- Principal principal = null;
- for(Principal p:subject.getPrincipals()) {
- if (this.userName.startsWith(p.getName())) {
- principal = p;
- break;
- }
- }
- return this.securityHelper.createSecurityContext(this.securitydomain, principal, credentials, subject);
- }
- }
- return sc;
+ return this.securityContext;
}
static String getBaseUsername(String username) {
Modified: branches/as7/runtime/src/main/java/org/teiid/transport/LogonImpl.java
===================================================================
--- branches/as7/runtime/src/main/java/org/teiid/transport/LogonImpl.java 2011-07-01 20:26:47 UTC (rev 3300)
+++ branches/as7/runtime/src/main/java/org/teiid/transport/LogonImpl.java 2011-07-04 19:09:19 UTC (rev 3301)
@@ -71,9 +71,8 @@
credential = new Credentials(password.toCharArray());
}
- boolean adminConnection = Boolean.parseBoolean(connProps.getProperty(TeiidURL.CONNECTION.ADMIN));
try {
- SessionMetadata sessionInfo = service.createSession(user,credential, applicationName, connProps, adminConnection, true);
+ SessionMetadata sessionInfo = service.createSession(user,credential, applicationName, connProps, true);
updateDQPContext(sessionInfo);
if (DQPWorkContext.getWorkContext().getClientAddress() == null) {
sessionInfo.setEmbedded(true);
Deleted: branches/as7/runtime/src/test/java/org/teiid/deployers/TestManagedPropertyUtil.java
===================================================================
--- branches/as7/runtime/src/test/java/org/teiid/deployers/TestManagedPropertyUtil.java 2011-07-01 20:26:47 UTC (rev 3300)
+++ branches/as7/runtime/src/test/java/org/teiid/deployers/TestManagedPropertyUtil.java 2011-07-04 19:09:19 UTC (rev 3301)
@@ -1,85 +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.util.Map;
-
-import org.jboss.managed.api.ManagedProperty;
-import org.jboss.metatype.api.values.MetaValueFactory;
-import org.junit.Test;
-import org.teiid.deployers.TestManagedPropertyUtil.FakeExecutionFactory.PropEnum;
-import org.teiid.templates.TranslatorTemplateInfoFactory;
-import org.teiid.translator.TranslatorProperty;
-
-@SuppressWarnings("nls")
-public class TestManagedPropertyUtil {
-
- public static class FakeExecutionFactory {
-
- public enum PropEnum {
- A, B, C
- }
-
- private PropEnum val = PropEnum.A;
-
- @TranslatorProperty(display="Read Only")
- public int readonly() {
- return 1;
- }
-
- @TranslatorProperty(display="Setter Property")
- public void x(@SuppressWarnings("unused") String y) {
-
- }
-
- @TranslatorProperty(display="Enum Property")
- public PropEnum getEnum() {
- return val;
- }
-
- public void setEnum(PropEnum value) {
- this.val = value;
- }
-
- }
-
- @Test public void testAnnotationProcessing() throws Exception {
- FakeExecutionFactory ef = new FakeExecutionFactory();
-
- Map<String, ManagedProperty> properties = TranslatorTemplateInfoFactory.getProperties(ef.getClass());
- ManagedProperty mp = properties.get("readonly");
- assertTrue(mp.isReadOnly());
- assertEquals(Integer.valueOf(1), MetaValueFactory.getInstance().unwrap(mp.getDefaultValue()));
-
- mp = properties.get("x");
- assertFalse(mp.isReadOnly());
- assertNull(mp.getDefaultValue());
-
- mp = properties.get("Enum");
- assertFalse(mp.isReadOnly());
- assertEquals(PropEnum.A.name(), MetaValueFactory.getInstance().unwrap(mp.getDefaultValue()));
- }
-
-}
Deleted: branches/as7/runtime/src/test/java/org/teiid/deployers/TestTranslatorMetadata.java
===================================================================
--- branches/as7/runtime/src/test/java/org/teiid/deployers/TestTranslatorMetadata.java 2011-07-01 20:26:47 UTC (rev 3300)
+++ branches/as7/runtime/src/test/java/org/teiid/deployers/TestTranslatorMetadata.java 2011-07-04 19:09:19 UTC (rev 3301)
@@ -1,74 +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.assertEquals;
-
-import java.io.StringReader;
-import java.io.StringWriter;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.Marshaller;
-import javax.xml.bind.Unmarshaller;
-
-import org.junit.Test;
-import org.teiid.adminapi.Translator;
-import org.teiid.adminapi.impl.TranslatorMetaData;
-import org.teiid.translator.ExecutionFactory;
-
-
-@SuppressWarnings("nls")
-public class TestTranslatorMetadata {
-
- @Test
- public void testFormat() throws Exception {
-
- TranslatorMetaDataGroup group = new TranslatorMetaDataGroup();
- TranslatorMetaData tm = new TranslatorMetaData();
- group.translators.add(tm);
-
- tm.setExecutionFactoryClass(ExecutionFactory.class);
- tm.setName("Oracle");
- tm.setDescription("desc");
- tm.addProperty("ExtensionTranslationClassName", "org.teiid.translator.jdbc.oracle.OracleSQLTranslator");
-
- JAXBContext jc = JAXBContext.newInstance(new Class<?>[] {TranslatorMetaDataGroup.class});
- Marshaller marshell = jc.createMarshaller();
- marshell.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,new Boolean(true));
-
- StringWriter sw = new StringWriter();
- marshell.marshal(group, sw);
-
- System.out.println(sw.toString());
-
- Unmarshaller un = jc.createUnmarshaller();
- group = (TranslatorMetaDataGroup)un.unmarshal(new StringReader(sw.toString()));
-
- tm = group.getTranslators().get(0);
-
- assertEquals("Oracle", tm.getName());
- assertEquals("desc", tm.getDescription());
- assertEquals(ExecutionFactory.class.getName(), tm.getPropertyValue(Translator.EXECUTION_FACTORY_CLASS));
- assertEquals("org.teiid.translator.jdbc.oracle.OracleSQLTranslator", tm.getPropertyValue("ExtensionTranslationClassName"));
-
- }
-}
13 years, 8 months
teiid SVN: r3300 - trunk/documentation/client-developers-guide/src/main/docbook/en-US/content.
by teiid-commits@lists.jboss.org
Author: van.halbert
Date: 2011-07-01 16:26:47 -0400 (Fri, 01 Jul 2011)
New Revision: 3300
Modified:
trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-connection.xml
trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-extensions.xml
Log:
TEIID-1651 Added backward compatibility support so that pre JDBC 4, the use of an 'Alias' can still be obtained via the ResultSetMetadata.getColumnName. In JDBC 4, you will need to call ResultSetMetadata.getColumnLabel. To enable backward support, add the property: useJDBC4ColumnNameAndLabelSemantics=false to the url connection string
Modified: trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-connection.xml
===================================================================
--- trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-connection.xml 2011-07-01 19:34:14 UTC (rev 3299)
+++ trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-connection.xml 2011-07-01 20:26:47 UTC (rev 3300)
@@ -242,6 +242,21 @@
</entry>
<entry>Default query timeout in seconds. Must be >= 0. 0 indicates no timeout. Can be overriden by <code>Statement.setQueryTimeout</code>. Default 0.</entry>
</row>
+ <row>
+ <entry>
+ <code>useJDBC4ColumnNameAndLabelSemantics</code>
+ </entry>
+ <entry>
+ <code>boolean</code>
+ </entry>
+ <entry>
+ <para>A change was made in JDBC4 so that when an 'Alias' is used it will
+ now be returned as the label. Prior to this, it was returned as
+ the name. Setting this property to false will enable
+ backwards compatibility when JDBC3 and older support is still required.
+ </para>
+ </entry>
+ </row>
</tbody>
</tgroup>
</table>
Modified: trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-extensions.xml
===================================================================
--- trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-extensions.xml 2011-07-01 19:34:14 UTC (rev 3299)
+++ trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-extensions.xml 2011-07-01 20:26:47 UTC (rev 3300)
@@ -170,6 +170,18 @@
<para>Same as the connection property.</para>
</entry>
</row>
+ <row>
+ <entry>
+ <code>JDBC4COLUMNNAMEANDLABELSEMANTICS / useJDBC4ColumnNameAndLabelSemantics</code>
+ </entry>
+ <entry>
+ <para>A change was made in JDBC4 so that when an 'Alias' is used it will.
+ now be returned as the label. Prior to this, it was returned as
+ the name. Setting this property to false will enable
+ backwards compatibility when JDBC3 and older support is still required.
+ </para>
+ </entry>
+ </row>
</tbody>
</tgroup>
</table>
13 years, 8 months
teiid SVN: r3299 - in trunk: client/src/test/java/org/teiid/jdbc and 2 other directories.
by teiid-commits@lists.jboss.org
Author: van.halbert
Date: 2011-07-01 15:34:14 -0400 (Fri, 01 Jul 2011)
New Revision: 3299
Modified:
trunk/client/src/main/java/org/teiid/jdbc/BaseDataSource.java
trunk/client/src/main/java/org/teiid/jdbc/DatabaseMetaDataImpl.java
trunk/client/src/main/java/org/teiid/jdbc/ExecutionProperties.java
trunk/client/src/main/java/org/teiid/jdbc/PreparedStatementImpl.java
trunk/client/src/main/java/org/teiid/jdbc/ResultSetImpl.java
trunk/client/src/main/java/org/teiid/jdbc/ResultSetMetaDataImpl.java
trunk/client/src/main/java/org/teiid/jdbc/StatementImpl.java
trunk/client/src/test/java/org/teiid/jdbc/TestAllResultsImpl.java
trunk/client/src/test/java/org/teiid/jdbc/TestStatement.java
trunk/client/src/test/java/org/teiid/jdbc/TestTeiidDataSource.java
trunk/client/src/test/java/org/teiid/jdbc/TestTeiidDriver.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/MetaDataProcessor.java
trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestResultsMetadataWithProvider.java
Log:
Added backward compatibility support so that pre JDBC 4, when using an 'Alias', it will still be returned via the ResultSetMetadata.getColumnName. In JDBC 4, you will need to call ResultSetMetadata.getColumnLabel. To enable backward support, add the property: useJDBC4ColumnNameAndLabelSemantics=false to the url connection string.
Modified: trunk/client/src/main/java/org/teiid/jdbc/BaseDataSource.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/BaseDataSource.java 2011-07-01 19:18:07 UTC (rev 3298)
+++ trunk/client/src/main/java/org/teiid/jdbc/BaseDataSource.java 2011-07-01 19:34:14 UTC (rev 3299)
@@ -147,6 +147,8 @@
private int queryTimeout;
+ private boolean useJDBC4ColumnNameAndLabelSemantics = true;
+
/**
* Reference to the logWriter, which is transient and is therefore not serialized with the DataSource.
*/
@@ -247,6 +249,10 @@
props.setProperty(ExecutionProperties.DISABLE_LOCAL_TRANSACTIONS, this.getDisableLocalTxn());
}
+ if (!this.getUseJDBC4ColumnNameAndLabelSemantics()) {
+ props.setProperty(ExecutionProperties.JDBC4COLUMNNAMEANDLABELSEMANTICS, "false");
+ }
+
if (this.additionalProperties != null) {
JDBCURL.parseConnectionProperties(this.additionalProperties, props);
}
@@ -652,7 +658,16 @@
public void setAutoCommitTxn(String transactionAutoWrap) {
this.transactionAutoWrap = transactionAutoWrap;
}
+
+
+ public boolean getUseJDBC4ColumnNameAndLabelSemantics() {
+ return useJDBC4ColumnNameAndLabelSemantics;
+ }
+ public void setUseJDBC4ColumnNameAndLabelSemantics(boolean useJDBC4ColumnNameAndLabelSemantics) {
+ this.useJDBC4ColumnNameAndLabelSemantics = useJDBC4ColumnNameAndLabelSemantics;
+ }
+
// --------------------------------------------------------------------------------------------
// V A L I D A T I O N M E T H O D S
// --------------------------------------------------------------------------------------------
Modified: trunk/client/src/main/java/org/teiid/jdbc/DatabaseMetaDataImpl.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/DatabaseMetaDataImpl.java 2011-07-01 19:18:07 UTC (rev 3298)
+++ trunk/client/src/main/java/org/teiid/jdbc/DatabaseMetaDataImpl.java 2011-07-01 19:34:14 UTC (rev 3299)
@@ -1583,7 +1583,7 @@
metadataList[16] = StatementImpl.getColumnMetadata(CoreConstants.SYSTEM_MODEL + "." + DATA_TYPES, JDBCColumnNames.TYPE_INFO.SQL_DATETIME_SUB, JDBCSQLTypeInfo.INTEGER, ResultsMetadataConstants.NULL_TYPES.NULLABLE, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.TRUE, Boolean.TRUE, Boolean.FALSE, driverConnection);//$NON-NLS-1$
metadataList[17] = StatementImpl.getColumnMetadata(CoreConstants.SYSTEM_MODEL + "." + DATA_TYPES, JDBCColumnNames.TYPE_INFO.NUM_PREC_RADIX, JDBCSQLTypeInfo.INTEGER, ResultsMetadataConstants.NULL_TYPES.NULLABLE, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.FALSE, Boolean.FALSE, Boolean.FALSE, driverConnection);//$NON-NLS-1$
- ResultSetMetaData rmetadata = new ResultSetMetaDataImpl(new MetadataProvider(metadataList));
+ ResultSetMetaData rmetadata = new ResultSetMetaDataImpl(new MetadataProvider(metadataList), null);
logger.fine(JDBCPlugin.Util.getString("MMDatabaseMetadata.getTypes_success")); //$NON-NLS-1$
Modified: trunk/client/src/main/java/org/teiid/jdbc/ExecutionProperties.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/ExecutionProperties.java 2011-07-01 19:18:07 UTC (rev 3298)
+++ trunk/client/src/main/java/org/teiid/jdbc/ExecutionProperties.java 2011-07-01 19:34:14 UTC (rev 3299)
@@ -104,5 +104,19 @@
public static final String QUERYTIMEOUT = "QUERYTIMEOUT"; //$NON-NLS-1$
+ /**
+ * TEIID-1651
+ * A change was made in JDBC4 so that when an 'Alias' is used it will
+ * now be returned as the label. Prior to this, it was returned as
+ * the name. Setting this property to <code>false</code> will enable
+ * backwards compatibility when JDBC3 and older support is still required.
+ *
+ * Default is <code>true</code>
+ * @since 7.4.1
+ */
+
+ public static final String JDBC4COLUMNNAMEANDLABELSEMANTICS = "useJDBC4ColumnNameAndLabelSemantics"; //$NON-NLS-1$
+
+
}
\ No newline at end of file
Modified: trunk/client/src/main/java/org/teiid/jdbc/PreparedStatementImpl.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/PreparedStatementImpl.java 2011-07-01 19:18:07 UTC (rev 3298)
+++ trunk/client/src/main/java/org/teiid/jdbc/PreparedStatementImpl.java 2011-07-01 19:34:14 UTC (rev 3299)
@@ -259,7 +259,7 @@
return null;
}
MetadataProvider provider = new MetadataProvider(getMetadataResults().getColumnMetadata());
- metadata = new ResultSetMetaDataImpl(provider);
+ metadata = new ResultSetMetaDataImpl(provider, this.getExecutionProperty(ExecutionProperties.JDBC4COLUMNNAMEANDLABELSEMANTICS));
}
}
@@ -653,7 +653,7 @@
public ParameterMetaData getParameterMetaData() throws SQLException {
if (parameterMetaData == null) {
//TODO: some of the base implementation of ResultSetMetadata could be on the MetadataProvider
- this.parameterMetaData = new ParameterMetaDataImpl(new ResultSetMetaDataImpl(new MetadataProvider(getMetadataResults().getParameterMetadata())));
+ this.parameterMetaData = new ParameterMetaDataImpl(new ResultSetMetaDataImpl(new MetadataProvider(getMetadataResults().getParameterMetadata()), this.getExecutionProperty(ExecutionProperties.JDBC4COLUMNNAMEANDLABELSEMANTICS)));
}
return parameterMetaData;
}
Modified: trunk/client/src/main/java/org/teiid/jdbc/ResultSetImpl.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/ResultSetImpl.java 2011-07-01 19:18:07 UTC (rev 3298)
+++ trunk/client/src/main/java/org/teiid/jdbc/ResultSetImpl.java 2011-07-01 19:34:14 UTC (rev 3299)
@@ -133,12 +133,11 @@
this.batchResults = new BatchResults(this, getCurrentBatch(resultsMsg), this.cursorType == ResultSet.TYPE_FORWARD_ONLY ? 1 : BatchResults.DEFAULT_SAVED_BATCHES);
accumulateWarnings(resultsMsg);
this.serverTimeZone = statement.getServerTimeZone();
-
if (metadata == null) {
MetadataProvider provider = new DeferredMetadataProvider(resultsMsg.getColumnNames(),
resultsMsg.getDataTypes(), statement,
statement.getCurrentRequestID());
- rmetadata = new ResultSetMetaDataImpl(provider);
+ rmetadata = new ResultSetMetaDataImpl(provider, this.statement.getExecutionProperty(ExecutionProperties.JDBC4COLUMNNAMEANDLABELSEMANTICS));
} else {
rmetadata = metadata;
}
Modified: trunk/client/src/main/java/org/teiid/jdbc/ResultSetMetaDataImpl.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/ResultSetMetaDataImpl.java 2011-07-01 19:18:07 UTC (rev 3298)
+++ trunk/client/src/main/java/org/teiid/jdbc/ResultSetMetaDataImpl.java 2011-07-01 19:34:14 UTC (rev 3299)
@@ -34,10 +34,13 @@
public class ResultSetMetaDataImpl extends WrapperImpl implements ResultSetMetaData {
private MetadataProvider provider;
+
+ private boolean useJDBC4ColumnNameAndLabelSemantics = true;
- public ResultSetMetaDataImpl(MetadataProvider provider) {
+ public ResultSetMetaDataImpl(MetadataProvider provider, String supportBackwardsCompatibility) {
this.provider = provider;
- }
+ this.useJDBC4ColumnNameAndLabelSemantics = (supportBackwardsCompatibility != null && supportBackwardsCompatibility.equalsIgnoreCase("false") ? false : true);
+ }
/**
* Adjust from 1-based to internal 0-based representation
@@ -105,6 +108,13 @@
}
public String getColumnName(int index) throws SQLException {
+
+ if (!useJDBC4ColumnNameAndLabelSemantics) {
+ String result = provider.getStringValue(adjustColumn(index), ResultsMetadataConstants.ELEMENT_LABEL);
+ if (result != null) {
+ return result;
+ }
+ }
return provider.getStringValue(adjustColumn(index), ResultsMetadataConstants.ELEMENT_NAME);
}
Modified: trunk/client/src/main/java/org/teiid/jdbc/StatementImpl.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/StatementImpl.java 2011-07-01 19:18:07 UTC (rev 3298)
+++ trunk/client/src/main/java/org/teiid/jdbc/StatementImpl.java 2011-07-01 19:34:14 UTC (rev 3299)
@@ -1158,7 +1158,7 @@
}
ResultSetImpl createResultSet(List records, Map[] columnMetadata) throws SQLException {
- ResultSetMetaData rsmd = new ResultSetMetaDataImpl(new MetadataProvider(columnMetadata));
+ ResultSetMetaData rsmd = new ResultSetMetaDataImpl(new MetadataProvider(columnMetadata), this.getExecutionProperty(ExecutionProperties.JDBC4COLUMNNAMEANDLABELSEMANTICS));
return createResultSet(records, rsmd);
}
Modified: trunk/client/src/test/java/org/teiid/jdbc/TestAllResultsImpl.java
===================================================================
--- trunk/client/src/test/java/org/teiid/jdbc/TestAllResultsImpl.java 2011-07-01 19:18:07 UTC (rev 3298)
+++ trunk/client/src/test/java/org/teiid/jdbc/TestAllResultsImpl.java 2011-07-01 19:34:14 UTC (rev 3299)
@@ -733,7 +733,7 @@
}
ResultsMessage msg = exampleResultsMsg4(1, batchLength, fetchSize, batchLength == totalLength);
- return new ResultSetImpl(msg, statement, new ResultSetMetaDataImpl(new MetadataProvider(DeferredMetadataProvider.loadPartialMetadata(msg.getColumnNames(), msg.getDataTypes()))), 0);
+ return new ResultSetImpl(msg, statement, new ResultSetMetaDataImpl(new MetadataProvider(DeferredMetadataProvider.loadPartialMetadata(msg.getColumnNames(), msg.getDataTypes())), null), 0);
}
// /////////////////////Helper Method///////////////////
Modified: trunk/client/src/test/java/org/teiid/jdbc/TestStatement.java
===================================================================
--- trunk/client/src/test/java/org/teiid/jdbc/TestStatement.java 2011-07-01 19:18:07 UTC (rev 3298)
+++ trunk/client/src/test/java/org/teiid/jdbc/TestStatement.java 2011-07-01 19:34:14 UTC (rev 3299)
@@ -145,4 +145,15 @@
assertEquals(2, statement.getQueryTimeout());
}
+ @Test public void testUseJDBC4ColumnNameAndLabelSemantics() throws Exception {
+ ConnectionImpl conn = Mockito.mock(ConnectionImpl.class);
+ Properties p = new Properties();
+ p.setProperty(ExecutionProperties.JDBC4COLUMNNAMEANDLABELSEMANTICS, "false");
+
+ Mockito.stub(conn.getExecutionProperties()).toReturn(p);
+ StatementImpl statement = new StatementImpl(conn, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
+ assertEquals(Boolean.FALSE.toString(), statement.getExecutionProperty(ExecutionProperties.JDBC4COLUMNNAMEANDLABELSEMANTICS));
+
+ }
+
}
Modified: trunk/client/src/test/java/org/teiid/jdbc/TestTeiidDataSource.java
===================================================================
--- trunk/client/src/test/java/org/teiid/jdbc/TestTeiidDataSource.java 2011-07-01 19:18:07 UTC (rev 3298)
+++ trunk/client/src/test/java/org/teiid/jdbc/TestTeiidDataSource.java 2011-07-01 19:34:14 UTC (rev 3299)
@@ -75,6 +75,7 @@
dataSource.setPartialResultsMode(STD_PARTIAL_MODE);
dataSource.setSecure(true);
dataSource.setAlternateServers(STD_ALTERNATE_SERVERS);
+ dataSource.setUseJDBC4ColumnNameAndLabelSemantics(true);
}
// =========================================================================
@@ -141,6 +142,19 @@
final int fetchSize, final boolean showPlan,
final boolean secure, final String expectedURL) {
+
+ helpTestBuildingURL2(vdbName, vdbVersion, serverName, portNumber, alternateServers,
+ txnAutoWrap, partialMode, fetchSize, showPlan, secure, true, expectedURL);
+ }
+
+ public void helpTestBuildingURL2( final String vdbName, final String vdbVersion,
+ final String serverName, final int portNumber,
+ final String alternateServers,
+ final String txnAutoWrap, final String partialMode,
+ final int fetchSize, final boolean showPlan,
+ final boolean secure, final boolean useJDBC4Semantics,
+ final String expectedURL ) {
+
final TeiidDataSource ds = new TeiidDataSource();
ds.setServerName(serverName);
ds.setDatabaseVersion(vdbVersion);
@@ -154,6 +168,7 @@
}
ds.setSecure(secure);
ds.setAlternateServers(alternateServers);
+ ds.setUseJDBC4ColumnNameAndLabelSemantics(useJDBC4Semantics);
String url;
try {
@@ -184,6 +199,7 @@
ds.setTransactionAutoWrap(txnAutoWrap);
ds.setPartialResultsMode(partialMode);
ds.setAlternateServers(alternateServers);
+ ds.setUseJDBC4ColumnNameAndLabelSemantics(true);
return ds.getConnection();
@@ -627,6 +643,21 @@
"jdbc:teiid:vdbName@mm://hostName:7001,hostName:7002,hostName2:7001,hostName2:7002;ApplicationName=JDBC;SHOWPLAN=ON;partialResultsMode=false;autoCommitTxn=DETECT;VirtualDatabaseName=vdbName"); //$NON-NLS-1$
}
+ /**
+ * Test turning off using JDBC4 semantics
+ */
+ public void testBuildURL8() {
+ final String serverName = "hostName"; //$NON-NLS-1$
+ final String vdbName = "vdbName"; //$NON-NLS-1$
+ final String vdbVersion = "1.2.3"; //$NON-NLS-1$
+ final int portNumber = 7001;
+ final String transactionAutoWrap = null;
+ final String partialMode = "true"; //$NON-NLS-1$
+ final boolean secure = false;
+ helpTestBuildingURL2(vdbName,vdbVersion,serverName,portNumber,null,transactionAutoWrap, partialMode, 500, false, secure, false,
+ "jdbc:teiid:vdbName@mm://hostname:7001;fetchSize=500;ApplicationName=JDBC;VirtualDatabaseVersion=1.2.3;partialResultsMode=true;useJDBC4ColumnNameAndLabelSemantics=false;VirtualDatabaseName=vdbName"); //$NON-NLS-1$
+ }
+
public void testBuildURL_AdditionalProperties() throws TeiidSQLException {
final TeiidDataSource ds = new TeiidDataSource();
ds.setAdditionalProperties("foo=bar;a=b"); //$NON-NLS-1$
Modified: trunk/client/src/test/java/org/teiid/jdbc/TestTeiidDriver.java
===================================================================
--- trunk/client/src/test/java/org/teiid/jdbc/TestTeiidDriver.java 2011-07-01 19:18:07 UTC (rev 3298)
+++ trunk/client/src/test/java/org/teiid/jdbc/TestTeiidDriver.java 2011-07-01 19:34:14 UTC (rev 3299)
@@ -89,7 +89,10 @@
assertTrue(!drv.acceptsURL("jdbc:teiid:@localhost:1234;logLevel=2;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
assertTrue(!drv.acceptsURL("jdbc:teiid:@localhost:1234;logLevel=2;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log;autoCommitTxn=OFF;paritalResultsMode=true")); //$NON-NLS-1$
assertTrue(!drv.acceptsURL("jdbc:teiid:@localhost:1234;stickyConnections=false;socketsPerVM=4")); //$NON-NLS-1$
- assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://my_host.mydomain.com:53535,127.0.0.1:1234")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://my_host.mydomain.com:53535,127.0.0.1:1234")); //$NON-NLS-1$
+
+ assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://localhost:1234;version=x;useJDBC4ColumnNameAndLabelSemantics=false")); //$NON-NLS-1$
+
}
/** Invalid format of urls*/
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/MetaDataProcessor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/MetaDataProcessor.java 2011-07-01 19:18:07 UTC (rev 3298)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/MetaDataProcessor.java 2011-07-01 19:34:14 UTC (rev 3299)
@@ -387,6 +387,10 @@
public Map<Integer, Object> getDefaultColumn(String tableName, String columnName,
Class<?> javaType) {
+ return getDefaultColumn(tableName, columnName, columnName, javaType);
+ }
+
+ public Map<Integer, Object> getDefaultColumn(String tableName, String columnName, String columnLabel, Class<?> javaType ) {
Map<Integer, Object> column = new HashMap<Integer, Object>();
@@ -395,7 +399,7 @@
column.put(ResultsMetadataConstants.VIRTUAL_DATABASE_VERSION, vdbVersion);
column.put(ResultsMetadataConstants.GROUP_NAME, tableName);
column.put(ResultsMetadataConstants.ELEMENT_NAME, columnName);
- column.put(ResultsMetadataConstants.ELEMENT_LABEL, columnName);
+ column.put(ResultsMetadataConstants.ELEMENT_LABEL, columnLabel);
column.put(ResultsMetadataConstants.AUTO_INCREMENTING, Boolean.FALSE);
column.put(ResultsMetadataConstants.CASE_SENSITIVE, Boolean.FALSE);
column.put(ResultsMetadataConstants.NULLABLE, ResultsMetadataConstants.NULL_TYPES.NULLABLE);
Modified: trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestResultsMetadataWithProvider.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestResultsMetadataWithProvider.java 2011-07-01 19:18:07 UTC (rev 3298)
+++ trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestResultsMetadataWithProvider.java 2011-07-01 19:34:14 UTC (rev 3299)
@@ -45,8 +45,8 @@
public MetadataProvider exampleProvider() throws Exception {
MetaDataProcessor processor = new MetaDataProcessor(null, null, "vdb", 1); //$NON-NLS-1$
- Map col1 = processor.getDefaultColumn("table", "col1", String.class); //$NON-NLS-1$ //$NON-NLS-2$
- Map col2 = processor.getDefaultColumn("table", "col2", Integer.class); //$NON-NLS-1$ //$NON-NLS-2$
+ Map col1 = processor.getDefaultColumn("table", "col1", "col1Label", String.class); //$NON-NLS-1$ //$NON-NLS-2$
+ Map col2 = processor.getDefaultColumn("table", "col2", "col2Label", Integer.class); //$NON-NLS-1$ //$NON-NLS-2$
Map[] columnMetadata = new Map[] {
col1, col2
@@ -55,9 +55,9 @@
MetadataProvider provider = new MetadataProvider(columnMetadata);
return provider;
}
-
+
public void test1() throws Exception {
- ResultSetMetaDataImpl rmd = new ResultSetMetaDataImpl(exampleProvider());
+ ResultSetMetaDataImpl rmd = new ResultSetMetaDataImpl(exampleProvider(), null);
assertEquals(false, rmd.isAutoIncrement(1));
assertEquals(false, rmd.isCaseSensitive(1));
@@ -71,6 +71,26 @@
assertEquals(null, rmd.getSchemaName(1));
assertEquals("table", rmd.getTableName(1)); //$NON-NLS-1$
assertEquals("col1", rmd.getColumnName(1)); //$NON-NLS-1$
+ assertEquals("col1Label", rmd.getColumnLabel(1)); //$NON-NLS-1$
assertEquals("string", rmd.getColumnTypeName(1)); //$NON-NLS-1$
}
+
+ public void test2BackwardCompatibilityTest() throws Exception {
+ ResultSetMetaDataImpl rmd = new ResultSetMetaDataImpl(exampleProvider(), "false");
+
+ assertEquals(false, rmd.isAutoIncrement(1));
+ assertEquals(false, rmd.isCaseSensitive(1));
+ assertEquals(false, rmd.isCurrency(1));
+ assertEquals(true, rmd.isDefinitelyWritable(1));
+ assertEquals(false, rmd.isReadOnly(1));
+ assertEquals(true, rmd.isSearchable(1));
+ assertEquals(true, rmd.isSigned(1));
+ assertEquals(true, rmd.isWritable(1));
+ assertEquals("vdb", rmd.getCatalogName(1)); //$NON-NLS-1$
+ assertEquals(null, rmd.getSchemaName(1));
+ assertEquals("table", rmd.getTableName(1)); //$NON-NLS-1$
+ assertEquals("col1Label", rmd.getColumnName(1)); //$NON-NLS-1$
+ assertEquals("col1Label", rmd.getColumnLabel(1)); //$NON-NLS-1$
+ assertEquals("string", rmd.getColumnTypeName(1)); //$NON-NLS-1$
+ }
}
13 years, 8 months
teiid SVN: r3298 - branches/7.4.x/test-integration/common/src/test/java/org/teiid/jdbc.
by teiid-commits@lists.jboss.org
Author: van.halbert
Date: 2011-07-01 15:18:07 -0400 (Fri, 01 Jul 2011)
New Revision: 3298
Modified:
branches/7.4.x/test-integration/common/src/test/java/org/teiid/jdbc/TestResultsMetadataWithProvider.java
Log:
Added backward compatibility support so that pre JDBC 4, when using an 'Alias', it will still be returned via the ResultSetMetadata.getColumnName. In JDBC 4, you will need to call ResultSetMetadata.getColumnLabel. To enable backward support, add the property: useJDBC4ColumnNameAndLabelSemantics=false to the url connection string.
Modified: branches/7.4.x/test-integration/common/src/test/java/org/teiid/jdbc/TestResultsMetadataWithProvider.java
===================================================================
--- branches/7.4.x/test-integration/common/src/test/java/org/teiid/jdbc/TestResultsMetadataWithProvider.java 2011-07-01 19:17:29 UTC (rev 3297)
+++ branches/7.4.x/test-integration/common/src/test/java/org/teiid/jdbc/TestResultsMetadataWithProvider.java 2011-07-01 19:18:07 UTC (rev 3298)
@@ -45,8 +45,8 @@
public MetadataProvider exampleProvider() throws Exception {
MetaDataProcessor processor = new MetaDataProcessor(null, null, "vdb", 1); //$NON-NLS-1$
- Map col1 = processor.getDefaultColumn("table", "col1", String.class); //$NON-NLS-1$ //$NON-NLS-2$
- Map col2 = processor.getDefaultColumn("table", "col2", Integer.class); //$NON-NLS-1$ //$NON-NLS-2$
+ Map col1 = processor.getDefaultColumn("table", "col1", "col1Label", String.class); //$NON-NLS-1$ //$NON-NLS-2$
+ Map col2 = processor.getDefaultColumn("table", "col2", "col2Label", Integer.class); //$NON-NLS-1$ //$NON-NLS-2$
Map[] columnMetadata = new Map[] {
col1, col2
@@ -55,9 +55,9 @@
MetadataProvider provider = new MetadataProvider(columnMetadata);
return provider;
}
-
+
public void test1() throws Exception {
- ResultSetMetaDataImpl rmd = new ResultSetMetaDataImpl(exampleProvider());
+ ResultSetMetaDataImpl rmd = new ResultSetMetaDataImpl(exampleProvider(), null);
assertEquals(false, rmd.isAutoIncrement(1));
assertEquals(false, rmd.isCaseSensitive(1));
@@ -71,6 +71,26 @@
assertEquals(null, rmd.getSchemaName(1));
assertEquals("table", rmd.getTableName(1)); //$NON-NLS-1$
assertEquals("col1", rmd.getColumnName(1)); //$NON-NLS-1$
+ assertEquals("col1Label", rmd.getColumnLabel(1)); //$NON-NLS-1$
assertEquals("string", rmd.getColumnTypeName(1)); //$NON-NLS-1$
}
+
+ public void test2BackwardCompatibilityTest() throws Exception {
+ ResultSetMetaDataImpl rmd = new ResultSetMetaDataImpl(exampleProvider(), "false");
+
+ assertEquals(false, rmd.isAutoIncrement(1));
+ assertEquals(false, rmd.isCaseSensitive(1));
+ assertEquals(false, rmd.isCurrency(1));
+ assertEquals(true, rmd.isDefinitelyWritable(1));
+ assertEquals(false, rmd.isReadOnly(1));
+ assertEquals(true, rmd.isSearchable(1));
+ assertEquals(true, rmd.isSigned(1));
+ assertEquals(true, rmd.isWritable(1));
+ assertEquals("vdb", rmd.getCatalogName(1)); //$NON-NLS-1$
+ assertEquals(null, rmd.getSchemaName(1));
+ assertEquals("table", rmd.getTableName(1)); //$NON-NLS-1$
+ assertEquals("col1Label", rmd.getColumnName(1)); //$NON-NLS-1$
+ assertEquals("col1Label", rmd.getColumnLabel(1)); //$NON-NLS-1$
+ assertEquals("string", rmd.getColumnTypeName(1)); //$NON-NLS-1$
+ }
}
13 years, 8 months
teiid SVN: r3297 - branches/7.4.x/engine/src/main/java/org/teiid/dqp/internal/process.
by teiid-commits@lists.jboss.org
Author: van.halbert
Date: 2011-07-01 15:17:29 -0400 (Fri, 01 Jul 2011)
New Revision: 3297
Modified:
branches/7.4.x/engine/src/main/java/org/teiid/dqp/internal/process/MetaDataProcessor.java
Log:
Added backward compatibility support so that pre JDBC 4, when using an 'Alias', it will still be returned via the ResultSetMetadata.getColumnName. In JDBC 4, you will need to call ResultSetMetadata.getColumnLabel. To enable backward support, add the property: useJDBC4ColumnNameAndLabelSemantics=false to the url connection string.
Modified: branches/7.4.x/engine/src/main/java/org/teiid/dqp/internal/process/MetaDataProcessor.java
===================================================================
--- branches/7.4.x/engine/src/main/java/org/teiid/dqp/internal/process/MetaDataProcessor.java 2011-07-01 19:17:03 UTC (rev 3296)
+++ branches/7.4.x/engine/src/main/java/org/teiid/dqp/internal/process/MetaDataProcessor.java 2011-07-01 19:17:29 UTC (rev 3297)
@@ -387,6 +387,10 @@
public Map<Integer, Object> getDefaultColumn(String tableName, String columnName,
Class<?> javaType) {
+ return getDefaultColumn(tableName, columnName, columnName, javaType);
+ }
+
+ public Map<Integer, Object> getDefaultColumn(String tableName, String columnName, String columnLabel, Class<?> javaType ) {
Map<Integer, Object> column = new HashMap<Integer, Object>();
@@ -395,7 +399,7 @@
column.put(ResultsMetadataConstants.VIRTUAL_DATABASE_VERSION, vdbVersion);
column.put(ResultsMetadataConstants.GROUP_NAME, tableName);
column.put(ResultsMetadataConstants.ELEMENT_NAME, columnName);
- column.put(ResultsMetadataConstants.ELEMENT_LABEL, columnName);
+ column.put(ResultsMetadataConstants.ELEMENT_LABEL, columnLabel);
column.put(ResultsMetadataConstants.AUTO_INCREMENTING, Boolean.FALSE);
column.put(ResultsMetadataConstants.CASE_SENSITIVE, Boolean.FALSE);
column.put(ResultsMetadataConstants.NULLABLE, ResultsMetadataConstants.NULL_TYPES.NULLABLE);
13 years, 8 months