teiid SVN: r2057 - trunk/client/src/main/java/org/teiid/adminapi/impl.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2010-04-14 17:49:25 -0400 (Wed, 14 Apr 2010)
New Revision: 2057
Modified:
trunk/client/src/main/java/org/teiid/adminapi/impl/DataPolicyMetadata.java
trunk/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java
trunk/client/src/main/java/org/teiid/adminapi/impl/SourceMappingMetadata.java
trunk/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java
Log:
TEIID-1046: Adding the ManagementObjectId annotation back on to the managed object, so that the name of the component is correctly set.
Modified: trunk/client/src/main/java/org/teiid/adminapi/impl/DataPolicyMetadata.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/DataPolicyMetadata.java 2010-04-13 20:06:24 UTC (rev 2056)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/DataPolicyMetadata.java 2010-04-14 21:49:25 UTC (rev 2057)
@@ -32,6 +32,7 @@
import javax.xml.bind.annotation.XmlType;
import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementObjectID;
import org.jboss.managed.api.annotation.ManagementProperties;
import org.jboss.managed.api.annotation.ManagementProperty;
import org.teiid.adminapi.DataPolicy;
@@ -66,7 +67,7 @@
@Override
@ManagementProperty(description="Policy Name")
- //@ManagementObjectID(type="policy")
+ @ManagementObjectID(type="policy")
public String getName() {
return name;
}
Modified: trunk/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java 2010-04-13 20:06:24 UTC (rev 2056)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java 2010-04-14 21:49:25 UTC (rev 2057)
@@ -35,6 +35,7 @@
import javax.xml.bind.annotation.XmlValue;
import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementObjectID;
import org.jboss.managed.api.annotation.ManagementProperties;
import org.jboss.managed.api.annotation.ManagementProperty;
import org.teiid.adminapi.Model;
@@ -78,6 +79,7 @@
@ManagementProperty(description="Model Name")
@XmlAttribute(name = "name", required = true)
+ @ManagementObjectID(type="models")
public String getName() {
return super.getName();
}
Modified: trunk/client/src/main/java/org/teiid/adminapi/impl/SourceMappingMetadata.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/SourceMappingMetadata.java 2010-04-13 20:06:24 UTC (rev 2056)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/SourceMappingMetadata.java 2010-04-14 21:49:25 UTC (rev 2057)
@@ -31,6 +31,7 @@
import javax.xml.bind.annotation.XmlType;
import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementObjectID;
import org.jboss.managed.api.annotation.ManagementProperties;
import org.jboss.managed.api.annotation.ManagementProperty;
@@ -55,6 +56,7 @@
}
@ManagementProperty (description="Source Name")
+ @ManagementObjectID(type="source")
public String getName() {
return name;
}
Modified: trunk/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java 2010-04-13 20:06:24 UTC (rev 2056)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java 2010-04-14 21:49:25 UTC (rev 2057)
@@ -35,6 +35,7 @@
import org.jboss.managed.api.annotation.ManagementComponent;
import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementObjectID;
import org.jboss.managed.api.annotation.ManagementProperties;
import org.jboss.managed.api.annotation.ManagementProperty;
import org.teiid.adminapi.DataPolicy;
@@ -88,6 +89,7 @@
@ManagementProperty(description="Name of the VDB")
+ @ManagementObjectID(type="vdb")
@XmlAttribute(name = "name", required = true)
public String getName() {
return super.getName();
14 years, 8 months
teiid SVN: r2056 - trunk/jboss-integration/src/main/java/org/teiid/templates/connector.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2010-04-13 16:06:24 -0400 (Tue, 13 Apr 2010)
New Revision: 2056
Modified:
trunk/jboss-integration/src/main/java/org/teiid/templates/connector/ExportConnectorTypeTemplateInfo.java
Log:
TEIID-1044, TEIID-1045: Correcting the export functionality of the Connection factory and adding the export of the data source
Modified: trunk/jboss-integration/src/main/java/org/teiid/templates/connector/ExportConnectorTypeTemplateInfo.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/templates/connector/ExportConnectorTypeTemplateInfo.java 2010-04-13 18:42:24 UTC (rev 2055)
+++ trunk/jboss-integration/src/main/java/org/teiid/templates/connector/ExportConnectorTypeTemplateInfo.java 2010-04-13 20:06:24 UTC (rev 2056)
@@ -26,7 +26,6 @@
import org.jboss.managed.api.DeploymentTemplateInfo;
import org.jboss.managed.api.ManagedProperty;
-import org.jboss.profileservice.management.FilteredDeploymentTemplateInfo;
import org.jboss.resource.deployers.management.DsDataSourceTemplate;
import org.jboss.resource.deployers.management.DsDataSourceTemplateInfo;
@@ -49,8 +48,7 @@
public static class ExportConnectionFactoryTemplate extends DsDataSourceTemplate {
@Override
public void writeTemplate(File dsXml, DeploymentTemplateInfo values) throws Exception {
- FilteredDeploymentTemplateInfo filterInfo = new FilteredDeploymentTemplateInfo(values);
- super.writeTemplate(dsXml, filterInfo);
+ super.writeTemplate(dsXml, values);
}
}
14 years, 8 months
teiid SVN: r2055 - in trunk: build/kit-jboss-container/deploy/teiid and 6 other directories.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2010-04-13 14:42:24 -0400 (Tue, 13 Apr 2010)
New Revision: 2055
Added:
trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/ExtendedComponentType.java
trunk/jboss-integration/src/main/java/org/teiid/templates/connector/ExportConnectorTypeTemplateInfo.java
Modified:
trunk/adminshell/src/main/resources/scripts/adminapi.bsh
trunk/build/kit-jboss-container/deploy/teiid/teiid-connector-templates-jboss-beans.xml
trunk/client/src/main/java/org/teiid/adminapi/Admin.java
trunk/common-core/src/main/java/com/metamatrix/core/util/ObjectConverterUtil.java
trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java
trunk/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties
trunk/test-integration/db/src/test/java/org/teiid/adminapi/jboss/TestConnectorBindings.java
Log:
TEIID-1044, TEIID-1045: Correcting the export functionality of the Connection factory and adding the export of the data source
Modified: trunk/adminshell/src/main/resources/scripts/adminapi.bsh
===================================================================
--- trunk/adminshell/src/main/resources/scripts/adminapi.bsh 2010-04-13 17:52:41 UTC (rev 2054)
+++ trunk/adminshell/src/main/resources/scripts/adminapi.bsh 2010-04-13 18:42:24 UTC (rev 2055)
@@ -12,7 +12,7 @@
* @return the {@link VDB} representing the current property values and runtime state.
*/
VDB deployVDB(String vdbFile) {
- debug("Adding VDB " + name + " from " + vdbFile);
+ debug("Adding VDB " + vdbFile);
checkAdmin();
return internalAdmin.deployVDB(vdbFile, new FileInputStream(new File(vdbFile)));
}
@@ -44,7 +44,7 @@
ObjectConverterUtil.write(contents, fileName);
}
else {
- throw new AdminProcessingException("VDB with name "+ name + " is not found to export");
+ throw new AdminProcessingException("VDB with name "+ vdbName + " is not found to export");
}
}
@@ -104,7 +104,7 @@
ObjectConverterUtil.write(contents, fileName);
}
else {
- throw new AdminProcessingException("Connector Binding "+ bindingName + " not found for exporting");
+ throw new AdminProcessingException("Connector Binding "+ deployedName + " not found for exporting");
}
}
@@ -128,13 +128,14 @@
/**
* Adds JDBC XA Data Source in the container.
* @param dsName - name of the source
+ * @param type - type of data source
* @param properties - properties
* @throws AdminException
*/
-void addDataSource(String dsName, Properties properties) {
+void addDataSource(String dsName, DataSourceType type,Properties properties) {
debug("Adding Datasource " + dsName);
checkAdmin();
- return internalAdmin.addDataSource(dsName, properties);
+ return internalAdmin.addDataSource(dsName, type, properties);
}
/**
@@ -148,6 +149,24 @@
return internalAdmin.deleteDataSource(dsName);
}
+/**
+ * Export the data source in "-ds.xml" file format.
+ * @param dsName - name of the data source
+ * @param fileName
+ * @return
+ * @throws AdminException
+ */
+void exportDataSource(String dsName, String fileName) {
+ debug("Exporting Data source " + dsName + " to file " + fileName);
+ checkAdmin();
+ contents = internalAdmin.exportDataSource(dsName);
+ if (contents != null) {
+ ObjectConverterUtil.write(contents, fileName);
+ }
+ else {
+ throw new AdminProcessingException("Data Source "+ dsName + " not found for exporting");
+ }
+}
/**
* Get the property definitions for creating the JDBC data source.
Modified: trunk/build/kit-jboss-container/deploy/teiid/teiid-connector-templates-jboss-beans.xml
===================================================================
--- trunk/build/kit-jboss-container/deploy/teiid/teiid-connector-templates-jboss-beans.xml 2010-04-13 17:52:41 UTC (rev 2054)
+++ trunk/build/kit-jboss-container/deploy/teiid/teiid-connector-templates-jboss-beans.xml 2010-04-13 18:42:24 UTC (rev 2055)
@@ -1,6 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<deployment xmlns="urn:jboss:bean-deployer:2.0">
- <!-- This file defines the connector templates for Teiid based connectors -->
+
+ <!-- This file defines the connector templates for Teiid based connectors -->
+ <bean name="export-template" class="org.jboss.resource.deployers.management.DsDataSourceTemplate">
+ <property name="info"><inject bean="export-templateinfo"/></property>
+ </bean>
+ <bean name="export-templateinfo" class="org.teiid.templates.connector.ExportConnectorTypeTemplateInfo">
+ <constructor factoryMethod="createTemplateInfo">
+ <factory bean="DSDeploymentTemplateInfoFactory"/>
+ <parameter class="java.lang.Class">org.teiid.templates.connector.ExportConnectorTypeTemplateInfo</parameter>
+ <parameter class="java.lang.Class">org.jboss.resource.metadata.mcf.NoTxConnectionFactoryDeploymentMetaData</parameter>
+ <parameter class="java.lang.String">export-template</parameter>
+ <parameter class="java.lang.String">Teiid Export Template</parameter>
+ </constructor>
+ </bean>
+
<bean name="connector-jdbc-${project.version}" class="org.teiid.templates.connector.ConnectorTypeTemplate">
<property name="info"><inject bean="connector-jdbc-templateinfo"/></property>
<property name="targetTemplate"><inject bean="NoTxConnectionFactoryTemplate"/></property>
Modified: trunk/client/src/main/java/org/teiid/adminapi/Admin.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/Admin.java 2010-04-13 17:52:41 UTC (rev 2054)
+++ trunk/client/src/main/java/org/teiid/adminapi/Admin.java 2010-04-13 18:42:24 UTC (rev 2055)
@@ -29,7 +29,8 @@
import java.util.Set;
public interface Admin {
-
+
+ public enum DataSourceType {XA, LOCAL};
public enum Cache {CODE_TABLE_CACHE,PREPARED_PLAN_CACHE, QUERY_SERVICE_RESULT_SET_CACHE};
/**
@@ -327,20 +328,29 @@
/**
* Adds JDBC XA Data Source in the container.
- * @param dsName - name of the source
+ * @param deploymentName - name of the source
+ * @param type - type of data source
* @param properties - properties
* @throws AdminException
*/
- void addDataSource(String deploymentName, Properties properties) throws AdminException;
+ void addDataSource(String deploymentName, DataSourceType type, Properties properties) throws AdminException;
/**
* Delete data source.
- * @param dsName
+ * @param deployedName
* @throws AdminException
*/
- void deleteDataSource(String deploymentName) throws AdminException;
+ void deleteDataSource(String deployedName) throws AdminException;
/**
+ * Export the data source in "-ds.xml" file format.
+ * @param deployedName
+ * @return
+ * @throws AdminException
+ */
+ Reader exportDataSource(String deployedName) throws AdminException;
+
+ /**
* Get the property definitions for creating the JDBC data source.
* @return
* @throws AdminException
Modified: trunk/common-core/src/main/java/com/metamatrix/core/util/ObjectConverterUtil.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/core/util/ObjectConverterUtil.java 2010-04-13 17:52:41 UTC (rev 2054)
+++ trunk/common-core/src/main/java/com/metamatrix/core/util/ObjectConverterUtil.java 2010-04-13 18:42:24 UTC (rev 2055)
@@ -29,6 +29,7 @@
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
+import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
@@ -128,7 +129,29 @@
write(is, f);
}
+
+ public static void write(final Reader reader, final String fileName) throws IOException {
+ File f = new File(fileName);
+ f.delete();
+ write(reader, f);
+ }
+
+ public static void write(final Reader reader, final File f) throws IOException {
+ FileWriter fw = new FileWriter(f);
+ try {
+ char[] buff = new char[2048];
+ int bytesRead;
+
+ // Simple read/write loop.
+ while (-1 != (bytesRead = reader.read(buff, 0, buff.length))) {
+ fw.write(buff, 0, bytesRead);
+ }
+ } finally {
+ fw.close();
+ }
+ }
+
public static void write(final InputStream is, final File f) throws IOException {
FileOutputStream fio = new FileOutputStream(f);
BufferedOutputStream bos = new BufferedOutputStream(fio);
Modified: trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java 2010-04-13 17:52:41 UTC (rev 2054)
+++ trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java 2010-04-13 18:42:24 UTC (rev 2055)
@@ -27,8 +27,8 @@
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
-import java.io.InputStreamReader;
import java.io.Reader;
+import java.io.StringReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
@@ -47,6 +47,7 @@
import org.jboss.managed.api.ComponentType;
import org.jboss.managed.api.DeploymentTemplateInfo;
import org.jboss.managed.api.ManagedComponent;
+import org.jboss.managed.api.ManagedDeployment;
import org.jboss.managed.api.ManagedObject;
import org.jboss.managed.api.ManagedProperty;
import org.jboss.managed.plugins.DefaultFieldsImpl;
@@ -66,8 +67,8 @@
import org.teiid.adminapi.AdminException;
import org.teiid.adminapi.AdminObject;
import org.teiid.adminapi.AdminProcessingException;
+import org.teiid.adminapi.ConnectionFactory;
import org.teiid.adminapi.ConnectionPoolStatistics;
-import org.teiid.adminapi.ConnectionFactory;
import org.teiid.adminapi.Model;
import org.teiid.adminapi.PropertyDefinition;
import org.teiid.adminapi.Request;
@@ -76,8 +77,8 @@
import org.teiid.adminapi.Transaction;
import org.teiid.adminapi.VDB;
import org.teiid.adminapi.WorkerPoolStatistics;
+import org.teiid.adminapi.impl.ConnectionFactoryMetaData;
import org.teiid.adminapi.impl.ConnectionPoolStatisticsMetadata;
-import org.teiid.adminapi.impl.ConnectionFactoryMetaData;
import org.teiid.adminapi.impl.DataPolicyMetadata;
import org.teiid.adminapi.impl.ModelMetaData;
import org.teiid.adminapi.impl.PropertyDefinitionMetadata;
@@ -90,18 +91,26 @@
import org.teiid.connector.api.Connector;
import org.teiid.jboss.IntegrationPlugin;
import org.teiid.jboss.deployers.RuntimeEngineDeployer;
+import org.teiid.templates.connector.ExportConnectorTypeTemplateInfo;
+import com.metamatrix.core.util.ObjectConverterUtil;
+
public class Admin extends TeiidAdmin {
private static final ProfileKey DEFAULT_PROFILE_KEY = new ProfileKey(ProfileKey.DEFAULT);
-
+
private static final String XA_DATA_SOURCE_TEMPLATE = "XADataSourceTemplate"; //$NON-NLS-1$
+ private static final String LOCAL_DATA_SOURCE_TEMPLATE = "LocalTxDataSourceTemplateInfo"; //$NON-NLS-1$
private static final long serialVersionUID = 7081309086056911304L;
private static ComponentType VDBTYPE = new ComponentType("teiid", "vdb");//$NON-NLS-1$ //$NON-NLS-2$
- private static ComponentType NOTXTYPE = new ComponentType("ConnectionFactory", "NoTx");//$NON-NLS-1$ //$NON-NLS-2$
- private static ComponentType TXTYPE = new ComponentType("ConnectionFactory", "Tx");//$NON-NLS-1$ //$NON-NLS-2$
private static ComponentType DQPTYPE = new ComponentType("teiid", "dqp");//$NON-NLS-1$ //$NON-NLS-2$
- private static ComponentType DSTYPE = new ComponentType("DataSource", "XA");//$NON-NLS-1$ //$NON-NLS-2$
private static String DQPNAME = RuntimeEngineDeployer.class.getName();
+ private static ExtendedComponentType NOTXTYPE = new ExtendedComponentType("ConnectionFactory", "NoTx", "no-tx-connection-factory");//$NON-NLS-1$ //$NON-NLS-2$
+ private static ExtendedComponentType TXTYPE = new ExtendedComponentType("ConnectionFactory", "Tx", "tx-connection-factory");//$NON-NLS-1$ //$NON-NLS-2$
+ private static ExtendedComponentType DS_LOCAL_TX = new ExtendedComponentType("DataSource", "LocalTx", "local-tx-datasource");//$NON-NLS-1$ //$NON-NLS-2$
+ private static ExtendedComponentType DS_XA_TX = new ExtendedComponentType("DataSource", "XA", "xa-datasource");//$NON-NLS-1$ //$NON-NLS-2$
+ private static ExtendedComponentType DS_NO_TX = new ExtendedComponentType("DataSource", "NoTx", "no-tx-datasource");//$NON-NLS-1$ //$NON-NLS-2$
+ private static ExtendedComponentType[] DS_TYPES = new ExtendedComponentType[] {DS_XA_TX, DS_LOCAL_TX, DS_NO_TX};
+ private static ExtendedComponentType[] CF_TYPES = new ExtendedComponentType[] {NOTXTYPE, TXTYPE};
private ManagementView view;
private DeploymentManager deploymentMgr;
@@ -178,12 +187,72 @@
@Override
public Reader exportConnectionFactory(String deployedName) throws AdminException {
- ManagedComponent mc = getConnectorBindingComponent(deployedName);
- if (mc != null) {
- return new InputStreamReader(exportDeployment(mc.getDeployment().getName()));
+ ManagementView view = getView();
+ try {
+ for (ExtendedComponentType type:CF_TYPES) {
+ ManagedComponent mc = view.getComponent(deployedName, type);
+ if (mc != null) {
+ return exportJCAConnection(deployedName, mc, type);
+ }
+ }
+ throw new AdminProcessingException(IntegrationPlugin.Util.getString("connector_not_found", deployedName)); //$NON-NLS-1$
+ } catch (Exception e) {
+ throw new AdminComponentException(e);
}
- return null;
}
+
+ private Reader exportJCAConnection(String deployedName, ManagedComponent mc, ExtendedComponentType type) throws AdminException {
+ try {
+ DeploymentTemplateInfo info = getView().getTemplate("export-template");
+ if(info == null) {
+ throw new AdminProcessingException(IntegrationPlugin.Util.getString("connector_type_not_found", "export-template")); //$NON-NLS-1$
+ }
+
+ for (ManagedProperty infoProperty:info.getProperties().values()) {
+ if (infoProperty != null) {
+ ManagedProperty mp = mc.getProperty(infoProperty.getName());
+ if (mp != null) {
+ infoProperty.setValue(mp.getValue());
+ }
+ }
+ }
+
+ ManagedProperty dsType = info.getProperties().get("dsType");
+ dsType.setValue(ManagedUtil.wrap(SimpleMetaType.STRING, type.getDsType()));
+
+ File dsXml = File.createTempFile(deployedName, "-ds.xml");
+ ExportConnectorTypeTemplateInfo.writeTemplate(dsXml, info);
+ Reader r = new StringReader(ObjectConverterUtil.convertFileToString(dsXml));
+ dsXml.delete();
+ return r;
+ } catch (NoSuchDeploymentException e) {
+ throw new AdminComponentException(e);
+ } catch (IOException e) {
+ throw new AdminComponentException(e);
+ } catch(Exception e) {
+ throw new AdminComponentException(e);
+ }
+ }
+
+ @Override
+ public Reader exportDataSource(String deployedName) throws AdminException {
+ if (deployedName.startsWith("java:")) { //$NON-NLS-1$
+ deployedName = deployedName.substring(5);
+ }
+ try {
+ ManagedComponent mc = null;
+ ManagementView view = getView();
+ for (ExtendedComponentType type:DS_TYPES) {
+ mc = view.getComponent(deployedName, type);
+ if (mc != null) {
+ return exportJCAConnection(deployedName, mc, type);
+ }
+ }
+ throw new AdminProcessingException(IntegrationPlugin.Util.getString("datasource_not_found", deployedName)); //$NON-NLS-1$
+ } catch (Exception e) {
+ throw new AdminComponentException(e);
+ }
+ }
private InputStream exportDeployment(String url) throws AdminComponentException {
try {
@@ -202,19 +271,14 @@
deployedName = deployedName.substring(5);
}
ManagementView view = getView();
- ManagedComponent mc = view.getComponent(deployedName, NOTXTYPE);
- if (mc != null) {
- if (isConnectorBinding(mc)) {
- return mc;
- }
- }
-
- mc = view.getComponent(deployedName, TXTYPE);
- if (mc != null) {
- if (isConnectorBinding(mc)) {
- return mc;
- }
- }
+ for (ExtendedComponentType type:CF_TYPES) {
+ ManagedComponent mc = view.getComponent(deployedName, type);
+ if (mc != null) {
+ if (isConnectorBinding(mc)) {
+ return mc;
+ }
+ }
+ }
} catch(Exception e) {
throw new AdminProcessingException(e.getMessage(), e);
}
@@ -374,14 +438,19 @@
@Override
public Set<String> getConnectorNames() throws AdminException{
- Set<String> names = getView().getTemplateNames();
- HashSet<String> matched = new HashSet<String>();
- for(String name:names) {
- if (name.startsWith("connector-")) {//$NON-NLS-1$
- matched.add(name);
+ try {
+ Set<ManagedDeployment> rarFiles = getView().getDeploymentsForType("rar");//$NON-NLS-1$
+ HashSet<String> matched = new HashSet<String>();
+ for(ManagedDeployment md:rarFiles) {
+ String name = md.getSimpleName();
+ if (name.startsWith("connector-") && name.endsWith(".rar")) {//$NON-NLS-1$ //$NON-NLS-2$
+ matched.add(name.substring(0, name.length()-4));
+ }
}
+ return matched;
+ } catch(Exception e) {
+ throw new AdminComponentException(e.getMessage(), e);
}
- return matched;
}
boolean matches(String regEx, String value) {
@@ -848,8 +917,13 @@
}
@Override
- public void addDataSource(String deploymentName, Properties properties) throws AdminException {
- addConnectionfactory(deploymentName, XA_DATA_SOURCE_TEMPLATE, properties);
+ public void addDataSource(String deploymentName, DataSourceType type, Properties properties) throws AdminException {
+ if (type == DataSourceType.XA) {
+ addConnectionfactory(deploymentName, XA_DATA_SOURCE_TEMPLATE, properties);
+ }
+ else if (type == DataSourceType.LOCAL) {
+ addConnectionfactory(deploymentName, LOCAL_DATA_SOURCE_TEMPLATE, properties);
+ }
}
private void addConnectionfactory(String deploymentName, String typeName, Properties properties) throws AdminException {
@@ -899,10 +973,13 @@
public void deleteDataSource(String deployedName) throws AdminException {
try {
ManagementView view = getView();
- ManagedComponent mc = view.getComponent(deployedName, DSTYPE);
- if (mc != null) {
- ManagedUtil.removeArchive(getDeploymentManager(),mc.getDeployment().getName());
- }
+ for (ExtendedComponentType type:DS_TYPES) {
+ ManagedComponent mc = view.getComponent(deployedName, type);
+ if (mc != null) {
+ ManagedUtil.removeArchive(getDeploymentManager(),mc.getDeployment().getName());
+ break;
+ }
+ }
} catch (Exception e) {
throw new AdminComponentException(e.getMessage(), e);
}
Added: trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/ExtendedComponentType.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/ExtendedComponentType.java (rev 0)
+++ trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/ExtendedComponentType.java 2010-04-13 18:42:24 UTC (rev 2055)
@@ -0,0 +1,39 @@
+/*
+ * 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.ComponentType;
+
+public class ExtendedComponentType extends ComponentType {
+ private static final long serialVersionUID = 5526223504408812809L;
+
+ private String dsType;
+
+ public ExtendedComponentType(String type, String subtype, String dsType) {
+ super(type, subtype);
+ this.dsType = dsType;
+ }
+
+ public String getDsType() {
+ return this.dsType;
+ }
+}
Property changes on: trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/ExtendedComponentType.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jboss-integration/src/main/java/org/teiid/templates/connector/ExportConnectorTypeTemplateInfo.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/templates/connector/ExportConnectorTypeTemplateInfo.java (rev 0)
+++ trunk/jboss-integration/src/main/java/org/teiid/templates/connector/ExportConnectorTypeTemplateInfo.java 2010-04-13 18:42:24 UTC (rev 2055)
@@ -0,0 +1,57 @@
+/*
+ * 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.profileservice.management.FilteredDeploymentTemplateInfo;
+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 {
+ FilteredDeploymentTemplateInfo filterInfo = new FilteredDeploymentTemplateInfo(values);
+ super.writeTemplate(dsXml, filterInfo);
+ }
+ }
+
+}
Property changes on: trunk/jboss-integration/src/main/java/org/teiid/templates/connector/ExportConnectorTypeTemplateInfo.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties
===================================================================
--- trunk/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties 2010-04-13 17:52:41 UTC (rev 2054)
+++ trunk/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties 2010-04-13 18:42:24 UTC (rev 2055)
@@ -36,6 +36,8 @@
vdb_not_found=VDB with name "{0}" version "{1}" not found in configuration
model_not_found=Model name "{0}" not found in the VDB with name "{1}" version "{2}"
policy_not_found=Policy name "{0}" not found in the VDB with name "{1}" version "{2}"
+connector_not_found=Connection factory {0} not found in the configuration.
+datasource_not_found=Datasource {0} not found in the configuration.
sourcename_not_found=No source name {0} found in the model: {1}.{2}.{3}
connector_started= Teiid connector {0} started
Modified: trunk/test-integration/db/src/test/java/org/teiid/adminapi/jboss/TestConnectorBindings.java
===================================================================
--- trunk/test-integration/db/src/test/java/org/teiid/adminapi/jboss/TestConnectorBindings.java 2010-04-13 17:52:41 UTC (rev 2054)
+++ trunk/test-integration/db/src/test/java/org/teiid/adminapi/jboss/TestConnectorBindings.java 2010-04-13 18:42:24 UTC (rev 2055)
@@ -389,4 +389,12 @@
// remove non-existent role name
admin.removeRoleFromDataPolicy("TransactionsRevisited", 1, "policy1", "FOO");
}
+
+ @Test public void testExportConnectionFactory() throws Exception {
+ ObjectConverterUtil.write(admin.exportConnectionFactory("products-cf"), "cf.xml");
+ }
+
+ @Test public void testExportDataSource() throws Exception {
+ ObjectConverterUtil.write(admin.exportDataSource("CustomersDS"), "ds.xml");
+ }
}
14 years, 8 months
teiid SVN: r2054 - in trunk: engine/src/main/java/org/teiid/dqp/internal/process and 1 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-04-13 13:52:41 -0400 (Tue, 13 Apr 2010)
New Revision: 2054
Added:
trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestResultsCache.java
Modified:
trunk/engine/src/main/java/com/metamatrix/query/analysis/AnalysisRecord.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java
Log:
TEIID-168 fixing regressions with cached results
Modified: trunk/engine/src/main/java/com/metamatrix/query/analysis/AnalysisRecord.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/analysis/AnalysisRecord.java 2010-04-13 17:50:43 UTC (rev 2053)
+++ trunk/engine/src/main/java/com/metamatrix/query/analysis/AnalysisRecord.java 2010-04-13 17:52:41 UTC (rev 2054)
@@ -106,6 +106,7 @@
private boolean recordQueryPlan;
private boolean recordDebug;
+ private PlanNode queryPlan;
// Annotations
private Collection<Annotation> annotations;
@@ -130,6 +131,14 @@
public static AnalysisRecord createNonRecordingRecord() {
return new AnalysisRecord(false, false);
}
+
+ public PlanNode getQueryPlan() {
+ return queryPlan;
+ }
+
+ public void setQueryPlan(PlanNode queryPlan) {
+ this.queryPlan = queryPlan;
+ }
/**
* Determine whether query plan should be recorded
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java 2010-04-13 17:50:43 UTC (rev 2053)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java 2010-04-13 17:52:41 UTC (rev 2054)
@@ -214,6 +214,9 @@
} finally {
if (this.state == ProcessingState.CLOSE && !isClosed) {
attemptClose();
+ if (this.processingException != null) {
+ sendError();
+ }
} else if (isClosed) {
/*
* since there may be a client waiting notify them of a problem
@@ -248,6 +251,14 @@
sendResultsIfNeeded(null);
collector.collectTuples();
doneProducingBatches = this.resultsBuffer.isFinal();
+ if (doneProducingBatches && cid != null) {
+ boolean sessionScope = this.processor.getContext().isSessionFunctionEvaluated();
+ CachedResults cr = new CachedResults();
+ cr.setCommand(originalCommand);
+ cr.setAnalysisRecord(analysisRecord);
+ cr.setResults(this.resultsBuffer);
+ dqpCore.getRsCache().put(cid, sessionScope, cr);
+ }
}
if (doneProducingBatches) {
if (this.transactionState == TransactionState.ACTIVE) {
@@ -285,26 +296,21 @@
protected void attemptClose() {
int rowcount = -1;
if (this.resultsBuffer != null) {
- this.processor.closeProcessing();
+ if (this.processor != null) {
+ this.processor.closeProcessing();
- if (LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) {
- LogManager.logDetail(LogConstants.CTX_DQP, "Removing tuplesource for the request " + requestID); //$NON-NLS-1$
- }
- rowcount = resultsBuffer.getRowCount();
- if (this.cid == null || !this.doneProducingBatches) {
- resultsBuffer.remove();
- } else {
- boolean sessionScope = this.processor.getContext().isSessionFunctionEvaluated();
- CachedResults cr = new CachedResults();
- cr.setCommand(originalCommand);
- cr.setAnalysisRecord(analysisRecord);
- cr.setResults(this.resultsBuffer);
- dqpCore.getRsCache().put(cid, sessionScope, cr);
+ if (LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) {
+ LogManager.logDetail(LogConstants.CTX_DQP, "Removing tuplesource for the request " + requestID); //$NON-NLS-1$
+ }
+ rowcount = resultsBuffer.getRowCount();
+ if (this.cid == null || !this.doneProducingBatches) {
+ resultsBuffer.remove();
+ }
+
+ for (DataTierTupleSource connectorRequest : this.connectorInfo.values()) {
+ connectorRequest.fullyCloseSource();
+ }
}
-
- for (DataTierTupleSource connectorRequest : this.connectorInfo.values()) {
- connectorRequest.fullyCloseSource();
- }
this.resultsBuffer = null;
@@ -366,6 +372,7 @@
resultsBuffer = collector.getTupleBuffer();
resultsBuffer.setForwardOnly(isForwardOnly());
analysisRecord = request.analysisRecord;
+ analysisRecord.setQueryPlan(processor.getProcessorPlan().getDescriptionProperties());
transactionContext = request.transactionContext;
if (this.transactionContext != null && this.transactionContext.getTransactionType() != Scope.NONE) {
this.transactionState = TransactionState.ACTIVE;
@@ -438,10 +445,12 @@
// send any warnings with the response object
List<Throwable> responseWarnings = new ArrayList<Throwable>();
- List<Exception> currentWarnings = processor.getAndClearWarnings();
- if (currentWarnings != null) {
- responseWarnings.addAll(currentWarnings);
- }
+ if (this.processor != null) {
+ List<Exception> currentWarnings = processor.getAndClearWarnings();
+ if (currentWarnings != null) {
+ responseWarnings.addAll(currentWarnings);
+ }
+ }
synchronized (warnings) {
responseWarnings.addAll(this.warnings);
this.warnings.clear();
@@ -481,9 +490,12 @@
}
private void setAnalysisRecords(ResultsMessage response) {
- if(analysisRecord != null) {
+ if(analysisRecord != null) {
if (requestMsg.getShowPlan() != ShowPlan.OFF) {
- response.setPlanDescription(processor.getProcessorPlan().getDescriptionProperties());
+ if (processor != null) {
+ analysisRecord.setQueryPlan(processor.getProcessorPlan().getDescriptionProperties());
+ }
+ response.setPlanDescription(analysisRecord.getQueryPlan());
response.setAnnotations(analysisRecord.getAnnotations());
}
if (requestMsg.getShowPlan() == ShowPlan.DEBUG) {
Added: trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestResultsCache.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestResultsCache.java (rev 0)
+++ trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestResultsCache.java 2010-04-13 17:52:41 UTC (rev 2054)
@@ -0,0 +1,59 @@
+/*
+ * 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.jdbc;
+
+import static org.junit.Assert.*;
+
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.Statement;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import com.metamatrix.core.util.UnitTestUtil;
+
+@SuppressWarnings("nls")
+public class TestResultsCache {
+
+ private Connection conn;
+
+ @Before public void setUp() throws Exception {
+ FakeServer server = new FakeServer();
+ server.deployVDB("test", UnitTestUtil.getTestDataPath() + "/TestCase3473/test.vdb");
+ conn = server.createConnection("jdbc:teiid:test"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ @Test public void testCache() throws Exception {
+ Statement s = conn.createStatement();
+ s.execute("set showplan on");
+ ResultSet rs = s.executeQuery("/* cache */ select 1");
+ assertTrue(rs.next());
+ s.execute("set noexec on");
+ rs = s.executeQuery("/* cache */ select 1");
+ assertTrue(rs.next());
+ rs = s.executeQuery("select 1");
+ assertFalse(rs.next());
+ }
+
+}
Property changes on: trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestResultsCache.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
14 years, 8 months
teiid SVN: r2052 - in trunk/runtime/src/test/java/org/teiid: deployers and 1 other directory.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-04-13 13:47:07 -0400 (Tue, 13 Apr 2010)
New Revision: 2052
Added:
trunk/runtime/src/test/java/org/teiid/deployers/
trunk/runtime/src/test/java/org/teiid/deployers/TestObjectSerializer.java
Log:
TEIID-1043 fix to ensure that attachment information errors do not prevent vdb loading
Added: trunk/runtime/src/test/java/org/teiid/deployers/TestObjectSerializer.java
===================================================================
--- trunk/runtime/src/test/java/org/teiid/deployers/TestObjectSerializer.java (rev 0)
+++ trunk/runtime/src/test/java/org/teiid/deployers/TestObjectSerializer.java 2010-04-13 17:47:07 UTC (rev 2052)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.deployers;
+
+import static org.junit.Assert.*;
+
+import java.io.File;
+
+import org.junit.Test;
+
+import com.metamatrix.core.util.UnitTestUtil;
+
+@SuppressWarnings("nls")
+public class TestObjectSerializer {
+
+ @Test public void testLoadSafe() throws Exception {
+ ObjectSerializer os = new ObjectSerializer();
+ File f = UnitTestUtil.getTestScratchFile("foo");
+ os.saveAttachment(f, new Long(2));
+ assertNotNull(os.loadAttachment(f, Long.class));
+ assertNull(os.loadSafe(f, Integer.class));
+ }
+
+}
Property changes on: trunk/runtime/src/test/java/org/teiid/deployers/TestObjectSerializer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
14 years, 8 months
teiid SVN: r2051 - in trunk: test-integration/db/src/test/java/com and 1 other directory.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-04-13 12:28:08 -0400 (Tue, 13 Apr 2010)
New Revision: 2051
Added:
trunk/test-integration/db/src/test/java/com/IntTest.java
Modified:
trunk/runtime/src/main/java/org/teiid/deployers/ObjectSerializer.java
trunk/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java
trunk/runtime/src/main/java/org/teiid/deployers/VDBParserDeployer.java
Log:
TEIID-1043 fix to ensure that attachment information errors do not prevent vdb loading
Modified: trunk/runtime/src/main/java/org/teiid/deployers/ObjectSerializer.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/ObjectSerializer.java 2010-04-12 03:02:54 UTC (rev 2050)
+++ trunk/runtime/src/main/java/org/teiid/deployers/ObjectSerializer.java 2010-04-13 16:28:08 UTC (rev 2051)
@@ -30,14 +30,17 @@
import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
import org.jboss.logging.Logger;
+import org.teiid.runtime.RuntimePlugin;
+import com.metamatrix.common.log.LogConstants;
+import com.metamatrix.common.log.LogManager;
import com.metamatrix.core.util.FileUtils;
public class ObjectSerializer {
private static final Logger log = Logger.getLogger(ObjectSerializer.class);
- private static final String ATTACHMENT_SUFFIX = ".ser";
+ private static final String ATTACHMENT_SUFFIX = ".ser"; //$NON-NLS-1$
private String storagePath;
@@ -45,10 +48,9 @@
this.storagePath = path;
}
- @SuppressWarnings("unchecked")
public <T> T loadAttachment(File attachmentsStore, Class<T> expected) throws IOException, ClassNotFoundException {
if (log.isTraceEnabled()) {
- log.trace("loadAttachment, attachmentsStore=" + attachmentsStore);
+ log.trace("loadAttachment, attachmentsStore=" + attachmentsStore); //$NON-NLS-1$
}
ObjectInputStream ois = null;
@@ -64,7 +66,7 @@
public void saveAttachment(File attachmentsStore, Object attachment) throws IOException {
if (log.isTraceEnabled()) {
- log.trace("saveAttachment, attachmentsStore=" + attachmentsStore + ", attachment=" + attachment);
+ log.trace("saveAttachment, attachmentsStore=" + attachmentsStore + ", attachment=" + attachment); //$NON-NLS-1$ //$NON-NLS-2$
}
ObjectOutputStream oos = null;
@@ -100,4 +102,17 @@
String dirName = this.storagePath + File.separator + fileName + File.separator;
return dirName;
}
+
+ public <T> T loadSafe(File cacheFile, Class<T> clazz) {
+ try {
+ if (cacheFile.exists()) {
+ return clazz.cast(loadAttachment(cacheFile, clazz));
+ }
+ return null;
+ } catch (Exception e) {
+ LogManager.logWarning(LogConstants.CTX_RUNTIME, e, RuntimePlugin.Util.getString("invalid_metadata_file", cacheFile.getAbsolutePath())); //$NON-NLS-1$
+ }
+ cacheFile.delete();
+ return null;
+ }
}
Modified: trunk/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java 2010-04-12 03:02:54 UTC (rev 2050)
+++ trunk/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java 2010-04-13 16:28:08 UTC (rev 2051)
@@ -223,19 +223,13 @@
boolean cache = "cached".equalsIgnoreCase(vdb.getPropertyValue("UseConnectorMetadata")); //$NON-NLS-1$ //$NON-NLS-2$
File cacheFile = null;
if (cache) {
- try {
- cacheFile = buildCachedFileName(unit, vdb,model.getName());
- if (cacheFile.exists()) {
- return this.serializer.loadAttachment(cacheFile, MetadataStore.class);
- }
- } catch (IOException e) {
- LogManager.logWarning(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("invalid_metadata_file", cacheFile.getAbsolutePath())); //$NON-NLS-1$
- } catch (ClassNotFoundException e) {
- LogManager.logWarning(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("invalid_metadata_file", cacheFile.getAbsolutePath())); //$NON-NLS-1$
- }
+ cacheFile = buildCachedFileName(unit, vdb,model.getName());
+ MetadataStore store = this.serializer.loadSafe(cacheFile, MetadataStore.class);
+ if (store != null) {
+ return store;
+ }
}
-
Exception exception = null;
for (String sourceName: model.getSourceNames()) {
ConnectorManager cm = this.connectorManagerRepository.getConnectorManager(model.getSourceJndiName(sourceName));
Modified: trunk/runtime/src/main/java/org/teiid/deployers/VDBParserDeployer.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/VDBParserDeployer.java 2010-04-12 03:02:54 UTC (rev 2050)
+++ trunk/runtime/src/main/java/org/teiid/deployers/VDBParserDeployer.java 2010-04-13 16:28:08 UTC (rev 2051)
@@ -140,12 +140,9 @@
unit.addAttachment(IndexMetadataFactory.class, imf);
// add the cached store.
- MetadataStoreGroup stores = null;
- File cacheFileName = this.serializer.getAttachmentPath(unit, vdb.getName()+"_"+vdb.getVersion()); //$NON-NLS-1$
- if (cacheFileName.exists()) {
- stores = this.serializer.loadAttachment(cacheFileName, MetadataStoreGroup.class);
- }
- else {
+ File cacheFile = this.serializer.getAttachmentPath(unit, vdb.getName()+"_"+vdb.getVersion()); //$NON-NLS-1$
+ MetadataStoreGroup stores = this.serializer.loadSafe(cacheFile, MetadataStoreGroup.class);
+ if (stores == null) {
stores = new MetadataStoreGroup();
stores.addStore(imf.getMetadataStore());
}
Added: trunk/test-integration/db/src/test/java/com/IntTest.java
===================================================================
--- trunk/test-integration/db/src/test/java/com/IntTest.java (rev 0)
+++ trunk/test-integration/db/src/test/java/com/IntTest.java 2010-04-13 16:28:08 UTC (rev 2051)
@@ -0,0 +1,37 @@
+/*
+ * Copyright � 2000-2005 MetaMatrix, Inc. All rights reserved.
+ */
+package com;
+
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.Statement;
+
+import org.teiid.jdbc.TeiidDriver;
+import org.teiid.jdbc.TeiidStatement;
+
+
+/**
+ */
+public class IntTest {
+
+ public static void main(String[] args) throws Exception {
+ Connection c = TeiidDriver.getInstance().connect("jdbc:teiid:TPCRperf@mm://localhost:31000;user=admin;password=teiid", null);
+ Statement s = c.createStatement();
+ try {
+ s.execute("set showplan debug");
+ ResultSet rs = s.executeQuery("SELECT ORDERS.O_ORDERKEY, ORDERS.O_ORDERDATE, ORDERS.O_CLERK, CUSTOMER.C_CUSTKEY, CUSTOMER.C_NAME FROM TPCR01_SqlServerVirt.TPCR01.ORDERS, TPCR01_OracleVirt.CUSTOMER WHERE CUSTOMER.C_CUSTKEY = ORDERS.O_CUSTKEY AND CUSTOMER.C_NATIONKEY = 1 AND CUSTOMER.C_ACCTBAL between 5 AND 2000 AND ORDERS.O_ORDERDATE < {ts'1998-01-01 00:00:00'} OPTION MAKEDEP TPCR01_SQLServerPhys.TPCR01.ORDERS");
+ int i = 0;
+ while (rs.next()) {
+ i++;
+ }
+ System.out.println(s.unwrap(TeiidStatement.class).getPlanDescription());
+ System.out.println(s.unwrap(TeiidStatement.class).getDebugLog());
+ System.out.println(i);
+ } finally {
+ s.close();
+ c.close();
+ }
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/test-integration/db/src/test/java/com/IntTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
14 years, 8 months
teiid SVN: r2050 - trunk/documentation/reference/src/main/docbook/en-US/content.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-04-11 23:02:54 -0400 (Sun, 11 Apr 2010)
New Revision: 2050
Modified:
trunk/documentation/reference/src/main/docbook/en-US/content/federated_planning.xml
Log:
TEIID-1040 changing to document the use of set statements
Modified: trunk/documentation/reference/src/main/docbook/en-US/content/federated_planning.xml
===================================================================
--- trunk/documentation/reference/src/main/docbook/en-US/content/federated_planning.xml 2010-04-12 01:49:40 UTC (rev 2049)
+++ trunk/documentation/reference/src/main/docbook/en-US/content/federated_planning.xml 2010-04-12 03:02:54 UTC (rev 2050)
@@ -301,24 +301,13 @@
default for all queries in a Connection with either
setPartialResultsMode("true") on a DataSource or
partialResultsMode=true on a JDBC URL. In either case, partial
- results mode may be overridden on a per-query basis by setting
- the execution property on the Statement. To set this property,
- cast to the Teiid Statement JDBC API extension interface
- <classname>org.teiid.jdbc.TeiidStatement
- </classname>
+ results mode may be overridden with a set statement.
</para>
<example>
<title>Example - Setting Partial Results Mode</title>
<programlisting>Statement statement = ...obtain statement from Connection...
-
-TeiidStatement mmStatement = statement.unWrap(TeiidStatement.class);
-
-mmStatement.setExecutionProperty(
- ExecutionProperties.PROP_PARTIAL_RESULTS_MODE, "true");</programlisting>
+statement.execute("set partialResultsMode true");</programlisting>
</example>
- <para>This property can be set before each execution (via an
- execute method) on a Statement (or PreparedStatement or
- CallableStatement).</para>
</sect3>
<sect3>
<title>Source Unavailability</title>
@@ -354,7 +343,7 @@
<example>
<title>Example - Printing List of Failed Sources
</title>
- <programlisting>statement.setExecutionProperty( PROP_PARTIAL_RESULTS_MODE, "true");
+ <programlisting>statement.execute("set partialResultsMode true");
ResultSet results = statement.executeQuery("SELECT Name FROM Accounts");
SQLWarning warning = statement.getWarnings();
if(warning instanceof PartialResultsWarning) {
@@ -404,19 +393,12 @@
</para>
<example>
<title>Retrieving a Query Plan</title>
- <programlisting>TeiidStatement mmstatement = statement.unWrap(TeiidStatement.class);
-String sql = "select ...";
-
-mmstatement.setExecutionProperty(ExecutionProperties.PROP_SQL_OPTIONS, ExecutionProperties.SQL_OPTION_SHOWPLAN);
-//or
-//sql += " OPTION SHOWPLAN";
-//or
-//sql += " OPTION PLANONLY";
-
-ResultSet rs = statement.executeQuery(sql);
-
-PlanNode queryPlan = mmstatement.getPlanDescription();
-System.out.println(XMLOutputVisitor.convertToXML(queryPlan);</programlisting>
+ <programlisting>
+statement.execute("set showplan on");
+ResultSet rs = statement.executeQuery("select ...");
+TeiidStatement tstatement = statement.unWrap(TeiidStatement.class);
+PlanNode queryPlan = tstatement.getPlanDescription();
+System.out.println(queryPlan);</programlisting>
</example>
<para>The query plan is made available automatically in several
of Teiid's tools.</para>
14 years, 8 months