Author: rareddy
Date: 2009-05-06 18:23:37 -0400 (Wed, 06 May 2009)
New Revision: 869
Modified:
trunk/client/src/main/java/com/metamatrix/admin/api/embedded/EmbeddedConfigAdmin.java
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPConfigAdminImpl.java
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/configuration/ServerConfigFileReader.java
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedConfigurationService.java
Log:
TEIID-472, TEIID-558, TEIID-557
Modified:
trunk/client/src/main/java/com/metamatrix/admin/api/embedded/EmbeddedConfigAdmin.java
===================================================================
---
trunk/client/src/main/java/com/metamatrix/admin/api/embedded/EmbeddedConfigAdmin.java 2009-05-06
20:38:38 UTC (rev 868)
+++
trunk/client/src/main/java/com/metamatrix/admin/api/embedded/EmbeddedConfigAdmin.java 2009-05-06
22:23:37 UTC (rev 869)
@@ -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:
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPConfigAdminImpl.java
===================================================================
---
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPConfigAdminImpl.java 2009-05-06
20:38:38 UTC (rev 868)
+++
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPConfigAdminImpl.java 2009-05-06
22:23:37 UTC (rev 869)
@@ -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:
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/configuration/ServerConfigFileReader.java
===================================================================
---
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/configuration/ServerConfigFileReader.java 2009-05-06
20:38:38 UTC (rev 868)
+++
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/configuration/ServerConfigFileReader.java 2009-05-06
22:23:37 UTC (rev 869)
@@ -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:
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedConfigurationService.java
===================================================================
---
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedConfigurationService.java 2009-05-06
20:38:38 UTC (rev 868)
+++
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedConfigurationService.java 2009-05-06
22:23:37 UTC (rev 869)
@@ -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,12 @@
if(udfFile != null && exists(udfFile)) {
List<URL> urls = getCommonExtensionClasspath();
try {
- this.udfSource = new UDFSource(udfFile, urls.toArray(new URL[urls.size()]));
+ 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 +1068,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 +1086,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