Author: rareddy
Date: 2009-05-12 15:36:13 -0400 (Tue, 12 May 2009)
New Revision: 915
Modified:
branches/6.0.x/client-jdbc/src/main/java/com/metamatrix/jdbc/EmbeddedDriver.java
branches/6.0.x/client-jdbc/src/main/java/com/metamatrix/jdbc/MMConnection.java
branches/6.0.x/client-jdbc/src/main/java/com/metamatrix/jdbc/MMServerConnection.java
branches/6.0.x/client/src/main/java/com/metamatrix/admin/api/embedded/EmbeddedConfigAdmin.java
branches/6.0.x/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPConfigAdminImpl.java
branches/6.0.x/embedded/src/main/java/com/metamatrix/dqp/embedded/configuration/ServerConfigFileReader.java
branches/6.0.x/embedded/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedConfigurationService.java
branches/6.0.x/embedded/src/main/java/com/metamatrix/jdbc/EmbeddedConnection.java
Log:
TEIID-558, TEIID-557, TEIID-564
Modified:
branches/6.0.x/client/src/main/java/com/metamatrix/admin/api/embedded/EmbeddedConfigAdmin.java
===================================================================
---
branches/6.0.x/client/src/main/java/com/metamatrix/admin/api/embedded/EmbeddedConfigAdmin.java 2009-05-12
15:49:00 UTC (rev 914)
+++
branches/6.0.x/client/src/main/java/com/metamatrix/admin/api/embedded/EmbeddedConfigAdmin.java 2009-05-12
19:36:13 UTC (rev 915)
@@ -23,12 +23,17 @@
package com.metamatrix.admin.api.embedded;
import com.metamatrix.admin.api.core.CoreConfigAdmin;
+import com.metamatrix.admin.api.exception.AdminException;
/**
* @since 4.3
*/
-public interface EmbeddedConfigAdmin extends
- CoreConfigAdmin {
-
+public interface EmbeddedConfigAdmin extends CoreConfigAdmin {
+ /**
+ * Reload the User Defined function.
+ * @throws AdminException
+ * @since 6.1.0
+ */
+ void reloadUDF() throws AdminException;
}
Modified:
branches/6.0.x/client-jdbc/src/main/java/com/metamatrix/jdbc/EmbeddedDriver.java
===================================================================
---
branches/6.0.x/client-jdbc/src/main/java/com/metamatrix/jdbc/EmbeddedDriver.java 2009-05-12
15:49:00 UTC (rev 914)
+++
branches/6.0.x/client-jdbc/src/main/java/com/metamatrix/jdbc/EmbeddedDriver.java 2009-05-12
19:36:13 UTC (rev 915)
@@ -372,7 +372,13 @@
}
URL[] dqpClassPath = runtimeClasspath.toArray(new
URL[runtimeClasspath.size()]);
- this.classLoader = new URLClassLoader(dqpClassPath,
Thread.currentThread().getContextClassLoader(), new MetaMatrixURLStreamHandlerFactory());
+ boolean useNondelegation =
Boolean.parseBoolean(info.getProperty("dqp.useNonDelegateClassloader",
"false")); //$NON-NLS-1$ //$NON-NLS-2$
+ if (useNondelegation) {
+ this.classLoader = new NonDelegatingClassLoader(dqpClassPath,
Thread.currentThread().getContextClassLoader(), new MetaMatrixURLStreamHandlerFactory());
+ }
+ else {
+ this.classLoader = new URLClassLoader(dqpClassPath,
Thread.currentThread().getContextClassLoader(), new MetaMatrixURLStreamHandlerFactory());
+ }
String logMsg =
BaseDataSource.getResourceMessage("EmbeddedDriver.use_classpath");
//$NON-NLS-1$
DriverManager.println(logMsg);
for (int i = 0; i < dqpClassPath.length; i++) {
Modified: branches/6.0.x/client-jdbc/src/main/java/com/metamatrix/jdbc/MMConnection.java
===================================================================
---
branches/6.0.x/client-jdbc/src/main/java/com/metamatrix/jdbc/MMConnection.java 2009-05-12
15:49:00 UTC (rev 914)
+++
branches/6.0.x/client-jdbc/src/main/java/com/metamatrix/jdbc/MMConnection.java 2009-05-12
19:36:13 UTC (rev 915)
@@ -501,7 +501,7 @@
* Get the database name that this connection is representing
* @return String name of the database
*/
- abstract String getDatabaseName();
+ public abstract String getDatabaseName();
/**
* Retrieves the current holdability of ResultSet objects created using this
Connection object.
@@ -904,9 +904,9 @@
}
}
- abstract BaseDriver getBaseDriver();
+ public abstract BaseDriver getBaseDriver();
- abstract boolean isSameProcess(MMConnection conn) throws CommunicationException;
+ public abstract boolean isSameProcess(MMConnection conn) throws CommunicationException;
public void setClientInfo(Properties properties)
throws SQLClientInfoException {
Modified:
branches/6.0.x/client-jdbc/src/main/java/com/metamatrix/jdbc/MMServerConnection.java
===================================================================
---
branches/6.0.x/client-jdbc/src/main/java/com/metamatrix/jdbc/MMServerConnection.java 2009-05-12
15:49:00 UTC (rev 914)
+++
branches/6.0.x/client-jdbc/src/main/java/com/metamatrix/jdbc/MMServerConnection.java 2009-05-12
19:36:13 UTC (rev 915)
@@ -94,7 +94,7 @@
/**
* @see com.metamatrix.jdbc.MMConnection#getDatabaseName()
*/
- String getDatabaseName() {
+ public String getDatabaseName() {
return SERVER_NAME;
}
@@ -113,7 +113,7 @@
}
@Override
- boolean isSameProcess(MMConnection conn) throws CommunicationException {
+ public boolean isSameProcess(MMConnection conn) throws CommunicationException {
if (conn instanceof MMServerConnection
&& this.serverConn instanceof SocketServerConnection
&& conn.serverConn instanceof SocketServerConnection) {
Modified:
branches/6.0.x/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPConfigAdminImpl.java
===================================================================
---
branches/6.0.x/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPConfigAdminImpl.java 2009-05-12
15:49:00 UTC (rev 914)
+++
branches/6.0.x/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPConfigAdminImpl.java 2009-05-12
19:36:13 UTC (rev 915)
@@ -213,8 +213,6 @@
}
} catch (MetaMatrixComponentException e) {
throw new AdminComponentException(e);
- } catch (MetaMatrixProcessingException e) {
- throw new AdminProcessingException(e);
}
}
@@ -287,20 +285,18 @@
// now that all of the input parameters validated, add the connector binding
binding = addConnectorBinding(deployName, binding, ctype, true);
- } catch (MetaMatrixProcessingException e) {
- throw new AdminProcessingException(e);
} catch (MetaMatrixComponentException e) {
throw new AdminComponentException(e);
}
return (com.metamatrix.admin.api.objects.ConnectorBinding)
convertToAdminObjects(binding);
}
- boolean bindingExists(String name) throws MetaMatrixComponentException,
MetaMatrixProcessingException {
+ boolean bindingExists(String name) throws MetaMatrixComponentException {
ConnectorBinding binding = getDataService().getConnectorBinding(name);
return (binding != null);
}
- boolean bindingTypeExists(String name) throws MetaMatrixComponentException,
MetaMatrixProcessingException {
+ boolean bindingTypeExists(String name) throws MetaMatrixComponentException {
ConnectorBindingType type = getConfigurationService().getConnectorType(name);
return (type != null);
}
@@ -366,8 +362,6 @@
} catch (MetaMatrixComponentException e) {
throw new AdminComponentException(e);
- } catch (MetaMatrixProcessingException e) {
- throw new AdminProcessingException(e);
}
return (com.metamatrix.admin.api.objects.ConnectorBinding)
convertToAdminObjects(binding);
@@ -397,9 +391,7 @@
return binding;
} catch (MetaMatrixComponentException e) {
throw new AdminComponentException(e);
- } catch (MetaMatrixProcessingException e) {
- throw new AdminProcessingException(e);
- }
+ }
}
throw new
AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.connector_load_failed_wrong_type",
deployName)); //$NON-NLS-1$
}
@@ -468,7 +460,6 @@
try {
startVDBConnectorBindings(deployedVDB);
} catch (MetaMatrixComponentException e) {
- } catch (MetaMatrixProcessingException e) {
} catch (ApplicationLifecycleException e) {
// we can safely ignore these because the cause of the not starting
is already recorded
// and more likely VDB deployment succeeded.
@@ -478,8 +469,6 @@
return (VDB) convertToAdminObjects(deployedVDB);
} catch (MetaMatrixComponentException e) {
throw new AdminComponentException(e);
- } catch (MetaMatrixProcessingException e) {
- throw new AdminProcessingException(e);
}
}
@@ -488,7 +477,7 @@
* @param vdb
*/
private void startVDBConnectorBindings(VDBArchive vdb) throws
MetaMatrixComponentException,
- MetaMatrixProcessingException, ApplicationLifecycleException {
+ ApplicationLifecycleException {
VDBDefn def = vdb.getConfigurationDef();
Collection<ConnectorBinding> bindings = def.getConnectorBindings().values();
@@ -503,8 +492,7 @@
* the decrypt properties.
*/
void validateConnectorBindingsInVdb(VDBArchive vdb, AdminOptions options)
- throws MetaMatrixComponentException, MetaMatrixProcessingException,
- AdminProcessingException, AdminException {
+ throws MetaMatrixComponentException, AdminProcessingException, AdminException {
VDBDefn def = vdb.getConfigurationDef();
@@ -861,7 +849,7 @@
if (type == null) {
type = connectorTypes[typeIndex];
ExtensionModule[] extModules = archive.getExtensionModules(type);
- checkAddingConnectorType(type, extModules, options,
previouslyAddedModules);
+ checkDuplicateExtensionModules(extModules, options,
previouslyAddedModules);
saveConnectorType(type);
} else {
@@ -876,14 +864,14 @@
// Now that we know we need to add this to configuration;
let's get on with it
type = connectorTypes[typeIndex];
ExtensionModule[] extModules =
archive.getExtensionModules(type);
- checkAddingConnectorType(type, extModules, options,
previouslyAddedModules);
+ checkDuplicateExtensionModules(extModules, options,
previouslyAddedModules);
saveConnectorType(type);
}
}
// Now that we know we need to add this to configuration; let's get
on with it
type = connectorTypes[typeIndex];
ExtensionModule[] extModules = archive.getExtensionModules(type);
- checkAddingConnectorType(type, extModules, options,
previouslyAddedModules);
+ checkDuplicateExtensionModules(extModules, options,
previouslyAddedModules);
}
// Now add the extension modules
@@ -894,8 +882,6 @@
} catch (MetaMatrixComponentException e) {
throw new AdminComponentException(e);
- } catch(MetaMatrixProcessingException e) {
- throw new AdminProcessingException(e);
}
}
@@ -904,12 +890,12 @@
* system, if it there takes the appropriate action. Otherwise keeps tracks of all
modules
* to add.
* @param type - connector type
- * @param extModules - Extension modules for the Coneector Type
+ * @param extModules - Extension modules for the Connector Type
* @param options - Admin Options
* @param ignorableModules - Modules which are already added, can be ignored for
adding
*/
- void checkAddingConnectorType(ConnectorBindingType type, ExtensionModule[]
extModules, AdminOptions options, HashSet ignorableModules)
- throws MetaMatrixComponentException, MetaMatrixProcessingException,
AdminException {
+ void checkDuplicateExtensionModules(ExtensionModule[] extModules, AdminOptions
options, HashSet ignorableModules)
+ throws AdminException {
// Now check if the the extension modules are already there
for (int i = 0; i < extModules.length; i++) {
@@ -932,7 +918,7 @@
// this is OK, we did not find any thing
}
- // if we found it take approprite action.
+ // if we found it take appropriate action.
if(previousModule != null &&
options.containsOption(AdminOptions.OnConflict.EXCEPTION)) {
throw new
AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.extension_module_exists",
previousModule.getFullName())); //$NON-NLS-1$
}
@@ -1003,14 +989,12 @@
}
}
- private void saveConnectorType(ConnectorBindingType type) throws
MetaMatrixProcessingException, MetaMatrixComponentException {
+ private void saveConnectorType(ConnectorBindingType type) throws
MetaMatrixComponentException {
getConfigurationService().saveConnectorType(type);
}
- /**
- * @see com.metamatrix.admin.api.core.CoreConfigAdmin#addUDF(byte[], java.lang.String)
- */
+ @Override
public void addUDF(byte[] modelFileContents, String classpath)
throws AdminException {
if (modelFileContents == null || modelFileContents.length == 0) {
@@ -1057,9 +1041,7 @@
}
}
- /**
- * @see com.metamatrix.admin.api.core.CoreConfigAdmin#deleteUDF()
- */
+ @Override
public void deleteUDF() throws AdminException {
try {
getConfigurationService().unloadUDF();
@@ -1067,5 +1049,14 @@
} catch (MetaMatrixComponentException e) {
throw new AdminComponentException(e);
}
+ }
+
+ @Override
+ public void reloadUDF() throws AdminException {
+ try {
+ getConfigurationService().loadUDF();
+ } catch (MetaMatrixComponentException e) {
+ throw new AdminComponentException(e);
+ }
}
}
Modified:
branches/6.0.x/embedded/src/main/java/com/metamatrix/dqp/embedded/configuration/ServerConfigFileReader.java
===================================================================
---
branches/6.0.x/embedded/src/main/java/com/metamatrix/dqp/embedded/configuration/ServerConfigFileReader.java 2009-05-12
15:49:00 UTC (rev 914)
+++
branches/6.0.x/embedded/src/main/java/com/metamatrix/dqp/embedded/configuration/ServerConfigFileReader.java 2009-05-12
19:36:13 UTC (rev 915)
@@ -27,16 +27,22 @@
import java.net.URL;
import java.util.Collection;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
+import java.util.Set;
import com.metamatrix.common.config.api.ComponentType;
+import com.metamatrix.common.config.api.ComponentTypeID;
import com.metamatrix.common.config.api.Configuration;
import com.metamatrix.common.config.api.ConfigurationModelContainer;
import com.metamatrix.common.config.api.ConnectorBinding;
+import com.metamatrix.common.config.api.ConnectorBindingType;
import com.metamatrix.common.config.api.exceptions.ConfigurationException;
+import com.metamatrix.common.config.model.BasicComponentType;
import com.metamatrix.common.config.model.ConfigurationModelContainerAdapter;
+import com.metamatrix.common.object.PropertyDefinition;
/**
* This class loades the server configuration file
<code>ServerConfig.xml</code>
@@ -78,7 +84,7 @@
for (Iterator i = componentTypes.iterator(); i.hasNext();) {
ComponentType type = (ComponentType)i.next();
if (type.getComponentTypeCode() ==
ComponentType.CONNECTOR_COMPONENT_TYPE_CODE) {
- connectorTypes.put(type.getName(), type);
+ connectorTypes.put(type.getName(), resolvePropertyDefns(type,
this.configuration));
}
}
@@ -134,4 +140,23 @@
public Map getConnectorTypes() {
return connectorTypes;
}
+
+ public static ComponentType resolvePropertyDefns(ComponentType type,
ConfigurationModelContainer configuration) {
+ BasicComponentType baseType = (BasicComponentType)type;
+ Collection c =
configuration.getAllComponentTypeDefinitions((ComponentTypeID)baseType.getID());
+
+ // if the type is found in the configuration.xml, then add its prop-definitions;
else look for parent
+ if (c == null || c.isEmpty()) {
+ // this means user has added a new connector type
+ c = configuration.getAllComponentTypeDefinitions(type.getSuperComponentTypeID());
+ }
+
+ if (c != null && !c.isEmpty()) {
+ Set<PropertyDefinition> defns = new HashSet<PropertyDefinition>();
+ defns.addAll(c);
+ defns.addAll(type.getComponentTypeDefinitions());
+ baseType.setComponentTypeDefinitions(defns);
+ }
+ return baseType;
+ }
}
Modified:
branches/6.0.x/embedded/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedConfigurationService.java
===================================================================
---
branches/6.0.x/embedded/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedConfigurationService.java 2009-05-12
15:49:00 UTC (rev 914)
+++
branches/6.0.x/embedded/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedConfigurationService.java 2009-05-12
19:36:13 UTC (rev 915)
@@ -231,32 +231,6 @@
DQPEmbeddedPlugin.logError(e,
"EmbeddedConfigurationService.udf_classspath_failure", new Object[] {});
//$NON-NLS-1$
}
}
- /*
- else {
- try {
- StringBuffer sb = new StringBuffer();
- List<ExtensionModule> extModules = getExtensionModules();
- boolean valid = false;
- for (ExtensionModule module:extModules) {
-
sb.append("extensionjar:").append(module.getFullName()).append(";");
//$NON-NLS-1$ //$NON-NLS-2$
- valid = true;
- }
- if (valid) {
- classpath = sb.toString();
- ArrayList<URL> allExtensionModules = new ArrayList<URL>();
- URL[] contexts = getExtensionPath();
- for (URL context:contexts) {
-
allExtensionModules.addAll(ExtensionModuleReader.resolveExtensionClasspath(classpath,
context));
- }
- return allExtensionModules;
- }
- } catch (MetaMatrixComponentException e) {
- // ok to return null
- } catch (IOException e) {
- DQPEmbeddedPlugin.logError(e,
"EmbeddedConfigurationService.udf_classspath_failure", new Object[] {});
//$NON-NLS-1$
- }
- }
- */
return null;
}
@@ -875,7 +849,7 @@
* @since 4.3
*/
public void saveConnectorType(ConnectorBindingType type) throws
MetaMatrixComponentException {
- loadedConnectorTypes.put(type.getName(), addFullPropertyDefns(type));
+ loadedConnectorTypes.put(type.getName(),
ServerConfigFileReader.resolvePropertyDefns(type, this.configurationModel));
// Also add binding type to the configuration and save.
DQPEmbeddedPlugin.logInfo("EmbeddedConfigurationService.connector_type_save",
new Object[] {type.getName()}); //$NON-NLS-1$
@@ -928,7 +902,16 @@
if(udfFile != null && exists(udfFile)) {
List<URL> urls = getCommonExtensionClasspath();
try {
- this.udfSource = new UDFSource(udfFile, urls.toArray(new URL[urls.size()]));
+
+ // un-register the old UDF model, if there is one.
+ unloadUDF();
+
+ if (urls == null || urls.isEmpty()) {
+ this.udfSource = new UDFSource(udfFile);
+ }
+ else {
+ this.udfSource = new UDFSource(udfFile, urls.toArray(new
URL[urls.size()]));
+ }
FunctionLibraryManager.registerSource(this.udfSource);
DQPEmbeddedPlugin.logInfo("EmbeddedConfigurationService.udf_load", new
Object[] {udfFile, urls}); //$NON-NLS-1$
} catch (IOException e) {
@@ -1089,7 +1072,7 @@
for (Iterator it = def.getConnectorTypes().values().iterator();
it.hasNext();) {
ConnectorBindingType type= (ConnectorBindingType)it.next();
if (!loadedConnectorTypes.containsKey(type.getName())) {
- loadedConnectorTypes.put(type.getName(),
addFullPropertyDefns(type));
+ loadedConnectorTypes.put(type.getName(),
ServerConfigFileReader.resolvePropertyDefns(type, this.configurationModel));
}
}
@@ -1107,24 +1090,7 @@
}
}
- private ComponentType addFullPropertyDefns(ConnectorBindingType type) {
- BasicComponentType baseType = (BasicComponentType)type;
- Collection c =
this.configurationModel.getAllComponentTypeDefinitions((ComponentTypeID)baseType.getID());
- // if the type is found in the configuration.xml, then add its prop-definitions;
else look for parent
- if (c == null || c.isEmpty()) {
- // this means user has added a new connector type
- c =
this.configurationModel.getAllComponentTypeDefinitions(type.getSuperComponentTypeID());
- }
-
- if (c != null && !c.isEmpty()) {
- Set<PropertyDefinition> defns = new HashSet<PropertyDefinition>();
- defns.addAll(c);
- defns.addAll(type.getComponentTypeDefinitions());
- baseType.setComponentTypeDefinitions(defns);
- }
- return baseType;
- }
/**
* Add the connnector binding with new deployment name
Modified:
branches/6.0.x/embedded/src/main/java/com/metamatrix/jdbc/EmbeddedConnection.java
===================================================================
---
branches/6.0.x/embedded/src/main/java/com/metamatrix/jdbc/EmbeddedConnection.java 2009-05-12
15:49:00 UTC (rev 914)
+++
branches/6.0.x/embedded/src/main/java/com/metamatrix/jdbc/EmbeddedConnection.java 2009-05-12
19:36:13 UTC (rev 915)
@@ -140,7 +140,7 @@
* @see com.metamatrix.jdbc.MMConnection#getDatabaseName()
*/
@Override
- String getDatabaseName() {
+ public String getDatabaseName() {
return SERVER_NAME;
}
@@ -150,7 +150,7 @@
}
@Override
- boolean isSameProcess(MMConnection conn) {
+ public boolean isSameProcess(MMConnection conn) {
return (conn instanceof EmbeddedConnection);
}