Author: rareddy
Date: 2010-06-15 11:59:48 -0400 (Tue, 15 Jun 2010)
New Revision: 2231
Removed:
trunk/adminshell/src/main/resources/connector.xsl
Modified:
trunk/adminshell/src/main/java/org/teiid/adminshell/MigrationUtil.java
trunk/adminshell/src/main/resources/vdb.xsl
Log:
TEIID-1121: Fixing the migrate script for translator changes
Modified: trunk/adminshell/src/main/java/org/teiid/adminshell/MigrationUtil.java
===================================================================
--- trunk/adminshell/src/main/java/org/teiid/adminshell/MigrationUtil.java 2010-06-14
16:35:03 UTC (rev 2230)
+++ trunk/adminshell/src/main/java/org/teiid/adminshell/MigrationUtil.java 2010-06-15
15:59:48 UTC (rev 2231)
@@ -58,17 +58,14 @@
"\n 7.0 compatible replacement files will be created in the same directory
" +
"\n as your file." +
"\n If you supply a vdb, the new vdb file will have a _70.vdb suffix." +
- "\n If you supply a dynamic vdb file, then two new files will be created:
" +
- "\n <file name>-vdb.xml and <file name>-bindings.xml" +
- "\n\nNote: this program will only create connector binding connection factories
" +
- "\n if the bindings are present in the specified file." +
+ "\n If you supply a dynamic vdb file, <file name>-vdb.xml is created
" +
+ "\n\nNote: This program will create translator names by Connector's
Component Type name" +
+ "\n As they are not gureented to match; recheck their for their validity"
+
"\n\nNote: this program will NOT create the -ds.xml files needed by JBoss to
" +
"\n create underlying DataSource connection pools." +
"\n You will need to manually create one -ds.xml for each JDBC DataSource
" +
"\n with a JNDI name of <connector binding name>DS, " +
- "\n where any spaces in the name are replace by _" +
- "\n\nNode: depending upon the connectors used, you may need to manually edit
the " +
- " -bindings.xml file.");
+ "\n where any spaces in the name are replace by _");
System.exit(-1);
}
File file = new File(args[0]);
@@ -101,7 +98,6 @@
manifest.delete();
}
transformConfig(config, "/vdb.xsl", new StreamResult(new File(metainf,
"vdb.xml")));
- transformConfig(config, "/connector.xsl", new StreamResult(new
File(file.getParentFile(), fileName + "-bindings-ds.xml")));
config.delete();
FileOutputStream out = new FileOutputStream(new File(file.getParent(), fileName +
"_70.vdb"));
ZipOutputStream zos = new ZipOutputStream(new BufferedOutputStream(out));
@@ -114,7 +110,6 @@
} else if (ext.endsWith("xml") || ext.endsWith("def")){
File parent = file.getParentFile();
transformConfig(file, "/vdb.xsl", new StreamResult(new File(parent, fileName
+ "-vdb.xml")));
- transformConfig(file, "/connector.xsl", new StreamResult(new File(parent,
fileName + "-bindings-ds.xml")));
} else {
System.err.println(fullName + " is not a vdb or xml file. Run with no arguments
for help."); //$NON-NLS-1$
System.exit(-1);
Deleted: trunk/adminshell/src/main/resources/connector.xsl
===================================================================
--- trunk/adminshell/src/main/resources/connector.xsl 2010-06-14 16:35:03 UTC (rev 2230)
+++ trunk/adminshell/src/main/resources/connector.xsl 2010-06-15 15:59:48 UTC (rev 2231)
@@ -1,138 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
- <xsl:param name="version">7.0</xsl:param>
- <xsl:output method="xml" indent="yes"/>
- <xsl:strip-space elements="*"/>
- <xsl:template match="VDB">
- <xsl:if test="ConnectorBindings">
- <connection-factories>
- <xsl:for-each select="ConnectorBindings/Connector">
- <no-tx-connection-factory>
- <jndi-name><xsl:value-of select="translate(@Name, ' ',
'_')" /></jndi-name>
- <xsl:choose>
- <xsl:when test="@ComponentType='Text File Connector'">
- <rar-name>connector-text-<xsl:value-of
select="$version"/>.rar</rar-name>
- </xsl:when>
- <xsl:when test="starts-with(@ComponentType,'Apache ') or
starts-with(@ComponentType,'MySQL ')
- or starts-with(@ComponentType,'Oracle ') or
starts-with(@ComponentType,'PostgreSQL ')
- or starts-with(@ComponentType,'SQL Server ') or
starts-with(@ComponentType,'DB2 ')
- or starts-with(@ComponentType,'MS Access ') or
starts-with(@ComponentType,'MS Excel ')
- or starts-with(@ComponentType,'JDBC ') or
starts-with(@ComponentType,'Teiid ')
- or starts-with(@ComponentType,'MM ') or
starts-with(@ComponentType,'H2 ')
- or starts-with(@ComponentType,'HSQLDB ') or
starts-with(@ComponentType,'Sybase ')
- ">
- <rar-name>connector-jdbc-<xsl:value-of
select="$version"/>.rar</rar-name>
- </xsl:when>
- <xsl:when test="@ComponentType='LDAP Connector'">
- <rar-name>connector-ldap-<xsl:value-of
select="$version"/>.rar</rar-name>
- </xsl:when>
- <xsl:when test="@ComponentType='Loopback Connector'">
- <rar-name>connector-loopback-<xsl:value-of
select="$version"/>.rar</rar-name>
- </xsl:when>
- <xsl:when test="@ComponentType='Salesforce Connector'">
- <rar-name>connector-salesforce-<xsl:value-of
select="$version"/>.rar</rar-name>
- </xsl:when>
- <xsl:when test="@ComponentType='XML File Connector' or
@ComponentType='XML-Relational File Connector'">
- <rar-name>connector-xml-file-<xsl:value-of
select="$version"/>.rar</rar-name>
- </xsl:when>
- <xsl:when test="@ComponentType='XML SOAP Connector' or
@ComponentType='XML-Relational Soap Connector'">
- <rar-name>connector-xml-soap-<xsl:value-of
select="$version"/>.rar</rar-name>
- </xsl:when>
- <xsl:when test="@ComponentType='XML-Relational HTTP
Connector'">
- <rar-name>connector-xml-http-<xsl:value-of
select="$version"/>.rar</rar-name>
- </xsl:when>
- </xsl:choose>
-
<connection-definition>org.teiid.connector.api.Connector</connection-definition>
- <xsl:for-each select="Properties/Property">
- <xsl:choose>
- <xsl:when test="@Name='ConnectorMaxConnections' or
@Name='UsePostDelegation'
- or @Name='ConnectorThreadTTL' or @Name='DeployedName'
- or @Name='ConnectorMaxThreads' or @Name='SetCriteriaBatchSize'
- or @Name='ConnectorClassPath' or
@Name='SourceConnectionTestInterval'
- or @Name='metamatrix.service.essentialservice' or
@Name='ServiceMonitoringEnabled'
- or @Name='ConnectorClass' or @Name='ServiceClassName'
- or @Name='SynchWorkers' or @Name='UseCredentialMap'
- or @Name='ConnectionPoolEnabled' or
@Name='AdminConnectionsAllowed'
- or starts-with((a)Name,'com.metamatrix.data.pool') or starts-with(@Name,
'getMax')
- or starts-with(@Name, 'supports') or starts-with(@Name,
'getSupported')
- or @Name='requiresCriteria' or @Name='useAnsiJoin'
- or @Name='URL' or @Name='ConnectionSource'
- or @Name='User' or @Name='Password' or starts-with(@Name,
'ResultSetCache')
- or starts-with(@Name, 'Extension') or @Name='Driver'
- or @Name='MaxSQLLength'">
- <xsl:comment><config-property name="<xsl:value-of
select="@Name"/>"><xsl:value-of
select="text()"/></config-property></xsl:comment>
- </xsl:when>
- <xsl:when test="@Name='MaxResultRows' and
text()='0'">
- <config-property>
- <xsl:attribute name="name">
- <xsl:value-of select="@Name"/>
- </xsl:attribute>-1</config-property>
- </xsl:when>
- <xsl:otherwise>
- <config-property>
- <xsl:attribute name="name">
- <xsl:value-of select="@Name"/>
- </xsl:attribute>
- <xsl:value-of select="text()"/>
- </config-property>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:for-each>
- <xsl:if test="starts-with(@ComponentType,'Apache ') or
starts-with(@ComponentType,'MySQL ')
- or starts-with(@ComponentType,'Oracle ') or
starts-with(@ComponentType,'PostgreSQL ')
- or starts-with(@ComponentType,'SQL Server ') or
starts-with(@ComponentType,'DB2 ')
- or starts-with(@ComponentType,'MS Access ') or
starts-with(@ComponentType,'MS Excel ')
- or starts-with(@ComponentType,'JDBC ') or
starts-with(@ComponentType,'Teiid ')
- or starts-with(@ComponentType,'MM ') or
starts-with(@ComponentType,'H2 ')
- or starts-with(@ComponentType,'HSQLDB ') or
starts-with(@ComponentType,'Sybase ')
- ">
- <config-property name="SourceJNDIName">java:<xsl:value-of
select="translate(@Name, ' ', '_')"
/>DS</config-property>
- <xsl:message>For connector binding "<xsl:value-of
select="@Name" />" of legacy type "<xsl:value-of
select="@ComponentType" />", you will need to create a -ds.xml JDBC
DataSource with JNDI name <xsl:value-of select="translate(@Name, ' ',
'_')" />DS</xsl:message>
- <xsl:choose>
- <xsl:when test="starts-with(@ComponentType,'Apache ')">
- <config-property
name="ExtensionTranslationClassName">org.teiid.connector.jdbc.derby.DerbySQLTranslator</config-property>
- </xsl:when>
- <xsl:when test="starts-with(@ComponentType,'MySQL 5 ')">
- <config-property
name="ExtensionTranslationClassName">org.teiid.connector.jdbc.mysql.MySQL5Translator</config-property>
- </xsl:when>
- <xsl:when test="starts-with(@ComponentType,'MySQL JDBC')">
- <config-property
name="ExtensionTranslationClassName">org.teiid.connector.jdbc.mysql.MySQLTranslator</config-property>
- </xsl:when>
- <xsl:when test="starts-with(@ComponentType,'Oracle')">
- <config-property
name="ExtensionTranslationClassName">org.teiid.connector.jdbc.oracle.OracleSQLTranslator</config-property>
- </xsl:when>
- <xsl:when test="starts-with(@ComponentType,'PostgreSQL')">
- <config-property
name="ExtensionTranslationClassName">org.teiid.connector.jdbc.postgresql.PostgreSQLTranslator</config-property>
- </xsl:when>
- <xsl:when test="starts-with(@ComponentType,'SQL Server')">
- <config-property
name="ExtensionTranslationClassName">org.teiid.connector.jdbc.sqlserver.SQLServerSQLTranslator</config-property>
- </xsl:when>
- <xsl:when test="starts-with(@ComponentType,'DB2')">
- <config-property
name="ExtensionTranslationClassName">org.teiid.connector.jdbc.db2.DB2SQLTranslator</config-property>
- </xsl:when>
- <xsl:when test="starts-with(@ComponentType,'H2')">
- <config-property
name="ExtensionTranslationClassName">org.teiid.connector.jdbc.h2.H2Translator</config-property>
- </xsl:when>
- <xsl:when test="starts-with(@ComponentType,'HSQLDQ')">
- <config-property
name="ExtensionTranslationClassName">org.teiid.connector.jdbc.hsql.HSSQLTranslator</config-property>
- </xsl:when>
- <xsl:when test="starts-with(@ComponentType,'Sybase')">
- <config-property
name="ExtensionTranslationClassName">org.teiid.connector.jdbc.sybase.SybaseSQLTranslator</config-property>
- </xsl:when>
- <xsl:otherwise>
- <config-property
name="ExtensionTranslationClassName">org.teiid.connector.jdbc.translator.Translator</config-property>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:if>
- <xsl:if test="contains(@ComponentType,'XA')">
- <config-property name="IsXA">true</config-property>
- </xsl:if>
- <xsl:if test="Properties/Property[@Name='ConnectorMaxConnections' or
@Name='com.metamatrix.data.pool.max_connections']">
- <max-pool-size><xsl:value-of
select="Properties/Property[@Name='ConnectorMaxConnections' or
@Name='com.metamatrix.data.pool.max_connections']/text()"/></max-pool-size>
- </xsl:if>
- </no-tx-connection-factory>
- </xsl:for-each>
- </connection-factories>
- </xsl:if>
- </xsl:template>
-</xsl:stylesheet>
Modified: trunk/adminshell/src/main/resources/vdb.xsl
===================================================================
--- trunk/adminshell/src/main/resources/vdb.xsl 2010-06-14 16:35:03 UTC (rev 2230)
+++ trunk/adminshell/src/main/resources/vdb.xsl 2010-06-15 15:59:48 UTC (rev 2231)
@@ -40,8 +40,15 @@
</xsl:for-each>
<xsl:for-each select="ConnectorBindings/Connector">
<source>
+ <xsl:variable name="connector-name" select="@Name"/>
<xsl:attribute name="name"><xsl:value-of
select="@Name" /></xsl:attribute>
- <xsl:attribute name="jndi-name"><xsl:value-of
select="concat('java:',translate(@Name, ' ', '_'))"
/></xsl:attribute>
+ <xsl:attribute
name="connection-jndi-name"><xsl:value-of
select="concat('java:',translate(@Name, ' ', '_'))"
/></xsl:attribute>
+
+ <xsl:for-each select="//ConnectorBindings/Connector">
+ <xsl:if test="@Name=$connector-name">
+ <xsl:attribute name="translator-name"><xsl:value-of
select="translate(substring-before(@ComponentType, ' '),
'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'abcdefghijklmnopqrstuvwxyz')"/></xsl:attribute>
+ </xsl:if>
+ </xsl:for-each>
</source>
</xsl:for-each>
</model>