Author: rareddy
Date: 2010-04-16 17:07:02 -0400 (Fri, 16 Apr 2010)
New Revision: 2060
Modified:
trunk/build/kit-jboss-container/deploy/teiid/teiid-connector-templates-jboss-beans.xml
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-1051: Adding .RAR extension to the connector names, so that there is no extra logic
needs to be done when user looking at the connection factory property.
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-15
20:03:04 UTC (rev 2059)
+++
trunk/build/kit-jboss-container/deploy/teiid/teiid-connector-templates-jboss-beans.xml 2010-04-16
21:07:02 UTC (rev 2060)
@@ -24,7 +24,7 @@
<factory bean="DSDeploymentTemplateInfoFactory"/>
<parameter
class="java.lang.Class">org.teiid.templates.connector.ConnectorTypeTemplateInfo</parameter>
<parameter
class="java.lang.Class">org.jboss.resource.metadata.mcf.NoTxConnectionFactoryDeploymentMetaData</parameter>
- <parameter
class="java.lang.String">connector-jdbc-${project.version}</parameter>
+ <parameter
class="java.lang.String">connector-jdbc-${project.version}.rar</parameter>
<parameter class="java.lang.String">Teiid JDBC
Connector</parameter>
</constructor>
</bean>
@@ -38,7 +38,7 @@
<factory bean="DSDeploymentTemplateInfoFactory"/>
<parameter
class="java.lang.Class">org.teiid.templates.connector.ConnectorTypeTemplateInfo</parameter>
<parameter
class="java.lang.Class">org.jboss.resource.metadata.mcf.NoTxConnectionFactoryDeploymentMetaData</parameter>
- <parameter
class="java.lang.String">connector-ldap-${project.version}</parameter>
+ <parameter
class="java.lang.String">connector-ldap-${project.version}.rar</parameter>
<parameter class="java.lang.String">Teiid LDAP
Connector</parameter>
</constructor>
</bean>
@@ -52,7 +52,7 @@
<factory bean="DSDeploymentTemplateInfoFactory"/>
<parameter
class="java.lang.Class">org.teiid.templates.connector.ConnectorTypeTemplateInfo</parameter>
<parameter
class="java.lang.Class">org.jboss.resource.metadata.mcf.NoTxConnectionFactoryDeploymentMetaData</parameter>
- <parameter
class="java.lang.String">connector-loopback-${project.version}</parameter>
+ <parameter
class="java.lang.String">connector-loopback-${project.version}.rar</parameter>
<parameter class="java.lang.String">Teiid Loopback
Connector</parameter>
</constructor>
</bean>
@@ -66,7 +66,7 @@
<factory bean="DSDeploymentTemplateInfoFactory"/>
<parameter
class="java.lang.Class">org.teiid.templates.connector.ConnectorTypeTemplateInfo</parameter>
<parameter
class="java.lang.Class">org.jboss.resource.metadata.mcf.NoTxConnectionFactoryDeploymentMetaData</parameter>
- <parameter
class="java.lang.String">connector-salesforce-${project.version}</parameter>
+ <parameter
class="java.lang.String">connector-salesforce-${project.version}.rar</parameter>
<parameter class="java.lang.String">Teiid Salesforce
Connector</parameter>
</constructor>
</bean>
@@ -80,7 +80,7 @@
<factory bean="DSDeploymentTemplateInfoFactory"/>
<parameter
class="java.lang.Class">org.teiid.templates.connector.ConnectorTypeTemplateInfo</parameter>
<parameter
class="java.lang.Class">org.jboss.resource.metadata.mcf.NoTxConnectionFactoryDeploymentMetaData</parameter>
- <parameter
class="java.lang.String">connector-text-${project.version}</parameter>
+ <parameter
class="java.lang.String">connector-text-${project.version}.rar</parameter>
<parameter class="java.lang.String">Teiid Text
Connector</parameter>
</constructor>
</bean>
@@ -94,7 +94,7 @@
<factory bean="DSDeploymentTemplateInfoFactory"/>
<parameter
class="java.lang.Class">org.teiid.templates.connector.ConnectorTypeTemplateInfo</parameter>
<parameter
class="java.lang.Class">org.jboss.resource.metadata.mcf.NoTxConnectionFactoryDeploymentMetaData</parameter>
- <parameter
class="java.lang.String">connector-xmlsource-file-${project.version}</parameter>
+ <parameter
class="java.lang.String">connector-xmlsource-file-${project.version}.rar</parameter>
<parameter class="java.lang.String">Teiid XML File
Connector</parameter>
</constructor>
</bean>
@@ -108,7 +108,7 @@
<factory bean="DSDeploymentTemplateInfoFactory"/>
<parameter
class="java.lang.Class">org.teiid.templates.connector.ConnectorTypeTemplateInfo</parameter>
<parameter
class="java.lang.Class">org.jboss.resource.metadata.mcf.NoTxConnectionFactoryDeploymentMetaData</parameter>
- <parameter
class="java.lang.String">connector-xmlsource-soap-${project.version}</parameter>
+ <parameter
class="java.lang.String">connector-xmlsource-soap-${project.version}.rar</parameter>
<parameter class="java.lang.String">Teiid XML SOAP
Connector</parameter>
</constructor>
</bean>
@@ -122,7 +122,7 @@
<factory bean="DSDeploymentTemplateInfoFactory"/>
<parameter
class="java.lang.Class">org.teiid.templates.connector.ConnectorTypeTemplateInfo</parameter>
<parameter
class="java.lang.Class">org.jboss.resource.metadata.mcf.NoTxConnectionFactoryDeploymentMetaData</parameter>
- <parameter
class="java.lang.String">connector-xml-http-${project.version}</parameter>
+ <parameter
class="java.lang.String">connector-xml-http-${project.version}.rar</parameter>
<parameter class="java.lang.String">Teiid XML HTTP
Connector</parameter>
</constructor>
</bean>
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-15
20:03:04 UTC (rev 2059)
+++ trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java 2010-04-16
21:07:02 UTC (rev 2060)
@@ -96,8 +96,9 @@
import com.metamatrix.core.util.ObjectConverterUtil;
public class Admin extends TeiidAdmin {
+ private static final String CONNECTOR_PREFIX = "connector-";
+ private static final String RAR = ".rar"; //$NON-NLS-1$
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;
@@ -195,7 +196,7 @@
return exportJCAConnection(deployedName, mc, type);
}
}
- throw new
AdminProcessingException(IntegrationPlugin.Util.getString("connector_not_found",
deployedName)); //$NON-NLS-1$
+ throw new
AdminProcessingException(IntegrationPlugin.Util.getString("connectionfactory_not_found",
deployedName)); //$NON-NLS-1$
} catch (Exception e) {
throw new AdminComponentException(e);
}
@@ -443,8 +444,8 @@
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));
+ if (name.startsWith(CONNECTOR_PREFIX) && name.endsWith(RAR)) {
+ matched.add(md.getSimpleName());
}
}
return matched;
@@ -722,21 +723,17 @@
}
@Override
- public void addConnector(String connectorName, InputStream rar) throws AdminException{
- if (!connectorName.startsWith("connector-")) {//$NON-NLS-1$
+ public void addConnector(String connectorName, InputStream contents) throws
AdminException{
+ if (!connectorName.startsWith(CONNECTOR_PREFIX) || !connectorName.endsWith(RAR))
{//$NON-NLS-1$
throw new
AdminProcessingException(IntegrationPlugin.Util.getString("bad_connector_type_name"));
//$NON-NLS-1$
}
-
- if (!connectorName.endsWith(".rar")) {//$NON-NLS-1$
- connectorName = connectorName + ".rar";//$NON-NLS-1$
- }
-
+
String deployerName = getRarDeployerName(connectorName);
if (deployerName != null) {
- throw new
AdminProcessingException(IntegrationPlugin.Util.getString("connector_type_exists",
deployerName)); //$NON-NLS-1$
+ throw new
AdminProcessingException(IntegrationPlugin.Util.getString("connector_type_exists",
connectorName)); //$NON-NLS-1$
}
- ManagedUtil.deployArchive(getDeploymentManager(), connectorName, rar, false);
+ ManagedUtil.deployArchive(getDeploymentManager(), connectorName, contents, false);
//also need to add a template for the properties
try {
@@ -751,29 +748,32 @@
@Override
public void deleteConnector(String connectorName) throws AdminException {
- if (!connectorName.endsWith(".rar")) {//$NON-NLS-1$
- connectorName = connectorName + ".rar";//$NON-NLS-1$
+ if (!connectorName.startsWith(CONNECTOR_PREFIX) || !connectorName.endsWith(RAR))
{//$NON-NLS-1$
+ throw new
AdminProcessingException(IntegrationPlugin.Util.getString("bad_connector_type_name"));
//$NON-NLS-1$
}
+
String deployerName = getRarDeployerName(connectorName);
- if (deployerName != null) {
- //also need to delete template for the properties
- String connectorNameWithoutExt = connectorName.substring(0,
connectorName.length()-4);
- ManagedUtil.removeArchive(getDeploymentManager(),
connectorNameWithoutExt+"-template.jar");//$NON-NLS-1$
-
- ManagedUtil.removeArchive(getDeploymentManager(), deployerName);
+ if (deployerName == null) {
+ throw new
AdminProcessingException(IntegrationPlugin.Util.getString("connector_not_found",
connectorName));
}
+
+ //also need to delete template for the properties
+ String connectorNameWithoutExt = connectorName.substring(0, connectorName.length()-4);
+ ManagedUtil.removeArchive(getDeploymentManager(),
connectorNameWithoutExt+"-template.jar");//$NON-NLS-1$
+ ManagedUtil.removeArchive(getDeploymentManager(), deployerName);
}
@Override
public InputStream exportConnector(String connectorName) throws AdminException {
- if (!connectorName.endsWith(".rar")) {//$NON-NLS-1$
- connectorName = connectorName + ".rar";//$NON-NLS-1$
+ if (!connectorName.startsWith(CONNECTOR_PREFIX) || !connectorName.endsWith(RAR))
{//$NON-NLS-1$
+ throw new
AdminProcessingException(IntegrationPlugin.Util.getString("bad_connector_type_name"));
//$NON-NLS-1$
}
+
String deployerName = getRarDeployerName(connectorName);
- if (deployerName != null) {
- return exportDeployment(deployerName);
+ if (deployerName == null) {
+ throw new
AdminProcessingException(IntegrationPlugin.Util.getString("connector_not_found",
connectorName));
}
- return null;
+ return exportDeployment(deployerName);
}
@Override
@@ -1003,7 +1003,7 @@
" <factory
bean=\"DSDeploymentTemplateInfoFactory\"/>\n" + //$NON-NLS-1$
" <parameter
class=\"java.lang.Class\">org.teiid.templates.connector.ConnectorTypeTemplateInfo</parameter>\n"
+ //$NON-NLS-1$
" <parameter
class=\"java.lang.Class\">org.jboss.resource.metadata.mcf.NoTxConnectionFactoryDeploymentMetaData</parameter>\n"
+ //$NON-NLS-1$
- " <parameter
class=\"java.lang.String\">${name}</parameter>\n" + //$NON-NLS-1$
+ " <parameter
class=\"java.lang.String\">${name}.rar</parameter>\n" +
//$NON-NLS-1$
" <parameter
class=\"java.lang.String\">${name}</parameter>\n"+ //$NON-NLS-1$
" </constructor>\n" + //$NON-NLS-1$
"</bean>\n"+ //$NON-NLS-1$
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-15
20:03:04 UTC (rev 2059)
+++ trunk/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties 2010-04-16
21:07:02 UTC (rev 2060)
@@ -30,14 +30,15 @@
failed_to_start_connector=Failed to start Connection factory = {0}
failed_to_stop_connector=Failed to start Connection factory = {0}
bad_vdb_extension=The extension of the file name must be either ".vdb" for
designer vdb or "xxx-vdb.xml" for dynamic VDBs
-bad_connector_type_name="Teiid connector names must start with
\"connector-\""
+bad_connector_type_name=Teiid connector names must start with \"connector-\"
and end with ".rar" extension.
connector_type_exists=Connector with name:"{0}" already exists!
connector_type_not_found=Connector template "{0}" not found in the
configuration.
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.
+connectionfactory_not_found=Connection factory {0} not found in the configuration.
datasource_not_found=Datasource {0} not found in the configuration.
+connector_not_found=Connector {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-15
20:03:04 UTC (rev 2059)
+++
trunk/test-integration/db/src/test/java/org/teiid/adminapi/jboss/TestConnectorBindings.java 2010-04-16
21:07:02 UTC (rev 2060)
@@ -306,16 +306,16 @@
}
@Test
- public void testTemplate() throws Exception{
+ public void testConnectorAddDelete() throws Exception{
File f = new File(UnitTestUtil.getTestDataPath()+"/connector-loopback.rar");
//$NON-NLS-1$
FileInputStream fis = new FileInputStream(f);
- admin.addConnector("connector-loopy", fis); //$NON-NLS-1$
+ admin.addConnector("connector-loopy.rar", fis); //$NON-NLS-1$
fis.close();
Set<String> names = admin.getConnectorNames();
- assertTrue(names.contains("connector-loopy")); //$NON-NLS-1$
+ assertTrue(names.contains("connector-loopy.rar")); //$NON-NLS-1$
- admin.deleteConnector("connector-loopy"); //$NON-NLS-1$
+ admin.deleteConnector("connector-loopy.rar"); //$NON-NLS-1$
names = admin.getConnectorNames();
//assertTrue(!names.contains("connector-loopy")); //$NON-NLS-1$