Author: rareddy
Date: 2011-06-27 12:56:11 -0400 (Mon, 27 Jun 2011)
New Revision: 3274
Added:
branches/as7/client/src/main/java/org/teiid/adminapi/impl/Admin.java
branches/as7/connectors/sandbox/translator-yahoo/src/main/resources/META-INF/MANIFEST.MF
branches/as7/connectors/sandbox/translator-yahoo/src/main/resources/META-INF/services/
branches/as7/connectors/sandbox/translator-yahoo/src/main/resources/META-INF/services/org.teiid.translator.ExecutionFactory
branches/as7/connectors/translator-file/src/main/resources/META-INF/MANIFEST.MF
branches/as7/connectors/translator-file/src/main/resources/META-INF/services/
branches/as7/connectors/translator-file/src/main/resources/META-INF/services/org.teiid.translator.ExecutionFactory
branches/as7/connectors/translator-jdbc/src/main/resources/META-INF/MANIFEST.MF
branches/as7/connectors/translator-jdbc/src/main/resources/META-INF/services/
branches/as7/connectors/translator-jdbc/src/main/resources/META-INF/services/org.teiid.translator.ExecutionFactory
branches/as7/connectors/translator-ldap/src/main/resources/META-INF/MANIFEST.MF
branches/as7/connectors/translator-ldap/src/main/resources/META-INF/services/
branches/as7/connectors/translator-ldap/src/main/resources/META-INF/services/org.teiid.translator.ExecutionFactory
branches/as7/connectors/translator-loopback/src/main/resources/META-INF/MANIFEST.MF
branches/as7/connectors/translator-loopback/src/main/resources/META-INF/services/
branches/as7/connectors/translator-loopback/src/main/resources/META-INF/services/org.teiid.translator.ExecutionFactory
branches/as7/connectors/translator-olap/src/main/resources/META-INF/MANIFEST.MF
branches/as7/connectors/translator-olap/src/main/resources/META-INF/services/
branches/as7/connectors/translator-olap/src/main/resources/META-INF/services/org.teiid.translator.ExecutionFactory
branches/as7/connectors/translator-salesforce/src/main/resources/META-INF/MANIFEST.MF
branches/as7/connectors/translator-salesforce/src/main/resources/META-INF/services/
branches/as7/connectors/translator-salesforce/src/main/resources/META-INF/services/org.teiid.translator.ExecutionFactory
branches/as7/connectors/translator-ws/src/main/resources/META-INF/MANIFEST.MF
branches/as7/connectors/translator-ws/src/main/resources/META-INF/services/
branches/as7/connectors/translator-ws/src/main/resources/META-INF/services/org.teiid.translator.ExecutionFactory
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/TeiidServiceNames.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/TranslatorRepositoryService.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorService.java
branches/as7/runtime/src/main/java/org/teiid/deployers/TeiidAttachments.java
branches/as7/runtime/src/main/java/org/teiid/deployers/VDBDependencyProcessor.java
branches/as7/runtime/src/main/java/org/teiid/deployers/VDBService.java
Removed:
branches/as7/connectors/sandbox/translator-yahoo/src/main/resources/META-INF/jboss-beans.xml
branches/as7/connectors/translator-file/src/main/resources/META-INF/jboss-beans.xml
branches/as7/connectors/translator-jdbc/src/main/resources/META-INF/jboss-beans.xml
branches/as7/connectors/translator-ldap/src/main/resources/META-INF/jboss-beans.xml
branches/as7/connectors/translator-loopback/src/main/resources/META-INF/jboss-beans.xml
branches/as7/connectors/translator-olap/src/main/resources/META-INF/jboss-beans.xml
branches/as7/connectors/translator-salesforce/src/main/resources/META-INF/jboss-beans.xml
branches/as7/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java
branches/as7/jboss-integration/src/main/java/org/teiid/adminapi/jboss/AdminObjectBuilder.java
branches/as7/jboss-integration/src/main/java/org/teiid/adminapi/jboss/AdminProvider.java
branches/as7/jboss-integration/src/main/java/org/teiid/adminapi/jboss/ExtendedPropertyInfo.java
branches/as7/jboss-integration/src/main/java/org/teiid/adminapi/jboss/JBossConfiguration.java
branches/as7/jboss-integration/src/main/java/org/teiid/adminapi/jboss/ManagedUtil.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/deployers/ConnectionFactoryDeployer.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/deployers/TranslatorMetadataGroupComponentMapper.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/deployers/VDBMetaDataInstanceClassFactory.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/deployers/VDBMetadataComponentMapper.java
branches/as7/jboss-integration/src/main/java/org/teiid/templates/connector/ConnectorDeploymentTemplate.java
branches/as7/jboss-integration/src/main/java/org/teiid/templates/connector/ConnectorTemplateInfo.java
branches/as7/jboss-integration/src/main/java/org/teiid/templates/connector/ExportConnectorTypeTemplateInfo.java
branches/as7/jboss-integration/src/main/java/org/teiid/templates/connector/LocalJdbcConnectorTemplate.java
branches/as7/jboss-integration/src/main/java/org/teiid/templates/connector/LocalJdbcConnectorTemplateInfo.java
branches/as7/jboss-integration/src/main/java/org/teiid/templates/connector/RaXmlPropertyConverter.java
branches/as7/jboss-integration/src/main/java/org/teiid/templates/connector/XaJdbcConnectorTemplate.java
branches/as7/jboss-integration/src/main/java/org/teiid/templates/connector/XaJdbcConnectorTemplateInfo.java
branches/as7/jboss-integration/src/test/java/org/teiid/adminapi/jboss/TestManagedUtil.java
branches/as7/runtime/src/main/java/org/teiid/deployers/BaseMultipleVFSParsingDeployer.java
branches/as7/runtime/src/main/java/org/teiid/deployers/DynamicVDBDeployer.java
branches/as7/runtime/src/main/java/org/teiid/deployers/ManagedPropertyUtil.java
branches/as7/runtime/src/main/java/org/teiid/deployers/TranslatorAnnotationScanningDeployer.java
branches/as7/runtime/src/main/java/org/teiid/deployers/TranslatorDeployer.java
branches/as7/runtime/src/main/java/org/teiid/deployers/TranslatorMetaDataGroup.java
branches/as7/runtime/src/main/java/org/teiid/deployers/TranslatorParserDeployer.java
branches/as7/runtime/src/main/java/org/teiid/templates/TranslatorDeploymentTemplate.java
branches/as7/runtime/src/main/java/org/teiid/templates/TranslatorMetadataICF.java
branches/as7/runtime/src/main/java/org/teiid/templates/TranslatorTemplateInfo.java
branches/as7/runtime/src/main/java/org/teiid/templates/TranslatorTemplateInfoFactory.java
Modified:
branches/as7/build/kits/jboss-as7/standalone/configuration/standalone.xml
branches/as7/client/src/main/java/org/teiid/adminapi/impl/VDBTranslatorMetaData.java
branches/as7/engine/src/main/java/org/teiid/dqp/internal/datamgr/TranslatorRepository.java
branches/as7/engine/src/main/java/org/teiid/dqp/service/SessionService.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/JBossLifeCycleListener.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/Namespace.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/OperationsConstants.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidExtension.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidSubsystemParser.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
branches/as7/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties
branches/as7/jboss-integration/src/main/resources/schema/jboss-teiid.xsd
branches/as7/jboss-integration/src/test/java/org/teiid/jboss/TestTeiidConfiguration.java
branches/as7/jboss-integration/src/test/resources/teiid-sample-config.xml
branches/as7/metadata/src/main/java/org/teiid/metadata/index/IndexMetadataFactory.java
branches/as7/pom.xml
branches/as7/runtime/pom.xml
branches/as7/runtime/src/main/java/org/teiid/deployers/ObjectSerializer.java
branches/as7/runtime/src/main/java/org/teiid/deployers/TranslatorUtil.java
branches/as7/runtime/src/main/java/org/teiid/deployers/UDFMetaData.java
branches/as7/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java
branches/as7/runtime/src/main/java/org/teiid/deployers/VDBParserDeployer.java
branches/as7/runtime/src/main/java/org/teiid/deployers/VDBRepository.java
branches/as7/runtime/src/main/java/org/teiid/deployers/VDBStructure.java
branches/as7/runtime/src/main/java/org/teiid/services/BufferServiceImpl.java
branches/as7/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java
branches/as7/runtime/src/main/java/org/teiid/transport/SocketConfiguration.java
Log:
Add and remove Translator services and more engine service enablement, vdb deployment
framework fixes
Modified: branches/as7/build/kits/jboss-as7/standalone/configuration/standalone.xml
===================================================================
--- branches/as7/build/kits/jboss-as7/standalone/configuration/standalone.xml 2011-06-27
14:25:00 UTC (rev 3273)
+++ branches/as7/build/kits/jboss-as7/standalone/configuration/standalone.xml 2011-06-27
16:56:11 UTC (rev 3274)
@@ -140,6 +140,12 @@
<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" />
@@ -333,12 +339,6 @@
</subsystem>
<subsystem xmlns="urn:jboss:domain:teiid:1.0">
- <session-service>
- <securityDomains>teiid-security</securityDomains>
- <adminSecurityDomain>jmx-console</adminSecurityDomain>
- <sessionMaxLimit>5000</sessionMaxLimit>
- <sessionExpirationTimeLimit>0</sessionExpirationTimeLimit>
- </session-service>
<buffer-service>
<useDisk>true</useDisk>
<diskDirectory>${jboss.server.temp.dir}/teiid</diskDirectory>
@@ -368,6 +368,7 @@
</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>
@@ -383,6 +384,10 @@
<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">
@@ -392,17 +397,6 @@
<socket-binding>teiid-jdbc</socket-binding>
</jdbc>
- <admin enabled="true">
- <maxSocketThreads>4</maxSocketThreads>
- <inputBufferSize>0</inputBufferSize>
- <outputBufferSize>0</outputBufferSize>
- <socket-binding>teiid-admin</socket-binding>
- <ssl>
- <mode>login</mode>
- <authenticationMode>anonymous</authenticationMode>
- </ssl>
- </admin>
-
<odbc enabled="true">
<maxSocketThreads>0</maxSocketThreads>
<inputBufferSize>0</inputBufferSize>
@@ -446,7 +440,6 @@
<socket-binding name="messaging" port="5445" />
<socket-binding name="messaging-throughput"
port="5455"/>
<socket-binding name="teiid-jdbc" port="31000"/>
- <socket-binding name="teiid-admin" port="31443"/>
<socket-binding name="teiid-odbc" port="35432"/>
</socket-binding-group>
Added: branches/as7/client/src/main/java/org/teiid/adminapi/impl/Admin.java
===================================================================
--- branches/as7/client/src/main/java/org/teiid/adminapi/impl/Admin.java
(rev 0)
+++ branches/as7/client/src/main/java/org/teiid/adminapi/impl/Admin.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -0,0 +1,745 @@
+/*
+ * 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);
+ }
+}
Property changes on: branches/as7/client/src/main/java/org/teiid/adminapi/impl/Admin.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
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-06-27
14:25:00 UTC (rev 3273)
+++
branches/as7/client/src/main/java/org/teiid/adminapi/impl/VDBTranslatorMetaData.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -43,6 +43,7 @@
private String type;
private Class<?> executionClass;
private String description;
+ private String moduleName;
@Override
@ManagementProperty(description="Name of the Translator", mandatory = true)
@@ -97,4 +98,12 @@
public void setDescription(String desc) {
this.description = desc;
}
+
+ public String getModuleName() {
+ return this.moduleName;
+ }
+
+ public void setModuleName(String name) {
+ this.moduleName = name;
+ }
}
Added:
branches/as7/connectors/sandbox/translator-yahoo/src/main/resources/META-INF/MANIFEST.MF
===================================================================
---
branches/as7/connectors/sandbox/translator-yahoo/src/main/resources/META-INF/MANIFEST.MF
(rev 0)
+++
branches/as7/connectors/sandbox/translator-yahoo/src/main/resources/META-INF/MANIFEST.MF 2011-06-27
16:56:11 UTC (rev 3274)
@@ -0,0 +1 @@
+Dependencies: org.jboss.teiid.common-core org.jboss.teiid.api
Property changes on:
branches/as7/connectors/sandbox/translator-yahoo/src/main/resources/META-INF/MANIFEST.MF
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Deleted:
branches/as7/connectors/sandbox/translator-yahoo/src/main/resources/META-INF/jboss-beans.xml
===================================================================
---
branches/as7/connectors/sandbox/translator-yahoo/src/main/resources/META-INF/jboss-beans.xml 2011-06-27
14:25:00 UTC (rev 3273)
+++
branches/as7/connectors/sandbox/translator-yahoo/src/main/resources/META-INF/jboss-beans.xml 2011-06-27
16:56:11 UTC (rev 3274)
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<deployment xmlns="urn:jboss:bean-deployer:2.0">
-
- <bean name="translator-yahoo-template"
class="org.teiid.templates.TranslatorDeploymentTemplate">
- <property name="info"><inject
bean="translator-yahoo"/></property>
- <property name="managedObjectFactory"><inject
bean="ManagedObjectFactory"/></property>
- </bean>
-
- <bean name="translator-yahoo"
class="org.teiid.templates.TranslatorTemplateInfo">
- <constructor factoryMethod="createTemplateInfo">
- <factory bean="TranslatorDeploymentTemplateInfoFactory"/>
- <parameter
class="java.lang.Class">org.teiid.templates.TranslatorTemplateInfo</parameter>
- <parameter
class="java.lang.Class">org.teiid.translator.yahoo.YahooExecutionFactory</parameter>
- <parameter
class="java.lang.String">translator-yahoo</parameter>
- <parameter class="java.lang.String">Yahoo</parameter>
- </constructor>
- </bean>
-
-</deployment>
\ No newline at end of file
Added:
branches/as7/connectors/sandbox/translator-yahoo/src/main/resources/META-INF/services/org.teiid.translator.ExecutionFactory
===================================================================
---
branches/as7/connectors/sandbox/translator-yahoo/src/main/resources/META-INF/services/org.teiid.translator.ExecutionFactory
(rev 0)
+++
branches/as7/connectors/sandbox/translator-yahoo/src/main/resources/META-INF/services/org.teiid.translator.ExecutionFactory 2011-06-27
16:56:11 UTC (rev 3274)
@@ -0,0 +1 @@
+org.teiid.translator.yahoo.YahooExecutionFactory
\ No newline at end of file
Added: branches/as7/connectors/translator-file/src/main/resources/META-INF/MANIFEST.MF
===================================================================
--- branches/as7/connectors/translator-file/src/main/resources/META-INF/MANIFEST.MF
(rev 0)
+++
branches/as7/connectors/translator-file/src/main/resources/META-INF/MANIFEST.MF 2011-06-27
16:56:11 UTC (rev 3274)
@@ -0,0 +1 @@
+Dependencies: org.jboss.teiid.common-core org.jboss.teiid.api
Property changes on:
branches/as7/connectors/translator-file/src/main/resources/META-INF/MANIFEST.MF
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Deleted:
branches/as7/connectors/translator-file/src/main/resources/META-INF/jboss-beans.xml
===================================================================
---
branches/as7/connectors/translator-file/src/main/resources/META-INF/jboss-beans.xml 2011-06-27
14:25:00 UTC (rev 3273)
+++
branches/as7/connectors/translator-file/src/main/resources/META-INF/jboss-beans.xml 2011-06-27
16:56:11 UTC (rev 3274)
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<deployment xmlns="urn:jboss:bean-deployer:2.0">
-
- <bean name="translator-file-template"
class="org.teiid.templates.TranslatorDeploymentTemplate">
- <property name="info"><inject
bean="translator-file"/></property>
- <property name="managedObjectFactory"><inject
bean="ManagedObjectFactory"/></property>
- </bean>
-
- <bean name="translator-file"
class="org.teiid.templates.TranslatorTemplateInfo">
- <constructor factoryMethod="createTemplateInfo">
- <factory bean="TranslatorDeploymentTemplateInfoFactory"/>
- <parameter
class="java.lang.Class">org.teiid.templates.TranslatorTemplateInfo</parameter>
- <parameter
class="java.lang.Class">org.teiid.translator.file.FileExecutionFactory</parameter>
- <parameter
class="java.lang.String">translator-file</parameter>
- <parameter class="java.lang.String">File</parameter>
- </constructor>
- </bean>
-
-</deployment>
\ No newline at end of file
Added:
branches/as7/connectors/translator-file/src/main/resources/META-INF/services/org.teiid.translator.ExecutionFactory
===================================================================
---
branches/as7/connectors/translator-file/src/main/resources/META-INF/services/org.teiid.translator.ExecutionFactory
(rev 0)
+++
branches/as7/connectors/translator-file/src/main/resources/META-INF/services/org.teiid.translator.ExecutionFactory 2011-06-27
16:56:11 UTC (rev 3274)
@@ -0,0 +1 @@
+org.teiid.translator.file.FileExecutionFactory
\ No newline at end of file
Added: branches/as7/connectors/translator-jdbc/src/main/resources/META-INF/MANIFEST.MF
===================================================================
--- branches/as7/connectors/translator-jdbc/src/main/resources/META-INF/MANIFEST.MF
(rev 0)
+++
branches/as7/connectors/translator-jdbc/src/main/resources/META-INF/MANIFEST.MF 2011-06-27
16:56:11 UTC (rev 3274)
@@ -0,0 +1 @@
+Dependencies: org.jboss.teiid.common-core org.jboss.teiid.api
Property changes on:
branches/as7/connectors/translator-jdbc/src/main/resources/META-INF/MANIFEST.MF
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Deleted:
branches/as7/connectors/translator-jdbc/src/main/resources/META-INF/jboss-beans.xml
===================================================================
---
branches/as7/connectors/translator-jdbc/src/main/resources/META-INF/jboss-beans.xml 2011-06-27
14:25:00 UTC (rev 3273)
+++
branches/as7/connectors/translator-jdbc/src/main/resources/META-INF/jboss-beans.xml 2011-06-27
16:56:11 UTC (rev 3274)
@@ -1,339 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<deployment xmlns="urn:jboss:bean-deployer:2.0">
-
- <!-- JDBC-ANSI -->
- <bean name="translator-jdbc-ansi-template"
class="org.teiid.templates.TranslatorDeploymentTemplate">
- <property name="info"><inject
bean="translator-jdbc-ansi" /> </property>
- <property name="managedObjectFactory"> <inject
bean="ManagedObjectFactory" /> </property>
- </bean>
-
- <bean name="translator-jdbc-ansi"
class="org.teiid.templates.TranslatorTemplateInfo">
- <constructor factoryMethod="createTemplateInfo">
- <factory bean="TranslatorDeploymentTemplateInfoFactory" />
- <parameter
class="java.lang.Class">org.teiid.templates.TranslatorTemplateInfo</parameter>
- <parameter
class="java.lang.Class">org.teiid.translator.jdbc.JDBCExecutionFactory</parameter>
- <parameter
class="java.lang.String">translator-jdbc-ansi</parameter>
- <parameter class="java.lang.String">ANSI
JDBC</parameter>
- </constructor>
- </bean>
-
- <!-- JDBC-SIMPLE -->
- <bean name="translator-jdbc-simple-template"
class="org.teiid.templates.TranslatorDeploymentTemplate">
- <property name="info"><inject
bean="translator-jdbc-simple" /> </property>
- <property name="managedObjectFactory"> <inject
bean="ManagedObjectFactory" /> </property>
- </bean>
-
- <bean name="translator-jdbc-simple"
class="org.teiid.templates.TranslatorTemplateInfo">
- <constructor factoryMethod="createTemplateInfo">
- <factory bean="TranslatorDeploymentTemplateInfoFactory" />
- <parameter
class="java.lang.Class">org.teiid.templates.TranslatorTemplateInfo</parameter>
- <parameter
class="java.lang.Class">org.teiid.translator.jdbc.SimpleJDBCExecutionFactory</parameter>
- <parameter
class="java.lang.String">translator-jdbc-simple</parameter>
- <parameter class="java.lang.String">JDBC with Simple
capabilities</parameter>
- </constructor>
- </bean>
-
- <!-- ACCESS -->
- <bean name="translator-access-template"
class="org.teiid.templates.TranslatorDeploymentTemplate">
- <property name="info"><inject
bean="translator-access" /> </property>
- <property name="managedObjectFactory"> <inject
bean="ManagedObjectFactory" /> </property>
- </bean>
-
- <bean name="translator-access"
class="org.teiid.templates.TranslatorTemplateInfo">
- <constructor factoryMethod="createTemplateInfo">
- <factory bean="TranslatorDeploymentTemplateInfoFactory" />
- <parameter
class="java.lang.Class">org.teiid.templates.TranslatorTemplateInfo</parameter>
- <parameter
class="java.lang.Class">org.teiid.translator.jdbc.access.AccessExecutionFactory</parameter>
- <parameter
class="java.lang.String">translator-access</parameter>
- <parameter class="java.lang.String">Access</parameter>
- </constructor>
- </bean>
-
- <!-- DB2 -->
- <bean name="translator-db2-template"
class="org.teiid.templates.TranslatorDeploymentTemplate">
- <property name="info"><inject bean="translator-db2"
/> </property>
- <property name="managedObjectFactory"> <inject
bean="ManagedObjectFactory" /> </property>
- </bean>
-
- <bean name="translator-db2"
class="org.teiid.templates.TranslatorTemplateInfo">
- <constructor factoryMethod="createTemplateInfo">
- <factory bean="TranslatorDeploymentTemplateInfoFactory" />
- <parameter
class="java.lang.Class">org.teiid.templates.TranslatorTemplateInfo</parameter>
- <parameter
class="java.lang.Class">org.teiid.translator.jdbc.db2.DB2ExecutionFactory</parameter>
- <parameter
class="java.lang.String">translator-db2</parameter>
- <parameter class="java.lang.String">DB2</parameter>
- </constructor>
- </bean>
-
- <!-- DERBY -->
- <bean name="translator-derby-template"
class="org.teiid.templates.TranslatorDeploymentTemplate">
- <property name="info"><inject
bean="translator-derby" /> </property>
- <property name="managedObjectFactory"> <inject
bean="ManagedObjectFactory" /> </property>
- </bean>
-
- <bean name="translator-derby"
class="org.teiid.templates.TranslatorTemplateInfo">
- <constructor factoryMethod="createTemplateInfo">
- <factory bean="TranslatorDeploymentTemplateInfoFactory" />
- <parameter
class="java.lang.Class">org.teiid.templates.TranslatorTemplateInfo</parameter>
- <parameter
class="java.lang.Class">org.teiid.translator.jdbc.derby.DerbyExecutionFactory</parameter>
- <parameter
class="java.lang.String">translator-derby</parameter>
- <parameter class="java.lang.String">Derby</parameter>
- </constructor>
- </bean>
-
- <!-- H2 -->
- <bean name="translator-h2-template"
class="org.teiid.templates.TranslatorDeploymentTemplate">
- <property name="info"><inject bean="translator-h2"
/> </property>
- <property name="managedObjectFactory"> <inject
bean="ManagedObjectFactory" /> </property>
- </bean>
-
- <bean name="translator-h2"
class="org.teiid.templates.TranslatorTemplateInfo">
- <constructor factoryMethod="createTemplateInfo">
- <factory bean="TranslatorDeploymentTemplateInfoFactory" />
- <parameter
class="java.lang.Class">org.teiid.templates.TranslatorTemplateInfo</parameter>
- <parameter
class="java.lang.Class">org.teiid.translator.jdbc.h2.H2ExecutionFactory</parameter>
- <parameter
class="java.lang.String">translator-h2</parameter>
- <parameter class="java.lang.String">H2</parameter>
- </constructor>
- </bean>
-
- <!-- HSQL -->
- <bean name="translator-hsql-template"
class="org.teiid.templates.TranslatorDeploymentTemplate">
- <property name="info"><inject bean="translator-hsql"
/> </property>
- <property name="managedObjectFactory"> <inject
bean="ManagedObjectFactory" /> </property>
- </bean>
-
- <bean name="translator-hsql"
class="org.teiid.templates.TranslatorTemplateInfo">
- <constructor factoryMethod="createTemplateInfo">
- <factory bean="TranslatorDeploymentTemplateInfoFactory" />
- <parameter
class="java.lang.Class">org.teiid.templates.TranslatorTemplateInfo</parameter>
- <parameter
class="java.lang.Class">org.teiid.translator.jdbc.hsql.HsqlExecutionFactory</parameter>
- <parameter
class="java.lang.String">translator-hsql</parameter>
- <parameter class="java.lang.String">HSQL</parameter>
- </constructor>
- </bean>
-
- <!-- INFORMIX -->
- <bean name="translator-informix-template"
class="org.teiid.templates.TranslatorDeploymentTemplate">
- <property name="info"><inject
bean="translator-informix" /> </property>
- <property name="managedObjectFactory"> <inject
bean="ManagedObjectFactory" /> </property>
- </bean>
-
- <bean name="translator-informix"
class="org.teiid.templates.TranslatorTemplateInfo">
- <constructor factoryMethod="createTemplateInfo">
- <factory bean="TranslatorDeploymentTemplateInfoFactory" />
- <parameter
class="java.lang.Class">org.teiid.templates.TranslatorTemplateInfo</parameter>
- <parameter
class="java.lang.Class">org.teiid.translator.jdbc.informix.InformixExecutionFactory</parameter>
- <parameter
class="java.lang.String">translator-informix</parameter>
- <parameter
class="java.lang.String">Informix</parameter>
- </constructor>
- </bean>
-
- <!-- METAMATRIX -->
- <bean name="translator-metamatrix-template"
class="org.teiid.templates.TranslatorDeploymentTemplate">
- <property name="info"><inject
bean="translator-metamatrix" /> </property>
- <property name="managedObjectFactory"> <inject
bean="ManagedObjectFactory" /> </property>
- </bean>
-
- <bean name="translator-metamatrix"
class="org.teiid.templates.TranslatorTemplateInfo">
- <constructor factoryMethod="createTemplateInfo">
- <factory bean="TranslatorDeploymentTemplateInfoFactory" />
- <parameter
class="java.lang.Class">org.teiid.templates.TranslatorTemplateInfo</parameter>
- <parameter
class="java.lang.Class">org.teiid.translator.jdbc.mm.MetaMatrixExecutionFactory</parameter>
- <parameter
class="java.lang.String">translator-metamatrix</parameter>
- <parameter
class="java.lang.String">MetaMatrix</parameter>
- </constructor>
- </bean>
-
- <!-- MYSQL -->
- <bean name="translator-mysql-template"
class="org.teiid.templates.TranslatorDeploymentTemplate">
- <property name="info"><inject
bean="translator-mysql" /> </property>
- <property name="managedObjectFactory"> <inject
bean="ManagedObjectFactory" /> </property>
- </bean>
-
- <bean name="translator-mysql"
class="org.teiid.templates.TranslatorTemplateInfo">
- <constructor factoryMethod="createTemplateInfo">
- <factory bean="TranslatorDeploymentTemplateInfoFactory" />
- <parameter
class="java.lang.Class">org.teiid.templates.TranslatorTemplateInfo</parameter>
- <parameter
class="java.lang.Class">org.teiid.translator.jdbc.mysql.MySQLExecutionFactory</parameter>
- <parameter
class="java.lang.String">translator-mysql</parameter>
- <parameter class="java.lang.String">MySQL</parameter>
- </constructor>
- </bean>
-
- <!-- MYSQL5 -->
- <bean name="translator-mysql5-template"
class="org.teiid.templates.TranslatorDeploymentTemplate">
- <property name="info"><inject
bean="translator-mysql5" /> </property>
- <property name="managedObjectFactory"> <inject
bean="ManagedObjectFactory" /> </property>
- </bean>
-
- <bean name="translator-mysql5"
class="org.teiid.templates.TranslatorTemplateInfo">
- <constructor factoryMethod="createTemplateInfo">
- <factory bean="TranslatorDeploymentTemplateInfoFactory" />
- <parameter
class="java.lang.Class">org.teiid.templates.TranslatorTemplateInfo</parameter>
- <parameter
class="java.lang.Class">org.teiid.translator.jdbc.mysql.MySQL5ExecutionFactory</parameter>
- <parameter
class="java.lang.String">translator-mysql5</parameter>
- <parameter class="java.lang.String">MySQL5</parameter>
- </constructor>
- </bean>
-
- <!-- ORACLE -->
- <bean name="translator-oracle-template"
class="org.teiid.templates.TranslatorDeploymentTemplate">
- <property name="info"><inject
bean="translator-oracle" /> </property>
- <property name="managedObjectFactory"> <inject
bean="ManagedObjectFactory" /> </property>
- </bean>
-
- <bean name="translator-oracle"
class="org.teiid.templates.TranslatorTemplateInfo">
- <constructor factoryMethod="createTemplateInfo">
- <factory bean="TranslatorDeploymentTemplateInfoFactory" />
- <parameter
class="java.lang.Class">org.teiid.templates.TranslatorTemplateInfo</parameter>
- <parameter
class="java.lang.Class">org.teiid.translator.jdbc.oracle.OracleExecutionFactory</parameter>
- <parameter
class="java.lang.String">translator-oracle</parameter>
- <parameter class="java.lang.String">oracle</parameter>
- </constructor>
- </bean>
-
- <!-- POSTGRESQL -->
- <bean name="translator-postgresql-template"
class="org.teiid.templates.TranslatorDeploymentTemplate">
- <property name="info"><inject
bean="translator-postgresql" /> </property>
- <property name="managedObjectFactory"> <inject
bean="ManagedObjectFactory" /> </property>
- </bean>
-
- <bean name="translator-postgresql"
class="org.teiid.templates.TranslatorTemplateInfo">
- <constructor factoryMethod="createTemplateInfo">
- <factory bean="TranslatorDeploymentTemplateInfoFactory" />
- <parameter
class="java.lang.Class">org.teiid.templates.TranslatorTemplateInfo</parameter>
- <parameter
class="java.lang.Class">org.teiid.translator.jdbc.postgresql.PostgreSQLExecutionFactory</parameter>
- <parameter
class="java.lang.String">translator-postgresql</parameter>
- <parameter
class="java.lang.String">PostgreSQL</parameter>
- </constructor>
- </bean>
-
- <!-- SQL SERVER -->
- <bean name="translator-sqlserver-template"
class="org.teiid.templates.TranslatorDeploymentTemplate">
- <property name="info"><inject
bean="translator-sqlserver" /> </property>
- <property name="managedObjectFactory"> <inject
bean="ManagedObjectFactory" /> </property>
- </bean>
-
- <bean name="translator-sqlserver"
class="org.teiid.templates.TranslatorTemplateInfo">
- <constructor factoryMethod="createTemplateInfo">
- <factory bean="TranslatorDeploymentTemplateInfoFactory" />
- <parameter
class="java.lang.Class">org.teiid.templates.TranslatorTemplateInfo</parameter>
- <parameter
class="java.lang.Class">org.teiid.translator.jdbc.sqlserver.SQLServerExecutionFactory</parameter>
- <parameter
class="java.lang.String">translator-sqlserver</parameter>
- <parameter
class="java.lang.String">SQLServer</parameter>
- </constructor>
- </bean>
-
- <!-- SYBASE -->
- <bean name="translator-sybase-template"
class="org.teiid.templates.TranslatorDeploymentTemplate">
- <property name="info"><inject
bean="translator-sybase" /> </property>
- <property name="managedObjectFactory"> <inject
bean="ManagedObjectFactory" /> </property>
- </bean>
-
- <bean name="translator-sybase"
class="org.teiid.templates.TranslatorTemplateInfo">
- <constructor factoryMethod="createTemplateInfo">
- <factory bean="TranslatorDeploymentTemplateInfoFactory" />
- <parameter
class="java.lang.Class">org.teiid.templates.TranslatorTemplateInfo</parameter>
- <parameter
class="java.lang.Class">org.teiid.translator.jdbc.sybase.SybaseExecutionFactory</parameter>
- <parameter
class="java.lang.String">translator-sybase</parameter>
- <parameter class="java.lang.String">Sybase</parameter>
- </constructor>
- </bean>
-
- <!-- TEIID -->
- <bean name="translator-teiid-template"
class="org.teiid.templates.TranslatorDeploymentTemplate">
- <property name="info"><inject
bean="translator-teiid" /> </property>
- <property name="managedObjectFactory"> <inject
bean="ManagedObjectFactory" /> </property>
- </bean>
-
- <bean name="translator-teiid"
class="org.teiid.templates.TranslatorTemplateInfo">
- <constructor factoryMethod="createTemplateInfo">
- <factory bean="TranslatorDeploymentTemplateInfoFactory" />
- <parameter
class="java.lang.Class">org.teiid.templates.TranslatorTemplateInfo</parameter>
- <parameter
class="java.lang.Class">org.teiid.translator.jdbc.teiid.TeiidExecutionFactory</parameter>
- <parameter
class="java.lang.String">translator-teiid</parameter>
- <parameter class="java.lang.String">Teiid</parameter>
- </constructor>
- </bean>
-
- <!-- TERADATA -->
- <bean name="translator-teradata-template"
class="org.teiid.templates.TranslatorDeploymentTemplate">
- <property name="info"><inject
bean="translator-teradata" /> </property>
- <property name="managedObjectFactory"> <inject
bean="ManagedObjectFactory" /> </property>
- </bean>
-
- <bean name="translator-teradata"
class="org.teiid.templates.TranslatorTemplateInfo">
- <constructor factoryMethod="createTemplateInfo">
- <factory bean="TranslatorDeploymentTemplateInfoFactory" />
- <parameter
class="java.lang.Class">org.teiid.templates.TranslatorTemplateInfo</parameter>
- <parameter
class="java.lang.Class">org.teiid.translator.jdbc.teradata.TeradataExecutionFactory</parameter>
- <parameter
class="java.lang.String">translator-teradata</parameter>
- <parameter
class="java.lang.String">teradata</parameter>
- </constructor>
- </bean>
-
- <!-- MODESHAPE -->
- <bean name="translator-modeshape-template"
class="org.teiid.templates.TranslatorDeploymentTemplate">
- <property name="info"><inject
bean="translator-modeshape" /> </property>
- <property name="managedObjectFactory"> <inject
bean="ManagedObjectFactory" /> </property>
- </bean>
-
- <bean name="translator-modeshape"
class="org.teiid.templates.TranslatorTemplateInfo">
- <constructor factoryMethod="createTemplateInfo">
- <factory bean="TranslatorDeploymentTemplateInfoFactory" />
- <parameter
class="java.lang.Class">org.teiid.templates.TranslatorTemplateInfo</parameter>
- <parameter
class="java.lang.Class">org.teiid.translator.jdbc.modeshape.ModeShapeExecutionFactory</parameter>
- <parameter
class="java.lang.String">translator-modeshape</parameter>
- <parameter
class="java.lang.String">Modeshape</parameter>
- </constructor>
- </bean>
-
- <!-- Ingres -->
- <bean name="translator-ingres-template"
class="org.teiid.templates.TranslatorDeploymentTemplate">
- <property name="info"><inject
bean="translator-ingres" /> </property>
- <property name="managedObjectFactory"> <inject
bean="ManagedObjectFactory" /> </property>
- </bean>
-
- <bean name="translator-ingres"
class="org.teiid.templates.TranslatorTemplateInfo">
- <constructor factoryMethod="createTemplateInfo">
- <factory bean="TranslatorDeploymentTemplateInfoFactory" />
- <parameter
class="java.lang.Class">org.teiid.templates.TranslatorTemplateInfo</parameter>
- <parameter
class="java.lang.Class">org.teiid.translator.jdbc.ingres.IngresExecutionFactory</parameter>
- <parameter
class="java.lang.String">translator-ingres</parameter>
- <parameter class="java.lang.String">Ingres</parameter>
- </constructor>
- </bean>
-
- <!-- Ingres 9.3 -->
- <bean name="translator-ingres-template93"
class="org.teiid.templates.TranslatorDeploymentTemplate">
- <property name="info"><inject
bean="translator-ingres93" /> </property>
- <property name="managedObjectFactory"> <inject
bean="ManagedObjectFactory" /> </property>
- </bean>
-
- <bean name="translator-ingres93"
class="org.teiid.templates.TranslatorTemplateInfo">
- <constructor factoryMethod="createTemplateInfo">
- <factory bean="TranslatorDeploymentTemplateInfoFactory" />
- <parameter
class="java.lang.Class">org.teiid.templates.TranslatorTemplateInfo</parameter>
- <parameter
class="java.lang.Class">org.teiid.translator.jdbc.ingres.Ingres93ExecutionFactory</parameter>
- <parameter
class="java.lang.String">translator-ingres93</parameter>
- <parameter
class="java.lang.String">Ingres93</parameter>
- </constructor>
- </bean>
-
- <!-- InterSystems Cache -->
- <bean name="translator-intersystems-cache-template"
class="org.teiid.templates.TranslatorDeploymentTemplate">
- <property name="info"><inject
bean="translator-intersystems-cache" /> </property>
- <property name="managedObjectFactory"> <inject
bean="ManagedObjectFactory" /> </property>
- </bean>
-
- <bean name="translator-intersystems-cache"
class="org.teiid.templates.TranslatorTemplateInfo">
- <constructor factoryMethod="createTemplateInfo">
- <factory bean="TranslatorDeploymentTemplateInfoFactory" />
- <parameter
class="java.lang.Class">org.teiid.templates.TranslatorTemplateInfo</parameter>
- <parameter
class="java.lang.Class">org.teiid.translator.jdbc.intersyscache.InterSystemsCacheExecutionFactory</parameter>
- <parameter
class="java.lang.String">translator-intersystems-cache</parameter>
- <parameter class="java.lang.String">InterSystems
Cache</parameter>
- </constructor>
- </bean>
-</deployment>
\ No newline at end of file
Added:
branches/as7/connectors/translator-jdbc/src/main/resources/META-INF/services/org.teiid.translator.ExecutionFactory
===================================================================
---
branches/as7/connectors/translator-jdbc/src/main/resources/META-INF/services/org.teiid.translator.ExecutionFactory
(rev 0)
+++
branches/as7/connectors/translator-jdbc/src/main/resources/META-INF/services/org.teiid.translator.ExecutionFactory 2011-06-27
16:56:11 UTC (rev 3274)
@@ -0,0 +1,22 @@
+org.teiid.translator.jdbc.JDBCExecutionFactory #jdbc-ansi
+org.teiid.translator.jdbc.SimpleJDBCExecutionFactory #jdbc-simple
+org.teiid.translator.jdbc.access.AccessExecutionFactory # Access
+org.teiid.translator.jdbc.db2.DB2ExecutionFactory #db2
+org.teiid.translator.jdbc.derby.DerbyExecutionFactory #Derby
+org.teiid.translator.jdbc.h2.H2ExecutionFactory #h2
+org.teiid.translator.jdbc.hsql.HsqlExecutionFactory #hsql
+org.teiid.translator.jdbc.informix.InformixExecutionFactory #informix
+org.teiid.translator.jdbc.mm.MetaMatrixExecutionFactory #metamatrix
+org.teiid.translator.jdbc.mysql.MySQLExecutionFactory #mysql
+org.teiid.translator.jdbc.mysql.MySQL5ExecutionFactory #mysql5
+org.teiid.translator.jdbc.oracle.OracleExecutionFactory #oracle
+org.teiid.translator.jdbc.postgresql.PostgreSQLExecutionFactory #postgresql
+org.teiid.translator.jdbc.sqlserver.SQLServerExecutionFactory #sqlserver
+org.teiid.translator.jdbc.sybase.SybaseExecutionFactory #sybase
+org.teiid.translator.jdbc.teiid.TeiidExecutionFactory #teiid
+org.teiid.translator.jdbc.teradata.TeradataExecutionFactory #teradata
+org.teiid.translator.jdbc.modeshape.ModeShapeExecutionFactory #modeshape
+org.teiid.translator.jdbc.ingres.IngresExecutionFactory #ingres
+org.teiid.translator.jdbc.ingres.Ingres93ExecutionFactory #ingres93
+org.teiid.translator.jdbc.intersyscache.InterSystemsCacheExecutionFactory
#intersystems-cache
+
Added: branches/as7/connectors/translator-ldap/src/main/resources/META-INF/MANIFEST.MF
===================================================================
--- branches/as7/connectors/translator-ldap/src/main/resources/META-INF/MANIFEST.MF
(rev 0)
+++
branches/as7/connectors/translator-ldap/src/main/resources/META-INF/MANIFEST.MF 2011-06-27
16:56:11 UTC (rev 3274)
@@ -0,0 +1 @@
+Dependencies: org.jboss.teiid.common-core org.jboss.teiid.api
Property changes on:
branches/as7/connectors/translator-ldap/src/main/resources/META-INF/MANIFEST.MF
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Deleted:
branches/as7/connectors/translator-ldap/src/main/resources/META-INF/jboss-beans.xml
===================================================================
---
branches/as7/connectors/translator-ldap/src/main/resources/META-INF/jboss-beans.xml 2011-06-27
14:25:00 UTC (rev 3273)
+++
branches/as7/connectors/translator-ldap/src/main/resources/META-INF/jboss-beans.xml 2011-06-27
16:56:11 UTC (rev 3274)
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<deployment xmlns="urn:jboss:bean-deployer:2.0">
-
- <bean name="translator-ldap-template"
class="org.teiid.templates.TranslatorDeploymentTemplate">
- <property name="info"><inject
bean="translator-ldap"/></property>
- <property name="managedObjectFactory"><inject
bean="ManagedObjectFactory"/></property>
- </bean>
-
- <bean name="translator-ldap"
class="org.teiid.templates.TranslatorTemplateInfo">
- <constructor factoryMethod="createTemplateInfo">
- <factory bean="TranslatorDeploymentTemplateInfoFactory"/>
- <parameter
class="java.lang.Class">org.teiid.templates.TranslatorTemplateInfo</parameter>
- <parameter
class="java.lang.Class">org.teiid.translator.ldap.LDAPExecutionFactory</parameter>
- <parameter
class="java.lang.String">translator-ldap</parameter>
- <parameter class="java.lang.String">ldap</parameter>
- </constructor>
- </bean>
-
-</deployment>
\ No newline at end of file
Added:
branches/as7/connectors/translator-ldap/src/main/resources/META-INF/services/org.teiid.translator.ExecutionFactory
===================================================================
---
branches/as7/connectors/translator-ldap/src/main/resources/META-INF/services/org.teiid.translator.ExecutionFactory
(rev 0)
+++
branches/as7/connectors/translator-ldap/src/main/resources/META-INF/services/org.teiid.translator.ExecutionFactory 2011-06-27
16:56:11 UTC (rev 3274)
@@ -0,0 +1 @@
+org.teiid.translator.ldap.LdapExecutionFactory
\ No newline at end of file
Added:
branches/as7/connectors/translator-loopback/src/main/resources/META-INF/MANIFEST.MF
===================================================================
--- branches/as7/connectors/translator-loopback/src/main/resources/META-INF/MANIFEST.MF
(rev 0)
+++
branches/as7/connectors/translator-loopback/src/main/resources/META-INF/MANIFEST.MF 2011-06-27
16:56:11 UTC (rev 3274)
@@ -0,0 +1 @@
+Dependencies: org.jboss.teiid.common-core org.jboss.teiid.api
Property changes on:
branches/as7/connectors/translator-loopback/src/main/resources/META-INF/MANIFEST.MF
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Deleted:
branches/as7/connectors/translator-loopback/src/main/resources/META-INF/jboss-beans.xml
===================================================================
---
branches/as7/connectors/translator-loopback/src/main/resources/META-INF/jboss-beans.xml 2011-06-27
14:25:00 UTC (rev 3273)
+++
branches/as7/connectors/translator-loopback/src/main/resources/META-INF/jboss-beans.xml 2011-06-27
16:56:11 UTC (rev 3274)
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<deployment xmlns="urn:jboss:bean-deployer:2.0">
-
- <bean name="translator-loopback-template"
class="org.teiid.templates.TranslatorDeploymentTemplate">
- <property name="info"><inject
bean="translator-loopback"/></property>
- <property name="managedObjectFactory"><inject
bean="ManagedObjectFactory"/></property>
- </bean>
-
- <bean name="translator-loopback"
class="org.teiid.templates.TranslatorTemplateInfo">
- <constructor factoryMethod="createTemplateInfo">
- <factory bean="TranslatorDeploymentTemplateInfoFactory"/>
- <parameter
class="java.lang.Class">org.teiid.templates.TranslatorTemplateInfo</parameter>
- <parameter
class="java.lang.Class">org.teiid.translator.loopback.LoopbackExecutionFactory</parameter>
- <parameter
class="java.lang.String">translator-loopback</parameter>
- <parameter class="java.lang.String">Loopback</parameter>
- </constructor>
- </bean>
-
-</deployment>
\ No newline at end of file
Added:
branches/as7/connectors/translator-loopback/src/main/resources/META-INF/services/org.teiid.translator.ExecutionFactory
===================================================================
---
branches/as7/connectors/translator-loopback/src/main/resources/META-INF/services/org.teiid.translator.ExecutionFactory
(rev 0)
+++
branches/as7/connectors/translator-loopback/src/main/resources/META-INF/services/org.teiid.translator.ExecutionFactory 2011-06-27
16:56:11 UTC (rev 3274)
@@ -0,0 +1 @@
+org.teiid.translator.loopback.LoopbackExecutionFactory
\ No newline at end of file
Added: branches/as7/connectors/translator-olap/src/main/resources/META-INF/MANIFEST.MF
===================================================================
--- branches/as7/connectors/translator-olap/src/main/resources/META-INF/MANIFEST.MF
(rev 0)
+++
branches/as7/connectors/translator-olap/src/main/resources/META-INF/MANIFEST.MF 2011-06-27
16:56:11 UTC (rev 3274)
@@ -0,0 +1 @@
+Dependencies: org.jboss.teiid.common-core org.jboss.teiid.api
Property changes on:
branches/as7/connectors/translator-olap/src/main/resources/META-INF/MANIFEST.MF
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Deleted:
branches/as7/connectors/translator-olap/src/main/resources/META-INF/jboss-beans.xml
===================================================================
---
branches/as7/connectors/translator-olap/src/main/resources/META-INF/jboss-beans.xml 2011-06-27
14:25:00 UTC (rev 3273)
+++
branches/as7/connectors/translator-olap/src/main/resources/META-INF/jboss-beans.xml 2011-06-27
16:56:11 UTC (rev 3274)
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<deployment xmlns="urn:jboss:bean-deployer:2.0">
- <!-- OLAP -->
- <bean name="translator-olap-template"
class="org.teiid.templates.TranslatorDeploymentTemplate">
- <property name="info"><inject bean="translator-olap"
/> </property>
- <property name="managedObjectFactory"> <inject
bean="ManagedObjectFactory" /> </property>
- </bean>
-
- <bean name="translator-olap"
class="org.teiid.templates.TranslatorTemplateInfo">
- <constructor factoryMethod="createTemplateInfo">
- <factory bean="TranslatorDeploymentTemplateInfoFactory" />
- <parameter
class="java.lang.Class">org.teiid.templates.TranslatorTemplateInfo</parameter>
- <parameter
class="java.lang.Class">org.teiid.translator.olap.OlapExecutionFactory</parameter>
- <parameter
class="java.lang.String">translator-olap</parameter>
- <parameter class="java.lang.String">olap</parameter>
- </constructor>
- </bean>
-</deployment>
Added:
branches/as7/connectors/translator-olap/src/main/resources/META-INF/services/org.teiid.translator.ExecutionFactory
===================================================================
---
branches/as7/connectors/translator-olap/src/main/resources/META-INF/services/org.teiid.translator.ExecutionFactory
(rev 0)
+++
branches/as7/connectors/translator-olap/src/main/resources/META-INF/services/org.teiid.translator.ExecutionFactory 2011-06-27
16:56:11 UTC (rev 3274)
@@ -0,0 +1 @@
+org.teiid.translator.olap.OlapExecutionFactory
\ No newline at end of file
Added:
branches/as7/connectors/translator-salesforce/src/main/resources/META-INF/MANIFEST.MF
===================================================================
--- branches/as7/connectors/translator-salesforce/src/main/resources/META-INF/MANIFEST.MF
(rev 0)
+++
branches/as7/connectors/translator-salesforce/src/main/resources/META-INF/MANIFEST.MF 2011-06-27
16:56:11 UTC (rev 3274)
@@ -0,0 +1 @@
+Dependencies: org.jboss.teiid.common-core org.jboss.teiid.api
Property changes on:
branches/as7/connectors/translator-salesforce/src/main/resources/META-INF/MANIFEST.MF
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Deleted:
branches/as7/connectors/translator-salesforce/src/main/resources/META-INF/jboss-beans.xml
===================================================================
---
branches/as7/connectors/translator-salesforce/src/main/resources/META-INF/jboss-beans.xml 2011-06-27
14:25:00 UTC (rev 3273)
+++
branches/as7/connectors/translator-salesforce/src/main/resources/META-INF/jboss-beans.xml 2011-06-27
16:56:11 UTC (rev 3274)
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<deployment xmlns="urn:jboss:bean-deployer:2.0">
-
- <bean name="translator-salesforce-template"
class="org.teiid.templates.TranslatorDeploymentTemplate">
- <property name="info"><inject
bean="translator-salesforce"/></property>
- <property name="managedObjectFactory"><inject
bean="ManagedObjectFactory"/></property>
- </bean>
-
- <bean name="translator-salesforce"
class="org.teiid.templates.TranslatorTemplateInfo">
- <constructor factoryMethod="createTemplateInfo">
- <factory bean="TranslatorDeploymentTemplateInfoFactory"/>
- <parameter
class="java.lang.Class">org.teiid.templates.TranslatorTemplateInfo</parameter>
- <parameter
class="java.lang.Class">org.teiid.translator.salesforce.SalesForceExecutionFactory</parameter>
- <parameter
class="java.lang.String">translator-salesforce</parameter>
- <parameter class="java.lang.String">Salesforce</parameter>
- </constructor>
- </bean>
-
-</deployment>
\ No newline at end of file
Added:
branches/as7/connectors/translator-salesforce/src/main/resources/META-INF/services/org.teiid.translator.ExecutionFactory
===================================================================
---
branches/as7/connectors/translator-salesforce/src/main/resources/META-INF/services/org.teiid.translator.ExecutionFactory
(rev 0)
+++
branches/as7/connectors/translator-salesforce/src/main/resources/META-INF/services/org.teiid.translator.ExecutionFactory 2011-06-27
16:56:11 UTC (rev 3274)
@@ -0,0 +1 @@
+org.teiid.translator.salesforce.SalesForceExecutionFactory
\ No newline at end of file
Added: branches/as7/connectors/translator-ws/src/main/resources/META-INF/MANIFEST.MF
===================================================================
--- branches/as7/connectors/translator-ws/src/main/resources/META-INF/MANIFEST.MF
(rev 0)
+++
branches/as7/connectors/translator-ws/src/main/resources/META-INF/MANIFEST.MF 2011-06-27
16:56:11 UTC (rev 3274)
@@ -0,0 +1 @@
+Dependencies: org.jboss.teiid.common-core org.jboss.teiid.api
Property changes on:
branches/as7/connectors/translator-ws/src/main/resources/META-INF/MANIFEST.MF
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
branches/as7/connectors/translator-ws/src/main/resources/META-INF/services/org.teiid.translator.ExecutionFactory
===================================================================
---
branches/as7/connectors/translator-ws/src/main/resources/META-INF/services/org.teiid.translator.ExecutionFactory
(rev 0)
+++
branches/as7/connectors/translator-ws/src/main/resources/META-INF/services/org.teiid.translator.ExecutionFactory 2011-06-27
16:56:11 UTC (rev 3274)
@@ -0,0 +1 @@
+org.teiid.translator.ws.WSExecutionFactory
\ No newline at end of file
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-06-27
14:25:00 UTC (rev 3273)
+++
branches/as7/engine/src/main/java/org/teiid/dqp/internal/datamgr/TranslatorRepository.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -30,7 +30,7 @@
import org.teiid.adminapi.impl.VDBTranslatorMetaData;
-public class TranslatorRepository implements Serializable{
+public class TranslatorRepository implements Serializable {
private static final long serialVersionUID = -1212280886010974273L;
private Map<String, VDBTranslatorMetaData> translatorRepo = new
ConcurrentHashMap<String, VDBTranslatorMetaData>();
Modified: branches/as7/engine/src/main/java/org/teiid/dqp/service/SessionService.java
===================================================================
--- branches/as7/engine/src/main/java/org/teiid/dqp/service/SessionService.java 2011-06-27
14:25:00 UTC (rev 3273)
+++ branches/as7/engine/src/main/java/org/teiid/dqp/service/SessionService.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -66,7 +66,7 @@
public SessionMetadata createSession(String userName,
Credentials credentials,
String applicationName,
- Properties properties, boolean admin,
boolean authenticate)
+ Properties properties, boolean
authenticate)
throws LoginException, SessionServiceException;
/**
Modified: branches/as7/jboss-integration/pom.xml
===================================================================
--- branches/as7/jboss-integration/pom.xml 2011-06-27 14:25:00 UTC (rev 3273)
+++ branches/as7/jboss-integration/pom.xml 2011-06-27 16:56:11 UTC (rev 3274)
@@ -83,7 +83,17 @@
<groupId>org.picketbox</groupId>
<artifactId>picketbox</artifactId>
<scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-server</artifactId>
+ <scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-connector</artifactId>
+ <scope>provided</scope>
+ </dependency>
<!--
<dependency>
Deleted: branches/as7/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java
===================================================================
---
branches/as7/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java 2011-06-27
14:25:00 UTC (rev 3273)
+++
branches/as7/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -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.jboss;
-
-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);
- }
-}
Deleted:
branches/as7/jboss-integration/src/main/java/org/teiid/adminapi/jboss/AdminObjectBuilder.java
===================================================================
---
branches/as7/jboss-integration/src/main/java/org/teiid/adminapi/jboss/AdminObjectBuilder.java 2011-06-27
14:25:00 UTC (rev 3273)
+++
branches/as7/jboss-integration/src/main/java/org/teiid/adminapi/jboss/AdminObjectBuilder.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -1,155 +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.jboss;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.jboss.managed.api.ManagedCommon;
-import org.jboss.managed.api.ManagedObject;
-import org.jboss.managed.api.ManagedProperty;
-import org.jboss.managed.api.factory.ManagedObjectFactory;
-import org.jboss.managed.plugins.factory.AbstractManagedObjectFactory;
-import org.jboss.managed.plugins.factory.ManagedObjectFactoryBuilder;
-import org.jboss.metatype.api.types.CollectionMetaType;
-import org.jboss.metatype.api.types.MetaType;
-import org.jboss.metatype.api.types.SimpleMetaType;
-import org.jboss.metatype.api.values.MapCompositeValueSupport;
-import org.jboss.metatype.api.values.MetaValue;
-import org.jboss.metatype.api.values.MetaValueFactory;
-import org.jboss.metatype.api.values.SimpleValue;
-import org.teiid.adminapi.impl.PropertyMetadata;
-import org.teiid.adminapi.impl.TranslatorMetaData;
-import org.teiid.core.TeiidRuntimeException;
-import org.teiid.core.util.PropertiesUtils;
-import org.teiid.jboss.IntegrationPlugin;
-import org.teiid.templates.TranslatorMetadataICF;
-
-
-
-public class AdminObjectBuilder {
-
- private ManagedObjectFactory mof = ManagedObjectFactoryBuilder.create();
-
- public AdminObjectBuilder() {
- this.mof.setInstanceClassFactory(TranslatorMetaData.class, new
TranslatorMetadataICF(this.mof));
- }
-
- public static <T> T buildAO(ManagedCommon mc, Class<T> clazz) {
-
- try {
- Object t = clazz.newInstance();
-
- Map<String, ManagedProperty> managedProperties = mc.getProperties();
- for (ManagedProperty mp: managedProperties.values()) {
- MetaValue value = mp.getValue();
- if (value != null) {
- MetaType type = value.getMetaType();
- if (type.isSimple()) {
- PropertiesUtils.setBeanProperty(t, mp.getMappedName(),
((SimpleValue)value).getValue());
- }
- else if (type.isPrimitive()) {
- PropertiesUtils.setBeanProperty(t, mp.getMappedName(),
((SimpleValue)value).getValue());
- }
- else if (type.isEnum()) {
- PropertiesUtils.setBeanProperty(t, mp.getMappedName(),
((org.jboss.metatype.api.values.EnumValue)value).getValue());
- }
- else if (type.isProperties()) {
-
- }
- else if (type.isComposite()) {
- if (value instanceof MapCompositeValueSupport) {
- HashMap<String, String> myValue = (HashMap<String,
String>)MetaValueFactory.getInstance().unwrap(value);
-
- if (mp.getMappedName().equals("JAXBProperties")) { //$NON-NLS-1$
- List<PropertyMetadata> props = new ArrayList<PropertyMetadata>();
- for (String key:myValue.keySet()) {
- props.add(new PropertyMetadata(key, myValue.get(key)));
- }
- PropertiesUtils.setBeanProperty(t, mp.getMappedName(), props);
- }
- else {
- PropertiesUtils.setBeanProperty(t, mp.getMappedName(), myValue);
- }
- }
- }
- else if (type.isCollection()) {
- List list = new ArrayList();
-
- MetaType elementType = ((CollectionMetaType) type).getElementType();
- if (elementType == AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE) {
- List<ManagedObject> managedObjects = (List<ManagedObject>)
MetaValueFactory.getInstance().unwrap(value);
- for (ManagedObject mo : managedObjects) {
- list.add(buildAO(mo, mo.getAttachment().getClass()));
- }
- }
- else if (elementType == SimpleMetaType.STRING) {
- list.addAll((List<String>) MetaValueFactory.getInstance().unwrap(value));
- }
- else if (elementType.isComposite()) {
- list.addAll((List)MetaValueFactory.getInstance().unwrap(value));
- }
- else {
- throw new TeiidRuntimeException("unsupported type"); //$NON-NLS-1$
- }
- PropertiesUtils.setBeanProperty(t, mp.getMappedName(), list);
- }
- else if (type.isGeneric()) {
- throw new TeiidRuntimeException("unsupported type"); //$NON-NLS-1$
- }
- else if (type.isTable()|| type.isArray()) {
- throw new TeiidRuntimeException("unsupported type"); //$NON-NLS-1$
- }
- }
- }
- return clazz.cast(t);
- } catch (InstantiationException e) {
- throw new TeiidRuntimeException(e,
IntegrationPlugin.Util.getString("class_not_found", clazz.getName()));
//$NON-NLS-1$
- } catch (IllegalAccessException e) {
- throw new TeiidRuntimeException(e,
IntegrationPlugin.Util.getString("class_not_found", clazz.getName()));
//$NON-NLS-1$
- }
- }
-
-
-
- public <T> T buildAdminObject(ManagedCommon mc, Class<T> clazz) {
- try {
- Object t = clazz.newInstance();
- ManagedObject mo = mof.initManagedObject(t, "teiid",
"translator"); //$NON-NLS-1$ //$NON-NLS-2$
- for (ManagedProperty mp : mc.getProperties().values()) {
- ManagedProperty dsProp = mo.getProperty(mp.getName());
- if (dsProp != null) {
- if (mp.getValue() != null) {
- dsProp.setValue(mp.getValue());
- }
- }
- }
- return clazz.cast(t);
- } catch (InstantiationException e) {
- throw new TeiidRuntimeException(e,
IntegrationPlugin.Util.getString("class_not_found", clazz.getName()));
//$NON-NLS-1$
- } catch (IllegalAccessException e) {
- throw new TeiidRuntimeException(e,
IntegrationPlugin.Util.getString("class_not_found", clazz.getName()));
//$NON-NLS-1$
- }
- }
-}
Deleted:
branches/as7/jboss-integration/src/main/java/org/teiid/adminapi/jboss/AdminProvider.java
===================================================================
---
branches/as7/jboss-integration/src/main/java/org/teiid/adminapi/jboss/AdminProvider.java 2011-06-27
14:25:00 UTC (rev 3273)
+++
branches/as7/jboss-integration/src/main/java/org/teiid/adminapi/jboss/AdminProvider.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -1,198 +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.jboss;
-
-import java.io.IOException;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.util.Properties;
-
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-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.Configuration;
-import javax.security.auth.login.LoginContext;
-import javax.security.auth.login.LoginException;
-
-import org.jboss.deployers.spi.management.ManagementView;
-import org.jboss.deployers.spi.management.deploy.DeploymentManager;
-import org.jboss.profileservice.spi.ProfileService;
-import org.teiid.adminapi.AdminComponentException;
-import org.teiid.deployers.VDBStatusChecker;
-
-public class AdminProvider {
-
- public static Admin getLocal(final ProfileService profileService, VDBStatusChecker
vdbStatusChecker) {
- ProfileConnection pc = new ProfileConnection(profileService);
- return new Admin(pc.getManagementView(), pc.getDeploymentManager(), vdbStatusChecker);
- }
-
- public static Admin getLocal(VDBStatusChecker vdbStatusChecker) throws
AdminComponentException {
- ProfileConnection pc = new ProfileConnection();
- return new Admin(pc.getManagementView(), pc.getDeploymentManager(), vdbStatusChecker);
- }
-
- public static Admin getRemote(String provideURL, String userid, String password,
VDBStatusChecker vdbStatusChecker) throws AdminComponentException {
- ProfileConnection pc = new ProfileConnection(provideURL, userid, password);
- return new Admin(pc.getManagementView(), pc.getDeploymentManager(),
vdbStatusChecker);
- }
-
- /**
- * Connection to profile service from a remote VM or local connection
- */
- static private class ProfileConnection {
- private static final String PROFILE_SERVICE_JNDI_NAME = "ProfileService";
//$NON-NLS-1$
- private static final String SECURE_PROFILE_SERVICE_JNDI_NAME =
"SecureProfileService/remote"; //$NON-NLS-1$
- private static final String NAMING_CONTEXT_FACTORY =
"org.jnp.interfaces.NamingContextFactory"; //$NON-NLS-1$
- private static final String JNP_TIMEOUT_JNP_INIT_PROP = "jnp.timeout";
//$NON-NLS-1$
- private static final String JNP_SOTIMEOUT_JNP_INIT_PROP = "jnp.sotimeout";
//$NON-NLS-1$
- private static final String JNP_DISABLE_DISCOVERY_JNP_INIT_PROP =
"jnp.disableDiscovery"; //$NON-NLS-1$
-
- /**
- * This is the timeout (in milliseconds) for the initial attempt to establish the
remote connection.
- */
- private static final int JNP_TIMEOUT = 60 * 1000; // 60 seconds
-
- /**
- * This is the timeout (in milliseconds) for methods invoked on the remote
ProfileService. NOTE: This timeout comes
- * into play if the JBossAS instance has gone down since the original JNP connection
was made.
- */
- private static final int JNP_SO_TIMEOUT = 60 * 1000; // 60 seconds
-
- /**
- * A flag indicating that the discovery process should not attempt to automatically
discover (via multicast) naming
- * servers running the JBoss HA-JNDI service if it fails to connect to the specified
jnp URL.
- */
- private static final boolean JNP_DISABLE_DISCOVERY = true;
-
- private ProfileService profileService;
- private String userName;
- private String password;
-
- public ProfileConnection() throws AdminComponentException {
- this.profileService = connect(null, null, null);
- }
-
- public ProfileConnection(final ProfileService profileService) {
- this.profileService = profileService;
- }
-
- public ProfileConnection(String providerURL, String user, String password) throws
AdminComponentException {
- this.userName = user;
- this.password = password;
- this.profileService = connect(providerURL, user, password);
- }
-
- public ManagementView getManagementView() {
- return this.profileService.getViewManager();
- }
-
- public DeploymentManager getDeploymentManager() {
- return this.profileService.getDeploymentManager();
- }
-
- private ProfileService connect(String providerURL, String user, String password) throws
AdminComponentException {
- ClassLoader originalContextClassLoader =
Thread.currentThread().getContextClassLoader();
- try {
- // local connection
- if (providerURL == null) {
- InitialContext ic = new InitialContext();
- return (ProfileService)ic.lookup(PROFILE_SERVICE_JNDI_NAME);
- }
-
- Properties env = new Properties();
- env.setProperty(Context.PROVIDER_URL, providerURL);
-
- // un-authenticated remote login
- env.setProperty(Context.INITIAL_CONTEXT_FACTORY,
NAMING_CONTEXT_FACTORY);
- env.setProperty(Context.SECURITY_PRINCIPAL, user);
- env.setProperty(Context.SECURITY_CREDENTIALS, password);
- env.put(Context.URL_PKG_PREFIXES, "org.jnp.interfaces");
//$NON-NLS-1$
- env.setProperty(JNP_DISABLE_DISCOVERY_JNP_INIT_PROP, "true");
//$NON-NLS-1$
- env.setProperty(JNP_TIMEOUT_JNP_INIT_PROP, String.valueOf(JNP_TIMEOUT));
- env.setProperty(JNP_SOTIMEOUT_JNP_INIT_PROP,
String.valueOf(JNP_SO_TIMEOUT));
- env.setProperty(JNP_DISABLE_DISCOVERY_JNP_INIT_PROP,
String.valueOf(JNP_DISABLE_DISCOVERY));
- env.setProperty("java.naming.factory.url.pkgs",
"org.jboss.naming:org.jnp.interfaces"); //$NON-NLS-1$ //$NON-NLS-2$
- InitialContext ic = new InitialContext(env);
-
- try {
- return (ProfileService)ic.lookup(PROFILE_SERVICE_JNDI_NAME);
- } catch(NamingException e) {
- ProfileService ps =
(ProfileService)ic.lookup(SECURE_PROFILE_SERVICE_JNDI_NAME);
- return
(ProfileService)Proxy.newProxyInstance(this.getClass().getClassLoader(), new Class[]
{ProfileService.class}, new JaasSecurityHandler(ps, this.userName, this.password));
- }
- } catch(NamingException e) {
- throw new AdminComponentException(e);
- } finally {
- Thread.currentThread().setContextClassLoader(originalContextClassLoader);
- }
- }
- }
-
- static class JaasSecurityHandler implements InvocationHandler {
- private Object target;
- private LoginContext loginContext;
-
- public JaasSecurityHandler(Object target, final String username, final String
password) {
- this.target = target;
- Configuration jaasConfig = new JBossConfiguration();
- try {
- this.loginContext = new LoginContext(JBossConfiguration.JBOSS_ENTRY_NAME,
null, new CallbackHandler() {
-
- @Override
- public void handle(Callback[] callbacks) throws IOException,
UnsupportedCallbackException {
- for (Callback callback : callbacks) {
- if (callback instanceof NameCallback) {
- NameCallback nameCallback = (NameCallback)callback;
- nameCallback.setName(username);
- }
- else if (callback instanceof PasswordCallback) {
- PasswordCallback passwordCallback = (PasswordCallback)callback;
- passwordCallback.setPassword(password.toCharArray());
- }
- else {
- throw new UnsupportedCallbackException(callback, "Unrecognized
Callback: " + callback); //$NON-NLS-1$
- }
- }
-
- }
- }, jaasConfig);
- }
- catch (LoginException e) {
- throw new RuntimeException(e);
- }
- }
-
- public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
- this.loginContext.login();
- Object returnValue = method.invoke(this.target, args);
- this.loginContext.logout();
- return returnValue;
- }
- }
-}
Deleted:
branches/as7/jboss-integration/src/main/java/org/teiid/adminapi/jboss/ExtendedPropertyInfo.java
===================================================================
---
branches/as7/jboss-integration/src/main/java/org/teiid/adminapi/jboss/ExtendedPropertyInfo.java 2011-06-27
14:25:00 UTC (rev 3273)
+++
branches/as7/jboss-integration/src/main/java/org/teiid/adminapi/jboss/ExtendedPropertyInfo.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -1,28 +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.jboss;
-
-import org.jboss.managed.api.ManagedComponent;
-
-public interface ExtendedPropertyInfo {
- void updateProperty(String name, String value, ManagedComponent mc);
-}
Deleted:
branches/as7/jboss-integration/src/main/java/org/teiid/adminapi/jboss/JBossConfiguration.java
===================================================================
---
branches/as7/jboss-integration/src/main/java/org/teiid/adminapi/jboss/JBossConfiguration.java 2011-06-27
14:25:00 UTC (rev 3273)
+++
branches/as7/jboss-integration/src/main/java/org/teiid/adminapi/jboss/JBossConfiguration.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -1,63 +0,0 @@
-/*
- * Jopr Management Platform
- * Copyright (C) 2005-2009 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2, as
- * published by the Free Software Foundation, and/or the GNU Lesser
- * General Public License, version 2.1, also as published by the Free
- * Software Foundation.
- *
- * This program 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 General Public License and the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License
- * and the GNU Lesser General Public License along with this program;
- * if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.teiid.adminapi.jboss;
-
-import java.util.Map;
-import java.util.HashMap;
-
-import javax.security.auth.login.Configuration;
-import javax.security.auth.login.AppConfigurationEntry;
-
-/**
- * A JAAS configuration for a JBoss client. This is the programmatic equivalent of the
following auth.conf file:
- *
- * <code>
- * jboss
- * {
- * org.jboss.security.ClientLoginModule required
- * multi-threaded=true;
- * };
- * </code>
- *
- * @author Ian Springer
- */
-public class JBossConfiguration extends Configuration {
- public static final String JBOSS_ENTRY_NAME = "profileservice";
-
- private static final String JBOSS_LOGIN_MODULE_CLASS_NAME =
"org.jboss.security.ClientLoginModule";
- private static final String MULTI_THREADED_OPTION = "multi-threaded";
-
- public AppConfigurationEntry[] getAppConfigurationEntry(String name) {
- if (JBOSS_ENTRY_NAME.equals(name)) {
- Map options = new HashMap(1);
- options.put(MULTI_THREADED_OPTION, Boolean.TRUE.toString());
- AppConfigurationEntry appConfigurationEntry = new
AppConfigurationEntry(JBOSS_LOGIN_MODULE_CLASS_NAME,
AppConfigurationEntry.LoginModuleControlFlag.REQUIRED, options);
- return new AppConfigurationEntry[] {appConfigurationEntry};
- }
- throw new IllegalArgumentException("Unknown entry name: " + name);
- }
-
- public void refresh() {
- return;
- }
-}
Deleted:
branches/as7/jboss-integration/src/main/java/org/teiid/adminapi/jboss/ManagedUtil.java
===================================================================
---
branches/as7/jboss-integration/src/main/java/org/teiid/adminapi/jboss/ManagedUtil.java 2011-06-27
14:25:00 UTC (rev 3273)
+++
branches/as7/jboss-integration/src/main/java/org/teiid/adminapi/jboss/ManagedUtil.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -1,323 +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.jboss;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.net.URLStreamHandler;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
-import org.jboss.deployers.spi.management.deploy.DeploymentManager;
-import org.jboss.deployers.spi.management.deploy.DeploymentProgress;
-import org.jboss.deployers.spi.management.deploy.DeploymentStatus;
-import org.jboss.managed.api.ManagedCommon;
-import org.jboss.managed.api.ManagedOperation;
-import org.jboss.managed.api.ManagedProperty;
-import org.jboss.metatype.api.types.EnumMetaType;
-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.CollectionValue;
-import org.jboss.metatype.api.values.EnumValue;
-import org.jboss.metatype.api.values.EnumValueSupport;
-import org.jboss.metatype.api.values.MapCompositeValueSupport;
-import org.jboss.metatype.api.values.MetaValue;
-import org.jboss.metatype.api.values.PropertiesMetaValue;
-import org.jboss.metatype.api.values.SimpleValue;
-import org.jboss.metatype.api.values.SimpleValueSupport;
-import org.jboss.profileservice.spi.DeploymentOption;
-import org.teiid.adminapi.AdminProcessingException;
-import org.teiid.core.TeiidRuntimeException;
-import org.teiid.jboss.IntegrationPlugin;
-
-
-public class ManagedUtil {
-
- public static boolean sameValue(MetaValue v1, String v2) {
- if (v1 == null || v2 == null) {
- return false;
- }
-
- MetaType type = v1.getMetaType();
- if (v1 instanceof SimpleValue && type instanceof SimpleMetaType) {
- SimpleMetaType st = (SimpleMetaType)type;
- SimpleValue sv = wrap(st, v2);
- return sv.compareTo((SimpleValue)v1) == 0;
- }
- return false;
- }
-
- public static boolean sameValue(MetaValue v1, MetaValue v2) {
- if (v1 == null || v2 == null) {
- return false;
- }
-
- if (v1 instanceof SimpleValue && v2 instanceof SimpleValue) {
- return ((SimpleValue)v1).compareTo((SimpleValue)v2) == 0;
- }
- return false;
- }
-
- public static MapCompositeValueSupport compositeValueMap(Map<String, String> map)
{
- MapCompositeValueSupport metaValue = new
MapCompositeValueSupport(SimpleMetaType.STRING);
- for (String key : map.keySet()) {
- MetaValue value = SimpleValueSupport.wrap(map.get(key));
- metaValue.put(key, value);
- }
- return metaValue;
- }
-
- public static String stringValue(MetaValue v1) {
- if (v1 != null) {
- MetaType type = v1.getMetaType();
- if (type instanceof SimpleMetaType) {
- SimpleValue simple = (SimpleValue)v1;
- return simple.getValue().toString();
- }
- throw new TeiidRuntimeException("Failed to convert value to string value");
//$NON-NLS-1$
- }
- return null;
- }
-
- public static <T> T getSimpleValue(ManagedCommon mc, String prop, Class<T>
expectedType) {
- ManagedProperty mp = mc.getProperty(prop);
- if (mp != null) {
- MetaType metaType = mp.getMetaType();
- if (metaType.isSimple()) {
- SimpleValue simpleValue = (SimpleValue)mp.getValue();
- return expectedType.cast((simpleValue != null) ? simpleValue.getValue() :
null);
- }
- else if (metaType.isEnum()) {
- EnumValue enumValue = (EnumValue)mp.getValue();
- return expectedType.cast((enumValue != null) ? enumValue.getValue() : null);
- }
- throw new IllegalArgumentException(prop+ " is not a simple type");
//$NON-NLS-1$
- }
- return null;
- }
-
- public static Properties getPropertiesValue(ManagedCommon mc, String prop) {
- ManagedProperty mp = mc.getProperty(prop);
- if (mp != null) {
- MetaType metaType = mp.getMetaType();
- if (metaType.isProperties()) {
- return (PropertiesMetaValue)mp.getValue();
- }
- else if (metaType.isComposite()) {
- Properties props = new Properties();
- MapCompositeValueSupport map = (MapCompositeValueSupport) mp.getValue();
- MapCompositeMetaType type = map.getMetaType();
- for (String key : type.keySet()) {
- MetaValue value = map.get(key);
- props.setProperty(key, stringValue(value));
- }
- return props;
- }
- throw new IllegalArgumentException(prop+ " is not a properties type");
//$NON-NLS-1$
- }
- return null;
- }
-
- public static <T> void getCollectionValue(ManagedCommon mc, String prop,
Collection<T> list, Class<T> expectedType) {
- ManagedProperty mp = mc.getProperty(prop);
- if (mp != null) {
- MetaType metaType = mp.getMetaType();
- if (metaType.isCollection()) {
- CollectionValue collectionValue = (CollectionValue)mp.getValue();
- for(MetaValue value:collectionValue.getElements()) {
- if (value.getMetaType().isSimple()) {
- SimpleValue simpleValue = (SimpleValue)value;
- list.add(expectedType.cast(simpleValue.getValue()));
- }
- else {
- throw new IllegalArgumentException(prop+ " is not a simple type");
//$NON-NLS-1$
- }
- }
- }
- }
- }
-
- public static EnumValue wrap(EnumMetaType type, String value) {
- return new EnumValueSupport(type, value);
- }
-
- public static SimpleValue wrap(MetaType type, String value) {
- if (type instanceof SimpleMetaType) {
- SimpleMetaType st = (SimpleMetaType)type;
-
- if (SimpleMetaType.BIGDECIMAL.equals(st)) {
- return new SimpleValueSupport(st, new BigDecimal(value));
- } else if (SimpleMetaType.BIGINTEGER.equals(st)) {
- return new SimpleValueSupport(st, new BigInteger(value));
- } else if (SimpleMetaType.BOOLEAN.equals(st)) {
- return new SimpleValueSupport(st, Boolean.valueOf(value));
- } else if (SimpleMetaType.BOOLEAN_PRIMITIVE.equals(st)) {
- return new SimpleValueSupport(st, Boolean.valueOf(value).booleanValue());
- } else if (SimpleMetaType.BYTE.equals(st)) {
- return new SimpleValueSupport(st, new Byte(value.getBytes()[0]));
- } else if (SimpleMetaType.BYTE_PRIMITIVE.equals(st)) {
- return new SimpleValueSupport(st, value.getBytes()[0]);
- } else if (SimpleMetaType.CHARACTER.equals(st)) {
- return new SimpleValueSupport(st, new Character(value.charAt(0)));
- } else if (SimpleMetaType.CHARACTER_PRIMITIVE.equals(st)) {
- return new SimpleValueSupport(st,value.charAt(0));
- } else if (SimpleMetaType.DATE.equals(st)) {
- try {
- return new SimpleValueSupport(st, SimpleDateFormat.getInstance().parse(value));
- } catch (ParseException e) {
- throw new TeiidRuntimeException(e,
IntegrationPlugin.Util.getString("failed_to_convert", type.getClassName()));
//$NON-NLS-1$
- }
- } else if (SimpleMetaType.DOUBLE.equals(st)) {
- return new SimpleValueSupport(st, Double.valueOf(value));
- } else if (SimpleMetaType.DOUBLE_PRIMITIVE.equals(st)) {
- return new SimpleValueSupport(st, Double.parseDouble(value));
- } else if (SimpleMetaType.FLOAT.equals(st)) {
- return new SimpleValueSupport(st, Float.parseFloat(value));
- } else if (SimpleMetaType.FLOAT_PRIMITIVE.equals(st)) {
- return new SimpleValueSupport(st, Float.valueOf(value));
- } else if (SimpleMetaType.INTEGER.equals(st)) {
- return new SimpleValueSupport(st, Integer.valueOf(value));
- } else if (SimpleMetaType.INTEGER_PRIMITIVE.equals(st)) {
- return new SimpleValueSupport(st, Integer.parseInt(value));
- } else if (SimpleMetaType.LONG.equals(st)) {
- return new SimpleValueSupport(st, Long.valueOf(value));
- } else if (SimpleMetaType.LONG_PRIMITIVE.equals(st)) {
- return new SimpleValueSupport(st, Long.parseLong(value));
- } else if (SimpleMetaType.SHORT.equals(st)) {
- return new SimpleValueSupport(st, Short.valueOf(value));
- } else if (SimpleMetaType.SHORT_PRIMITIVE.equals(st)) {
- return new SimpleValueSupport(st, Short.parseShort(value));
- } else if (SimpleMetaType.STRING.equals(st)) {
- return new SimpleValueSupport(st,value);
- }
- }
- throw new
TeiidRuntimeException(IntegrationPlugin.Util.getString("failed_to_convert",
type.getClassName())); //$NON-NLS-1$
- }
-
- public static void deployArchive(DeploymentManager deploymentManager, String fileName,
final InputStream resource, boolean deployExploded) throws AdminProcessingException {
- deployArchive(deploymentManager, fileName, getTempURL(resource), deployExploded);
- }
-
- public static void deployArchive(DeploymentManager deploymentManager, String fileName,
URL resourceURL, boolean deployExploded) throws AdminProcessingException {
- List<DeploymentOption> deploymentOptions = new
ArrayList<DeploymentOption>();
- if (deployExploded) {
- deploymentOptions.add(DeploymentOption.Explode);
- }
- // try to deploy
- DeploymentProgress progress = null;
- try {
- progress = deploymentManager.distribute(fileName, resourceURL,
deploymentOptions.toArray(new DeploymentOption[deploymentOptions.size()]));
- execute(progress, IntegrationPlugin.Util.getString("distribute_failed",
fileName)); //$NON-NLS-1$
- } catch (Exception e) {
- handleException(e);
- }
-
- // Now that we've successfully distributed the deployment, we need to
- // start it.
- String[] deploymentNames = progress.getDeploymentID().getRepositoryNames();
- try {
- progress = deploymentManager.start(deploymentNames);
- execute(progress,
IntegrationPlugin.Util.getString("deployment_start_failed", fileName));
//$NON-NLS-1$
- } catch(Exception e) {
- try {
- // if failed to start remove it.
- execute(deploymentManager.remove(deploymentNames),
IntegrationPlugin.Util.getString("failed_to_remove")); //$NON-NLS-1$
- } catch (Exception e1) {
- handleException(e1);
- }
- handleException(e);
- }
- }
-
- static URL getTempURL(final InputStream resource) {
- try {
- return new URL(null, "temp:#temp", new URLStreamHandler() { //$NON-NLS-1$
-
- @Override
- protected URLConnection openConnection(URL u) throws IOException {
- return new URLConnection(u) {
-
- @Override
- public void connect() throws IOException {
-
- }
-
- @Override
- public InputStream getInputStream() throws IOException {
- return resource;
- }
- };
- }
- });
- } catch (MalformedURLException e2) {
- throw new TeiidRuntimeException(e2);
- }
- }
-
- public static void handleException(Exception e) throws AdminProcessingException {
- if (e instanceof AdminProcessingException) {
- throw (AdminProcessingException)e;
- }
- throw new AdminProcessingException(e.getMessage(), e);
- }
-
- public static void execute(DeploymentProgress progress, String errorMessage) throws
AdminProcessingException {
- progress.run();
- DeploymentStatus status = progress.getDeploymentStatus();
-
- if (status.isFailed()) {
- if (status.getFailure() != null) {
- throw new AdminProcessingException(status.getFailure().getMessage(),
status.getFailure());
- }
- throw new AdminProcessingException(errorMessage);
- }
- }
-
- public static void removeArchive(DeploymentManager deploymentManager, String...
deploymentNames) throws AdminProcessingException{
- try {
- execute(deploymentManager.stop(deploymentNames),
IntegrationPlugin.Util.getString("failed_to_remove")); //$NON-NLS-1$
- execute(deploymentManager.remove(deploymentNames),
IntegrationPlugin.Util.getString("failed_to_remove")); //$NON-NLS-1$
- } catch (Exception e) {
- handleException(e);
- }
- }
-
- public static MetaValue executeOperation(ManagedCommon mc, String operation,
MetaValue... args) {
- for (ManagedOperation mo:mc.getOperations()) {
- if (mo.getName().equals(operation)) {
- return mo.invoke(args);
- }
- }
- throw new
TeiidRuntimeException(IntegrationPlugin.Util.getString("no_operation",
operation)); //$NON-NLS-1$
- }
-}
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-06-27
14:25:00 UTC (rev 3273)
+++
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/Configuration.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -21,6 +21,11 @@
*/
package org.teiid.jboss;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.*;
+
+import org.jboss.dmr.ModelNode;
+import org.jboss.dmr.ModelType;
+
class Configuration {
public static final String BUFFER_SERVICE = "buffer-service";//$NON-NLS-1$
public static final String RESULTSET_CACHE = "resultset-cache";//$NON-NLS-1$
@@ -29,9 +34,11 @@
public static final String QUERY_ENGINE = "query-engine";//$NON-NLS-1$
public static final String JDBC = "jdbc";//$NON-NLS-1$
public static final String ODBC = "odbc"; //$NON-NLS-1$
+ 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$
public static final String USER_REQUEST_SOURCE_CONCURRENCY =
"userRequestSourceConcurrency";//$NON-NLS-1$
@@ -90,6 +97,29 @@
public static final String TRUST_PASSWD = "truststorePassword";//$NON-NLS-1$
public static final String AUTH_MODE = "authenticationMode";//$NON-NLS-1$
public static final String SSL = "ssl";//$NON-NLS-1$
+
+ public static final String TRANSLATOR_NAME = "name";//$NON-NLS-1$
+ public static final String TRANSLATOR_MODULE = "module";//$NON-NLS-1$
+
+ public static final String DESC = ".describe"; //$NON-NLS-1$
+ static void addAttribute(ModelNode node, String name, String type, String description,
ModelType dataType, boolean required, String defaultValue) {
+ node.get(type, name, TYPE).set(dataType);
+ 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
+ }
}
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-06-27
14:25:00 UTC (rev 3273)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/Element.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -32,6 +32,7 @@
QUERY_ENGINE_ELEMENT(QUERY_ENGINE),
// Query-ENGINE
+ ASYNC_THREAD_GROUP_ELEMENT(ASYNC_THREAD_GROUP),
MAX_THREADS_ELEMENT(MAX_THREADS),
MAX_ACTIVE_PLANS_ELEMENT(MAX_ACTIVE_PLANS),
USER_REQUEST_SOURCE_CONCURRENCY_ELEMENT(USER_REQUEST_SOURCE_CONCURRENCY),
Modified:
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/JBossLifeCycleListener.java
===================================================================
---
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/JBossLifeCycleListener.java 2011-06-27
14:25:00 UTC (rev 3273)
+++
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/JBossLifeCycleListener.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -21,50 +21,22 @@
*/
package org.teiid.jboss;
-import javax.management.InstanceNotFoundException;
-import javax.management.MBeanServer;
-import javax.management.MBeanServerFactory;
-import javax.management.MalformedObjectNameException;
-import javax.management.Notification;
-import javax.management.NotificationListener;
-import javax.management.ObjectName;
-
-import org.jboss.system.ServiceMBeanSupport;
+import org.jboss.msc.service.ServiceContainer.TerminateListener;
import org.teiid.deployers.ContainerLifeCycleListener;
-public class JBossLifeCycleListener extends ServiceMBeanSupport implements
NotificationListener, ContainerLifeCycleListener{
+class JBossLifeCycleListener implements TerminateListener, ContainerLifeCycleListener{
- public final String START_NOTIFICATION_TYPE =
"org.jboss.system.server.started"; //$NON-NLS-1$
- /** The JMX notification event type sent on begin of the server shutdown */
- public final String STOP_NOTIFICATION_TYPE =
"org.jboss.system.server.stopped"; //$NON-NLS-1$
-
private boolean shutdownInProgress = false;
- public JBossLifeCycleListener() {
- try {
- MBeanServer server = MBeanServerFactory.findMBeanServer(null).get(0);
- ObjectName on = new ObjectName("jboss.system:type=Server"); //$NON-NLS-1$
- server.addNotificationListener(on, this, null, null);
- } catch (MalformedObjectNameException e) {
- //ignore
- } catch (InstanceNotFoundException e) {
- //ignore
- }
- }
-
@Override
- public void handleNotification(Notification msg, Object handback) {
- String type = msg.getType();
- if (type.equals(START_NOTIFICATION_TYPE)) {
- }
-
- if (type.equals(STOP_NOTIFICATION_TYPE)) {
- shutdownInProgress = true;
- }
+ public boolean isShutdownInProgress() {
+ return shutdownInProgress;
}
@Override
- public boolean isShutdownInProgress() {
- return shutdownInProgress;
+ public void handleTermination(Info info) {
+ if (info.getShutdownInitiated() > 0) {
+ this.shutdownInProgress = true;
+ }
}
}
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/Namespace.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/Namespace.java 2011-06-27
14:25:00 UTC (rev 3273)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/Namespace.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -25,7 +25,7 @@
import java.util.HashMap;
import java.util.Map;
-public enum Namespace {
+enum Namespace {
// must be first
UNKNOWN(null),
TEIID_1_0("urn:jboss:domain:teiid:1.0"); //$NON-NLS-1$
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-06-27
14:25:00 UTC (rev 3273)
+++
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/OperationsConstants.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -21,7 +21,7 @@
*/
package org.teiid.jboss;
-public class OperationsConstants {
+class OperationsConstants {
public static final String SESSION = "session";//$NON-NLS-1$
public static final String VDB_NAME = "vdb-name";//$NON-NLS-1$
public static final String VDB_VERSION = "vdb-version";//$NON-NLS-1$
Added: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineAdd.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineAdd.java
(rev 0)
+++
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineAdd.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -0,0 +1,389 @@
+/*
+ * 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.OP_ADDR;
+
+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.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.service.*;
+import org.teiid.cache.CacheConfiguration;
+import org.teiid.cache.CacheFactory;
+import org.teiid.cache.jboss.ClusterableCacheFactory;
+import org.teiid.deployers.*;
+import org.teiid.dqp.internal.datamgr.TranslatorRepository;
+import org.teiid.jboss.deployers.RuntimeEngineDeployer;
+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;
+
+class QueryEngineAdd implements ModelAddOperationHandler, BootOperationHandler {
+
+ @Override
+ public OperationResult execute(OperationContext context, ModelNode operation,
ResultHandler resultHandler) throws OperationFailedException {
+ final ModelNode modelNode = context.getSubModel();
+
+
+ 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 SessionServiceImpl sessionService =
buildSessionService(queryEngineNode);
+ sessionService.setVDBRepository(vdbRepo);
+
+ 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.setSessionService(sessionService);
+ engine.setBufferService(bufferManager);
+ engine.setVDBRepository(vdbRepo);
+ engine.setCacheFactory(cacheFactory);
+ engine.setResultsetCacheConfig(resultsetCache);
+ engine.setPreparedPlanCacheConfig(preparePlanCache);
+ engine.setSecurityHelper(new JBossSecurityHelper());
+
+
+ ServiceBuilder<ClientServiceRegistry> serviceBuilder =
target.addService(RuntimeEngineDeployer.SERVICE_NAME, 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$
+ 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
+ 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;
+ }
+
+
+
+ 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) {
+ engine.setMaxThreads(node.get(Configuration.MAX_THREADS).asInt());
+ }
+ if (node.get(Configuration.MAX_ACTIVE_PLANS) != null) {
+ engine.setMaxActivePlans(node.get(Configuration.MAX_ACTIVE_PLANS).asInt());
+ }
+ if (node.get(Configuration.USER_REQUEST_SOURCE_CONCURRENCY) != null) {
+
engine.setUserRequestSourceConcurrency(node.get(Configuration.USER_REQUEST_SOURCE_CONCURRENCY).asInt());
+ }
+ if (node.get(Configuration.TIME_SLICE_IN_MILLI) != null) {
+ engine.setTimeSliceInMilli(node.get(Configuration.TIME_SLICE_IN_MILLI).asInt());
+ }
+ if (node.get(Configuration.MAX_ROWS_FETCH_SIZE) != null) {
+ engine.setMaxRowsFetchSize(node.get(Configuration.MAX_ROWS_FETCH_SIZE).asInt());
+ }
+ if (node.get(Configuration.LOB_CHUNK_SIZE_IN_KB) != null) {
+ engine.setLobChunkSizeInKB(node.get(Configuration.LOB_CHUNK_SIZE_IN_KB).asInt());
+ }
+ if (node.get(Configuration.USE_DATA_ROLES) != null) {
+ engine.setUseDataRoles(node.get(Configuration.USE_DATA_ROLES).asBoolean());
+ }
+ if (node.get(Configuration.ALLOW_CREATE_TEMPORY_TABLES_BY_DEFAULT) != null) {
+
engine.setAllowCreateTemporaryTablesByDefault(node.get(Configuration.ALLOW_CREATE_TEMPORY_TABLES_BY_DEFAULT).asBoolean());
+ }
+ if (node.get(Configuration.ALLOW_FUNCTION_CALLS_BY_DEFAULT) != null) {
+
engine.setAllowFunctionCallsByDefault(node.get(Configuration.ALLOW_FUNCTION_CALLS_BY_DEFAULT).asBoolean());
+ }
+ if (node.get(Configuration.QUERY_THRESHOLD_IN_SECS) != null) {
+
engine.setQueryThresholdInSecs(node.get(Configuration.QUERY_THRESHOLD_IN_SECS).asInt());
+ }
+ if (node.get(Configuration.MAX_SOURCE_ROWS) != null) {
+ engine.setMaxSourceRows(node.get(Configuration.MAX_SOURCE_ROWS).asInt());
+ }
+ if (node.get(Configuration.EXCEPTION_ON_MAX_SOURCE_ROWS) != null) {
+
engine.setExceptionOnMaxSourceRows(node.get(Configuration.EXCEPTION_ON_MAX_SOURCE_ROWS).asBoolean());
+ }
+ if (node.get(Configuration.MAX_ODBC_LOB_SIZE_ALLOWED) != null) {
+
engine.setMaxODBCLobSizeAllowed(node.get(Configuration.MAX_ODBC_LOB_SIZE_ALLOWED).asInt());
+ }
+ if (node.get(Configuration.EVENT_DISTRIBUTOR_NAME) != null) {
+
engine.setEventDistributorName(node.get(Configuration.EVENT_DISTRIBUTOR_NAME).asString());
+ }
+ if (node.get(Configuration.DETECTING_CHANGE_EVENTS) != null) {
+
engine.setDetectingChangeEvents(node.get(Configuration.DETECTING_CHANGE_EVENTS).asBoolean());
+ }
+ 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) {
+
systemFunctionManager.setAllowEnvFunction(node.get(Configuration.ALLOW_ENV_FUNCTION).asBoolean());
+ }
+ else {
+ systemFunctionManager.setAllowEnvFunction(false);
+ }
+
+ VDBRepository vdbRepository = new VDBRepository();
+ vdbRepository.setSystemFunctionManager(systemFunctionManager);
+ return vdbRepository;
+ }
+
+ private BufferServiceImpl buildBufferManager(ModelNode node) {
+ BufferServiceImpl bufferManger = new BufferServiceImpl();
+
+ if (node == null) {
+ return bufferManger;
+ }
+
+ if (node.get(Configuration.USE_DISK) != null) {
+ 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) {
+
bufferManger.setProcessorBatchSize(node.get(Configuration.PROCESSOR_BATCH_SIZE).asInt());
+ }
+ if (node.get(Configuration.CONNECTOR_BATCH_SIZE) != null) {
+
bufferManger.setConnectorBatchSize(node.get(Configuration.CONNECTOR_BATCH_SIZE).asInt());
+ }
+ if (node.get(Configuration.MAX_RESERVE_BATCH_COLUMNS) != null) {
+
bufferManger.setMaxReserveBatchColumns(node.get(Configuration.MAX_RESERVE_BATCH_COLUMNS).asInt());
+ }
+ if (node.get(Configuration.MAX_PROCESSING_BATCH_COLUMNS) != null) {
+
bufferManger.setMaxProcessingBatchesColumns(node.get(Configuration.MAX_PROCESSING_BATCH_COLUMNS).asInt());
+ }
+ if (node.get(Configuration.MAX_FILE_SIZE) != null) {
+ bufferManger.setMaxFileSize(node.get(Configuration.MAX_FILE_SIZE).asInt());
+ }
+ if (node.get(Configuration.MAX_BUFFER_SPACE) != null) {
+ bufferManger.setMaxBufferSpace(node.get(Configuration.MAX_BUFFER_SPACE).asInt());
+ }
+ if (node.get(Configuration.MAX_OPEN_FILES) != null) {
+ bufferManger.setMaxOpenFiles(node.get(Configuration.MAX_OPEN_FILES).asInt());
+ }
+ return bufferManger;
+ }
+
+ private CacheFactory getCacheFactory(ModelNode node) {
+ ClusterableCacheFactory cacheFactory = new ClusterableCacheFactory();
+
+ if (node.get(Configuration.ENABLED) != null) {
+ cacheFactory.setEnabled(node.get(Configuration.ENABLED).asBoolean());
+ }
+ else {
+ cacheFactory.setEnabled(true);
+ }
+ if (node.get(Configuration.CACHE_SERVICE_JNDI_NAME) != null) {
+
cacheFactory.setCacheManager(node.get(Configuration.CACHE_SERVICE_JNDI_NAME).asString());
+ }
+ if (node.get(Configuration.RESULTSET_CACHE_NAME) != null) {
+
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) {
+ cacheConfig.setMaxEntries(node.get(Configuration.MAX_ENTRIES).asInt());
+ }
+ if (node.get(Configuration.MAX_AGE_IN_SECS) != null) {
+ cacheConfig.setMaxAgeInSeconds(node.get(Configuration.MAX_AGE_IN_SECS).asInt());
+ }
+ if (node.get(Configuration.MAX_STALENESS) != null) {
+ cacheConfig.setMaxStaleness(node.get(Configuration.MAX_STALENESS).asInt());
+ }
+ if (node.get(Configuration.CACHE_TYPE) != null) {
+ cacheConfig.setType(node.get(Configuration.CACHE_TYPE).asString());
+ }
+ if (node.get(Configuration.CACHE_LOCATION) != null) {
+ cacheConfig.setLocation(node.get(Configuration.CACHE_LOCATION).asString());
+ }
+ return cacheConfig;
+ }
+
+ 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) {
+
socket.setMaxSocketThreads(node.get(Configuration.MAX_SOCKET_THREAD_SIZE).asInt());
+ }
+ if (node.get(Configuration.IN_BUFFER_SIZE) != null) {
+ socket.setInputBufferSize(node.get(Configuration.IN_BUFFER_SIZE).asInt());
+ }
+ if (node.get(Configuration.OUT_BUFFER_SIZE) != null) {
+ socket.setOutputBufferSize(node.get(Configuration.OUT_BUFFER_SIZE).asInt());
+ }
+
+ SSLConfiguration ssl = new SSLConfiguration();
+ ssl.setAuthenticationMode(SSLConfiguration.ANONYMOUS);
+
+ if (node.get(Configuration.SSL) != null) {
+ ModelNode sslNode = node.get(Configuration.SSL);
+
+ if (sslNode.get(Configuration.SSL_MODE) != null) {
+ ssl.setMode(sslNode.get(Configuration.SSL_MODE).asString());
+ }
+
+ if (sslNode.get(Configuration.KEY_STORE_FILE) != null) {
+ ssl.setKeystoreFilename(sslNode.get(Configuration.KEY_STORE_FILE).asString());
+ }
+
+ if (sslNode.get(Configuration.KEY_STORE_PASSWD) != null) {
+
ssl.setKeystorePassword(sslNode.get(Configuration.KEY_STORE_PASSWD).asString());
+ }
+
+ if (sslNode.get(Configuration.KEY_STORE_TYPE) != null) {
+ ssl.setKeystoreType(sslNode.get(Configuration.KEY_STORE_TYPE).asString());
+ }
+
+ if (sslNode.get(Configuration.SSL_PROTOCOL) != null) {
+ ssl.setSslProtocol(sslNode.get(Configuration.SSL_PROTOCOL).asString());
+ }
+ if (sslNode.get(Configuration.KEY_MANAGEMENT_ALG) != null) {
+
ssl.setKeymanagementAlgorithm(sslNode.get(Configuration.KEY_MANAGEMENT_ALG).asString());
+ }
+ if (sslNode.get(Configuration.TRUST_FILE) != null) {
+ ssl.setTruststoreFilename(sslNode.get(Configuration.TRUST_FILE).asString());
+ }
+ if (sslNode.get(Configuration.TRUST_PASSWD) != null) {
+ ssl.setTruststorePassword(sslNode.get(Configuration.TRUST_PASSWD).asString());
+ }
+ if (sslNode.get(Configuration.AUTH_MODE) != null) {
+ ssl.setAuthenticationMode(sslNode.get(Configuration.AUTH_MODE).asString());
+ }
+ }
+
+ socket.setSSLConfiguration(ssl);
+ return socket;
+ }
+}
Property changes on:
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineAdd.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Copied:
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineDescription.java
(from rev 3232,
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidSubsystemDescription.java)
===================================================================
---
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineDescription.java
(rev 0)
+++
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineDescription.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -0,0 +1,189 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.jboss;
+
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.*;
+import static org.teiid.jboss.Configuration.*;
+
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+import org.jboss.as.controller.descriptions.DescriptionProvider;
+import org.jboss.dmr.ModelNode;
+import org.jboss.dmr.ModelType;
+
+class QueryEngineDescription implements DescriptionProvider {
+
+
+ @Override
+ public ModelNode getModelDescription(Locale locale) {
+ final ResourceBundle bundle = IntegrationPlugin.getResourceBundle(locale);
+
+ final ModelNode node = new ModelNode();
+ node.get(OPERATION_NAME).set(ADD);
+ node.get(DESCRIPTION).set("susbsystem.add"); //$NON-NLS-1$
+
+ getQueryEngineDescription(node.get(CHILDREN, Configuration.QUERY_ENGINE),
REQUEST_PROPERTIES, bundle);
+ return node;
+ }
+
+ static void getQueryEngineDescription(ModelNode node, String type, ResourceBundle
bundle) {
+ addAttribute(node, Configuration.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$
+ 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$
+ }
+}
Property changes on:
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineDescription.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Copied:
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineOperationHandler.java
(from rev 3232,
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineModelHandler.java)
===================================================================
---
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineOperationHandler.java
(rev 0)
+++
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineOperationHandler.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -0,0 +1,480 @@
+/*
+ * 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 QueryEngineOperationHandler implements OperationHandler,
DescriptionProvider {
+ private static final String DESCRIBE = ".describe"; //$NON-NLS-1$
+
+ private String operationName;
+
+ protected QueryEngineOperationHandler(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 QueryEngineOperationHandler{
+ 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 QueryEngineOperationHandler{
+ 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 QueryEngineOperationHandler{
+ 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 QueryEngineOperationHandler{
+ 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 QueryEngineOperationHandler{
+ 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 QueryEngineOperationHandler{
+ 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 QueryEngineOperationHandler{
+ 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 QueryEngineOperationHandler{
+ 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 QueryEngineOperationHandler{
+ 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 QueryEngineOperationHandler{
+
+ 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 QueryEngineOperationHandler{
+
+ 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 QueryEngineOperationHandler{
+
+ 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 QueryEngineOperationHandler{
+
+ 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 QueryEngineOperationHandler{
+
+ 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 QueryEngineOperationHandler{
+
+ 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 QueryEngineOperationHandler{
+
+ 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
Property changes on:
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineOperationHandler.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified:
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidExtension.java
===================================================================
---
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidExtension.java 2011-06-27
14:25:00 UTC (rev 3273)
+++
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidExtension.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -22,38 +22,22 @@
package org.teiid.jboss;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.*;
+import static org.teiid.jboss.Configuration.addAttribute;
import java.util.Locale;
import java.util.ResourceBundle;
-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.Extension;
+import org.jboss.as.controller.ExtensionContext;
+import org.jboss.as.controller.PathElement;
+import org.jboss.as.controller.SubsystemRegistration;
import org.jboss.as.controller.descriptions.DescriptionProvider;
import org.jboss.as.controller.descriptions.ModelDescriptionConstants;
-import org.jboss.as.controller.operations.common.Util;
import org.jboss.as.controller.parsing.ExtensionParsingContext;
import org.jboss.as.controller.registry.ModelNodeRegistration;
import org.jboss.as.controller.registry.AttributeAccess.Storage;
import org.jboss.dmr.ModelNode;
-import org.jboss.msc.service.ServiceBuilder;
-import org.jboss.msc.service.ServiceController;
-import org.jboss.msc.service.ServiceName;
-import org.jboss.msc.service.ServiceTarget;
-import org.jboss.util.threadpool.ThreadPool;
-import org.teiid.cache.CacheConfiguration;
-import org.teiid.cache.CacheFactory;
-import org.teiid.cache.jboss.ClusterableCacheFactory;
-import org.teiid.deployers.VDBRepository;
-import org.teiid.jboss.deployers.RuntimeEngineDeployer;
-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;
+import org.jboss.dmr.ModelType;
public class TeiidExtension implements Extension {
@@ -76,7 +60,10 @@
public static final String SUBSYSTEM_NAME = "teiid"; //$NON-NLS-1$
private static TeiidSubsystemParser parser = new TeiidSubsystemParser();
- private static TeiidSubsystemDescription teiidSubsystem = new
TeiidSubsystemDescription();
+ private static QueryEngineDescription ENGINE_DESC = new QueryEngineDescription();
+ private static QueryEngineAdd ENGINE_ADD = new QueryEngineAdd();
+ private static TranslatorAdd TRANSLATOR_ADD = new TranslatorAdd();
+ private static TranslatorRemove TRANSLATOR_REMOVE = new TranslatorRemove();
@Override
public void initialize(ExtensionContext context) {
@@ -84,11 +71,51 @@
registration.registerXMLElementWriter(parser);
- final ModelNodeRegistration subsystem =
registration.registerSubsystemModel(teiidSubsystem);
- subsystem.registerOperationHandler(ModelDescriptionConstants.ADD,
subsystemAddOperation, subsystemAddDescription);
+ final ModelNodeRegistration subsystem = registration.registerSubsystemModel(new
DescriptionProvider() {
+
+ @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);
+
+ node.get(CHILDREN, Configuration.QUERY_ENGINE,
DESCRIPTION).set(bundle.getString(Configuration.QUERY_ENGINE));
+ node.get(CHILDREN, Configuration.QUERY_ENGINE, REQUIRED).set(false);
+
+ node.get(CHILDREN, Configuration.TRANSLATOR,
DESCRIPTION).set(bundle.getString(Configuration.TRANSLATOR));
+ node.get(CHILDREN, Configuration.TRANSLATOR, REQUIRED).set(false);
+
+ return node;
+ }
+ });
+ subsystem.registerOperationHandler(ModelDescriptionConstants.ADD, ENGINE_ADD,
ENGINE_DESC);
//subsystem.registerOperationHandler(ModelDescriptionConstants.DESCRIBE, describe,
describe, false);
- QueryEngineModelHandler op;
+ final ModelNodeRegistration translators =
subsystem.registerSubModel(PathElement.pathElement(Configuration.TRANSLATOR), new
DescriptionProvider() {
+ @Override
+ public ModelNode getModelDescription(Locale locale) {
+ final ResourceBundle bundle = IntegrationPlugin.getResourceBundle(locale);
+
+ final ModelNode node = new ModelNode();
+ node.get(DESCRIPTION).set(bundle.getString(Configuration.TRANSLATOR));
+ node.get(HEAD_COMMENT_ALLOWED).set(true);
+ node.get(TAIL_COMMENT_ALLOWED).set(true);
+
+ addAttribute(node, Configuration.TRANSLATOR_NAME, ATTRIBUTES,
bundle.getString(Configuration.TRANSLATOR_NAME+Configuration.DESC), ModelType.STRING,
true, null);
+ addAttribute(node, Configuration.TRANSLATOR_MODULE, ATTRIBUTES,
bundle.getString(Configuration.TRANSLATOR_MODULE+Configuration.DESC), ModelType.STRING,
true, null);
+ return node;
+ }
+ });
+ translators.registerOperationHandler(ADD, TRANSLATOR_ADD, TRANSLATOR_ADD,
false);
+ translators.registerOperationHandler(REMOVE, TRANSLATOR_REMOVE,
TRANSLATOR_REMOVE, false);
+
+ QueryEngineOperationHandler op;
subsystem.registerReadOnlyAttribute(RUNTIME_VERSION, new
GetRuntimeVersion(RUNTIME_VERSION), Storage.RUNTIME);
subsystem.registerReadOnlyAttribute(ACTIVE_SESSION_COUNT, new
GetActiveSessionsCount(ACTIVE_SESSION_COUNT), Storage.RUNTIME);
@@ -140,309 +167,7 @@
context.setSubsystemXmlMapping(Namespace.CURRENT.getUri(), parser);
}
- static DescriptionProvider subsystemAddDescription = new DescriptionProvider() {
- @Override
- public ModelNode getModelDescription(Locale locale) {
- final ResourceBundle bundle = IntegrationPlugin.getResourceBundle(locale);
-
- final ModelNode node = new ModelNode();
- node.get(OPERATION_NAME).set(ADD);
- node.get(DESCRIPTION).set("susbsystem.add"); //$NON-NLS-1$
-
- TeiidSubsystemDescription.getQueryEngineDescription(node.get(CHILDREN,
Configuration.QUERY_ENGINE), REQUEST_PROPERTIES, bundle);
- return node;
- }
- };
- static ModelAddOperationHandler subsystemAddOperation = new ModelAddOperationHandler()
{
- @Override
- public OperationResult execute(OperationContext context, final ModelNode operation,
ResultHandler resultHandler) throws OperationFailedException {
- final ModelNode modelNode = context.getSubModel();
-
- 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 {
-
- VDBRepository vdbRepo = buildVDBRepository(queryEngineNode);
-
- SessionServiceImpl sessionService =
buildSessionService(queryEngineNode);
- sessionService.setVDBRepository(vdbRepo);
-
- 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));
-
- // now build the engine
- RuntimeEngineDeployer engine = buildRuntimeEngine(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());
-
- ServiceTarget target = context.getServiceTarget();
- ServiceBuilder<ClientServiceRegistry> serviceBuilder =
target.addService(RuntimeEngineDeployer.SERVICE_NAME, 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$
- //TODO: Threads??
-
serviceBuilder.addDependency(ServiceName.JBOSS.append("???", "???"),
ThreadPool.class, engine.threadPoolInjector); //$NON-NLS-1$ //$NON-NLS-2$
-
- serviceBuilder.setInitialMode(ServiceController.Mode.ACTIVE);
- serviceBuilder.install();
- }
-
+
- private RuntimeEngineDeployer buildRuntimeEngine(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) {
- engine.setMaxThreads(node.get(Configuration.MAX_THREADS).asInt());
- }
- if (node.get(Configuration.MAX_ACTIVE_PLANS) != null) {
-
engine.setMaxActivePlans(node.get(Configuration.MAX_ACTIVE_PLANS).asInt());
- }
- if (node.get(Configuration.USER_REQUEST_SOURCE_CONCURRENCY) != null) {
-
engine.setUserRequestSourceConcurrency(node.get(Configuration.USER_REQUEST_SOURCE_CONCURRENCY).asInt());
- }
- if (node.get(Configuration.TIME_SLICE_IN_MILLI) != null) {
-
engine.setTimeSliceInMilli(node.get(Configuration.TIME_SLICE_IN_MILLI).asInt());
- }
- if (node.get(Configuration.MAX_ROWS_FETCH_SIZE) != null) {
-
engine.setMaxRowsFetchSize(node.get(Configuration.MAX_ROWS_FETCH_SIZE).asInt());
- }
- if (node.get(Configuration.LOB_CHUNK_SIZE_IN_KB) != null) {
-
engine.setLobChunkSizeInKB(node.get(Configuration.LOB_CHUNK_SIZE_IN_KB).asInt());
- }
- if (node.get(Configuration.USE_DATA_ROLES) != null) {
-
engine.setUseDataRoles(node.get(Configuration.USE_DATA_ROLES).asBoolean());
- }
- if (node.get(Configuration.ALLOW_CREATE_TEMPORY_TABLES_BY_DEFAULT) !=
null) {
-
engine.setAllowCreateTemporaryTablesByDefault(node.get(Configuration.ALLOW_CREATE_TEMPORY_TABLES_BY_DEFAULT).asBoolean());
- }
- if (node.get(Configuration.ALLOW_FUNCTION_CALLS_BY_DEFAULT) != null) {
-
engine.setAllowFunctionCallsByDefault(node.get(Configuration.ALLOW_FUNCTION_CALLS_BY_DEFAULT).asBoolean());
- }
- if (node.get(Configuration.QUERY_THRESHOLD_IN_SECS) != null) {
-
engine.setQueryThresholdInSecs(node.get(Configuration.QUERY_THRESHOLD_IN_SECS).asInt());
- }
- if (node.get(Configuration.MAX_SOURCE_ROWS) != null) {
-
engine.setMaxSourceRows(node.get(Configuration.MAX_SOURCE_ROWS).asInt());
- }
- if (node.get(Configuration.EXCEPTION_ON_MAX_SOURCE_ROWS) != null) {
-
engine.setExceptionOnMaxSourceRows(node.get(Configuration.EXCEPTION_ON_MAX_SOURCE_ROWS).asBoolean());
- }
- if (node.get(Configuration.MAX_ODBC_LOB_SIZE_ALLOWED) != null) {
-
engine.setMaxODBCLobSizeAllowed(node.get(Configuration.MAX_ODBC_LOB_SIZE_ALLOWED).asInt());
- }
- if (node.get(Configuration.EVENT_DISTRIBUTOR_NAME) != null) {
-
engine.setEventDistributorName(node.get(Configuration.EVENT_DISTRIBUTOR_NAME).asString());
- }
- if (node.get(Configuration.DETECTING_CHANGE_EVENTS) != null) {
-
engine.setDetectingChangeEvents(node.get(Configuration.DETECTING_CHANGE_EVENTS).asBoolean());
- }
- 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) {
-
systemFunctionManager.setAllowEnvFunction(node.get(Configuration.ALLOW_ENV_FUNCTION).asBoolean());
- }
- else {
- systemFunctionManager.setAllowEnvFunction(false);
- }
-
- VDBRepository vdbRepository = new VDBRepository();
- vdbRepository.setSystemFunctionManager(systemFunctionManager);
- return vdbRepository;
- }
-
- private BufferServiceImpl buildBufferManager(ModelNode node) {
- BufferServiceImpl bufferManger = new BufferServiceImpl();
-
- if (node == null) {
- return bufferManger;
- }
-
- if (node.get(Configuration.USE_DISK) != null) {
-
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) {
-
bufferManger.setProcessorBatchSize(node.get(Configuration.PROCESSOR_BATCH_SIZE).asInt());
- }
- if (node.get(Configuration.CONNECTOR_BATCH_SIZE) != null) {
-
bufferManger.setConnectorBatchSize(node.get(Configuration.CONNECTOR_BATCH_SIZE).asInt());
- }
- if (node.get(Configuration.MAX_RESERVE_BATCH_COLUMNS) != null) {
-
bufferManger.setMaxReserveBatchColumns(node.get(Configuration.MAX_RESERVE_BATCH_COLUMNS).asInt());
- }
- if (node.get(Configuration.MAX_PROCESSING_BATCH_COLUMNS) != null) {
-
bufferManger.setMaxProcessingBatchesColumns(node.get(Configuration.MAX_PROCESSING_BATCH_COLUMNS).asInt());
- }
- if (node.get(Configuration.MAX_FILE_SIZE) != null) {
-
bufferManger.setMaxFileSize(node.get(Configuration.MAX_FILE_SIZE).asInt());
- }
- if (node.get(Configuration.MAX_BUFFER_SPACE) != null) {
-
bufferManger.setMaxBufferSpace(node.get(Configuration.MAX_BUFFER_SPACE).asInt());
- }
- if (node.get(Configuration.MAX_OPEN_FILES) != null) {
-
bufferManger.setMaxOpenFiles(node.get(Configuration.MAX_OPEN_FILES).asInt());
- }
- return bufferManger;
- }
-
- private CacheFactory getCacheFactory(ModelNode node) {
- ClusterableCacheFactory cacheFactory = new ClusterableCacheFactory();
-
- if (node.get(Configuration.ENABLED) != null) {
- cacheFactory.setEnabled(node.get(Configuration.ENABLED).asBoolean());
- }
- else {
- cacheFactory.setEnabled(true);
- }
- if (node.get(Configuration.CACHE_SERVICE_JNDI_NAME) != null) {
-
cacheFactory.setCacheManager(node.get(Configuration.CACHE_SERVICE_JNDI_NAME).asString());
- }
- if (node.get(Configuration.RESULTSET_CACHE_NAME) != null) {
-
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) {
-
cacheConfig.setMaxEntries(node.get(Configuration.MAX_ENTRIES).asInt());
- }
- if (node.get(Configuration.MAX_AGE_IN_SECS) != null) {
-
cacheConfig.setMaxAgeInSeconds(node.get(Configuration.MAX_AGE_IN_SECS).asInt());
- }
- if (node.get(Configuration.MAX_STALENESS) != null) {
-
cacheConfig.setMaxStaleness(node.get(Configuration.MAX_STALENESS).asInt());
- }
- if (node.get(Configuration.CACHE_TYPE) != null) {
- cacheConfig.setType(node.get(Configuration.CACHE_TYPE).asString());
- }
- if (node.get(Configuration.CACHE_LOCATION) != null) {
-
cacheConfig.setLocation(node.get(Configuration.CACHE_LOCATION).asString());
- }
- return cacheConfig;
- }
-
- 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.setBindAddress(node.get(Configuration.SOCKET_BINDING).asString());
- }
- if (node.get(Configuration.MAX_SOCKET_THREAD_SIZE) != null) {
-
socket.setMaxSocketThreads(node.get(Configuration.MAX_SOCKET_THREAD_SIZE).asInt());
- }
- if (node.get(Configuration.IN_BUFFER_SIZE) != null) {
-
socket.setInputBufferSize(node.get(Configuration.IN_BUFFER_SIZE).asInt());
- }
- if (node.get(Configuration.OUT_BUFFER_SIZE) != null) {
-
socket.setOutputBufferSize(node.get(Configuration.OUT_BUFFER_SIZE).asInt());
- }
-
- SSLConfiguration ssl = new SSLConfiguration();
- ssl.setAuthenticationMode(SSLConfiguration.ANONYMOUS);
-
- if (node.get(Configuration.SSL) != null) {
- ModelNode sslNode = node.get(Configuration.SSL);
-
- if (sslNode.get(Configuration.SSL_MODE) != null) {
- ssl.setMode(sslNode.get(Configuration.SSL_MODE).asString());
- }
-
- if (sslNode.get(Configuration.KEY_STORE_FILE) != null) {
-
ssl.setKeystoreFilename(sslNode.get(Configuration.KEY_STORE_FILE).asString());
- }
-
- if (sslNode.get(Configuration.KEY_STORE_PASSWD) != null) {
-
ssl.setKeystorePassword(sslNode.get(Configuration.KEY_STORE_PASSWD).asString());
- }
-
- if (sslNode.get(Configuration.KEY_STORE_TYPE) != null) {
-
ssl.setKeystoreType(sslNode.get(Configuration.KEY_STORE_TYPE).asString());
- }
-
- if (sslNode.get(Configuration.SSL_PROTOCOL) != null) {
-
ssl.setSslProtocol(sslNode.get(Configuration.SSL_PROTOCOL).asString());
- }
- if (sslNode.get(Configuration.KEY_MANAGEMENT_ALG) != null) {
-
ssl.setKeymanagementAlgorithm(sslNode.get(Configuration.KEY_MANAGEMENT_ALG).asString());
- }
- if (sslNode.get(Configuration.TRUST_FILE) != null) {
-
ssl.setTruststoreFilename(sslNode.get(Configuration.TRUST_FILE).asString());
- }
- if (sslNode.get(Configuration.TRUST_PASSWD) != null) {
-
ssl.setTruststorePassword(sslNode.get(Configuration.TRUST_PASSWD).asString());
- }
- if (sslNode.get(Configuration.AUTH_MODE) != null) {
-
ssl.setAuthenticationMode(sslNode.get(Configuration.AUTH_MODE).asString());
- }
- }
-
- socket.setSSLConfiguration(ssl);
- return socket;
- }
-
- };
- 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;
- }
-
- };
-
}
Added:
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidServiceNames.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidServiceNames.java
(rev 0)
+++
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidServiceNames.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -0,0 +1,34 @@
+/*
+ * 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.ServiceName;
+
+public class TeiidServiceNames {
+ public static ServiceName ENGINE = ServiceName.JBOSS.append("teiid",
"query-engine");
+ public static ServiceName TRANSLATOR_REPO = ServiceName.JBOSS.append("teiid",
"translator-repository");
+ static ServiceName TRANSLATOR_BASE = ServiceName.JBOSS.append("teiid",
"translator");
+
+ public static ServiceName translatorServiceName(String name) {
+ return TRANSLATOR_BASE.append(name);
+ }
+}
Property changes on:
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidServiceNames.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
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-06-27
14:25:00 UTC (rev 3273)
+++
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidSubsystemParser.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -21,8 +21,11 @@
*/
package org.teiid.jboss;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.ADD;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP_ADDR;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.SUBSYSTEM;
import static org.jboss.as.controller.parsing.ParseUtils.requireNoAttributes;
-import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.*;
import java.util.List;
@@ -32,7 +35,6 @@
import org.jboss.as.controller.parsing.ParseUtils;
import org.jboss.as.controller.persistence.SubsystemMarshallingContext;
import org.jboss.dmr.ModelNode;
-import org.jboss.dmr.ModelType;
import org.jboss.staxmapper.XMLElementReader;
import org.jboss.staxmapper.XMLElementWriter;
import org.jboss.staxmapper.XMLExtendedStreamReader;
@@ -150,6 +152,9 @@
//Strings
case EVENT_DISTRIBUTOR_NAME_ELEMENT:
case JDBC_SECURITY_DOMAIN_ELEMENT:
+ case ASYNC_THREAD_GROUP_ELEMENT:
+ node.get(reader.getLocalName()).set(reader.getElementText());
+ break;
// complex types
case BUFFER_SERVICE_ELEMENT:
Added: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorAdd.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorAdd.java
(rev 0)
+++
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorAdd.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -0,0 +1,113 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.jboss;
+
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.*;
+import static org.teiid.jboss.Configuration.addAttribute;
+
+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;
+import org.jboss.modules.ModuleIdentifier;
+import org.jboss.modules.ModuleLoadException;
+import org.jboss.msc.service.ServiceBuilder;
+import org.jboss.msc.service.ServiceController;
+import org.jboss.msc.service.ServiceTarget;
+import org.teiid.adminapi.impl.VDBTranslatorMetaData;
+import org.teiid.deployers.TranslatorUtil;
+import org.teiid.dqp.internal.datamgr.TranslatorRepository;
+import org.teiid.logging.LogConstants;
+import org.teiid.logging.LogManager;
+import org.teiid.translator.ExecutionFactory;
+
+public class TranslatorAdd implements DescriptionProvider, ModelAddOperationHandler {
+
+ @Override
+ public ModelNode getModelDescription(final Locale locale) {
+ final ResourceBundle bundle = IntegrationPlugin.getResourceBundle(locale);
+ final ModelNode operation = new ModelNode();
+ operation.get(OPERATION_NAME).set(ADD);
+ operation.get(DESCRIPTION).set(bundle.getString("translator.add"));
//$NON-NLS-1$
+ addAttribute(operation, Configuration.TRANSLATOR_NAME, REQUEST_PROPERTIES,
bundle.getString(Configuration.TRANSLATOR_NAME+Configuration.DESC), ModelType.STRING,
true, null);
+ addAttribute(operation, Configuration.TRANSLATOR_MODULE, REQUEST_PROPERTIES,
bundle.getString(Configuration.TRANSLATOR_MODULE+Configuration.DESC), ModelType.STRING,
true, null);
+ return operation;
+ }
+
+ @Override
+ public OperationResult execute(final OperationContext context, final ModelNode
operation, final ResultHandler resultHandler) 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 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);
+
+ if (context.getRuntimeContext() != null) {
+ context.getRuntimeContext().setRuntimeTask(new RuntimeTask() {
+ @Override
+ public void execute(RuntimeTaskContext context) throws
OperationFailedException {
+ 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();
+ }
+ return new BasicOperationResult(Util.getResourceRemoveOperation(address));
+ }
+}
Property changes on:
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorAdd.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorRemove.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorRemove.java
(rev 0)
+++
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorRemove.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -0,0 +1,74 @@
+/*
+ * 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.*;
+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 {
+
+ @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$
+ 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();
+ }
+ return new BasicOperationResult(compensating);
+ }
+}
Property changes on:
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorRemove.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorRepositoryService.java
===================================================================
---
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorRepositoryService.java
(rev 0)
+++
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorRepositoryService.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.jboss;
+
+import org.jboss.msc.service.Service;
+import org.jboss.msc.service.StartContext;
+import org.jboss.msc.service.StartException;
+import org.jboss.msc.service.StopContext;
+import org.teiid.dqp.internal.datamgr.TranslatorRepository;
+
+public class TranslatorRepositoryService implements Service<TranslatorRepository>
{
+ private TranslatorRepository repo;
+
+ public TranslatorRepositoryService(TranslatorRepository repo) {
+ this.repo = repo;
+ }
+
+ @Override
+ public void start(StartContext context) throws StartException {
+ }
+
+ @Override
+ public void stop(StopContext context) {
+ }
+
+ @Override
+ public TranslatorRepository getValue() throws IllegalStateException,
IllegalArgumentException {
+ return repo;
+ }
+
+}
Property changes on:
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorRepositoryService.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorService.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorService.java
(rev 0)
+++
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorService.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -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.adminapi.impl.VDBTranslatorMetaData;
+import org.teiid.dqp.internal.datamgr.TranslatorRepository;
+
+class TranslatorService implements Service<VDBTranslatorMetaData> {
+ private VDBTranslatorMetaData translator;
+
+ final InjectedValue<TranslatorRepository> repositoryInjector = new
InjectedValue<TranslatorRepository>();
+
+ public TranslatorService(VDBTranslatorMetaData translator) {
+ this.translator = translator;
+ }
+
+ @Override
+ public void start(StartContext context) throws StartException {
+ this.repositoryInjector.getValue().addTranslatorMetadata(this.translator.getName(),
this.translator);
+ }
+
+ @Override
+ public void stop(StopContext context) {
+ this.repositoryInjector.getValue().removeTranslatorMetadata(this.translator.getName());
+ }
+
+ @Override
+ public VDBTranslatorMetaData getValue() throws IllegalStateException,
IllegalArgumentException {
+ return this.translator;
+ }
+}
Property changes on:
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorService.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Deleted:
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/deployers/ConnectionFactoryDeployer.java
===================================================================
---
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/deployers/ConnectionFactoryDeployer.java 2011-06-27
14:25:00 UTC (rev 3273)
+++
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/deployers/ConnectionFactoryDeployer.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -1,68 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.jboss.deployers;
-
-import java.util.List;
-
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.resource.metadata.mcf.ManagedConnectionFactoryDeploymentGroup;
-import org.jboss.resource.metadata.mcf.ManagedConnectionFactoryDeploymentMetaData;
-import org.teiid.deployers.VDBStatusChecker;
-
-/**
- * This deployer listens to the data source load and unload events and manages the
connectionManager status based
- * on these events.
- */
-public class ConnectionFactoryDeployer extends
AbstractSimpleRealDeployer<ManagedConnectionFactoryDeploymentGroup> {
-
- private VDBStatusChecker vdbChecker;
-
- public ConnectionFactoryDeployer() {
- super(ManagedConnectionFactoryDeploymentGroup.class);
- setRelativeOrder(3000);
- }
-
- @Override
- public void deploy(DeploymentUnit unit, ManagedConnectionFactoryDeploymentGroup group)
throws DeploymentException {
- List<ManagedConnectionFactoryDeploymentMetaData> deployments =
group.getDeployments();
-
- for (ManagedConnectionFactoryDeploymentMetaData data : deployments) {
- this.vdbChecker.dataSourceAdded(data.getJndiName());
- }
- }
-
- @Override
- public void undeploy(DeploymentUnit unit, ManagedConnectionFactoryDeploymentGroup group)
{
- super.undeploy(unit, group);
- List<ManagedConnectionFactoryDeploymentMetaData> deployments =
group.getDeployments();
-
- for (ManagedConnectionFactoryDeploymentMetaData data : deployments) {
- this.vdbChecker.dataSourceRemoved(data.getJndiName());
- }
- }
-
- public void setVDBStatusChecker(VDBStatusChecker checker) {
- this.vdbChecker = checker;
- }
-}
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-06-27
14:25:00 UTC (rev 3273)
+++
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -31,6 +31,7 @@
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;
@@ -41,13 +42,13 @@
import javax.security.auth.login.LoginException;
import javax.transaction.TransactionManager;
+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.util.naming.Util;
-import org.jboss.util.threadpool.ThreadPool;
import org.teiid.adminapi.AdminComponentException;
import org.teiid.adminapi.AdminException;
import org.teiid.adminapi.AdminProcessingException;
@@ -69,7 +70,6 @@
import org.teiid.core.util.LRUCache;
import org.teiid.deployers.VDBLifeCycleListener;
import org.teiid.deployers.VDBRepository;
-import org.teiid.deployers.VDBStatusChecker;
import org.teiid.dqp.internal.process.*;
import org.teiid.dqp.service.BufferService;
import org.teiid.dqp.service.SessionService;
@@ -110,21 +110,20 @@
private transient ILogon logon;
private transient ClientServiceRegistryImpl csr = new ClientServiceRegistryImpl();
private transient VDBRepository vdbRepository;
- private transient VDBStatusChecker vdbStatusChecker;
private transient String jndiName;
private String eventDistributorName;
private transient EventDistributor eventDistributor;
- private ThreadPool theadPool;
// TODO: remove public?
public final InjectedValue<WorkManager> workManagerInjector = new
InjectedValue<WorkManager>();
public final InjectedValue<XATerminator> xaTerminatorInjector = new
InjectedValue<XATerminator>();
public final InjectedValue<TransactionManager> txnManagerInjector = new
InjectedValue<TransactionManager>();
- public final InjectedValue<ThreadPool> threadPoolInjector = new
InjectedValue<ThreadPool>();
+ 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 RuntimeEngineDeployer() {
// TODO: this does not belong here
LogManager.setLogListener(new Log4jListener());
@@ -146,6 +145,12 @@
setWorkManager(this.workManagerInjector.getValue());
setXATerminator(xaTerminatorInjector.getValue());
setTransactionManager(txnManagerInjector.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());
+
dqpCore.setTransactionService((TransactionService)LogManager.createLoggingProxy(LogConstants.CTX_TXN_LOG,
transactionServerImpl, new Class[] {TransactionService.class}, MessageLevel.DETAIL));
@@ -158,7 +163,6 @@
LogManager.logDetail(LogConstants.CTX_RUNTIME, ne,
IntegrationPlugin.Util.getString("jndi_failed", new
Date(System.currentTimeMillis()).toString())); //$NON-NLS-1$
}
}
- this.vdbStatusChecker = new VDBStatusChecker(this.vdbRepository, this.theadPool);
this.dqpCore.start(this);
this.dqpCore.getDataTierManager().setEventDistributor(this.eventDistributor);
// create the necessary services
@@ -346,10 +350,6 @@
this.vdbRepository = repo;
}
- public void setThreadPool(ThreadPool threadPool) {
- this.threadPool = threadPool;
- }
-
public void setJndiName(final String jndiName) {
this.jndiName = jndiName ;
}
Deleted:
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/deployers/TranslatorMetadataGroupComponentMapper.java
===================================================================
---
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/deployers/TranslatorMetadataGroupComponentMapper.java 2011-06-27
14:25:00 UTC (rev 3273)
+++
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/deployers/TranslatorMetadataGroupComponentMapper.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -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.jboss.deployers;
-
-import org.jboss.managed.api.ManagedObject;
-import org.jboss.system.server.profileservice.persistence.PersistenceFactory;
-import
org.jboss.system.server.profileservice.persistence.component.AbstractComponentMapper;
-import org.jboss.system.server.profileservice.persistence.xml.PersistedComponent;
-import org.teiid.adminapi.impl.TranslatorMetaData;
-import org.teiid.deployers.TranslatorMetaDataGroup;
-
-/**
- * This class used in the Teiid deployer -jboss-beans.xml file. This used to write the
persisted file for
- * a translator
- */
-public class TranslatorMetadataGroupComponentMapper extends AbstractComponentMapper {
-
- public TranslatorMetadataGroupComponentMapper(PersistenceFactory persistenceFactory) {
- super(persistenceFactory);
- }
-
- @Override
- protected ManagedObject getComponent(Object attachment, PersistedComponent component,
boolean create) {
- TranslatorMetaDataGroup deployment = (TranslatorMetaDataGroup) attachment;
- TranslatorMetaData data = null;
- if (deployment.getTranslators() != null &&
!deployment.getTranslators().isEmpty()) {
- for (TranslatorMetaData md : deployment.getTranslators()) {
- if (md.getName().equals(component.getOriginalName())) {
- data = md;
- break;
- }
- }
- }
- if (data == null && create) {
- // TODO create new attachment
- }
- if (data == null) {
- throw new IllegalStateException("could not find deployment "+
component.getOriginalName()); //$NON-NLS-1$
- }
- return getMOF().initManagedObject(data, null);
- }
-
- @Override
- protected void removeComponent(Object attachment,PersistedComponent component) {
- TranslatorMetaDataGroup deployment = (TranslatorMetaDataGroup) attachment;
- if (deployment.getTranslators() != null &&
!deployment.getTranslators().isEmpty()) {
- for (TranslatorMetaData data : deployment.getTranslators()) {
- if (!data.getName().equals(component.getOriginalName())) {
- deployment.addTranslator(data);
- }
- }
- }
- }
-
- @Override
- protected void setComponentName(PersistedComponent component, ManagedObject mo) {
- TranslatorMetaData metadata = (TranslatorMetaData)mo.getAttachment();
- component.setName(metadata.getName());
- }
-
- @Override
- public String getType() {
- return TranslatorMetaDataGroup.class.getName();
- }
-
-}
Deleted:
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/deployers/VDBMetaDataInstanceClassFactory.java
===================================================================
---
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/deployers/VDBMetaDataInstanceClassFactory.java 2011-06-27
14:25:00 UTC (rev 3273)
+++
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/deployers/VDBMetaDataInstanceClassFactory.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -1,111 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.jboss.deployers;
-
-import java.util.List;
-
-import org.jboss.beans.info.spi.BeanInfo;
-import org.jboss.managed.api.ManagedObject;
-import org.jboss.managed.api.ManagedProperty;
-import org.jboss.managed.api.factory.ManagedObjectFactory;
-import org.jboss.managed.plugins.factory.AbstractInstanceClassFactory;
-import org.jboss.metatype.api.values.MetaValue;
-import org.jboss.metatype.api.values.MetaValueFactory;
-import org.teiid.adminapi.impl.DataPolicyMetadata;
-import org.teiid.adminapi.impl.ModelMetaData;
-import org.teiid.adminapi.impl.PropertyMetadata;
-import org.teiid.adminapi.impl.VDBMetaData;
-import org.teiid.adminapi.impl.VDBTranslatorMetaData;
-import org.teiid.adminapi.jboss.ManagedUtil;
-
-public class VDBMetaDataInstanceClassFactory extends
AbstractInstanceClassFactory<VDBMetaData> {
-
- public VDBMetaDataInstanceClassFactory() {
- }
-
- public VDBMetaDataInstanceClassFactory(ManagedObjectFactory mof) {
- super(mof);
- }
-
- @Override
- public Class<VDBMetaData> getType() {
- return VDBMetaData.class;
- }
-
- @Override
- public void setValue(BeanInfo beanInfo, ManagedProperty property, VDBMetaData vdb,
MetaValue value) {
-
- if (property.getName().equals("models")) { //$NON-NLS-1$
- List<ManagedObject> models =
(List<ManagedObject>)MetaValueFactory.getInstance().unwrap(property.getValue());
- for(ManagedObject managedModel:models) {
- String modelName = ManagedUtil.getSimpleValue(managedModel, "name",
String.class); //$NON-NLS-1$
- ModelMetaData model = vdb.getModel(modelName);
-
- 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 name = ManagedUtil.getSimpleValue(mo, "name",
String.class);//$NON-NLS-1$
- String jndiName = ManagedUtil.getSimpleValue(mo,
"connectionJndiName", String.class);//$NON-NLS-1$
- String translatorName = ManagedUtil.getSimpleValue(mo,
"translatorName", String.class);//$NON-NLS-1$
- model.addSourceMapping(name, translatorName, jndiName);
- }
- }
- }
- }
- else if (property.getName().equals("JAXBProperties")) { //$NON-NLS-1$
- List<ManagedObject> properties =
(List<ManagedObject>)MetaValueFactory.getInstance().unwrap(property.getValue());
- for (ManagedObject managedProperty:properties) {
- vdb.addProperty(ManagedUtil.getSimpleValue(managedProperty, "name",
String.class), ManagedUtil.getSimpleValue(managedProperty, "value",
String.class)); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- else if (property.getName().equals("dataPolicies")) { //$NON-NLS-1$
- List<ManagedObject> policies =
(List<ManagedObject>)MetaValueFactory.getInstance().unwrap(property.getValue());
- for(ManagedObject managedPolicy:policies) {
- String policyName = ManagedUtil.getSimpleValue(managedPolicy, "name",
String.class); //$NON-NLS-1$
- Boolean anyAuthenticated = ManagedUtil.getSimpleValue(managedPolicy,
"anyAuthenticated", Boolean.class); //$NON-NLS-1$
- DataPolicyMetadata policy = vdb.getDataPolicy(policyName);
- policy.setAnyAuthenticated(Boolean.TRUE.equals(anyAuthenticated));
- ManagedProperty mappedRoleNames =
managedPolicy.getProperty("mappedRoleNames");//$NON-NLS-1$
- if (mappedRoleNames != null){
- List<String> roleNames =
(List<String>)MetaValueFactory.getInstance().unwrap(mappedRoleNames.getValue());
- policy.setMappedRoleNames(roleNames);
- }
- }
- }
- else if (property.getName().equals("overrideTranslators")) { //$NON-NLS-1$
- List<ManagedObject> translators =
(List<ManagedObject>)MetaValueFactory.getInstance().unwrap(property.getValue());
- for (ManagedObject translator:translators) {
- VDBTranslatorMetaData translatorInstance = vdb.getTranslator(translator.getName());
- ManagedProperty mp = translator.getProperty("property"); //$NON-NLS-1$
- List<PropertyMetadata> properties =
(List<PropertyMetadata>)MetaValueFactory.getInstance().unwrap(mp.getValue());
- for (PropertyMetadata managedProperty:properties) {
- translatorInstance.addProperty(managedProperty.getName(),
managedProperty.getValue());
- }
- }
- }
- else {
- super.setValue(beanInfo, property, vdb, value);
- }
- }
-
-}
Deleted:
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/deployers/VDBMetadataComponentMapper.java
===================================================================
---
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/deployers/VDBMetadataComponentMapper.java 2011-06-27
14:25:00 UTC (rev 3273)
+++
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/deployers/VDBMetadataComponentMapper.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -1,65 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.jboss.deployers;
-
-import org.jboss.managed.api.ManagedObject;
-import org.jboss.system.server.profileservice.persistence.PersistenceFactory;
-import
org.jboss.system.server.profileservice.persistence.component.AbstractComponentMapper;
-import org.jboss.system.server.profileservice.persistence.xml.PersistedComponent;
-import org.teiid.adminapi.impl.VDBMetaData;
-
-/**
- * This class used in the Teiid deployer -jboss-beans.xml file.
- */
-public class VDBMetadataComponentMapper extends AbstractComponentMapper {
-
- public VDBMetadataComponentMapper(PersistenceFactory persistenceFactory) {
- super(persistenceFactory);
- }
-
- @Override
- protected ManagedObject getComponent(Object attachment, PersistedComponent component,
boolean create) {
- VDBMetaData metadata = (VDBMetaData)attachment;
- String vdbName = metadata.getName()+"_"+metadata.getVersion(); //$NON-NLS-1$
- if (vdbName.equals(component.getName())) {
- return getMOF().initManagedObject(metadata, VDBMetaData.class, vdbName, vdbName);
- }
- throw new IllegalStateException("could not find deployment " +
component.getOriginalName());//$NON-NLS-1$
- }
-
- @Override
- protected void removeComponent(Object attachment,PersistedComponent component) {
- //TODO: What needs to be done here?
- }
-
- @Override
- protected void setComponentName(PersistedComponent component, ManagedObject mo) {
- VDBMetaData metadata = (VDBMetaData)mo.getAttachment();
- component.setName(metadata.getName()+"_"+metadata.getVersion());
//$NON-NLS-1$
- }
-
- @Override
- public String getType() {
- return VDBMetaData.class.getName();
- }
-
-}
Deleted:
branches/as7/jboss-integration/src/main/java/org/teiid/templates/connector/ConnectorDeploymentTemplate.java
===================================================================
---
branches/as7/jboss-integration/src/main/java/org/teiid/templates/connector/ConnectorDeploymentTemplate.java 2011-06-27
14:25:00 UTC (rev 3273)
+++
branches/as7/jboss-integration/src/main/java/org/teiid/templates/connector/ConnectorDeploymentTemplate.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -1,177 +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.templates.connector;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.resource.cci.ConnectionFactory;
-
-import org.jboss.deployers.spi.management.DeploymentTemplate;
-import org.jboss.managed.api.DeploymentTemplateInfo;
-import org.jboss.managed.api.ManagedProperty;
-import org.jboss.metatype.api.values.MetaValue;
-import org.jboss.metatype.api.values.SimpleValueSupport;
-import org.jboss.profileservice.spi.NoSuchDeploymentException;
-import org.jboss.virtual.VirtualFile;
-import org.teiid.adminapi.AdminComponentException;
-import org.teiid.adminapi.jboss.ManagedUtil;
-import org.teiid.jboss.IntegrationPlugin;
-
-/**
- * The connection factory template implementation. Here the idea is
"targetTemplate" is the actual template we store
- * the information under, which is the "connection factory" that container
generates. However, we have got data
- * passed under Teiid owned template. Now this classe'ss JOB is to transfer the
properties from the source template
- * into target template and write the target template.
- *
- * When the properties are written to target template, and source has a new property that
is not defined in target, that
- * property will be written as "config-property"
- */
-public class ConnectorDeploymentTemplate implements DeploymentTemplate {
-
- /** The deployment template info. */
- private DeploymentTemplateInfo info;
- private DeploymentTemplate targetTemplate;
-
- /** The file suffix. */
- private static final String FILE_SUFFIX = "-ds.xml";//$NON-NLS-1$
-
-
- public String getDeploymentName(String deploymentBaseName) {
- if (deploymentBaseName == null)
- throw new IllegalArgumentException("Null base name.");//$NON-NLS-1$
-
- if(deploymentBaseName.endsWith(FILE_SUFFIX) == false)
- deploymentBaseName = deploymentBaseName + FILE_SUFFIX;
-
- return deploymentBaseName;
- }
-
- public VirtualFile applyTemplate(DeploymentTemplateInfo sourceInfo) throws Exception {
- try {
-
- DeploymentTemplateInfo targetInfo = this.targetTemplate.getInfo();
-
- // override these properties always.
- targetInfo.getProperties().get("connection-definition").setValue(SimpleValueSupport.wrap(ConnectionFactory.class.getName()));//$NON-NLS-1$
- targetInfo.getProperties().get("rar-name").setValue(SimpleValueSupport.wrap(((ConnectorTemplateInfo)getInfo()).getRarName()));//$NON-NLS-1$
-
-
- //config-properties list
- List<String> connectorPropNames =
RaXmlPropertyConverter.getPropertyNames(((ConnectorTemplateInfo)getInfo()).getRarName());
- Map<String, String> configProps =
ConnectorDeploymentTemplate.propertiesAsMap(sourceInfo, connectorPropNames.toArray(new
String[connectorPropNames.size()]), info.getName());
- configProps.put(ConnectorTemplateInfo.TEMPLATE_NAME, getInfo().getName());
-
- // template properties specific to the template
- Map<String, ManagedProperty> propertyMap = targetInfo.getProperties();
-
- // walk through the supplied properties and assign properly to either template
- // or config-properties.
- for (String key:sourceInfo.getProperties().keySet()) {
- ManagedProperty mp = propertyMap.get(key);
-
- if (mp != null) {
- // property found in target, so just add as value
- MetaValue value = sourceInfo.getProperties().get(key).getValue();
- if (ManagedUtil.sameValue(mp.getDefaultValue(), value)) {
- continue;
- }
-
- if (value != null) {
- mp.setValue(value);
- }
- }
- else {
- // property not found in the target; add as "config-property"
- mp = sourceInfo.getProperties().get(key);
- if (ManagedUtil.sameValue(mp.getDefaultValue(), mp.getValue())) {
- continue;
- }
-
- if (mp.getValue() != null) {
- configProps.put(key, ManagedUtil.stringValue(mp.getValue()));
- configProps.put(key+".type",
mp.getValue().getMetaType().getClassName());//$NON-NLS-1$
- }
- }
- }
-
- if (configProps.size() > 0) {
- MetaValue metaValue = ManagedUtil.compositeValueMap(configProps);
- targetInfo.getProperties().get("config-property").setValue(metaValue);//$NON-NLS-1$
- }
- return this.targetTemplate.applyTemplate(targetInfo);
-
- } catch (NoSuchDeploymentException e) {
- throw new AdminComponentException(e.getMessage(), e);
- } catch(Exception e) {
- throw new AdminComponentException(e.getMessage(), e);
- }
- }
-
- @Override
- public DeploymentTemplateInfo getInfo() {
- return info;
- }
-
- public void setInfo(DeploymentTemplateInfo info) {
- this.info = info;
- }
-
- public void setTargetTemplate(DeploymentTemplate target) {
- this.targetTemplate = target;
- }
-
- /**
- * Check to make sure supplied names are extracted from original list. If a mandatory
property is missing fail
- * @param values
- * @param names
- * @param templateName
- * @return
- * @throws Exception
- */
- static Map<String, String> propertiesAsMap(DeploymentTemplateInfo values, String[]
names, String templateName) throws Exception {
- Map<String, String> props = new HashMap<String, String>();
-
- Map<String, ManagedProperty> sourceProperties = values.getProperties();
-
- for (String name:names) {
- ManagedProperty mp = sourceProperties.remove(name);
- if (mp != null) {
- if (mp.getValue() != null) {
- props.put(name, ManagedUtil.stringValue(mp.getValue()));
- }
- else {
- if (mp.isMandatory()) {
- if( mp.getDefaultValue() != null) {
- props.put(name, ManagedUtil.stringValue(mp.getDefaultValue()));
- }
- else {
- throw new
AdminComponentException(IntegrationPlugin.Util.getString("property_required_not_found",
mp.getName(), templateName));//$NON-NLS-1$
- }
- }
- }
- }
- }
- return props;
- }
-}
Deleted:
branches/as7/jboss-integration/src/main/java/org/teiid/templates/connector/ConnectorTemplateInfo.java
===================================================================
---
branches/as7/jboss-integration/src/main/java/org/teiid/templates/connector/ConnectorTemplateInfo.java 2011-06-27
14:25:00 UTC (rev 3273)
+++
branches/as7/jboss-integration/src/main/java/org/teiid/templates/connector/ConnectorTemplateInfo.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -1,109 +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.templates.connector;
-
-import java.util.List;
-import java.util.Map;
-
-import javax.resource.cci.ConnectionFactory;
-
-import org.jboss.managed.api.ManagedComponent;
-import org.jboss.managed.api.ManagedProperty;
-import org.jboss.managed.plugins.BasicDeploymentTemplateInfo;
-import org.jboss.metatype.api.types.SimpleMetaType;
-import org.jboss.metatype.api.values.MapCompositeValueSupport;
-import org.jboss.metatype.api.values.SimpleValueSupport;
-import org.teiid.adminapi.jboss.ExtendedPropertyInfo;
-import org.teiid.deployers.ManagedPropertyUtil;
-
-/**
- * This class some magic in it. First off all through the configuration it extends the
- * NoTxConnectionFactoryTemplate. Then using the JMX adds the properties defined inside a
connector
- * RAR file's ra.xml dynamically the above template. Also, it uses the
NoTxConnectionFactoryTemplate "applyTemplate" to write
- * the custom properties that have been added thru JMX as "config-property" in
the eventual "-ds.xml" file.
- */
-public class ConnectorTemplateInfo extends BasicDeploymentTemplateInfo implements
ExtendedPropertyInfo {
-
- private static final long serialVersionUID = 9066758787789280783L;
- private String rarName;
- static final String TEMPLATE_NAME = "template-name"; //$NON-NLS-1$
-
-
- public ConnectorTemplateInfo(String name, String description, Map<String,
ManagedProperty> properties) {
- super(name, description, properties);
- }
-
- public void start() {
- populate();
- }
-
- @Override
- public ConnectorTemplateInfo copy() {
- ConnectorTemplateInfo copy = new ConnectorTemplateInfo(getName(), getDescription(),
getProperties());
- copy.setRarName(getRarName());
- super.copy(copy);
- copy.populate();
-
- ManagedProperty mp =
copy.getProperties().get("connection-definition");//$NON-NLS-1$
- mp.setValue(SimpleValueSupport.wrap(ConnectionFactory.class.getName()));
-
- mp = copy.getProperties().get("rar-name");//$NON-NLS-1$
- mp.setValue(SimpleValueSupport.wrap(getRarName()));
- return copy;
- }
-
- private void populate() {
- List<ManagedProperty> props =
RaXmlPropertyConverter.getAsManagedProperties(getRarName());
- for (ManagedProperty p:props) {
- addProperty(p);
- }
- addProperty(buildTemplateProperty(getName()));
- }
-
- public String getRarName() {
- return rarName;
- }
-
- public void setRarName(String rarName) {
- this.rarName = rarName;
- }
-
- static ManagedProperty buildTemplateProperty(String name) {
- return ManagedPropertyUtil.createProperty(TEMPLATE_NAME, SimpleMetaType.STRING,
"Template Name", "The Name of the Teiid Connector Template", true,
true, name);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- @Override
- public void updateProperty(String name, String value, ManagedComponent main) {
- List<String> connectorNames =
RaXmlPropertyConverter.getPropertyNames(getRarName());
- if (connectorNames.contains(name)) {
- updateManagedConnectionFactory(name, value, main);
- }
- }
-
- static void updateManagedConnectionFactory(String name, String value, ManagedComponent
mc) {
- // Update the Container connection factory
- MapCompositeValueSupport previousValues =
(MapCompositeValueSupport)mc.getProperty("config-property").getValue();
//$NON-NLS-1$
- if (previousValues != null) {
- previousValues.put(name, SimpleValueSupport.wrap(value));
- }
- }
-}
Deleted:
branches/as7/jboss-integration/src/main/java/org/teiid/templates/connector/ExportConnectorTypeTemplateInfo.java
===================================================================
---
branches/as7/jboss-integration/src/main/java/org/teiid/templates/connector/ExportConnectorTypeTemplateInfo.java 2011-06-27
14:25:00 UTC (rev 3273)
+++
branches/as7/jboss-integration/src/main/java/org/teiid/templates/connector/ExportConnectorTypeTemplateInfo.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -1,55 +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.templates.connector;
-
-import java.io.File;
-import java.util.Map;
-
-import org.jboss.managed.api.DeploymentTemplateInfo;
-import org.jboss.managed.api.ManagedProperty;
-import org.jboss.resource.deployers.management.DsDataSourceTemplate;
-import org.jboss.resource.deployers.management.DsDataSourceTemplateInfo;
-
-public class ExportConnectorTypeTemplateInfo extends DsDataSourceTemplateInfo{
- private static final long serialVersionUID = 7725742249912578496L;
-
- public ExportConnectorTypeTemplateInfo(String name, String description, String
datasourceType) {
- super(name, description, datasourceType);
- }
-
- public ExportConnectorTypeTemplateInfo(String arg0, String arg1, Map<String,
ManagedProperty> arg2) {
- super(arg0, arg1, arg2);
- }
-
- public static void writeTemplate(File dsXml, DeploymentTemplateInfo info) throws
Exception {
- ExportConnectionFactoryTemplate template = new ExportConnectionFactoryTemplate();
- template.writeTemplate(dsXml, info);
- }
-
- public static class ExportConnectionFactoryTemplate extends DsDataSourceTemplate {
- @Override
- public void writeTemplate(File dsXml, DeploymentTemplateInfo values) throws Exception
{
- super.writeTemplate(dsXml, values);
- }
- }
-
-}
Deleted:
branches/as7/jboss-integration/src/main/java/org/teiid/templates/connector/LocalJdbcConnectorTemplate.java
===================================================================
---
branches/as7/jboss-integration/src/main/java/org/teiid/templates/connector/LocalJdbcConnectorTemplate.java 2011-06-27
14:25:00 UTC (rev 3273)
+++
branches/as7/jboss-integration/src/main/java/org/teiid/templates/connector/LocalJdbcConnectorTemplate.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -1,59 +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.templates.connector;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.jboss.managed.api.DeploymentTemplateInfo;
-import org.jboss.managed.api.ManagedProperty;
-import org.jboss.metatype.api.types.SimpleMetaType;
-import org.jboss.virtual.VirtualFile;
-import org.teiid.adminapi.jboss.ManagedUtil;
-
-
-
-public class LocalJdbcConnectorTemplate extends
org.jboss.resource.deployers.management.DsDataSourceTemplate {
-
- @Override
- public VirtualFile applyTemplate(DeploymentTemplateInfo values) throws Exception {
-
- values.getProperties().get("connection-definition").setValue(ManagedUtil.wrap(SimpleMetaType.STRING,
"javax.sql.DataSource"));//$NON-NLS-1$ //$NON-NLS-2$
- values.getProperties().get("dsType").setValue(ManagedUtil.wrap(SimpleMetaType.STRING,
"local-tx-datasource"));//$NON-NLS-1$ //$NON-NLS-2$
-
- Map<String, String> configProperties = new HashMap<String, String>();
- configProperties.put(ConnectorTemplateInfo.TEMPLATE_NAME, getInfo().getName());
- values.getProperties().get("config-property").setValue(ManagedUtil.compositeValueMap(configProperties));//$NON-NLS-1$
-
- Map<String, String> connectionProperties = new HashMap<String, String>();
-
- ManagedProperty mp =
values.getProperties().remove(LocalJdbcConnectorTemplateInfo.ADDITIONAL_CONNECTION_PROPS);
- if (mp != null && mp.getValue() != null) {
- XaJdbcConnectorTemplateInfo.parseProperties(ManagedUtil.stringValue(mp.getValue()),
connectionProperties);
- }
-
- values.getProperties().get("connection-properties").setValue(ManagedUtil.compositeValueMap(connectionProperties));//$NON-NLS-1$
-
- return super.applyTemplate(values);
- }
-
-}
Deleted:
branches/as7/jboss-integration/src/main/java/org/teiid/templates/connector/LocalJdbcConnectorTemplateInfo.java
===================================================================
---
branches/as7/jboss-integration/src/main/java/org/teiid/templates/connector/LocalJdbcConnectorTemplateInfo.java 2011-06-27
14:25:00 UTC (rev 3273)
+++
branches/as7/jboss-integration/src/main/java/org/teiid/templates/connector/LocalJdbcConnectorTemplateInfo.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -1,125 +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.templates.connector;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.StringTokenizer;
-
-import org.jboss.managed.api.ManagedComponent;
-import org.jboss.managed.api.ManagedProperty;
-import org.jboss.managed.plugins.DefaultFieldsImpl;
-import org.jboss.managed.plugins.ManagedPropertyImpl;
-import org.jboss.metatype.api.types.MapCompositeMetaType;
-import org.jboss.metatype.api.types.SimpleMetaType;
-import org.jboss.metatype.api.values.MapCompositeValueSupport;
-import org.jboss.metatype.api.values.SimpleValueSupport;
-import org.jboss.resource.deployers.management.DsDataSourceTemplateInfo;
-import org.teiid.adminapi.jboss.ExtendedPropertyInfo;
-import org.teiid.adminapi.jboss.ManagedUtil;
-import org.teiid.deployers.ManagedPropertyUtil;
-
-/**
- * This template is to create a simplified local JDBC datasource
- */
-public class LocalJdbcConnectorTemplateInfo extends DsDataSourceTemplateInfo implements
ExtendedPropertyInfo {
- private static final long serialVersionUID = 7618814758011974868L;
- static final String ADDITIONAL_CONNECTION_PROPS =
"addtional-connection-properties";//$NON-NLS-1$
-
- public LocalJdbcConnectorTemplateInfo(String name, String description, Map<String,
ManagedProperty> properties) {
- super(name, description, properties);
- }
-
- public void start() {
- populate();
- }
-
- @Override
- public LocalJdbcConnectorTemplateInfo copy() {
- LocalJdbcConnectorTemplateInfo copy = new LocalJdbcConnectorTemplateInfo(getName(),
getDescription(), getProperties());
- super.copy(copy);
- copy.populate();
- return copy;
- }
-
- private void populate() {
- super.start();
-
- ManagedProperty mp =
this.getProperties().get("connection-definition");//$NON-NLS-1$
- mp.setValue(ManagedUtil.wrap(SimpleMetaType.STRING,
"javax.sql.DataSource"));//$NON-NLS-1$
-
- mp = this.getProperties().get("dsType");//$NON-NLS-1$
- mp.setValue(ManagedUtil.wrap(SimpleMetaType.STRING,
"local-tx-datasource"));//$NON-NLS-1$
-
- ManagedPropertyImpl dsTypeMP = buildConfigProperty();
- addProperty(dsTypeMP);
-
- addProperty(ConnectorTemplateInfo.buildTemplateProperty(getName()));
-
- ManagedPropertyUtil.markAsTeiidProperty(this.getProperties().get("user-name"));
//$NON-NLS-1$
- ManagedPropertyUtil.markAsTeiidProperty(this.getProperties().get("password"));//$NON-NLS-1$
- ManagedPropertyUtil.markAsTeiidProperty(this.getProperties().get("driver-class"));
//$NON-NLS-1$
- ManagedPropertyUtil.markAsTeiidProperty(this.getProperties().get("connection-url"));//$NON-NLS-1$
-
- addProperty(ManagedPropertyUtil.createProperty(ADDITIONAL_CONNECTION_PROPS,
SimpleMetaType.STRING,"Addtional Connection Properties", "Addtional
Connection properties. (comma separated name value pairs)", false, false,
null));//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- static ManagedPropertyImpl buildConfigProperty() {
- DefaultFieldsImpl fields = new
DefaultFieldsImpl("config-property");//$NON-NLS-1$
- fields.setDescription("The config-property type"); //$NON-NLS-1$
- fields.setMetaType(new MapCompositeMetaType (SimpleMetaType.STRING));
- ManagedPropertyImpl dsTypeMP = new ManagedPropertyImpl(fields);
- return dsTypeMP;
- }
-
-
- @Override
- /**
- * This is for updating a single property.
- */
- public void updateProperty(String name, String value, ManagedComponent main) {
- if (name.equals(ADDITIONAL_CONNECTION_PROPS)) {
- Map<String, String> map = new HashMap<String, String>();
- parseProperties(value, map);
-
- // update the container managed object.
- MapCompositeValueSupport previousValues =
(MapCompositeValueSupport)main.getProperty("connection-properties").getValue();
//$NON-NLS-1$
- if (previousValues != null) {
- for (String key:map.keySet()) {
- previousValues.put(key, SimpleValueSupport.wrap(map.get(key)));
- }
- }
- }
- }
-
- static void parseProperties(String str, Map<String, String> props) {
- str = str.trim();
- StringTokenizer st = new StringTokenizer(str, ","); //$NON-NLS-1$
- while (st.hasMoreTokens()) {
- String property = st.nextToken();
- int index = property.indexOf('=');
- if (index != -1 && property.length() > (index+1)) {
- props.put(property.substring(0, index).trim(), property.substring(index+1).trim());
- }
- }
- }
-}
Deleted:
branches/as7/jboss-integration/src/main/java/org/teiid/templates/connector/RaXmlPropertyConverter.java
===================================================================
---
branches/as7/jboss-integration/src/main/java/org/teiid/templates/connector/RaXmlPropertyConverter.java 2011-06-27
14:25:00 UTC (rev 3273)
+++
branches/as7/jboss-integration/src/main/java/org/teiid/templates/connector/RaXmlPropertyConverter.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -1,118 +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.templates.connector;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import javax.management.AttributeNotFoundException;
-import javax.management.InstanceNotFoundException;
-import javax.management.MBeanException;
-import javax.management.MBeanServer;
-import javax.management.MBeanServerFactory;
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-import javax.management.ReflectionException;
-import javax.resource.cci.ConnectionFactory;
-
-import org.jboss.managed.api.Fields;
-import org.jboss.managed.api.ManagedProperty;
-import org.jboss.managed.plugins.DefaultFieldsImpl;
-import org.jboss.managed.plugins.ManagedPropertyImpl;
-import org.jboss.metatype.api.types.SimpleMetaType;
-import org.jboss.resource.metadata.ConfigPropertyMetaData;
-import org.jboss.resource.metadata.ConnectionDefinitionMetaData;
-import org.jboss.resource.metadata.ConnectorMetaData;
-import org.jboss.resource.metadata.DescriptionMetaData;
-import org.teiid.adminapi.jboss.ManagedUtil;
-import org.teiid.deployers.ExtendedPropertyMetadata;
-import org.teiid.deployers.ManagedPropertyUtil;
-
-public class RaXmlPropertyConverter {
-
-
- public static List<String> getPropertyNames(String rarName){
- ArrayList<String> names = new ArrayList<String>();
- Collection<ConfigPropertyMetaData> props = getRarProperties(rarName);
- if (props != null) {
- for (ConfigPropertyMetaData p:props) {
- names.add(p.getName());
- }
- }
- return names;
- }
-
- public static List<ManagedProperty> getAsManagedProperties(String rarName){
- ArrayList<ManagedProperty> managedProperties = new
ArrayList<ManagedProperty>();
- Collection<ConfigPropertyMetaData> props = getRarProperties(rarName);
- if (props != null) {
- for (ConfigPropertyMetaData p:props) {
- managedProperties.add(createConnectorProperty(p));
- }
- }
- return managedProperties;
- }
-
-
- private static Collection<ConfigPropertyMetaData> getRarProperties(String
rarName){
- try {
- MBeanServer server = MBeanServerFactory.findMBeanServer(null).get(0);
- ObjectName on = new
ObjectName("jboss.jca:service=RARDeployment,name='"+rarName+"'");//$NON-NLS-1$ //$NON-NLS-2$
- ConnectorMetaData obj = (ConnectorMetaData)server.getAttribute(on,
"MetaData");//$NON-NLS-1$
- ConnectionDefinitionMetaData metadata =
obj.getConnectionDefinition(ConnectionFactory.class.getName());
- if (metadata != null) {
- return metadata.getProperties();
- }
- } catch (MalformedObjectNameException e) {
- //ignore
- } catch (AttributeNotFoundException e) {
- //ignore
- } catch (InstanceNotFoundException e) {
- //ignore
- } catch (MBeanException e) {
- //ignore
- } catch (ReflectionException e) {
- //ignore
- }
- return null;
- }
-
- private static ManagedProperty createConnectorProperty(ConfigPropertyMetaData metadata)
{
-
- DescriptionMetaData descMetadata = metadata.getDescription();
- String description = descMetadata.getDescription();
- if (description != null) {
- ExtendedPropertyMetadata extended = new ExtendedPropertyMetadata(metadata.getName(),
metadata.getType(), description, metadata.getValue());
- return ManagedPropertyUtil.convert(extended);
- }
-
- DefaultFieldsImpl fields = new DefaultFieldsImpl(metadata.getName());
- SimpleMetaType metaType = SimpleMetaType.resolve(metadata.getType());
- fields.setMetaType(metaType);
- if (metadata.getValue() != null && metadata.getValue().trim().length() > 0)
{
- fields.setField(Fields.DEFAULT_VALUE, ManagedUtil.wrap(metaType,
metadata.getValue()));
- }
-
- return new ManagedPropertyImpl(fields);
- }
-}
Deleted:
branches/as7/jboss-integration/src/main/java/org/teiid/templates/connector/XaJdbcConnectorTemplate.java
===================================================================
---
branches/as7/jboss-integration/src/main/java/org/teiid/templates/connector/XaJdbcConnectorTemplate.java 2011-06-27
14:25:00 UTC (rev 3273)
+++
branches/as7/jboss-integration/src/main/java/org/teiid/templates/connector/XaJdbcConnectorTemplate.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -1,64 +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.templates.connector;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.jboss.managed.api.DeploymentTemplateInfo;
-import org.jboss.managed.api.ManagedProperty;
-import org.jboss.metatype.api.types.SimpleMetaType;
-import org.jboss.virtual.VirtualFile;
-import org.teiid.adminapi.jboss.ManagedUtil;
-
-
-
-public class XaJdbcConnectorTemplate extends
org.jboss.resource.deployers.management.DsDataSourceTemplate {
-
- private static final long serialVersionUID = 1607932913015949359L;
-
- @Override
- public VirtualFile applyTemplate(DeploymentTemplateInfo values) throws Exception {
-
- XaJdbcConnectorTemplateInfo info = (XaJdbcConnectorTemplateInfo)getInfo();
-
- values.getProperties().get("connection-definition").setValue(ManagedUtil.wrap(SimpleMetaType.STRING,
"javax.sql.DataSource"));//$NON-NLS-1$ //$NON-NLS-2$
- values.getProperties().get("dsType").setValue(ManagedUtil.wrap(SimpleMetaType.STRING,
"xa-datasource"));//$NON-NLS-1$ //$NON-NLS-2$
-
- Map<String, String> configProperties = new HashMap<String, String>();
- configProperties.put(ConnectorTemplateInfo.TEMPLATE_NAME, getInfo().getName());
- values.getProperties().get("config-property").setValue(ManagedUtil.compositeValueMap(configProperties));//$NON-NLS-1$
-
- // Data source specific properties
- Map<String, String> dsProps = ConnectorDeploymentTemplate.propertiesAsMap(values,
XaJdbcConnectorTemplateInfo.EXTENDED_DS_PROPERTIES, info.getName());
-
- ManagedProperty mp =
values.getProperties().remove(XaJdbcConnectorTemplateInfo.ADDITIONAL_DS_PROPS);
- if (mp != null && mp.getValue() != null) {
- XaJdbcConnectorTemplateInfo.parseProperties(ManagedUtil.stringValue(mp.getValue()),
dsProps);
- }
-
- values.getProperties().get("xa-datasource-properties").setValue(ManagedUtil.compositeValueMap(dsProps));//$NON-NLS-1$
-
- return super.applyTemplate(values);
- }
-
-}
Deleted:
branches/as7/jboss-integration/src/main/java/org/teiid/templates/connector/XaJdbcConnectorTemplateInfo.java
===================================================================
---
branches/as7/jboss-integration/src/main/java/org/teiid/templates/connector/XaJdbcConnectorTemplateInfo.java 2011-06-27
14:25:00 UTC (rev 3273)
+++
branches/as7/jboss-integration/src/main/java/org/teiid/templates/connector/XaJdbcConnectorTemplateInfo.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -1,137 +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.templates.connector;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.StringTokenizer;
-
-import org.jboss.managed.api.ManagedComponent;
-import org.jboss.managed.api.ManagedProperty;
-import org.jboss.managed.plugins.DefaultFieldsImpl;
-import org.jboss.managed.plugins.ManagedPropertyImpl;
-import org.jboss.metatype.api.types.MapCompositeMetaType;
-import org.jboss.metatype.api.types.SimpleMetaType;
-import org.jboss.metatype.api.values.MapCompositeValueSupport;
-import org.jboss.metatype.api.values.SimpleValueSupport;
-import org.jboss.resource.deployers.management.DsDataSourceTemplateInfo;
-import org.teiid.adminapi.jboss.ExtendedPropertyInfo;
-import org.teiid.adminapi.jboss.ManagedUtil;
-import org.teiid.deployers.ManagedPropertyUtil;
-
-/**
- * This template is to create a simplified XA JDBC datasource
- */
-public class XaJdbcConnectorTemplateInfo extends DsDataSourceTemplateInfo implements
ExtendedPropertyInfo {
-
- private static final long serialVersionUID = 9066758787789280783L;
- static final String SERVER_NAME = "ServerName";//$NON-NLS-1$
- static final String PORT_NUMBER = "PortNumber";//$NON-NLS-1$
- static final String DATABASE_NAME = "DatabaseName";//$NON-NLS-1$
- static final String ADDITIONAL_DS_PROPS =
"additional-ds-properties";//$NON-NLS-1$
-
- static final String[] EXTENDED_DS_PROPERTIES = {SERVER_NAME,
PORT_NUMBER,DATABASE_NAME};
-
- public XaJdbcConnectorTemplateInfo(String name, String description, Map<String,
ManagedProperty> properties) {
- super(name, description, properties);
- }
-
- public void start() {
- populate();
- }
-
- @Override
- public XaJdbcConnectorTemplateInfo copy() {
- XaJdbcConnectorTemplateInfo copy = new XaJdbcConnectorTemplateInfo(getName(),
getDescription(), getProperties());
- super.copy(copy);
- copy.populate();
- return copy;
- }
-
- private void populate() {
- super.start();
-
- ManagedProperty mp =
this.getProperties().get("connection-definition");//$NON-NLS-1$
- mp.setValue(ManagedUtil.wrap(SimpleMetaType.STRING,
"javax.sql.DataSource"));//$NON-NLS-1$
-
- mp = this.getProperties().get("dsType");//$NON-NLS-1$
- mp.setValue(ManagedUtil.wrap(SimpleMetaType.STRING,
"xa-datasource"));//$NON-NLS-1$
-
- ManagedPropertyImpl dsTypeMP = buildConfigProperty();
- addProperty(dsTypeMP);
-
- addProperty(ConnectorTemplateInfo.buildTemplateProperty(getName()));
-
- ManagedPropertyUtil.markAsTeiidProperty(this.getProperties().get("user-name"));
//$NON-NLS-1$
- ManagedPropertyUtil.markAsTeiidProperty(this.getProperties().get("password"));//$NON-NLS-1$
- addProperty(ManagedPropertyUtil.createProperty(DATABASE_NAME,
SimpleMetaType.STRING,"Database Name","Database Name", false, false,
null));//$NON-NLS-1$ //$NON-NLS-2$
- addProperty(ManagedPropertyUtil.createProperty(PORT_NUMBER,
SimpleMetaType.INTEGER,"Database Port", "Database Port",false, false,
null));//$NON-NLS-1$ //$NON-NLS-2$
- addProperty(ManagedPropertyUtil.createProperty(SERVER_NAME,
SimpleMetaType.STRING,"Database Server Name", "Database Server Name",
false, false, null));//$NON-NLS-1$ //$NON-NLS-2$
- addProperty(ManagedPropertyUtil.createProperty(ADDITIONAL_DS_PROPS,
SimpleMetaType.STRING,"Addtional Data Source Properties", "Addtional Data
source properties. (comma separated name value pairs)", false, false,
null));//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- static ManagedPropertyImpl buildConfigProperty() {
- DefaultFieldsImpl fields = new
DefaultFieldsImpl("config-property");//$NON-NLS-1$
- fields.setDescription("The config-property type"); //$NON-NLS-1$
- fields.setMetaType(new MapCompositeMetaType (SimpleMetaType.STRING));
- ManagedPropertyImpl dsTypeMP = new ManagedPropertyImpl(fields);
- return dsTypeMP;
- }
-
-
- @Override
- /**
- * This is for updating a single property.
- */
- public void updateProperty(String name, String value, ManagedComponent main) {
- if
(name.equals(DATABASE_NAME)||name.equals(PORT_NUMBER)||name.equals(SERVER_NAME)||name.equals(ADDITIONAL_DS_PROPS))
{
- Map<String, String> map = new HashMap<String, String>();
-
- if (name.equals(ADDITIONAL_DS_PROPS)) {
- parseProperties(value, map);
- }
- else {
- map.put(name, value);
- }
-
- // update the container managed object.
- MapCompositeValueSupport previousValues =
(MapCompositeValueSupport)main.getProperty("xa-datasource-properties").getValue();
//$NON-NLS-1$
- if (previousValues != null) {
- for (String key:map.keySet()) {
- previousValues.put(key, SimpleValueSupport.wrap(map.get(key)));
- }
- }
- }
- }
-
- static void parseProperties(String str, Map<String, String> props) {
- str = str.trim();
- StringTokenizer st = new StringTokenizer(str, ","); //$NON-NLS-1$
- while (st.hasMoreTokens()) {
- String property = st.nextToken();
- int index = property.indexOf('=');
- if (index != -1 && property.length() > (index+1)) {
- props.put(property.substring(0, index).trim(), property.substring(index+1).trim());
- }
- }
- }
-}
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-06-27
14:25:00 UTC (rev 3273)
+++
branches/as7/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties 2011-06-27
16:56:11 UTC (rev 3274)
@@ -48,8 +48,8 @@
admin_executing=JOPR admin {0} is executing command {1}
DQPCore.unable_to_process_event=Unable to process event.
+translator.added = Teiid translator "{0}" added.
-
# subsystem description
buffer-service.describe=Buffer Manager Configuration
resultset-cache.describe=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
@@ -62,6 +62,7 @@
#Query-ENGINE
jndi-name.describe=JNDI name of the Teiid Query Engine
+thread-group-async.describe=Thread Pool to be used with Asynchronous operations in Teiid
maxThreads.describe=Process pool maximum thread count. (default 64)
maxActivePlans.describe=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.
userRequestSourceConcurrency.describe=Max source query concurrency per user request
(default 0). \
Modified: branches/as7/jboss-integration/src/main/resources/schema/jboss-teiid.xsd
===================================================================
--- branches/as7/jboss-integration/src/main/resources/schema/jboss-teiid.xsd 2011-06-27
14:25:00 UTC (rev 3273)
+++ branches/as7/jboss-integration/src/main/resources/schema/jboss-teiid.xsd 2011-06-27
16:56:11 UTC (rev 3274)
@@ -143,6 +143,11 @@
</xs:complexType>
<xs:complexType name="runtime-engine-type">
<xs:sequence>
+ <xs:element name="thread-group-async" type="xs:string"
minOccurs="0" maxOccurs="1" default="teiid-async">
+ <xs:annotation>
+ <xs:documentation>Thread group to use for Async
Processing</xs:documentation>
+ </xs:annotation>
+ </xs:element>
<xs:element name="maxThreads" type="xs:int"
minOccurs="0" maxOccurs="1" default="64">
<xs:annotation>
<xs:documentation>Process pool maximum thread count. (default
64)</xs:documentation>
Deleted:
branches/as7/jboss-integration/src/test/java/org/teiid/adminapi/jboss/TestManagedUtil.java
===================================================================
---
branches/as7/jboss-integration/src/test/java/org/teiid/adminapi/jboss/TestManagedUtil.java 2011-06-27
14:25:00 UTC (rev 3273)
+++
branches/as7/jboss-integration/src/test/java/org/teiid/adminapi/jboss/TestManagedUtil.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -1,42 +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.jboss;
-
-import static org.junit.Assert.*;
-
-import java.io.ByteArrayInputStream;
-import java.net.URL;
-
-import org.junit.Test;
-import org.teiid.core.util.ObjectConverterUtil;
-
-
-public class TestManagedUtil {
-
- @Test public void testTempURL() throws Exception {
- ByteArrayInputStream bais = new ByteArrayInputStream(new byte[100]);
- URL url = ManagedUtil.getTempURL(bais);
- assertEquals(100, ObjectConverterUtil.convertToByteArray(url.openStream()).length);
- }
-
-}
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-06-27
14:25:00 UTC (rev 3273)
+++
branches/as7/jboss-integration/src/test/java/org/teiid/jboss/TestTeiidConfiguration.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -274,7 +274,7 @@
@Test
public void testSubSystemDescription() throws IOException {
- TeiidSubsystemDescription tsd = new TeiidSubsystemDescription();
+ QueryEngineDescription tsd = new QueryEngineDescription();
assertEquals(ObjectConverterUtil.convertToString(new
FileReader("src/test/resources/teiid-model-config.txt")),
tsd.getModelDescription(null).toString());
}
}
Modified: branches/as7/jboss-integration/src/test/resources/teiid-sample-config.xml
===================================================================
--- branches/as7/jboss-integration/src/test/resources/teiid-sample-config.xml 2011-06-27
14:25:00 UTC (rev 3273)
+++ branches/as7/jboss-integration/src/test/resources/teiid-sample-config.xml 2011-06-27
16:56:11 UTC (rev 3274)
@@ -1,5 +1,6 @@
<subsystem xmlns="urn:jboss:domain:teiid:1.0">
<query-engine jndi-name="teiid/engine-deployer">
+ <thread-group-async>teiid-async</thread-group-async>
<maxThreads>64</maxThreads>
<maxActivePlans>20</maxActivePlans>
<userRequestSourceConcurrency>0</userRequestSourceConcurrency>
@@ -17,7 +18,6 @@
<detectingChangeEvents>true</detectingChangeEvents>
<jdbc-security-domain>teiid-security</jdbc-security-domain>
- <admin-security-domain>jmx-console</admin-security-domain>
<max-sessions-allowed>5000</max-sessions-allowed>
<sessions-expiration-timelimit>0</sessions-expiration-timelimit>
<allow-env-function>false</allow-env-function>
@@ -60,17 +60,6 @@
<socket-binding>teiid-jdbc</socket-binding>
</jdbc>
- <admin enabled="true">
- <maxSocketThreads>4</maxSocketThreads>
- <inputBufferSize>0</inputBufferSize>
- <outputBufferSize>0</outputBufferSize>
- <socket-binding>teiid-admin</socket-binding>
- <ssl>
- <mode>login</mode>
- <authenticationMode>anonymous</authenticationMode>
- </ssl>
- </admin>
-
<odbc enabled="true">
<maxSocketThreads>0</maxSocketThreads>
<inputBufferSize>0</inputBufferSize>
Modified:
branches/as7/metadata/src/main/java/org/teiid/metadata/index/IndexMetadataFactory.java
===================================================================
---
branches/as7/metadata/src/main/java/org/teiid/metadata/index/IndexMetadataFactory.java 2011-06-27
14:25:00 UTC (rev 3273)
+++
branches/as7/metadata/src/main/java/org/teiid/metadata/index/IndexMetadataFactory.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -170,7 +170,7 @@
public void addEntriesPlusVisibilities(VirtualFile root, VDBMetaData vdb) throws
IOException {
LinkedHashMap<String, Resource> visibilityMap = new LinkedHashMap<String,
Resource>();
for(VirtualFile f: root.getChildrenRecursively()) {
- if (f.isLeaf()) {
+ if (f.isFile()) {
// remove the leading vdb name from the entry
String path = f.getPathName().substring(root.getPathName().length());
if (!path.startsWith("/")) { //$NON-NLS-1$
Modified: branches/as7/pom.xml
===================================================================
--- branches/as7/pom.xml 2011-06-27 14:25:00 UTC (rev 3273)
+++ branches/as7/pom.xml 2011-06-27 16:56:11 UTC (rev 3274)
@@ -410,7 +410,17 @@
<groupId>org.picketbox</groupId>
<artifactId>picketbox</artifactId>
<version>4.0.0.Beta3</version>
- </dependency>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-server</artifactId>
+ <version>${jbossas-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-connector</artifactId>
+ <version>${jbossas-version}</version>
+ </dependency>
<!--
<dependency>
<groupId>jgroups</groupId>
Modified: branches/as7/runtime/pom.xml
===================================================================
--- branches/as7/runtime/pom.xml 2011-06-27 14:25:00 UTC (rev 3273)
+++ branches/as7/runtime/pom.xml 2011-06-27 16:56:11 UTC (rev 3274)
@@ -68,8 +68,18 @@
<groupId>org.jboss</groupId>
<artifactId>jboss-common-core</artifactId>
<scope>provided</scope>
- </dependency>
-
+ </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.cache</groupId>
Deleted:
branches/as7/runtime/src/main/java/org/teiid/deployers/BaseMultipleVFSParsingDeployer.java
===================================================================
---
branches/as7/runtime/src/main/java/org/teiid/deployers/BaseMultipleVFSParsingDeployer.java 2011-06-27
14:25:00 UTC (rev 3273)
+++
branches/as7/runtime/src/main/java/org/teiid/deployers/BaseMultipleVFSParsingDeployer.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -1,98 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.deployers;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.deployers.vfs.spi.deployer.MultipleVFSParsingDeployer;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.virtual.VirtualFile;
-import org.jboss.virtual.VirtualFileFilter;
-
-/**
- * Overriding the base MultipleVFSParsingDeployer so that the parse method is supplied
with VFSDeploymentUnit.
- * @param <T>
- */
-public abstract class BaseMultipleVFSParsingDeployer<T>
extends MultipleVFSParsingDeployer<T> {
-
- private String suffix2;
- private Class<?> suffixClass2;
-
- public BaseMultipleVFSParsingDeployer(Class<T> output,Map<String,
Class<?>> mappings, String suffix, Class<?> suffixClass, String suffix2,
Class<?>suffixClass2) {
- super(output, mappings, suffix, suffixClass);
- this.suffix2 = suffix2;
- this.suffixClass2 = suffixClass2;
- }
-
- @SuppressWarnings("unchecked")
- @Override
- protected T mergeFiles(VFSDeploymentUnit unit, T root,List<VirtualFile> files,
Set<String> missingFiles) throws Exception {
-
- List<VirtualFile> matched = unit.getMetaDataFiles(new VirtualFileFilter() {
- @Override
- public boolean accepts(VirtualFile file) {
- return file.getName().endsWith(suffix2);
- }
- });
-
- files.addAll(matched);
- Map<Class<?>, List<Object>> metadata = new HashMap<Class<?>,
List<Object>>();
- for (VirtualFile file : files) {
- Class<?> clazz = matchFileToClass(unit, file);
- List<Object> instances = metadata.get(clazz);
- if (instances == null) {
- instances = new ArrayList<Object>();
- metadata.put(clazz, instances);
- }
- Object instance = parse(unit, clazz, file, root);
- boolean found = false;
- for (Object obj:instances) {
- if (obj == instance) {
- found = true;
- }
- }
- if (!found) {
- instances.add(instance);
- }
- }
- return mergeMetaData(unit, root, metadata, missingFiles);
- }
-
- @Override
- protected Class<?> matchFileToClass(DeploymentUnit unit, VirtualFile file){
- if (file.getName().endsWith(this.suffix2)) {
- return this.suffixClass2;
- }
- return super.matchFileToClass(unit, file);
- }
-
- @Override
- protected <U> U parse(Class<U> expectedType, VirtualFile file, Object root)
throws Exception{
- throw new UnsupportedOperationException("This will be never invoked");
//$NON-NLS-1$
- }
- protected abstract <U> U parse(VFSDeploymentUnit unit, Class<U>
expectedType, VirtualFile file, Object root) throws Exception;
-}
Deleted: branches/as7/runtime/src/main/java/org/teiid/deployers/DynamicVDBDeployer.java
===================================================================
---
branches/as7/runtime/src/main/java/org/teiid/deployers/DynamicVDBDeployer.java 2011-06-27
14:25:00 UTC (rev 3273)
+++
branches/as7/runtime/src/main/java/org/teiid/deployers/DynamicVDBDeployer.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -1,55 +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 javax.xml.bind.Unmarshaller;
-
-import org.jboss.deployers.vfs.spi.deployer.AbstractVFSParsingDeployer;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.virtual.VirtualFile;
-import org.teiid.adminapi.impl.VDBMetaData;
-import org.teiid.logging.LogConstants;
-import org.teiid.logging.LogManager;
-
-
-public class DynamicVDBDeployer extends AbstractVFSParsingDeployer<VDBMetaData> {
-
- public DynamicVDBDeployer() {
- super(VDBMetaData.class);
- setSuffix("-vdb.xml"); //$NON-NLS-1$
- }
-
- @Override
- protected VDBMetaData parse(VFSDeploymentUnit unit, VirtualFile file, VDBMetaData root)
throws Exception {
- Unmarshaller un = VDBParserDeployer.getUnMarsheller();
- VDBMetaData vdb = (VDBMetaData)un.unmarshal(file.openStream());
-
- vdb.setUrl(unit.getRoot().toURL());
- vdb.setDynamic(true);
-
- LogManager.logDetail(LogConstants.CTX_RUNTIME,"VDB
"+unit.getRoot().getName()+" has been parsed."); //$NON-NLS-1$
//$NON-NLS-2$
-
- // The loading of metadata from data sources will be done during the real deploy
- // as the resources are guaranteed to be available by that time.
- return vdb;
- }
-}
Deleted: branches/as7/runtime/src/main/java/org/teiid/deployers/ManagedPropertyUtil.java
===================================================================
---
branches/as7/runtime/src/main/java/org/teiid/deployers/ManagedPropertyUtil.java 2011-06-27
14:25:00 UTC (rev 3273)
+++
branches/as7/runtime/src/main/java/org/teiid/deployers/ManagedPropertyUtil.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -1,159 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.deployers;
-
-import java.io.Serializable;
-import java.lang.reflect.Method;
-import java.util.HashSet;
-
-import org.jboss.managed.api.Fields;
-import org.jboss.managed.api.ManagedProperty;
-import org.jboss.managed.plugins.DefaultFieldsImpl;
-import org.jboss.managed.plugins.ManagedPropertyImpl;
-import org.jboss.metatype.api.types.MetaType;
-import org.jboss.metatype.api.types.SimpleMetaType;
-import org.jboss.metatype.api.values.MetaValue;
-import org.jboss.metatype.api.values.SimpleValueSupport;
-import org.teiid.core.TeiidRuntimeException;
-import org.teiid.translator.TranslatorProperty;
-
-public class ManagedPropertyUtil {
- private static final String TEIID_PROPERTY = "teiid-property"; //$NON-NLS-1$
-
- public static ManagedProperty convert(Object instance, Method method, TranslatorProperty
prop) {
- return (ManagedProperty)convert(instance, method, prop, false);
- }
-
- private static Object convert(Object instance, Method method, TranslatorProperty prop,
boolean needDefaultValue) {
- Class<?> type = method.getReturnType();
- String[] allowedValues = null;
- Method getter = null;
- boolean readOnly = false;
- if (type == Void.TYPE) { //check for setter
- Class<?>[] types = method.getParameterTypes();
- if (types.length != 1) {
- throw new TeiidRuntimeException("TranslatorProperty annotation should be placed
on valid getter or setter method, " + method + " is not valid.");
//$NON-NLS-1$ //$NON-NLS-2$
- }
- type = types[0];
- try {
- getter = instance.getClass().getMethod("get" + method.getName(),
(Class[])null); //$NON-NLS-1$
- } catch (Exception e) {
- try {
- getter = instance.getClass().getMethod("get" +
method.getName().substring(3), (Class[])null); //$NON-NLS-1$
- } catch (Exception e1) {
- //can't find getter, won't set the default value
- }
- }
- } else if (method.getParameterTypes().length != 0) {
- throw new TeiidRuntimeException("TranslatorProperty annotation should be placed
on valid getter or setter method, " + method + " is not valid.");
//$NON-NLS-1$ //$NON-NLS-2$
- } else {
- getter = method;
- try {
- TranslatorUtil.getSetter(instance.getClass(), method);
- } catch (Exception e) {
- readOnly = true;
- }
- }
- Object defaultValue = null;
- if (prop.required()) {
- if (prop.advanced()) {
- throw new TeiidRuntimeException("TranslatorProperty annotation should not both
be advanced and required " + method); //$NON-NLS-1$
- }
- } else if (getter != null) {
- try {
- defaultValue = getter.invoke(instance, (Object[])null);
- } catch (Exception e) {
- //no simple default value
- }
- }
- if (type.isEnum()) {
- Object[] constants = type.getEnumConstants();
- allowedValues = new String[constants.length];
- for( int i=0; i<constants.length; i++ ) {
- allowedValues[i] = ((Enum<?>)constants[i]).name();
- }
- type = String.class;
- if (defaultValue != null) {
- defaultValue = ((Enum<?>)defaultValue).name();
- }
- }
- if (!(defaultValue instanceof Serializable)) {
- defaultValue = null; //TODO
- }
- if (needDefaultValue) {
- return defaultValue;
- }
- return createProperty(TranslatorUtil.getPropertyName(method),
SimpleMetaType.resolve(type.getName()),
- prop.display(), prop.description(), prop.required(), readOnly,
(Serializable)defaultValue,
- prop.advanced(), prop.masked(), allowedValues);
- }
-
- public static Object getDefaultValue(Object instance, Method method, TranslatorProperty
prop) {
- return convert(instance, method, prop, true);
- }
-
- public static ManagedProperty convert(ExtendedPropertyMetadata prop) {
- return createProperty(prop.name(), SimpleMetaType.resolve(prop.type()),
- prop.display(), prop.description(), prop.required(), prop.readOnly(),
prop.defaultValue(),
- prop.advanced(), prop.masked(), prop.allowed());
- }
-
- public static ManagedProperty createProperty(String name,
- MetaType type, String displayName, String description,
- boolean mandatory, boolean readOnly, Serializable defaultValue) {
-
- DefaultFieldsImpl fields = new DefaultFieldsImpl(name);
- fields.setDescription(description);
- fields.setField(Fields.MAPPED_NAME,displayName);
- fields.setMetaType(type);
- fields.setField(Fields.MANDATORY, SimpleValueSupport.wrap(mandatory));
- fields.setField(Fields.READ_ONLY, SimpleValueSupport.wrap(readOnly));
- fields.setField(TEIID_PROPERTY, SimpleValueSupport.wrap(true));
-
- if (defaultValue != null) {
- fields.setField(Fields.DEFAULT_VALUE, SimpleValueSupport.wrap(defaultValue));
- }
- return new ManagedPropertyImpl(fields);
- }
-
- public static ManagedProperty createProperty(String name,
- SimpleMetaType type, String displayName, String description,
- boolean mandatory, boolean readOnly, Serializable defaultValue, boolean advanced,
- boolean masked, String[] allowed) {
-
- ManagedProperty mp = createProperty(name, type, displayName, description, mandatory,
readOnly, defaultValue);
- mp.setField("advanced", SimpleValueSupport.wrap(advanced));//$NON-NLS-1$
- mp.setField("masked", SimpleValueSupport.wrap(masked));//$NON-NLS-1$
- if (allowed != null) {
- HashSet<MetaValue> values = new HashSet<MetaValue>();
- for (String value:allowed) {
- values.add(SimpleValueSupport.wrap(value));
- }
- mp.setField(Fields.LEGAL_VALUES, values);
- }
- return mp;
- }
-
- public static void markAsTeiidProperty(ManagedProperty mp) {
- mp.setField(TEIID_PROPERTY, SimpleValueSupport.wrap(true));
- }
-}
Modified: branches/as7/runtime/src/main/java/org/teiid/deployers/ObjectSerializer.java
===================================================================
---
branches/as7/runtime/src/main/java/org/teiid/deployers/ObjectSerializer.java 2011-06-27
14:25:00 UTC (rev 3273)
+++
branches/as7/runtime/src/main/java/org/teiid/deployers/ObjectSerializer.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -21,15 +21,10 @@
*/
package org.teiid.deployers;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
+import java.io.*;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
import org.jboss.logging.Logger;
+import org.jboss.vfs.VirtualFile;
import org.teiid.core.util.FileUtils;
import org.teiid.logging.LogConstants;
import org.teiid.logging.LogManager;
@@ -44,7 +39,7 @@
private String storagePath;
- public void setAttachmentStoreRoot(String path) {
+ public ObjectSerializer(String path) {
this.storagePath = path;
}
@@ -84,12 +79,12 @@
return (cacheFile.exists() && timeAfter > cacheFile.lastModified());
}
- public void removeAttachments(VFSDeploymentUnit vf) {
+ public void removeAttachments(VirtualFile vf) {
String dirName = baseDirectory(vf);
FileUtils.removeDirectoryAndChildren(new File(dirName));
}
- public File getAttachmentPath(VFSDeploymentUnit vf, String baseName) {
+ public File getAttachmentPath(VirtualFile vf, String baseName) {
String dirName = baseDirectory(vf);
@@ -101,8 +96,8 @@
return f;
}
- private String baseDirectory(VFSDeploymentUnit vf) {
- String fileName = vf.getRoot().getName();
+ private String baseDirectory(VirtualFile vf) {
+ String fileName = vf.getName();
String dirName = this.storagePath + File.separator + fileName + File.separator;
return dirName;
}
Added: branches/as7/runtime/src/main/java/org/teiid/deployers/TeiidAttachments.java
===================================================================
--- branches/as7/runtime/src/main/java/org/teiid/deployers/TeiidAttachments.java
(rev 0)
+++
branches/as7/runtime/src/main/java/org/teiid/deployers/TeiidAttachments.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -0,0 +1,57 @@
+/*
+ * 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.
+ */
+
+package org.teiid.deployers;
+
+import org.jboss.as.server.deployment.AttachmentKey;
+import org.jboss.as.server.deployment.DeploymentUnit;
+import org.teiid.adminapi.impl.VDBMetaData;
+import org.teiid.metadata.index.IndexMetadataFactory;
+
+public final class TeiidAttachments {
+
+ enum DeploymentType{VDB, DYNAMIC_VDB};
+
+ public static final AttachmentKey<VDBMetaData> VDB_METADATA =
AttachmentKey.create(VDBMetaData.class);
+ public static final AttachmentKey<UDFMetaData> UDF_METADATA =
AttachmentKey.create(UDFMetaData.class);
+ public static final AttachmentKey<IndexMetadataFactory> INDEX_METADATA =
AttachmentKey.create(IndexMetadataFactory.class);
+ public static final AttachmentKey<MetadataStoreGroup> METADATA_STORE =
AttachmentKey.create(MetadataStoreGroup.class);
+
+ public static final AttachmentKey<DeploymentType> DEPLOYMENT_TYPE =
AttachmentKey.create(DeploymentType.class);
+
+ public static boolean isVDBDeployment(final DeploymentUnit deploymentUnit) {
+ return DeploymentType.VDB == deploymentUnit.getAttachment(DEPLOYMENT_TYPE) ||
DeploymentType.DYNAMIC_VDB == deploymentUnit.getAttachment(DEPLOYMENT_TYPE);
+ }
+
+ public static boolean isDynamicVDB(final DeploymentUnit deploymentUnit) {
+ return DeploymentType.DYNAMIC_VDB ==
deploymentUnit.getAttachment(DEPLOYMENT_TYPE);
+ }
+
+ public static void setAsVDBDeployment(final DeploymentUnit deploymentUnit) {
+ deploymentUnit.putAttachment(DEPLOYMENT_TYPE, DeploymentType.VDB);
+ }
+
+ public static void setAsDynamicVDBDeployment(final DeploymentUnit deploymentUnit) {
+ deploymentUnit.putAttachment(DEPLOYMENT_TYPE, DeploymentType.DYNAMIC_VDB);
+ }
+
+}
Property changes on:
branches/as7/runtime/src/main/java/org/teiid/deployers/TeiidAttachments.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Deleted:
branches/as7/runtime/src/main/java/org/teiid/deployers/TranslatorAnnotationScanningDeployer.java
===================================================================
---
branches/as7/runtime/src/main/java/org/teiid/deployers/TranslatorAnnotationScanningDeployer.java 2011-06-27
14:25:00 UTC (rev 3273)
+++
branches/as7/runtime/src/main/java/org/teiid/deployers/TranslatorAnnotationScanningDeployer.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -1,157 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.deployers;
-
-import java.util.Collection;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.annotations.AnnotationEnvironment;
-import org.jboss.deployers.spi.deployer.helpers.AbstractAnnotationDeployer;
-import org.jboss.deployers.spi.deployer.helpers.AbstractAnnotationProcessor;
-import org.jboss.deployers.spi.deployer.managed.ManagedObjectCreator;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.managed.api.ManagedObject;
-import org.jboss.managed.api.factory.ManagedObjectFactory;
-import org.teiid.adminapi.impl.TranslatorMetaData;
-import org.teiid.dqp.internal.datamgr.TranslatorRepository;
-import org.teiid.logging.LogConstants;
-import org.teiid.logging.LogManager;
-import org.teiid.runtime.RuntimePlugin;
-import org.teiid.translator.Translator;
-
-/**
- * This translator looks for classes with {@link Translator} annotation, if it finds it
tries to build metadata based on that
- * annotation.
- * TODO: the logic in the translator deployers need to be consolidated.
- */
-public class TranslatorAnnotationScanningDeployer extends AbstractAnnotationDeployer
implements ManagedObjectCreator {
-
- private TranslatorRepository translatorRepository;
- private VDBStatusChecker vdbChecker;
- private ManagedObjectFactory mof;
-
- public TranslatorAnnotationScanningDeployer() {
- super(new TranslatorAnnotationProcessor());
- }
-
- private static class TranslatorAnnotationProcessor extends
AbstractAnnotationProcessor<Translator, TranslatorMetaData> {
- public Class<Translator> getAnnotation() {
- return Translator.class;
- }
-
- public Class<TranslatorMetaData> getOutput() {
- return TranslatorMetaData.class;
- }
-
- // this is called with-in the deploy
- protected TranslatorMetaData createMetaDataFromClass(Class<?> clazz, Translator
bean) {
- String name = bean.name();
- if (name == null) {
- throw new IllegalArgumentException("Null Translator name: " + clazz);
//$NON-NLS-1$
- }
-
- TranslatorMetaData data = new TranslatorMetaData();
- data.setName(bean.name());
- data.setExecutionFactoryClass(clazz);
- data.setDescription(bean.description());
-
- return data;
- }
- }
-
- public void deploy(DeploymentUnit unit, AnnotationEnvironment deployment) throws
DeploymentException {
- super.deploy(unit, deployment);
-
- Collection<Object> group = unit.getAttachments().values();
-
- for (Object anObj : group) {
- if (anObj instanceof TranslatorMetaData) {
- TranslatorMetaData data = (TranslatorMetaData)anObj;
- String translatorName = data.getName();
- if (translatorName == null) {
- throw new
DeploymentException(RuntimePlugin.Util.getString("name_not_found",
unit.getName())); //$NON-NLS-1$
- }
-
- // fill with default properties for the tooling to see the properties
- Properties props =
TranslatorUtil.getTranslatorPropertiesAsProperties(data.getExecutionFactoryClass());
- data.setProperties(props);
- data.addProperty(TranslatorMetaData.EXECUTION_FACTORY_CLASS,
data.getExecutionFactoryClass().getName());
-
- this.translatorRepository.addTranslatorMetadata(translatorName, data);
- LogManager.logInfo(LogConstants.CTX_RUNTIME,
RuntimePlugin.Util.getString("translator_added", translatorName));
//$NON-NLS-1$
- this.vdbChecker.translatorAdded(translatorName);
- }
- }
- }
-
- @Override
- public void undeploy(DeploymentUnit unit, AnnotationEnvironment deployment) {
- super.undeploy(unit, deployment);
-
- Collection<Object> group = unit.getAttachments().values();
-
- for (Object anObj : group) {
- if (anObj instanceof TranslatorMetaData) {
- TranslatorMetaData data = (TranslatorMetaData)anObj;
- String translatorName = data.getName();
- if (this.translatorRepository != null) {
- this.translatorRepository.removeTranslatorMetadata(translatorName);
- LogManager.logInfo(LogConstants.CTX_RUNTIME,
RuntimePlugin.Util.getString("translator_removed", translatorName));
//$NON-NLS-1$
- this.vdbChecker.translatorRemoved(translatorName);
- }
- }
- }
- }
-
- @Override
- public void build(DeploymentUnit unit, Set<String> attachmentNames, Map<String,
ManagedObject> managedObjects) throws DeploymentException {
- Collection<Object> group = unit.getAttachments().values();
-
- for (Object anObj : group) {
- if (anObj instanceof TranslatorMetaData) {
- TranslatorMetaData data = (TranslatorMetaData)anObj;
-
- ManagedObject mo = this.mof.initManagedObject(data, TranslatorMetaData.class,
data.getName(),data.getName());
- if (mo == null) {
- throw new DeploymentException("could not create managed object");
//$NON-NLS-1$
- }
- managedObjects.put(mo.getName(), mo);
-
- }
- }
- }
-
- public void setTranslatorRepository(TranslatorRepository repo) {
- this.translatorRepository = repo;
- }
-
- public void setVDBStatusChecker(VDBStatusChecker checker) {
- this.vdbChecker = checker;
- }
-
- public void setManagedObjectFactory(ManagedObjectFactory mof) {
- this.mof = mof;
- }
-}
\ No newline at end of file
Deleted: branches/as7/runtime/src/main/java/org/teiid/deployers/TranslatorDeployer.java
===================================================================
---
branches/as7/runtime/src/main/java/org/teiid/deployers/TranslatorDeployer.java 2011-06-27
14:25:00 UTC (rev 3273)
+++
branches/as7/runtime/src/main/java/org/teiid/deployers/TranslatorDeployer.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -1,100 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.deployers;
-
-import java.util.Set;
-
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.teiid.adminapi.Translator;
-import org.teiid.adminapi.impl.TranslatorMetaData;
-import org.teiid.dqp.internal.datamgr.TranslatorRepository;
-import org.teiid.logging.LogConstants;
-import org.teiid.logging.LogManager;
-import org.teiid.runtime.RuntimePlugin;
-
-
-/**
- * Deployer for the Translator
- */
-public class TranslatorDeployer extends
AbstractSimpleRealDeployer<TranslatorMetaDataGroup> {
-
- private TranslatorRepository translatorRepository;
- private VDBStatusChecker vdbChecker;
-
- public TranslatorDeployer() {
- super(TranslatorMetaDataGroup.class);
- }
-
- @Override
- public void deploy(DeploymentUnit unit, TranslatorMetaDataGroup group) throws
DeploymentException {
-
- for (TranslatorMetaData data:group.getTranslators()) {
- String translatorName = data.getName();
- if (translatorName == null) {
- throw new
DeploymentException(RuntimePlugin.Util.getString("name_not_found",
unit.getName())); //$NON-NLS-1$
- }
-
- String type = data.getType();
- Translator parent = this.translatorRepository.getTranslatorMetaData(type);
- if ( parent == null) {
- throw new
DeploymentException(RuntimePlugin.Util.getString("translator_type_not_found",
unit.getName())); //$NON-NLS-1$
- }
-
- // fill with default properties ignoring the overridden ones.
- Set<String> keys = parent.getProperties().stringPropertyNames();
- for (String key:keys) {
- if (data.getPropertyValue(key) == null && parent.getPropertyValue(key) !=
null) {
- data.addProperty(key, parent.getPropertyValue(key));
- }
- }
-
- this.translatorRepository.addTranslatorMetadata(translatorName, data);
- LogManager.logInfo(LogConstants.CTX_RUNTIME,
RuntimePlugin.Util.getString("translator_added", translatorName));
//$NON-NLS-1$
- this.vdbChecker.translatorAdded(translatorName);
- }
- }
-
- @Override
- public void undeploy(DeploymentUnit unit, TranslatorMetaDataGroup group) {
- super.undeploy(unit, group);
-
- for (TranslatorMetaData data:group.getTranslators()) {
-
- String translatorName = data.getName();
- if (this.translatorRepository != null) {
- this.translatorRepository.removeTranslatorMetadata(translatorName);
- LogManager.logInfo(LogConstants.CTX_RUNTIME,
RuntimePlugin.Util.getString("translator_removed", translatorName));
//$NON-NLS-1$
- this.vdbChecker.translatorRemoved(translatorName);
- }
- }
- }
-
- public void setTranslatorRepository(TranslatorRepository repo) {
- this.translatorRepository = repo;
- }
-
- public void setVDBStatusChecker(VDBStatusChecker checker) {
- this.vdbChecker = checker;
- }
-}
Deleted:
branches/as7/runtime/src/main/java/org/teiid/deployers/TranslatorMetaDataGroup.java
===================================================================
---
branches/as7/runtime/src/main/java/org/teiid/deployers/TranslatorMetaDataGroup.java 2011-06-27
14:25:00 UTC (rev 3273)
+++
branches/as7/runtime/src/main/java/org/teiid/deployers/TranslatorMetaDataGroup.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -1,49 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, 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.deployers;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-
-import org.jboss.managed.api.annotation.ManagementObject;
-import org.jboss.managed.api.annotation.ManagementProperty;
-import org.teiid.adminapi.impl.TranslatorMetaData;
-
-@ManagementObject
-@XmlRootElement(name = "translator-factory")
-public class TranslatorMetaDataGroup {
-
- @XmlElement(name = "translator", type = TranslatorMetaData.class)
- protected List<TranslatorMetaData> translators = new
ArrayList<TranslatorMetaData>();
-
- @ManagementProperty(description="translators", managed=true)
- public List<TranslatorMetaData> getTranslators(){
- return this.translators;
- }
-
- public void addTranslator(TranslatorMetaData data) {
- this.translators.add(data);
- }
-}
Deleted:
branches/as7/runtime/src/main/java/org/teiid/deployers/TranslatorParserDeployer.java
===================================================================
---
branches/as7/runtime/src/main/java/org/teiid/deployers/TranslatorParserDeployer.java 2011-06-27
14:25:00 UTC (rev 3273)
+++
branches/as7/runtime/src/main/java/org/teiid/deployers/TranslatorParserDeployer.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -1,101 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, 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.deployers;
-
-import java.io.InputStream;
-import java.util.Map;
-import java.util.Set;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBElement;
-import javax.xml.bind.Unmarshaller;
-import javax.xml.transform.sax.SAXSource;
-
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.deployer.managed.ManagedObjectCreator;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.deployers.vfs.spi.deployer.AbstractVFSParsingDeployer;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.managed.api.ManagedObject;
-import org.jboss.managed.api.ManagedProperty;
-import org.jboss.metatype.api.types.MetaType;
-import org.jboss.metatype.api.values.CollectionValue;
-import org.jboss.metatype.api.values.GenericValue;
-import org.jboss.metatype.api.values.MetaValue;
-import org.jboss.util.xml.JBossEntityResolver;
-import org.jboss.virtual.VirtualFile;
-import org.xml.sax.InputSource;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.XMLReaderFactory;
-
-
-public class TranslatorParserDeployer extends
AbstractVFSParsingDeployer<TranslatorMetaDataGroup> implements ManagedObjectCreator
{
- public static final String TRANSLATOR_SUFFIX = "-translator.xml";
//$NON-NLS-1$
-
- public TranslatorParserDeployer() {
- super(TranslatorMetaDataGroup.class);
- setIncludeDeploymentFile(true);
- setSuffix(TRANSLATOR_SUFFIX);
- setBuildManagedObject(true);
- }
-
- @Override
- protected TranslatorMetaDataGroup parse(VFSDeploymentUnit unit, VirtualFile file,
TranslatorMetaDataGroup root) throws Exception {
- JAXBContext context = JAXBContext.newInstance(new Class[]
{TranslatorMetaDataGroup.class});
- Unmarshaller um = context.createUnmarshaller();
- InputStream is = file.openStream();
-
- try{
- InputSource input = new InputSource(is);
- input.setSystemId(file.toURI().toString());
- XMLReader reader = XMLReaderFactory.createXMLReader();
- reader.setEntityResolver(new JBossEntityResolver());
- SAXSource source = new SAXSource(reader, input);
- JAXBElement<TranslatorMetaDataGroup> elem = um.unmarshal(source,
TranslatorMetaDataGroup.class);
- TranslatorMetaDataGroup deployment = elem.getValue();
- return deployment;
- }
- finally {
- if (is != null)
- is.close();
- }
- }
-
- public void build(DeploymentUnit unit, Set<String> outputs, Map<String,
ManagedObject> managedObjects) throws DeploymentException {
- if (isBuildManagedObject()) {
- ManagedObject mo = managedObjects.get(TranslatorMetaDataGroup.class.getName());
- if (mo != null) {
- ManagedProperty translators = mo.getProperty("translators"); //$NON-NLS-1$
- MetaType propType = translators.getMetaType();
- if (propType.isCollection()) {
- CollectionValue value = (CollectionValue) translators.getValue();
- if (value != null) {
- for (MetaValue element:value.getElements()) {
- ManagedObject translator = (ManagedObject)((GenericValue)element).getValue();
- managedObjects.put(translator.getName(), translator);
- }
- }
- }
- }
- }
- }
-}
Modified: branches/as7/runtime/src/main/java/org/teiid/deployers/TranslatorUtil.java
===================================================================
--- branches/as7/runtime/src/main/java/org/teiid/deployers/TranslatorUtil.java 2011-06-27
14:25:00 UTC (rev 3273)
+++ branches/as7/runtime/src/main/java/org/teiid/deployers/TranslatorUtil.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -21,6 +21,7 @@
*/
package org.teiid.deployers;
+import java.io.Serializable;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.HashMap;
@@ -28,10 +29,12 @@
import java.util.Properties;
import java.util.TreeMap;
-import org.jboss.deployers.spi.DeploymentException;
+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;
import org.teiid.core.util.ReflectionHelper;
import org.teiid.core.util.StringUtil;
import org.teiid.logging.LogConstants;
@@ -54,7 +57,7 @@
Object instance = attachmentClass.newInstance();
Map<Method, TranslatorProperty> tps =
TranslatorUtil.getTranslatorProperties(attachmentClass);
for (Method m:tps.keySet()) {
- Object defaultValue = ManagedPropertyUtil.getDefaultValue(instance, m, tps.get(m));
+ Object defaultValue = getDefaultValue(instance, m, tps.get(m));
if (defaultValue != null) {
props.setProperty(getPropertyName(m), defaultValue.toString());
}
@@ -86,13 +89,13 @@
}
}
- public static ExecutionFactory buildExecutionFactory(Translator data) throws
DeploymentException {
+ public static ExecutionFactory buildExecutionFactory(Translator data) throws
DeploymentUnitProcessingException {
ExecutionFactory executionFactory;
try {
String executionClass =
data.getPropertyValue(TranslatorMetaData.EXECUTION_FACTORY_CLASS);
Object o = ReflectionHelper.create(executionClass, null,
Thread.currentThread().getContextClassLoader());
if(!(o instanceof ExecutionFactory)) {
- throw new DeploymentException(RuntimePlugin.Util.getString("invalid_class",
executionClass));//$NON-NLS-1$
+ throw new
DeploymentUnitProcessingException(RuntimePlugin.Util.getString("invalid_class",
executionClass));//$NON-NLS-1$
}
executionFactory = (ExecutionFactory)o;
@@ -100,15 +103,15 @@
executionFactory.start();
return executionFactory;
} catch (TeiidException e) {
- throw new DeploymentException(e);
+ throw new DeploymentUnitProcessingException(e);
} catch (InvocationTargetException e) {
- throw new DeploymentException(e);
+ throw new DeploymentUnitProcessingException(e);
} catch (IllegalAccessException e) {
- throw new DeploymentException(e);
+ throw new DeploymentUnitProcessingException(e);
}
}
- private static void injectProperties(ExecutionFactory ef, final Translator data) throws
InvocationTargetException, IllegalAccessException, DeploymentException{
+ private static void injectProperties(ExecutionFactory ef, final Translator data) throws
InvocationTargetException, IllegalAccessException, DeploymentUnitProcessingException{
Map<Method, TranslatorProperty> props =
TranslatorUtil.getTranslatorProperties(ef.getClass());
Map p = data.getProperties();
TreeMap<String, String> caseInsensitivProps = new TreeMap<String,
String>(String.CASE_INSENSITIVE_ORDER);
@@ -122,7 +125,7 @@
Method setterMethod = getSetter(ef.getClass(), method);
setterMethod.invoke(ef, convert(value, method.getReturnType()));
} else if (tp.required()) {
- throw new
DeploymentException(RuntimePlugin.Util.getString("required_property_not_exists",
tp.display())); //$NON-NLS-1$
+ throw new
DeploymentUnitProcessingException(RuntimePlugin.Util.getString("required_property_not_exists",
tp.display())); //$NON-NLS-1$
}
}
caseInsensitivProps.remove(Translator.EXECUTION_FACTORY_CLASS);
@@ -142,7 +145,7 @@
return result;
}
- public static Method getSetter(Class<?> clazz, Method method) throws
SecurityException, DeploymentException {
+ public static Method getSetter(Class<?> clazz, Method method) throws
SecurityException, DeploymentUnitProcessingException {
String setter = method.getName();
if (method.getName().startsWith("get")) { //$NON-NLS-1$
setter = "set"+setter.substring(3);//$NON-NLS-1$
@@ -159,7 +162,7 @@
try {
return clazz.getMethod(method.getName(), method.getReturnType());
} catch (NoSuchMethodException e1) {
- throw new DeploymentException(RuntimePlugin.Util.getString("no_set_method",
setter, method.getName())); //$NON-NLS-1$
+ throw new
DeploymentUnitProcessingException(RuntimePlugin.Util.getString("no_set_method",
setter, method.getName())); //$NON-NLS-1$
}
}
}
@@ -175,4 +178,87 @@
}
return value;
}
+
+ public static VDBTranslatorMetaData buildTranslatorMetadata(ExecutionFactory factory,
String moduleName) {
+
+ org.teiid.translator.Translator translator =
factory.getClass().getAnnotation(org.teiid.translator.Translator.class);
+ if (translator == null) {
+ return null;
+ }
+
+ VDBTranslatorMetaData metadata = new VDBTranslatorMetaData();
+ metadata.setName(translator.name());
+ metadata.setDescription(translator.description());
+ metadata.setExecutionFactoryClass(factory.getClass());
+ metadata.setModuleName(moduleName);
+
+ Properties props = getTranslatorPropertiesAsProperties(factory.getClass());
+ for (String key:props.stringPropertyNames()) {
+ metadata.addProperty(key, props.getProperty(key));
+ }
+ return metadata;
+ }
+
+ private static Object convert(Object instance, Method method, TranslatorProperty prop)
{
+ Class<?> type = method.getReturnType();
+ String[] allowedValues = null;
+ Method getter = null;
+ boolean readOnly = false;
+ if (type == Void.TYPE) { //check for setter
+ Class<?>[] types = method.getParameterTypes();
+ if (types.length != 1) {
+ throw new TeiidRuntimeException("TranslatorProperty annotation should be placed
on valid getter or setter method, " + method + " is not valid.");
//$NON-NLS-1$ //$NON-NLS-2$
+ }
+ type = types[0];
+ try {
+ getter = instance.getClass().getMethod("get" + method.getName(),
(Class[])null); //$NON-NLS-1$
+ } catch (Exception e) {
+ try {
+ getter = instance.getClass().getMethod("get" +
method.getName().substring(3), (Class[])null); //$NON-NLS-1$
+ } catch (Exception e1) {
+ //can't find getter, won't set the default value
+ }
+ }
+ } else if (method.getParameterTypes().length != 0) {
+ throw new TeiidRuntimeException("TranslatorProperty annotation should be placed
on valid getter or setter method, " + method + " is not valid.");
//$NON-NLS-1$ //$NON-NLS-2$
+ } else {
+ getter = method;
+ try {
+ TranslatorUtil.getSetter(instance.getClass(), method);
+ } catch (Exception e) {
+ readOnly = true;
+ }
+ }
+ Object defaultValue = null;
+ if (prop.required()) {
+ if (prop.advanced()) {
+ throw new TeiidRuntimeException("TranslatorProperty annotation should not both
be advanced and required " + method); //$NON-NLS-1$
+ }
+ } else if (getter != null) {
+ try {
+ defaultValue = getter.invoke(instance, (Object[])null);
+ } catch (Exception e) {
+ //no simple default value
+ }
+ }
+ if (type.isEnum()) {
+ Object[] constants = type.getEnumConstants();
+ allowedValues = new String[constants.length];
+ for( int i=0; i<constants.length; i++ ) {
+ allowedValues[i] = ((Enum<?>)constants[i]).name();
+ }
+ type = String.class;
+ if (defaultValue != null) {
+ defaultValue = ((Enum<?>)defaultValue).name();
+ }
+ }
+ if (!(defaultValue instanceof Serializable)) {
+ defaultValue = null; //TODO
+ }
+ return defaultValue;
+ }
+
+ public static Object getDefaultValue(Object instance, Method method, TranslatorProperty
prop) {
+ return convert(instance, method, prop);
+ }
}
Modified: branches/as7/runtime/src/main/java/org/teiid/deployers/UDFMetaData.java
===================================================================
--- branches/as7/runtime/src/main/java/org/teiid/deployers/UDFMetaData.java 2011-06-27
14:25:00 UTC (rev 3273)
+++ branches/as7/runtime/src/main/java/org/teiid/deployers/UDFMetaData.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -22,17 +22,11 @@
package org.teiid.deployers;
import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
import javax.xml.bind.JAXBException;
-import org.jboss.managed.api.annotation.ManagementObject;
-import org.jboss.virtual.VirtualFile;
-import org.teiid.api.exception.query.QueryMetadataException;
+import org.jboss.vfs.VirtualFile;
import org.teiid.metadata.FunctionMethod;
import org.teiid.query.QueryPlugin;
import org.teiid.query.function.metadata.FunctionMetadataReader;
@@ -42,7 +36,6 @@
import org.teiid.runtime.RuntimePlugin;
-@ManagementObject
public class UDFMetaData {
private HashMap<String, Collection <FunctionMethod>> methods = new
HashMap<String, Collection<FunctionMethod>>();
private HashMap<String, VirtualFile> files = new HashMap<String,
VirtualFile>();
@@ -52,7 +45,7 @@
}
- void buildFunctionModelFile(String name, String path) throws IOException, JAXBException,
QueryMetadataException {
+ void buildFunctionModelFile(String name, String path) throws IOException, JAXBException
{
for (String f:files.keySet()) {
if (f.endsWith(path)) {
path = f;
@@ -67,7 +60,7 @@
ActivityReport<ReportItem> report = new
ActivityReport<ReportItem>("UDF load"); //$NON-NLS-1$
FunctionMetadataValidator.validateFunctionMethods(udfMethods,report);
if(report.hasItems()) {
- throw new
QueryMetadataException(QueryPlugin.Util.getString("ERR.015.001.0005", report));
//$NON-NLS-1$
+ throw new IOException(QueryPlugin.Util.getString("ERR.015.001.0005",
report)); //$NON-NLS-1$
}
this.methods.put(name, udfMethods);
}
Added: branches/as7/runtime/src/main/java/org/teiid/deployers/VDBDependencyProcessor.java
===================================================================
--- branches/as7/runtime/src/main/java/org/teiid/deployers/VDBDependencyProcessor.java
(rev 0)
+++
branches/as7/runtime/src/main/java/org/teiid/deployers/VDBDependencyProcessor.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -0,0 +1,99 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.deployers;
+
+import java.io.Closeable;
+import java.io.IOException;
+import java.util.List;
+
+import org.jboss.as.server.deployment.*;
+import org.jboss.as.server.deployment.module.*;
+import org.jboss.modules.Module;
+import org.jboss.modules.ModuleIdentifier;
+import org.jboss.modules.ModuleLoadException;
+import org.jboss.modules.ModuleLoader;
+import org.jboss.vfs.VFS;
+import org.jboss.vfs.VirtualFile;
+import org.jboss.vfs.VirtualFileFilter;
+import org.jboss.vfs.VisitorAttributes;
+import org.jboss.vfs.util.SuffixMatchFilter;
+import org.teiid.adminapi.impl.ModelMetaData;
+import org.teiid.adminapi.impl.VDBMetaData;
+
+public class VDBDependencyProcessor implements DeploymentUnitProcessor {
+ public static final String LIB = "/lib"; //$NON-NLS-1$
+ private static final VirtualFileFilter DEFAULT_JAR_LIB_FILTER = new
SuffixMatchFilter(".jar", VisitorAttributes.DEFAULT); //$NON-NLS-1$
+
+ @Override
+ public void deploy(DeploymentPhaseContext phaseContext) throws
DeploymentUnitProcessingException {
+ DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
+ if (!TeiidAttachments.isVDBDeployment(deploymentUnit)) {
+ return;
+ }
+
+ if (!TeiidAttachments.isDynamicVDB(deploymentUnit)) {
+ final ResourceRoot deploymentResourceRoot =
deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT);
+ final VirtualFile deploymentRoot = deploymentResourceRoot.getRoot();
+ if(deploymentRoot == null) {
+ return;
+ }
+
+ try {
+ final VirtualFile libDir = deploymentRoot.getChild(LIB);
+ if (libDir.exists()) {
+ final List<VirtualFile> archives =
libDir.getChildren(DEFAULT_JAR_LIB_FILTER);
+ for (final VirtualFile archive : archives) {
+ try {
+ final Closeable closable = VFS.mountZip(archive,
archive,TempFileProviderService.provider());
+ final ResourceRoot jarArchiveRoot = new ResourceRoot(archive.getName(), archive,
new MountHandle(closable));
+ ModuleRootMarker.mark(jarArchiveRoot);
+ deploymentUnit.addToAttachmentList(Attachments.RESOURCE_ROOTS, jarArchiveRoot);
+ } catch (IOException e) {
+ throw new DeploymentUnitProcessingException("failed to process " +
archive, e); //$NON-NLS-1$
+ }
+ }
+ }
+ } catch(IOException e) {
+ throw new DeploymentUnitProcessingException(e);
+ }
+ }
+
+ // add translators as dependent modules to this VDB.
+ try {
+ final ModuleSpecification moduleSpecification =
deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
+ final ModuleLoader moduleLoader =
Module.getCallerModule().getModule(ModuleIdentifier.create("org.jboss.teiid")).getModuleLoader();
//$NON-NLS-1$
+ VDBMetaData vdb = deploymentUnit.getAttachment(TeiidAttachments.VDB_METADATA);
+
+ for (ModelMetaData model: vdb.getModelMetaDatas().values()) {
+ for (String source:model.getSourceNames()) {
+ moduleSpecification.addDependency(new ModuleDependency(moduleLoader,
ModuleIdentifier.create(model.getSourceTranslatorName(source)), false, false, false));
+ }
+ }
+ } catch (ModuleLoadException e) {
+ throw new DeploymentUnitProcessingException(e);
+ }
+ }
+
+ @Override
+ public void undeploy(DeploymentUnit context) {
+ }
+}
Property changes on:
branches/as7/runtime/src/main/java/org/teiid/deployers/VDBDependencyProcessor.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: branches/as7/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java
===================================================================
--- branches/as7/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java 2011-06-27
14:25:00 UTC (rev 3273)
+++ branches/as7/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -24,18 +24,14 @@
import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.IdentityHashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Set;
+import java.util.*;
+import java.util.concurrent.Executor;
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.util.threadpool.ThreadPool;
+import org.jboss.as.server.deployment.*;
+import org.jboss.msc.service.ServiceBuilder;
+import org.jboss.msc.service.ServiceName;
+import org.jboss.msc.value.InjectedValue;
+import org.jboss.vfs.VirtualFile;
import org.teiid.adminapi.Model;
import org.teiid.adminapi.Translator;
import org.teiid.adminapi.VDB;
@@ -57,22 +53,31 @@
import org.teiid.translator.TranslatorException;
-public class VDBDeployer extends AbstractSimpleRealDeployer<VDBMetaData> {
+public class VDBDeployer implements DeploymentUnitProcessor {
+ public ServiceName VDB_SVC_BASE = ServiceName.JBOSS.append("teiid",
"vdb"); //$NON-NLS-1$ //$NON-NLS-2$
+
private VDBRepository vdbRepository;
private TranslatorRepository translatorRepository;
private ObjectSerializer serializer;
private ContainerLifeCycleListener shutdownListener;
- private ThreadPool threadPool;
+ private InjectedValue<Executor> threadPoolInjector;
- public VDBDeployer() {
- super(VDBMetaData.class);
- setInput(VDBMetaData.class);
- setOutput(VDBMetaData.class);
- setRelativeOrder(3001); // after the data sources
+ public VDBDeployer (VDBRepository repo, InjectedValue<Executor>
threadPoolInjector, TranslatorRepository translatorRepo, ObjectSerializer serializer,
ContainerLifeCycleListener listener) {
+ this.vdbRepository = repo;
+ this.threadPoolInjector = threadPoolInjector;
+ this.translatorRepository = translatorRepo;
+ this.serializer = serializer;
+ this.shutdownListener = listener;
}
-
- @Override
- public void deploy(DeploymentUnit unit, VDBMetaData deployment) throws
DeploymentException {
+
+ public void deploy(final DeploymentPhaseContext context) throws
DeploymentUnitProcessingException {
+ DeploymentUnit deploymentUnit = context.getDeploymentUnit();
+ if (!TeiidAttachments.isVDBDeployment(deploymentUnit)) {
+ return;
+ }
+ VirtualFile file =
deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT).getRoot();
+ VDBMetaData deployment = deploymentUnit.getAttachment(TeiidAttachments.VDB_METADATA);
+
if (this.vdbRepository.removeVDB(deployment.getName(), deployment.getVersion())) {
LogManager.logInfo(LogConstants.CTX_RUNTIME,
RuntimePlugin.Util.getString("redeploying_vdb", deployment)); //$NON-NLS-1$
}
@@ -85,12 +90,12 @@
if (!preview) {
List<String> errors = deployment.getValidityErrors();
if (errors != null && !errors.isEmpty()) {
- throw new
DeploymentException(RuntimePlugin.Util.getString("validity_errors_in_vdb",
deployment)); //$NON-NLS-1$
+ throw new
DeploymentUnitProcessingException(RuntimePlugin.Util.getString("validity_errors_in_vdb",
deployment)); //$NON-NLS-1$
}
}
// get the metadata store of the VDB (this is build in parse stage)
- MetadataStoreGroup store = unit.getAttachment(MetadataStoreGroup.class);
+ MetadataStoreGroup store =
deploymentUnit.getAttachment(TeiidAttachments.METADATA_STORE);
// add required connector managers; if they are not already there
for (Translator t: deployment.getOverrideTranslators()) {
@@ -99,7 +104,7 @@
String type = data.getType();
Translator parent = this.translatorRepository.getTranslatorMetaData(type);
if ( parent == null) {
- throw new
DeploymentException(RuntimePlugin.Util.getString("translator_type_not_found",
unit.getName())); //$NON-NLS-1$
+ throw new
DeploymentUnitProcessingException(RuntimePlugin.Util.getString("translator_type_not_found",
file.getName())); //$NON-NLS-1$
}
Set<String> keys = parent.getProperties().stringPropertyNames();
@@ -115,7 +120,7 @@
// if store is null and vdb dynamic vdb then try to get the metadata
if (store == null && deployment.isDynamic()) {
store = new MetadataStoreGroup();
- asynchLoad = buildDynamicMetadataStore((VFSDeploymentUnit)unit, deployment, store,
cmr);
+ asynchLoad = buildDynamicMetadataStore(file, deployment, store, cmr);
}
// allow empty vdbs for enabling the preview functionality
@@ -128,18 +133,18 @@
}
// check if this is a VDB with index files, if there are then build the
TransformationMetadata
- UDFMetaData udf = unit.getAttachment(UDFMetaData.class);
+ UDFMetaData udf = deploymentUnit.getAttachment(TeiidAttachments.UDF_METADATA);
LinkedHashMap<String, Resource> visibilityMap = null;
- IndexMetadataFactory indexFactory = unit.getAttachment(IndexMetadataFactory.class);
+ IndexMetadataFactory indexFactory =
deploymentUnit.getAttachment(TeiidAttachments.INDEX_METADATA);
if (indexFactory != null) {
visibilityMap = indexFactory.getEntriesPlusVisibilities();
}
- // add the metadata objects as attachments
- deployment.removeAttachment(IndexMetadataFactory.class);
- deployment.removeAttachment(UDFMetaData.class);
- deployment.removeAttachment(MetadataStoreGroup.class);
+ // removethe metadata objects as attachments
+ deploymentUnit.removeAttachment(TeiidAttachments.INDEX_METADATA);
+ deploymentUnit.removeAttachment(TeiidAttachments.UDF_METADATA);
+ deploymentUnit.removeAttachment(TeiidAttachments.METADATA_STORE);
// add transformation metadata to the repository.
this.vdbRepository.addVDB(deployment, store, visibilityMap, udf, cmr);
@@ -148,7 +153,7 @@
synchronized (deployment) {
if (indexFactory != null) {
try {
- saveMetadataStore((VFSDeploymentUnit)unit, deployment, store);
+ saveMetadataStore(file, deployment, store);
} catch (IOException e1) {
LogManager.logWarning(LogConstants.CTX_RUNTIME, e1,
RuntimePlugin.Util.getString("vdb_save_failed",
deployment.getName()+"."+deployment.getVersion())); //$NON-NLS-1$
//$NON-NLS-2$
}
@@ -169,10 +174,19 @@
deployment.setStatus(VDB.Status.ACTIVE);
}
}
+
+ // build a VDB service
+ ServiceBuilder<VDBMetaData> vdbService =
context.getServiceTarget().addService(VDB_SVC_BASE.append(deployment.getName()+"."+deployment.getVersion()),
new VDBService(deployment)); //$NON-NLS-1$
+ for (ModelMetaData model:deployment.getModelMetaDatas().values()) {
+ for (String sourceName:model.getSourceNames()) {
+ vdbService.addDependency(ServiceName.JBOSS.append("data-source",
model.getSourceConnectionJndiName(sourceName))); //$NON-NLS-1$
+ }
+ }
+
LogManager.logInfo(LogConstants.CTX_RUNTIME,
RuntimePlugin.Util.getString("vdb_deployed",deployment,
valid?"active":"inactive")); //$NON-NLS-1$ //$NON-NLS-2$
//$NON-NLS-3$
}
- private void createConnectorManagers(ConnectorManagerRepository cmr,
TranslatorRepository repo, final VDBMetaData deployment) throws DeploymentException {
+ private void createConnectorManagers(ConnectorManagerRepository cmr,
TranslatorRepository repo, final VDBMetaData deployment) throws
DeploymentUnitProcessingException {
IdentityHashMap<Translator, ExecutionFactory<Object, Object>> map = new
IdentityHashMap<Translator, ExecutionFactory<Object, Object>>();
for (Model model:deployment.getModels()) {
@@ -191,16 +205,16 @@
}
}
- private ExecutionFactory<Object, Object> getExecutionFactory(String name,
TranslatorRepository repo, VDBMetaData deployment, IdentityHashMap<Translator,
ExecutionFactory<Object, Object>> map, HashSet<String> building) throws
DeploymentException {
+ private ExecutionFactory<Object, Object> getExecutionFactory(String name,
TranslatorRepository repo, VDBMetaData deployment, IdentityHashMap<Translator,
ExecutionFactory<Object, Object>> map, HashSet<String> building) throws
DeploymentUnitProcessingException {
if (!building.add(name)) {
- throw new
DeploymentException(RuntimePlugin.Util.getString("recursive_delegation",
deployment.getName(), deployment.getVersion(), building)); //$NON-NLS-1$
+ throw new
DeploymentUnitProcessingException(RuntimePlugin.Util.getString("recursive_delegation",
deployment.getName(), deployment.getVersion(), building)); //$NON-NLS-1$
}
Translator translator = repo.getTranslatorMetaData(name);
if (translator == null) {
translator = this.translatorRepository.getTranslatorMetaData(name);
}
if (translator == null) {
- throw new
DeploymentException(RuntimePlugin.Util.getString("translator_not_found",
deployment.getName(), deployment.getVersion(), name)); //$NON-NLS-1$
+ throw new
DeploymentUnitProcessingException(RuntimePlugin.Util.getString("translator_not_found",
deployment.getName(), deployment.getVersion(), name)); //$NON-NLS-1$
}
ExecutionFactory<Object, Object> ef = map.get(translator);
if ( ef == null) {
@@ -241,54 +255,42 @@
return valid;
}
- public void setVDBRepository(VDBRepository repo) {
- this.vdbRepository = repo;
- }
-
@Override
- public void undeploy(DeploymentUnit unit, VDBMetaData deployment) {
- super.undeploy(unit, deployment);
+ public void undeploy(final DeploymentUnit deploymentUnit) {
+ VDBMetaData deployment = deploymentUnit.getAttachment(TeiidAttachments.VDB_METADATA);
+ VirtualFile file =
deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT).getRoot();
if (this.vdbRepository != null) {
this.vdbRepository.removeVDB(deployment.getName(), deployment.getVersion());
}
deployment.setRemoved(true);
-
- try {
- deleteMetadataStore((VFSDeploymentUnit)unit);
- } catch (IOException e) {
- LogManager.logWarning(LogConstants.CTX_RUNTIME,
RuntimePlugin.Util.getString("vdb_delete_failed", e.getMessage()));
//$NON-NLS-1$
- }
+ deleteMetadataStore(file);
LogManager.logInfo(LogConstants.CTX_RUNTIME,
RuntimePlugin.Util.getString("vdb_undeployed", deployment)); //$NON-NLS-1$
}
- public void setObjectSerializer(ObjectSerializer serializer) {
- this.serializer = serializer;
- }
-
- private void saveMetadataStore(VFSDeploymentUnit unit, VDBMetaData vdb,
MetadataStoreGroup store) throws IOException {
+ private void saveMetadataStore(VirtualFile unit, VDBMetaData vdb, MetadataStoreGroup
store) throws IOException {
File cacheFileName = buildCachedVDBFileName(this.serializer, unit, vdb);
if (!cacheFileName.exists()) {
this.serializer.saveAttachment(cacheFileName,store);
- LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB
"+unit.getRoot().getName()+" metadata has been cached to "+ cacheFileName);
//$NON-NLS-1$ //$NON-NLS-2$
+ LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB "+unit.getName()+"
metadata has been cached to "+ cacheFileName); //$NON-NLS-1$ //$NON-NLS-2$
}
}
- private void deleteMetadataStore(VFSDeploymentUnit unit) throws IOException {
- if (!unit.getRoot().exists() || !shutdownListener.isShutdownInProgress()) {
+ private void deleteMetadataStore(VirtualFile unit) {
+ if (!unit.exists() || !shutdownListener.isShutdownInProgress()) {
this.serializer.removeAttachments(unit);
- LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB
"+unit.getRoot().getName()+" metadata removed"); //$NON-NLS-1$
//$NON-NLS-2$
+ LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB "+unit.getName()+"
metadata removed"); //$NON-NLS-1$ //$NON-NLS-2$
}
}
- private boolean buildDynamicMetadataStore(final VFSDeploymentUnit unit, final
VDBMetaData vdb, final MetadataStoreGroup vdbStore, final ConnectorManagerRepository cmr)
throws DeploymentException {
+ private boolean buildDynamicMetadataStore(final VirtualFile unit, final VDBMetaData
vdb, final MetadataStoreGroup vdbStore, final ConnectorManagerRepository cmr) throws
DeploymentUnitProcessingException {
boolean asynch = false;
// make sure we are configured correctly first
for (final ModelMetaData model:vdb.getModelMetaDatas().values()) {
if (model.getSourceNames().isEmpty()) {
- throw new
DeploymentException(RuntimePlugin.Util.getString("fail_to_deploy",
vdb.getName()+"-"+vdb.getVersion(), model.getName())); //$NON-NLS-1$
//$NON-NLS-2$
+ throw new
DeploymentUnitProcessingException(RuntimePlugin.Util.getString("fail_to_deploy",
vdb.getName()+"-"+vdb.getVersion(), model.getName())); //$NON-NLS-1$
//$NON-NLS-2$
}
final boolean cache =
"cached".equalsIgnoreCase(vdb.getPropertyValue("UseConnectorMetadata"));
//$NON-NLS-1$ //$NON-NLS-2$
@@ -303,8 +305,7 @@
}
if (!loaded) {
- asynch = true;
- threadPool.run(new Runnable() {
+ Runnable job = new Runnable() {
@Override
public void run() {
Boolean loadStatus = loadMetadata(vdb, model, cache, cacheFile, vdbStore, cmr);
@@ -316,7 +317,15 @@
model.addAttchment(Runnable.class, this);
}
}
- });
+ };
+ Executor executor = this.threadPoolInjector.getValue();
+ if (executor == null) {
+ job.run();
+ }
+ else {
+ asynch = true;
+ executor.execute(job);
+ }
}
}
return asynch;
@@ -383,23 +392,11 @@
return loaded;
}
- private File buildCachedModelFileName(VFSDeploymentUnit unit, VDBMetaData vdb, String
modelName) {
+ private File buildCachedModelFileName(VirtualFile unit, VDBMetaData vdb, String
modelName) {
return this.serializer.getAttachmentPath(unit,
vdb.getName()+"_"+vdb.getVersion()+"_"+modelName); //$NON-NLS-1$
//$NON-NLS-2$
}
- static File buildCachedVDBFileName(ObjectSerializer serializer, VFSDeploymentUnit unit,
VDBMetaData vdb) {
+ static File buildCachedVDBFileName(ObjectSerializer serializer, VirtualFile unit,
VDBMetaData vdb) {
return serializer.getAttachmentPath(unit,
vdb.getName()+"_"+vdb.getVersion()); //$NON-NLS-1$
}
-
- public void setTranslatorRepository(TranslatorRepository repo) {
- this.translatorRepository = repo;
- }
-
- public void setContainerLifeCycleListener(ContainerLifeCycleListener listener) {
- shutdownListener = listener;
- }
-
- public void setThreadPool(ThreadPool pool) {
- this.threadPool = pool;
- }
}
Modified: branches/as7/runtime/src/main/java/org/teiid/deployers/VDBParserDeployer.java
===================================================================
---
branches/as7/runtime/src/main/java/org/teiid/deployers/VDBParserDeployer.java 2011-06-27
14:25:00 UTC (rev 3273)
+++
branches/as7/runtime/src/main/java/org/teiid/deployers/VDBParserDeployer.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -22,10 +22,8 @@
package org.teiid.deployers;
import java.io.File;
-import java.util.HashMap;
+import java.io.IOException;
import java.util.List;
-import java.util.Map;
-import java.util.Set;
import javax.xml.XMLConstants;
import javax.xml.bind.JAXBContext;
@@ -34,22 +32,14 @@
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.deployer.managed.ManagedObjectCreator;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.managed.api.ManagedObject;
-import org.jboss.managed.api.factory.ManagedObjectFactory;
-import org.jboss.virtual.VirtualFile;
+import org.jboss.as.server.deployment.*;
+import org.jboss.vfs.VirtualFile;
import org.teiid.adminapi.Model;
-import org.teiid.adminapi.Translator;
import org.teiid.adminapi.impl.ModelMetaData;
import org.teiid.adminapi.impl.VDBMetaData;
-import org.teiid.adminapi.impl.VDBTranslatorMetaData;
import org.teiid.logging.LogConstants;
import org.teiid.logging.LogManager;
import org.teiid.metadata.VdbConstants;
-import org.teiid.metadata.index.IndexConstants;
import org.teiid.metadata.index.IndexMetadataFactory;
import org.teiid.runtime.RuntimePlugin;
import org.xml.sax.SAXException;
@@ -58,62 +48,88 @@
/**
* This file loads the "vdb.xml" file inside a ".vdb" file, along
with all the metadata in the .INDEX files
*/
-public class VDBParserDeployer extends BaseMultipleVFSParsingDeployer<VDBMetaData>
implements ManagedObjectCreator {
+public class VDBParserDeployer implements DeploymentUnitProcessor {
private ObjectSerializer serializer;
private VDBRepository vdbRepository;
-
- public VDBParserDeployer() {
- super(VDBMetaData.class, getCustomMappings(),
IndexConstants.NAME_DELIM_CHAR+IndexConstants.INDEX_EXT, IndexMetadataFactory.class,
VdbConstants.MODEL_EXT, UDFMetaData.class);
- setAllowMultipleFiles(true);
+
+ public VDBParserDeployer(VDBRepository repo, ObjectSerializer serializer) {
+ this.vdbRepository = repo;
+ this.serializer = serializer;
}
+
+ public void deploy(final DeploymentPhaseContext phaseContext) throws
DeploymentUnitProcessingException {
+ DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
+ if (!TeiidAttachments.isVDBDeployment(deploymentUnit)) {
+ return;
+ }
- private static Map<String, Class<?>> getCustomMappings() {
- Map<String, Class<?>> mappings = new HashMap<String,
Class<?>>();
- mappings.put(VdbConstants.DEPLOYMENT_FILE, VDBMetaData.class);
- // this not required but the to make the framework with extended classes
- // this required otherwise different version of parse is invoked.
- mappings.put("undefined", UDFMetaData.class); //$NON-NLS-1$
- return mappings;
+ VirtualFile file =
deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT).getRoot();
+
+ if (TeiidAttachments.isDynamicVDB(deploymentUnit)) {
+ parseVDBXML(file, deploymentUnit);
+ }
+ else {
+ // scan for different files
+ List<VirtualFile> childFiles = file.getChildren();
+ for (VirtualFile childFile:childFiles) {
+ scanVDB(childFile, deploymentUnit);
+ }
+
+ mergeMetaData(deploymentUnit);
+ }
}
- @Override
- protected <U> U parse(VFSDeploymentUnit unit, Class<U> expectedType,
VirtualFile file, Object root) throws Exception {
- if (expectedType.equals(VDBMetaData.class)) {
- Unmarshaller un = getUnMarsheller();
- VDBMetaData def = (VDBMetaData)un.unmarshal(file.openStream());
-
- return expectedType.cast(def);
+ private void scanVDB(VirtualFile file, DeploymentUnit deploymentUnit) throws
DeploymentUnitProcessingException {
+ if (file.isDirectory()) {
+ List<VirtualFile> childFiles = file.getChildren();
+ for (VirtualFile childFile:childFiles) {
+ scanVDB(childFile, deploymentUnit);
+ }
}
- else if (expectedType.equals(UDFMetaData.class)) {
- if (root == null) {
- root = unit.getAttachment(UDFMetaData.class);
- if (root == null) {
- root = new UDFMetaData();
- unit.addAttachment(UDFMetaData.class, UDFMetaData.class.cast(root));
+ else {
+ if (file.getLowerCaseName().equals(VdbConstants.DEPLOYMENT_FILE)) {
+ parseVDBXML(file, deploymentUnit);
+ }
+ else if (file.getLowerCaseName().endsWith(VdbConstants.INDEX_EXT)) {
+ IndexMetadataFactory imf =
deploymentUnit.getAttachment(TeiidAttachments.INDEX_METADATA);
+ if (imf == null) {
+ imf = new IndexMetadataFactory();
+ deploymentUnit.putAttachment(TeiidAttachments.INDEX_METADATA, imf);
}
+ imf.addIndexFile(file);
}
- UDFMetaData udf = UDFMetaData.class.cast(root);
- udf.addModelFile(file);
-
- return expectedType.cast(udf);
- }
- else if (expectedType.equals(IndexMetadataFactory.class)) {
- if (root == null) {
- root = unit.getAttachment(IndexMetadataFactory.class);
- if (root == null) {
- root = new IndexMetadataFactory();
+ else if (file.getLowerCaseName().endsWith(VdbConstants.MODEL_EXT)) {
+ UDFMetaData udf = deploymentUnit.getAttachment(TeiidAttachments.UDF_METADATA);
+ if (udf == null) {
+ udf = new UDFMetaData();
+ deploymentUnit.putAttachment(TeiidAttachments.UDF_METADATA, udf);
}
+ udf.addModelFile(file);
}
- IndexMetadataFactory imf = IndexMetadataFactory.class.cast(root);
- imf.addIndexFile(file);
- unit.addAttachment(IndexMetadataFactory.class, imf);
- return expectedType.cast(imf);
+
}
- else {
- throw new IllegalArgumentException("Cannot match arguments: expectedClass="
+ expectedType ); //$NON-NLS-1$
- }
}
+ private void parseVDBXML(VirtualFile file, DeploymentUnit deploymentUnit)
+ throws DeploymentUnitProcessingException {
+ try {
+ Unmarshaller un = getUnMarsheller();
+ VDBMetaData vdb = (VDBMetaData)un.unmarshal(file.openStream());
+ deploymentUnit.putAttachment(TeiidAttachments.VDB_METADATA, vdb);
+ LogManager.logDetail(LogConstants.CTX_RUNTIME,"VDB "+file.getName()+"
has been parsed."); //$NON-NLS-1$ //$NON-NLS-2$
+ } catch (JAXBException e) {
+ throw new DeploymentUnitProcessingException(e);
+ } catch (SAXException e) {
+ throw new DeploymentUnitProcessingException(e);
+ } catch (IOException e) {
+ throw new DeploymentUnitProcessingException(e);
+ }
+ }
+
+ public void undeploy(final DeploymentUnit context) {
+ }
+
+
static Unmarshaller getUnMarsheller() throws JAXBException, SAXException {
JAXBContext jc = JAXBContext.newInstance(new Class<?>[] {VDBMetaData.class});
SchemaFactory schemaFactory =
SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
@@ -123,100 +139,62 @@
return un;
}
- @Override
- protected VDBMetaData mergeMetaData(VFSDeploymentUnit unit, Map<Class<?>,
List<Object>> metadata) throws Exception {
- VDBMetaData vdb = getInstance(metadata, VDBMetaData.class);
- UDFMetaData udf = getInstance(metadata, UDFMetaData.class);
- IndexMetadataFactory imf = getInstance(metadata, IndexMetadataFactory.class);
+ protected VDBMetaData mergeMetaData(DeploymentUnit deploymentUnit) throws
DeploymentUnitProcessingException {
+ VDBMetaData vdb = deploymentUnit.getAttachment(TeiidAttachments.VDB_METADATA);
+ UDFMetaData udf = deploymentUnit.getAttachment(TeiidAttachments.UDF_METADATA);
+ IndexMetadataFactory imf =
deploymentUnit.getAttachment(TeiidAttachments.INDEX_METADATA);
+ VirtualFile file =
deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT).getRoot();
if (vdb == null) {
- LogManager.logError(LogConstants.CTX_RUNTIME,
RuntimePlugin.Util.getString("invlaid_vdb_file",unit.getRoot().getName()));
//$NON-NLS-1$
+ LogManager.logError(LogConstants.CTX_RUNTIME,
RuntimePlugin.Util.getString("invlaid_vdb_file",file.getName())); //$NON-NLS-1$
return null;
}
- vdb.setUrl(unit.getRoot().toURL());
-
- // build the metadata store
- if (imf != null) {
- imf.addEntriesPlusVisibilities(unit.getRoot(), vdb);
- unit.addAttachment(IndexMetadataFactory.class, imf);
-
- // add the cached store.
- File cacheFile = VDBDeployer.buildCachedVDBFileName(this.serializer, unit, vdb);
- // check to see if the vdb has been modified when server is down; if it is then clear
the old files
- if (this.serializer.isStale(cacheFile, unit.getRoot().getLastModified())) {
- this.serializer.removeAttachments(unit);
- LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB",
unit.getRoot().getName(), "old cached metadata has been removed"); //$NON-NLS-1$
//$NON-NLS-2$
- }
- MetadataStoreGroup stores = this.serializer.loadSafe(cacheFile,
MetadataStoreGroup.class);
- if (stores == null) {
- // start to build the new metadata
- stores = new MetadataStoreGroup();
- stores.addStore(imf.getMetadataStore(vdbRepository.getSystemStore().getDatatypes()));
- }
- else {
- LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB",
unit.getRoot().getName(), "was loaded from cached metadata"); //$NON-NLS-1$
//$NON-NLS-2$
- }
- unit.addAttachment(MetadataStoreGroup.class, stores);
- }
-
- if (udf != null) {
- // load the UDF
- for(Model model:vdb.getModels()) {
- if (model.getModelType().equals(Model.Type.FUNCTION)) {
- String path = ((ModelMetaData)model).getPath();
- if (path == null) {
- throw new
DeploymentException(RuntimePlugin.Util.getString("invalid_udf_file",
model.getName())); //$NON-NLS-1$
- }
- udf.buildFunctionModelFile(model.getName(), path);
- }
- }
+ try {
+ vdb.setUrl(file.toURL());
- // If the UDF file is enclosed then attach it to the deployment artifact
- unit.addAttachment(UDFMetaData.class, udf);
- }
-
- LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB",
unit.getRoot().getName(), "has been parsed."); //$NON-NLS-1$ //$NON-NLS-2$
- return vdb;
- }
-
- public void setVdbRepository(VDBRepository vdbRepository) {
- this.vdbRepository = vdbRepository;
- }
-
- public void setObjectSerializer(ObjectSerializer serializer) {
- this.serializer = serializer;
- }
-
- private ManagedObjectFactory mof;
-
- @Override
- public void build(DeploymentUnit unit, Set<String> attachmentNames, Map<String,
ManagedObject> managedObjects)
- throws DeploymentException {
-
- ManagedObject vdbMO = managedObjects.get(VDBMetaData.class.getName());
- if (vdbMO != null) {
- VDBMetaData vdb = (VDBMetaData) vdbMO.getAttachment();
- for (Model m : vdb.getModels()) {
- ManagedObject mo = this.mof.initManagedObject(m, ModelMetaData.class,
m.getName(),m.getName());
- if (mo == null) {
- throw new DeploymentException("could not create managed object");
//$NON-NLS-1$
+ // build the metadata store
+ if (imf != null) {
+ imf.addEntriesPlusVisibilities(file, vdb);
+
+ // add the cached store.
+ File cacheFile = VDBDeployer.buildCachedVDBFileName(this.serializer, file, vdb);
+ // check to see if the vdb has been modified when server is down; if it is then clear
the old files
+ if (this.serializer.isStale(cacheFile, file.getLastModified())) {
+ this.serializer.removeAttachments(file);
+ LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB", file.getName(),
"old cached metadata has been removed"); //$NON-NLS-1$ //$NON-NLS-2$
}
- managedObjects.put(mo.getName(), mo);
+ MetadataStoreGroup stores = this.serializer.loadSafe(cacheFile,
MetadataStoreGroup.class);
+ if (stores == null) {
+ // start to build the new metadata
+ stores = new MetadataStoreGroup();
+ stores.addStore(imf.getMetadataStore(vdbRepository.getSystemStore().getDatatypes()));
+ }
+ else {
+ LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB", file.getName(),
"was loaded from cached metadata"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ deploymentUnit.putAttachment(TeiidAttachments.METADATA_STORE, stores);
}
- for (Translator t: vdb.getOverrideTranslators()) {
- ManagedObject mo = this.mof.initManagedObject(t, VDBTranslatorMetaData.class,
t.getName(), t.getName());
- if (mo == null) {
- throw new DeploymentException("could not create managed object");
//$NON-NLS-1$
- }
- managedObjects.put(mo.getName(), mo);
+ if (udf != null) {
+ // load the UDF
+ for(Model model:vdb.getModels()) {
+ if (model.getModelType().equals(Model.Type.FUNCTION)) {
+ String path = ((ModelMetaData)model).getPath();
+ if (path == null) {
+ throw new
DeploymentUnitProcessingException(RuntimePlugin.Util.getString("invalid_udf_file",
model.getName())); //$NON-NLS-1$
+ }
+ udf.buildFunctionModelFile(model.getName(), path);
+ }
+ }
}
+ } catch(IOException e) {
+ throw new DeploymentUnitProcessingException(e);
+ } catch (JAXBException e) {
+ throw new DeploymentUnitProcessingException(e);
}
- }
-
- public void setManagedObjectFactory(ManagedObjectFactory mof) {
- this.mof = mof;
+
+ LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB", file.getName(),
"has been parsed."); //$NON-NLS-1$ //$NON-NLS-2$
+ return vdb;
}
-
}
Modified: branches/as7/runtime/src/main/java/org/teiid/deployers/VDBRepository.java
===================================================================
--- branches/as7/runtime/src/main/java/org/teiid/deployers/VDBRepository.java 2011-06-27
14:25:00 UTC (rev 3273)
+++ branches/as7/runtime/src/main/java/org/teiid/deployers/VDBRepository.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -22,21 +22,11 @@
package org.teiid.deployers;
import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.NavigableMap;
-import java.util.Properties;
+import java.util.*;
import java.util.concurrent.ConcurrentSkipListMap;
import java.util.concurrent.CopyOnWriteArrayList;
-import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.as.server.deployment.DeploymentUnitProcessingException;
import org.teiid.adminapi.AdminException;
import org.teiid.adminapi.AdminProcessingException;
import org.teiid.adminapi.impl.VDBMetaData;
@@ -45,16 +35,7 @@
import org.teiid.dqp.internal.datamgr.ConnectorManagerRepository;
import org.teiid.logging.LogConstants;
import org.teiid.logging.LogManager;
-import org.teiid.metadata.AbstractMetadataRecord;
-import org.teiid.metadata.Column;
-import org.teiid.metadata.ColumnStats;
-import org.teiid.metadata.Datatype;
-import org.teiid.metadata.MetadataRepository;
-import org.teiid.metadata.MetadataStore;
-import org.teiid.metadata.Procedure;
-import org.teiid.metadata.Schema;
-import org.teiid.metadata.Table;
-import org.teiid.metadata.TableStats;
+import org.teiid.metadata.*;
import org.teiid.query.function.SystemFunctionManager;
import org.teiid.query.metadata.TransformationMetadata.Resource;
import org.teiid.runtime.RuntimePlugin;
@@ -80,14 +61,14 @@
return metadataRepository;
}
- public void addVDB(VDBMetaData vdb, MetadataStoreGroup stores, LinkedHashMap<String,
Resource> visibilityMap, UDFMetaData udf, ConnectorManagerRepository cmr) throws
DeploymentException {
+ public void addVDB(VDBMetaData vdb, MetadataStoreGroup stores, LinkedHashMap<String,
Resource> visibilityMap, UDFMetaData udf, ConnectorManagerRepository cmr) throws
DeploymentUnitProcessingException {
if (getVDB(vdb.getName(), vdb.getVersion()) != null) {
- throw new DeploymentException(RuntimePlugin.Util.getString("duplicate_vdb",
vdb.getName(), vdb.getVersion())); //$NON-NLS-1$
+ throw new
DeploymentUnitProcessingException(RuntimePlugin.Util.getString("duplicate_vdb",
vdb.getName(), vdb.getVersion())); //$NON-NLS-1$
}
// get the system VDB metadata store
if (this.systemStore == null) {
- throw new
DeploymentException(RuntimePlugin.Util.getString("system_vdb_load_error"));
//$NON-NLS-1$
+ throw new
DeploymentUnitProcessingException(RuntimePlugin.Util.getString("system_vdb_load_error"));
//$NON-NLS-1$
}
if (this.odbcEnabled && odbcStore == null) {
Added: branches/as7/runtime/src/main/java/org/teiid/deployers/VDBService.java
===================================================================
--- branches/as7/runtime/src/main/java/org/teiid/deployers/VDBService.java
(rev 0)
+++ branches/as7/runtime/src/main/java/org/teiid/deployers/VDBService.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -0,0 +1,32 @@
+package org.teiid.deployers;
+
+import org.jboss.msc.service.Service;
+import org.jboss.msc.service.StartContext;
+import org.jboss.msc.service.StartException;
+import org.jboss.msc.service.StopContext;
+import org.teiid.adminapi.impl.VDBMetaData;
+
+public class VDBService implements Service<VDBMetaData> {
+ private VDBMetaData vdb;
+
+ public VDBService(VDBMetaData metadata) {
+ this.vdb = metadata;
+ }
+ @Override
+ public void start(StartContext context) throws StartException {
+ // rameshTODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void stop(StopContext context) {
+ // rameshTODO Auto-generated method stub
+
+ }
+
+ @Override
+ public VDBMetaData getValue() throws IllegalStateException,IllegalArgumentException {
+ return this.vdb;
+ }
+
+}
Property changes on:
branches/as7/runtime/src/main/java/org/teiid/deployers/VDBService.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: branches/as7/runtime/src/main/java/org/teiid/deployers/VDBStructure.java
===================================================================
--- branches/as7/runtime/src/main/java/org/teiid/deployers/VDBStructure.java 2011-06-27
14:25:00 UTC (rev 3273)
+++ branches/as7/runtime/src/main/java/org/teiid/deployers/VDBStructure.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -21,77 +21,64 @@
*/
package org.teiid.deployers;
+import java.io.Closeable;
import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.vfs.plugins.structure.AbstractVFSStructureDeployer;
-import org.jboss.deployers.vfs.spi.structure.StructureContext;
-import org.jboss.virtual.VirtualFile;
-import org.jboss.virtual.plugins.context.jar.JarUtils;
+import org.jboss.as.server.deployment.*;
+import org.jboss.as.server.deployment.module.ModuleRootMarker;
+import org.jboss.as.server.deployment.module.MountHandle;
+import org.jboss.as.server.deployment.module.ResourceRoot;
+import org.jboss.as.server.deployment.module.TempFileProviderService;
+import org.jboss.vfs.VFS;
+import org.jboss.vfs.VirtualFile;
import org.teiid.metadata.VdbConstants;
-public class VDBStructure extends AbstractVFSStructureDeployer{
+public class VDBStructure implements DeploymentUnitProcessor {
+ private static final String VDB_EXTENSION = ".vdb"; //$NON-NLS-1$
+ private static final String DYNAMIC_VDB_STRUCTURE = "-vdb.xml"; //$NON-NLS-1$
- public VDBStructure(){
- setRelativeOrder(1000);
- JarUtils.addJarSuffix(".vdb"); //$NON-NLS-1$
- }
-
@Override
- public boolean determineStructure(StructureContext structureContext) throws
DeploymentException {
- VirtualFile file = structureContext.getFile();
- try {
- if (isLeaf(file) == false) {
- if (file.getName().endsWith(".vdb")) { //$NON-NLS-1$
-
- VirtualFile metainf = file.getChild("META-INF"); //$NON-NLS-1$
- if (metainf == null) {
- return false;
- }
-
- if (metainf.getChild(VdbConstants.DEPLOYMENT_FILE) == null) {
- return false;
- }
-
- List<String> scanDirs = new ArrayList<String>();
- scanDirs.add("/"); //$NON-NLS-1$
-
- List<VirtualFile> children = file.getChildren();
- for (VirtualFile child:children) {
- addAllDirs(child, scanDirs, null);
- }
- createContext(structureContext, scanDirs.toArray(new String[scanDirs.size()]));
- return true;
+ public void deploy(final DeploymentPhaseContext phaseContext) throws
DeploymentUnitProcessingException {
+
+ DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
+
+ VirtualFile file =
deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT).getRoot();
+ if (file == null) {
+ return;
+ }
+
+ if(file.getLowerCaseName().endsWith(VDB_EXTENSION)) {
+
+ try {
+ final Closeable closable = VFS.mountZip(file, file,
TempFileProviderService.provider());
+ final ResourceRoot vdbArchiveRoot = new ResourceRoot(file.getName(), file, new
MountHandle(closable));
+ ModuleRootMarker.mark(vdbArchiveRoot);
+
+ VirtualFile metainf = file.getChild("META-INF"); //$NON-NLS-1$
+ if (metainf == null) {
+ return;
}
- }
- } catch (IOException e) {
- throw DeploymentException.rethrowAsDeploymentException("Error determining
structure: " + file.getName(), e); //$NON-NLS-1$
- }
- return false;
+
+ if (metainf.getChild(VdbConstants.DEPLOYMENT_FILE) == null) {
+ return;
+ }
+ // adds a TYPE attachment.
+ TeiidAttachments.setAsVDBDeployment(deploymentUnit);
+ } catch (IOException e) {
+ throw new DeploymentUnitProcessingException("failed to process " + file,
e); //$NON-NLS-1$
+ }
+ }
+ else if (file.getLowerCaseName().endsWith(DYNAMIC_VDB_STRUCTURE)) {
+ TeiidAttachments.setAsDynamicVDBDeployment(deploymentUnit);
+ }
}
- private void addAllDirs(VirtualFile file, List<String> scanDirs, String
parentName) throws IOException {
- if (!file.isLeaf()) {
- if (parentName != null) {
- scanDirs.add(parentName + "/" + file.getName()); //$NON-NLS-1$
- }
- else {
- scanDirs.add(file.getName());
- }
- List<VirtualFile> children = file.getChildren();
- for (VirtualFile child:children) {
- if (parentName == null) {
- addAllDirs(child, scanDirs, file.getName());
- }
- else {
- addAllDirs(child, scanDirs, parentName + "/" +file.getName());
//$NON-NLS-1$
- }
- }
- }
+
+ @Override
+ public void undeploy(final DeploymentUnit context) {
+
}
}
Modified: branches/as7/runtime/src/main/java/org/teiid/services/BufferServiceImpl.java
===================================================================
---
branches/as7/runtime/src/main/java/org/teiid/services/BufferServiceImpl.java 2011-06-27
14:25:00 UTC (rev 3273)
+++
branches/as7/runtime/src/main/java/org/teiid/services/BufferServiceImpl.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -26,10 +26,6 @@
import java.io.IOException;
import java.io.Serializable;
-import org.jboss.managed.api.annotation.ManagementComponent;
-import org.jboss.managed.api.annotation.ManagementObject;
-import org.jboss.managed.api.annotation.ManagementProperties;
-import org.jboss.managed.api.annotation.ManagementProperty;
import org.teiid.common.buffer.BufferManager;
import org.teiid.common.buffer.impl.BufferManagerImpl;
import org.teiid.common.buffer.impl.FileStorageManager;
@@ -49,7 +45,6 @@
* a mixed disk/memory model which requires use of a directory on the disk
* for file service access.
*/
-@ManagementObject(name="BufferService",
componentType=@ManagementComponent(type="teiid",subtype="dqp"),
properties=ManagementProperties.EXPLICIT)
public class BufferServiceImpl implements BufferService, Serializable {
private static final long serialVersionUID = -6217808623863643531L;
private static final long MB = 1<<20;
@@ -153,12 +148,10 @@
return this.useDisk;
}
- @ManagementProperty(description="The max row count of a batch sent internally
within the query processor. Should be <= the connectorBatchSize. (default 256)")
public int getProcessorBatchSize() {
return this.processorBatchSize;
}
- @ManagementProperty(description="The max row count of a batch from a connector.
Should be even multiple of processorBatchSize. (default 512)")
public int getConnectorBatchSize() {
return this.connectorBatchSize;
}
@@ -175,31 +168,22 @@
this.maxProcessingBatchesColumns = value;
}
- @ManagementProperty(description="Max file size, in MB, for buffer files (default
2GB)")
public long getMaxFileSize() {
return maxFileSize;
}
- @ManagementProperty(description="Max open buffer files (default 64)")
public void setMaxOpenFiles(int maxOpenFiles) {
this.maxOpenFiles = maxOpenFiles;
}
- @ManagementProperty(description="The number of batch columns guarenteed to a
processing operation. Set this value lower if the workload typically" +
- "processes larger numbers of concurrent queries with large intermediate
results from operations such as sorting, " +
- "grouping, etc. (default 128)")
public int getMaxProcessingBatchesColumns() {
return maxProcessingBatchesColumns;
}
- @ManagementProperty(description="The number of batch columns to allow in memory
(default 16384). " +
- "This value should be set lower or higher depending on the available memory to
Teiid in the VM. " +
- "16384 is considered a good default for a dedicated 32-bit VM running Teiid
with a 1 gig heap.")
public int getMaxReserveBatchColumns() {
return maxReserveBatchColumns;
}
- @ManagementProperty(description="Max file storage space, in MB, to be used for
buffer files (default 50G)")
public long getMaxBufferSpace() {
return maxBufferSpace;
}
@@ -208,7 +192,6 @@
this.maxBufferSpace = maxBufferSpace;
}
- @ManagementProperty(description="The currently used file buffer space in
MB.", readOnly=true)
public long getUserBufferSpace() {
if (fsm != null) {
return fsm.getUsedBufferSpace()/MB;
@@ -216,22 +199,18 @@
return 0;
}
- @ManagementProperty(description="The total number of batches added to the buffer
mananger.", readOnly=true)
public long getBatchesAdded() {
return bufferMgr.getBatchesAdded();
}
- @ManagementProperty(description="The total number of batches read from
storage.", readOnly=true)
public long getReadCount() {
return bufferMgr.getReadCount();
}
- @ManagementProperty(description="The total number of batches written to
storage.", readOnly=true)
public long getWriteCount() {
return bufferMgr.getWriteCount();
}
- @ManagementProperty(description="The total number of batch read attempts.",
readOnly=true)
public long getReadAttempts() {
return bufferMgr.getReadAttempts();
}
Modified: branches/as7/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java
===================================================================
---
branches/as7/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java 2011-06-27
14:25:00 UTC (rev 3273)
+++
branches/as7/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -22,24 +22,12 @@
package org.teiid.services;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Timer;
-import java.util.TimerTask;
+import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import javax.security.auth.login.LoginContext;
import javax.security.auth.login.LoginException;
-import org.jboss.managed.api.annotation.ManagementComponent;
-import org.jboss.managed.api.annotation.ManagementObject;
-import org.jboss.managed.api.annotation.ManagementProperties;
-import org.jboss.managed.api.annotation.ManagementProperty;
import org.teiid.adminapi.VDB;
import org.teiid.adminapi.VDB.ConnectionType;
import org.teiid.adminapi.impl.SessionMetadata;
@@ -63,7 +51,6 @@
/**
* This class serves as the primary implementation of the Session Service.
*/
-@ManagementObject(name="SessionService",
componentType=@ManagementComponent(type="teiid",subtype="dqp"),
properties=ManagementProperties.EXPLICIT)
public class SessionServiceImpl implements SessionService {
public static final String SECURITY_DOMAINS = "securitydomains";
//$NON-NLS-1$
@@ -137,7 +124,7 @@
}
@Override
- public SessionMetadata createSession(String userName, Credentials credentials, String
applicationName, Properties properties, boolean adminConnection, boolean authenticate)
+ public SessionMetadata createSession(String userName, Credentials credentials, String
applicationName, Properties properties, boolean authenticate)
throws LoginException, SessionServiceException {
ArgCheck.isNotNull(applicationName);
ArgCheck.isNotNull(properties);
@@ -146,9 +133,6 @@
String securityDomain = "none"; //$NON-NLS-1$
Object securityContext = null;
List<String> domains = this.securityDomains;
- if (adminConnection) {
- domains = this.adminSecurityDomains;
- }
// Validate VDB and version if logging on to server product...
VDBMetaData vdb = null;
@@ -315,7 +299,6 @@
return info;
}
- @ManagementProperty (description="Maximum number of sessions allowed by the system
(default 5000)")
public long getSessionMaxLimit() {
return this.sessionMaxLimit;
}
@@ -324,7 +307,6 @@
this.sessionMaxLimit = limit;
}
- @ManagementProperty(description="Max allowed time before the session is terminated
by the system, 0 indicates unlimited (default 0)")
public long getSessionExpirationTimeLimit() {
return this.sessionExpirationTimeLimit;
}
Deleted:
branches/as7/runtime/src/main/java/org/teiid/templates/TranslatorDeploymentTemplate.java
===================================================================
---
branches/as7/runtime/src/main/java/org/teiid/templates/TranslatorDeploymentTemplate.java 2011-06-27
14:25:00 UTC (rev 3273)
+++
branches/as7/runtime/src/main/java/org/teiid/templates/TranslatorDeploymentTemplate.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -1,121 +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.templates;
-
-import java.io.File;
-import java.io.FileWriter;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.Marshaller;
-
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.management.DeploymentTemplate;
-import org.jboss.managed.api.DeploymentTemplateInfo;
-import org.jboss.managed.api.ManagedObject;
-import org.jboss.managed.api.ManagedProperty;
-import org.jboss.managed.api.factory.ManagedObjectFactory;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VirtualFile;
-import org.teiid.adminapi.impl.TranslatorMetaData;
-import org.teiid.deployers.TranslatorMetaDataGroup;
-import org.teiid.deployers.TranslatorParserDeployer;
-import org.teiid.runtime.RuntimePlugin;
-
-/**
- * Translator template writer and deployer
- */
-public class TranslatorDeploymentTemplate implements DeploymentTemplate {
-
- private DeploymentTemplateInfo info;
- private ManagedObjectFactory mof;
-
- public String getDeploymentName(String deploymentBaseName) {
- if (deploymentBaseName == null)
- throw new IllegalArgumentException("Null base name.");//$NON-NLS-1$
-
- if(deploymentBaseName.endsWith(TranslatorParserDeployer.TRANSLATOR_SUFFIX) ==
false)
- deploymentBaseName = deploymentBaseName +
TranslatorParserDeployer.TRANSLATOR_SUFFIX;
-
- return deploymentBaseName;
- }
-
- public VirtualFile applyTemplate(DeploymentTemplateInfo sourceInfo) throws Exception {
- File dsXml =
File.createTempFile(getClass().getSimpleName(),TranslatorParserDeployer.TRANSLATOR_SUFFIX);
- writeTemplate(dsXml, sourceInfo);
- return VFS.getRoot(dsXml.toURI());
- }
-
- private void writeTemplate(File dsXml, DeploymentTemplateInfo values) throws Exception
{
-
- TranslatorMetaDataGroup group = new TranslatorMetaDataGroup();
-
- // The management framework, will update the attachment the managed property value
changes.
- // that way the translator is configured.
- TranslatorMetaData translator = new TranslatorMetaData();
- this.mof.setInstanceClassFactory(TranslatorMetaData.class, new
TranslatorMetadataICF(this.mof));
- ManagedObject mo = mof.initManagedObject(translator, "teiid",
"translator"); //$NON-NLS-1$ //$NON-NLS-2$
-
- for (ManagedProperty mp : values.getProperties().values()) {
- ManagedProperty dsProp = mo.getProperty(mp.getName());
- if (dsProp != null) {
- if (mp.getValue() != null) {
- dsProp.setValue(mp.getValue());
- }
-
- if(mp.isMandatory() && mp.getValue() == null && mp.getDefaultValue()
== null) {
- throw new
DeploymentException(RuntimePlugin.Util.getString("required_property_not_exists",
mp.getName())); //$NON-NLS-1$
- }
- }
- }
-
- group.addTranslator(translator);
-
- // Now use JAXB and write the file.
- Class[] classes = { TranslatorMetaDataGroup.class };
- JAXBContext context = JAXBContext.newInstance(classes);
- Marshaller marshaller = context.createMarshaller();
- marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,new Boolean(true));
-
- FileWriter fw = null;
- try {
- fw = new FileWriter(dsXml);
- marshaller.marshal(group, fw);
- } finally {
- if (fw != null) {
- fw.close();
- }
- }
- }
-
- @Override
- public DeploymentTemplateInfo getInfo() {
- return info;
- }
-
- public void setInfo(DeploymentTemplateInfo info) {
- this.info = info;
- }
-
- public void setManagedObjectFactory(ManagedObjectFactory mof) {
- this.mof = mof;
- }
-}
Deleted:
branches/as7/runtime/src/main/java/org/teiid/templates/TranslatorMetadataICF.java
===================================================================
---
branches/as7/runtime/src/main/java/org/teiid/templates/TranslatorMetadataICF.java 2011-06-27
14:25:00 UTC (rev 3273)
+++
branches/as7/runtime/src/main/java/org/teiid/templates/TranslatorMetadataICF.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -1,113 +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.templates;
-
-import java.util.ArrayList;
-import java.util.List;
-
-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.ManagedProperty;
-import org.jboss.managed.api.factory.ManagedObjectFactory;
-import org.jboss.managed.plugins.factory.AbstractInstanceClassFactory;
-import org.jboss.metadata.spi.MetaData;
-import org.jboss.metatype.api.types.SimpleMetaType;
-import org.jboss.metatype.api.values.MapCompositeValueSupport;
-import org.jboss.metatype.api.values.MetaValue;
-import org.jboss.metatype.api.values.SimpleValueSupport;
-import org.teiid.adminapi.impl.PropertyMetadata;
-import org.teiid.adminapi.impl.TranslatorMetaData;
-
-/**
- * This class is defined as bean in the deployer's -jboss-beans.xml file. This used
to construct the
- * TranslatorMetadata object with "property"
- */
-public class TranslatorMetadataICF
extends AbstractInstanceClassFactory<TranslatorMetaData> {
-
- private static final String TRANSLATOR_PROPERTY = "property"; //$NON-NLS-1$
-
- public TranslatorMetadataICF(ManagedObjectFactory mof) {
- super(mof);
- }
-
- @Override
- public MetaValue getValue(BeanInfo beanInfo, ManagedProperty property, MetaData
metaData, TranslatorMetaData attachment) {
- // Get the property name
- String propertyName = property.getMappedName();
- if (propertyName == null)
- propertyName = property.getName();
-
- // Get the property info
- PropertyInfo propertyInfo = property.getField(Fields.PROPERTY_INFO,
PropertyInfo.class);
- if (propertyInfo == null)
- propertyInfo = beanInfo.getProperty(propertyName);
-
- // Check if the property is readable
- if (propertyInfo != null && propertyInfo.isReadable() == false)
- return null;
-
- MetaValue value = null;
- if (TRANSLATOR_PROPERTY.equals(property.getName())) {
- MapCompositeValueSupport mapValue = new
MapCompositeValueSupport(SimpleMetaType.STRING);
- List<PropertyMetadata> list = attachment.getJAXBProperties();
- if (list != null) {
- for (PropertyMetadata prop : list) {
- String name = prop.getName();
- MetaValue svalue = SimpleValueSupport.wrap(prop.getValue());
- mapValue.put(name, svalue);
- }
- }
- value = mapValue;
- } else {
- value = super.getValue(beanInfo, property, metaData, attachment);
- }
- return value;
- }
-
- @Override
- protected Object unwrapValue(BeanInfo beanInfo, ManagedProperty property, MetaValue
value) {
- Object unwrapValue = null;
- if (TRANSLATOR_PROPERTY.equals(property.getName())) {
-
- if ((value instanceof MapCompositeValueSupport) == false) {
- return super.unwrapValue(beanInfo, property, value);
- }
-
- MapCompositeValueSupport mapValue = (MapCompositeValueSupport) value;
-
- List<PropertyMetadata> list = new ArrayList<PropertyMetadata>();
- for (String name : mapValue.getMetaType().keySet()) {
- list.add(new PropertyMetadata(name, (String)
getMetaValueFactory().unwrap(mapValue.get(name))));
- }
- unwrapValue = list;
- } else {
- unwrapValue = super.unwrapValue(beanInfo, property, value);
- }
- return unwrapValue;
- }
-
- @Override
- public Class<TranslatorMetaData> getType() {
- return TranslatorMetaData.class;
- }
-}
Deleted:
branches/as7/runtime/src/main/java/org/teiid/templates/TranslatorTemplateInfo.java
===================================================================
---
branches/as7/runtime/src/main/java/org/teiid/templates/TranslatorTemplateInfo.java 2011-06-27
14:25:00 UTC (rev 3273)
+++
branches/as7/runtime/src/main/java/org/teiid/templates/TranslatorTemplateInfo.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -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.templates;
-
-import java.util.Map;
-
-import org.jboss.managed.api.ManagedProperty;
-import org.jboss.managed.plugins.BasicDeploymentTemplateInfo;
-import org.jboss.metatype.api.types.MapCompositeMetaType;
-import org.jboss.metatype.api.types.SimpleMetaType;
-import org.teiid.adminapi.Translator;
-import org.teiid.adminapi.impl.TranslatorMetaData;
-import org.teiid.deployers.ManagedPropertyUtil;
-import org.teiid.translator.TranslatorProperty;
-
-/**
- * This class defines the template for all the translator classes. Each Translator's
class
- * defines its properties through {@link TranslatorProperty} annotation. This class need
to
- * present them as template properties that can be managed.
- */
-public class TranslatorTemplateInfo extends BasicDeploymentTemplateInfo {
-
- private static final long serialVersionUID = 9066758787789280783L;
- static final String TYPE_NAME = "type"; //$NON-NLS-1$
- static final String NAME = "name"; //$NON-NLS-1$
- private String executionFactoryName;
-
-
-
- public TranslatorTemplateInfo(String name, String description, Map<String,
ManagedProperty> properties, String executionFactoryName) {
- super(name, description, properties);
- this.executionFactoryName = executionFactoryName;
- }
-
- public void start() {
- populate();
- }
-
- @Override
- public TranslatorTemplateInfo copy() {
- TranslatorTemplateInfo copy = new TranslatorTemplateInfo(getName(), getDescription(),
getProperties(), executionFactoryName);
- super.copy(copy);
- copy.populate();
-
- return copy;
- }
-
- private void populate() {
- addProperty(buildTemplateProperty(getName()));
-
- addProperty(ManagedPropertyUtil.createProperty(Translator.EXECUTION_FACTORY_CLASS,SimpleMetaType.STRING,
"Execution Factory Class name", "The translator's execution factory
name", true, true, this.executionFactoryName));//$NON-NLS-1$ //$NON-NLS-2$
- addProperty(ManagedPropertyUtil.createProperty(NAME,SimpleMetaType.STRING,
"name", "Name of the Translator", true, true,
getName()));//$NON-NLS-1$ //$NON-NLS-2$
- addProperty(ManagedPropertyUtil.createProperty(Translator.TRANSLATOR_PROPERTY, new
MapCompositeMetaType(SimpleMetaType.STRING), Translator.TRANSLATOR_PROPERTY,
"Additional Translator properties", false, false, null)); //$NON-NLS-1$
- }
-
- static ManagedProperty buildTemplateProperty(String name) {
- return ManagedPropertyUtil.createProperty(TYPE_NAME,SimpleMetaType.STRING,
- "Base Tanslator Type Name", "The Name of the Teiid Traslator",
true, true, name.substring(TranslatorMetaData.TRANSLATOR_PREFIX.length()));//$NON-NLS-1$
//$NON-NLS-2$
- }
-}
Deleted:
branches/as7/runtime/src/main/java/org/teiid/templates/TranslatorTemplateInfoFactory.java
===================================================================
---
branches/as7/runtime/src/main/java/org/teiid/templates/TranslatorTemplateInfoFactory.java 2011-06-27
14:25:00 UTC (rev 3273)
+++
branches/as7/runtime/src/main/java/org/teiid/templates/TranslatorTemplateInfoFactory.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -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.templates;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Method;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.jboss.managed.api.DeploymentTemplateInfo;
-import org.jboss.managed.api.ManagedProperty;
-import org.teiid.deployers.ManagedPropertyUtil;
-import org.teiid.deployers.TranslatorUtil;
-import org.teiid.translator.TranslatorProperty;
-
-public class TranslatorTemplateInfoFactory {
-
- /**
- * Create a DeploymentTemplateInfo by scanning the metadata attachment class
- * for ManagementProperty annotations.
- *
- * @param infoClass - the DeploymentTemplateInfo implementation to use. Must have a ctor
with sig (String,String,Map).
- * @param attachmentClass - the metadata class to scan for ManagementProperty
annotations
- * @param name - the template name
- * @param description - the template description
- * @return the DeploymentTemplateInfo instance
- * @throws Exception on failure to create the DeploymentTemplateInfo
- */
- public DeploymentTemplateInfo createTemplateInfo(Class<? extends
DeploymentTemplateInfo> infoClass, Class<?> attachmentClass, String name, String
description) throws Exception {
-
- Map<String, ManagedProperty> infoProps = getProperties(attachmentClass);
- Class<?>[] parameterTypes = { String.class, String.class, Map.class,
String.class};
- Constructor<? extends DeploymentTemplateInfo> ctor =
infoClass.getConstructor(parameterTypes);
- DeploymentTemplateInfo info = ctor.newInstance(name, description,infoProps,
attachmentClass.getName());
- return info;
- }
-
- public static Map<String, ManagedProperty> getProperties(
- Class<?> attachmentClass)
- throws InstantiationException, IllegalAccessException {
- Map<Method, TranslatorProperty> props =
TranslatorUtil.getTranslatorProperties(attachmentClass);
-
- Map<String, ManagedProperty> infoProps = new HashMap<String,
ManagedProperty>();
-
- Object factory = attachmentClass.newInstance();
-
- for (Map.Entry<Method, TranslatorProperty> entry : props.entrySet()) {
- ManagedProperty mp = ManagedPropertyUtil.convert(factory, entry.getKey(),
entry.getValue());
- infoProps.put(mp.getName(), mp);
- }
- return infoProps;
- }
-}
Modified: branches/as7/runtime/src/main/java/org/teiid/transport/SocketConfiguration.java
===================================================================
---
branches/as7/runtime/src/main/java/org/teiid/transport/SocketConfiguration.java 2011-06-27
14:25:00 UTC (rev 3273)
+++
branches/as7/runtime/src/main/java/org/teiid/transport/SocketConfiguration.java 2011-06-27
16:56:11 UTC (rev 3274)
@@ -24,15 +24,9 @@
import java.net.InetAddress;
import java.net.UnknownHostException;
-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.core.TeiidRuntimeException;
-@ManagementObject(componentType=@ManagementComponent(type="teiid",subtype="dqp"),
properties=ManagementProperties.EXPLICIT)
public class SocketConfiguration {
private int outputBufferSize;
@@ -44,9 +38,8 @@
private boolean enabled;
private String hostName;
private String name;
+ private String socketBinding;
- @ManagementProperty(description="Name of the configuration", readOnly=true)
- @ManagementObjectID(type="socket")
public String getName() {
return name;
}
@@ -55,6 +48,14 @@
this.name = name;
}
+ public String getSocketBinding() {
+ return socketBinding;
+ }
+
+ public void setSocketBinding(String socketBinding) {
+ this.socketBinding = socketBinding;
+ }
+
public void setBindAddress(String addr) {
this.hostName = addr;
}
@@ -90,7 +91,6 @@
}
}
- @ManagementProperty(description="enabled")
public boolean getEnabled() {
return enabled;
}
@@ -99,22 +99,18 @@
this.enabled = enabled;
}
- @ManagementProperty(description="SO_SNDBUF size, 0 indicates that system default
should be used (default 0)")
public int getOutputBufferSize() {
return outputBufferSize;
}
- @ManagementProperty(description="SO_RCVBUF size, 0 indicates that system default
should be used (default 0)")
public int getInputBufferSize() {
return inputBufferSize;
}
- @ManagementProperty(description="Max NIO threads")
public int getMaxSocketThreads() {
return maxSocketThreads;
}
- @ManagementProperty(description="Port Number")
public int getPortNumber() {
return portNumber;
}
@@ -137,7 +133,11 @@
}
}
- @ManagementProperty(description="Host Name")
+ public void setHostAddress(InetAddress hostAddress) {
+ this.hostAddress = hostAddress;
+ this.hostName = hostAddress.getHostName();
+ }
+
public String getHostName() {
resolveHostName();
return this.hostName;
@@ -147,7 +147,6 @@
return sslConfiguration;
}
- @ManagementProperty(description="SSL enabled")
public boolean getSslEnabled() {
return this.sslConfiguration != null && this.sslConfiguration.isSslEnabled();
}