teiid SVN: r771 - in branches/remove_psc/common-internal/src/main/java/com/metamatrix/common/config: model and 1 other directory.
by teiid-commits@lists.jboss.org
Author: vhalbert(a)redhat.com
Date: 2009-04-14 13:58:10 -0400 (Tue, 14 Apr 2009)
New Revision: 771
Modified:
branches/remove_psc/common-internal/src/main/java/com/metamatrix/common/config/api/ConfigurationObjectEditor.java
branches/remove_psc/common-internal/src/main/java/com/metamatrix/common/config/model/BasicConfigurationObjectEditor.java
Log:
Teiid 323 - refactured, removing unused Config API classes: ProductType, ProductTypeID and ConfigurationLock
Modified: branches/remove_psc/common-internal/src/main/java/com/metamatrix/common/config/api/ConfigurationObjectEditor.java
===================================================================
--- branches/remove_psc/common-internal/src/main/java/com/metamatrix/common/config/api/ConfigurationObjectEditor.java 2009-04-13 22:26:25 UTC (rev 770)
+++ branches/remove_psc/common-internal/src/main/java/com/metamatrix/common/config/api/ConfigurationObjectEditor.java 2009-04-14 17:58:10 UTC (rev 771)
@@ -85,17 +85,6 @@
*/
void createConfiguration(ConfigurationID configID, Collection configObjects);
-
- /**
- * This method is used only for importing a component type
- */
-// void createComponentType(ComponentType compType);
-
- /**
- * This method is used only for importing a service definition
- */
-// void createServiceComponentDefn(ServiceComponentDefn serviceDefn);
-
/**
* Create a new Configuration instance with the specified name ID.
* @param configurationName for the new configuration (may not be null).
@@ -118,17 +107,6 @@
Configuration createConfiguration(String configurationName, Date creationDate, Date lastChangedDate);
/**
- * <p>Copy-create method - creates a deep-copy of the original configuration,
- * with the new name. The new name cannot be the same as the original
- * configuration's name.</p>
- *
- * <p>All service component definitions, all deployed components, and all
- * property values will also be copied. The copies will all retain their original
- * short names; their full names will reflect the new configuration name.</p>
- */
- // Configuration createConfiguration(Configuration original, String newName);
-
- /**
* Create a new ComponentType instance with the specified name.
* @param classTypeCode identifies the type of class this component type should represent
* @see ComponentType for type codes
@@ -148,31 +126,8 @@
* @return ComponentType
*/
ComponentType createComponentType(ComponentType componentType, String name);
-
-
- /**
- * Create a new ProductType instance with the specified name. Use
- * {@link createProductType(String, Collection, boolean, boolean)} to
- * also assign legal service types to this product type.
- * @param name is the name of the ProductType
- * @param deployable is a boolean indicating if the type can be deployed in a configuration
- * @param monitored is a boolean insdicating if the type is to be monitored
- * @return ComponentType
- */
-// ProductType createProductType(String name, boolean deployable, boolean monitored);
/**
- * Create a new ProductType instance with the specified name.
- * @param name is the name of the ProductType
- * @param serviceComponentTypeIDs Collection of ComponentType objects which
- * indicate the service types that belong to this product type
- * @param deployable is a boolean indicating if the type can be deployed in a configuration
- * @param monitored is a boolean insdicating if the type is to be monitored
- * @return ComponentType
- */
-// ProductType createProductType(String name, Collection serviceComponentTypes, boolean deployable, boolean monitored);
-
- /**
* Create a new ComponentTypeDefn and update the ComponentType with the new defintion.
* @param type is the ComponentType the definition will be added to
* @param propertyDefinition are the attributes describing this definition
@@ -184,12 +139,8 @@
*/
ComponentTypeDefn createComponentTypeDefn(ComponentType type, PropertyDefinition propertyDefinition, boolean isEffectiveImmediately) ;
+
/**
- * @deprecated as of v 2.0 beta 1, use {@link #createComponentTypeDefn(ComponentType, PropertyDefinition, boolean)}
- */
- ComponentTypeDefn createComponentTypeDefn(ComponentType type, PropertyDefinition propertyDefinition);
-
- /**
* Create a new ComponentTypeDefn instance with the specified name. To create
* a basic PropertyDefinition, do the following:
*
@@ -209,11 +160,6 @@
ComponentTypeDefn createComponentTypeDefn(ComponentTypeID typeID, PropertyDefinition propertyDefinition, boolean isEffectiveImmediately) ;
/**
- * @deprecated as of v 2.0 beta 1, use {@link #createComponentTypeDefn(ComponentTypeID, PropertyDefinition, boolean)}
- */
- ComponentTypeDefn createComponentTypeDefn(ComponentTypeID typeID, PropertyDefinition propertyDefinition) ;
-
- /**
* Create a new PropDefnAllowedValue that will be added to the modifiable (cloned)
* PropertyDefinition that was obtained from the ComponentTypeDefn.
* @param typeDefn is the ComponentTypeDefn the allowed value will be added to
@@ -296,23 +242,6 @@
ServiceComponentDefn createServiceComponentDefn(Configuration configuration, ComponentTypeID typeID, String componentName, String routingUUID);
/**
- * Creates a new ServiceComponentDefn for a given Configuration and
- * ProductServiceConfig; also automatically "deploys" the service anywhere
- * that this PSC is already deployed, by creating the necessary
- * DeployedComponents (this will only work if the PSC parameter belongs
- * to the Configuration parameter).
- * @param configuration the Configuration containing the PSC; this will
- * have the new ServiceComponentDefn added to it, plus any DeployedComponents
- * created for the ServiceComponentDefn
- * @param typeID type of the new ServiceComponentDefn
- * @param componentName name for the new ServiceComponentDefn
- * @param pscID ID of the ProductServiceConfig which this ServiceComponentDefn
- * will belong to
- * @return new ServiceComponentDefn
- */
-// ServiceComponentDefn createServiceComponentDefn(Configuration configuration, ComponentTypeID typeID, String componentName, ProductServiceConfigID pscID);
-
- /**
* Create a new ResourceDescriptor Component Definition instance with a specified configuration
* @param configurationID that the new created component definition will be a part of
* @param typeID is the type of component definition to create
@@ -334,16 +263,6 @@
ResourceDescriptor createResourceDescriptor(Configuration configuration, ComponentTypeID typeID, String descriptorName);
/**
- * Create a new ResourceDescriptor Component Definition instance
- * @param typeID is the type of component definition to create
- * @param componentName is the name of the component
- * @return the ResourceDescriptor instance with the specified ID.
- * @throws IllegalArgumentException if either of the ID or data source ID is null
- */
- // ResourceDescriptor createResourceDescriptor(ComponentTypeID typeID, String componentName);
-
-
- /**
* Create a new SharedResource instance
* @param typeID is the type of component definition to create
* @param resourceName is the name of the shared resource
@@ -352,42 +271,8 @@
*/
SharedResource createSharedResource(ComponentTypeID typeID, String resourceName) ;
-
+
/**
- * Create a new DeployedComponent instance representing a deployed VM.
- * The Configuration parameter <i>will</i> be updated with the new
- * deployed component.
- * @param instanceName is the name assigned to this instance
- * @param configuration the configuration the vm is deployed within.
- * @param hostId the host the vm is deployed on.
- * @param vmComponentDefn is the VM component definition to be deployed.
- * @return the DeployedComponent instance with the specified ID.
- * @throws IllegalArgumentException if either of the IDs are null
- */
-// DeployedComponent createDeployedVMComponent(String instanceName, Configuration configuration, HostID hostId, VMComponentDefn vmComponentDefn);
-
- /**
- * Create a new DeployedComponent instance representing a deployed VM.
- * This method has the advantage of allowing the creation of
- * a deployed component entirely with ID objects, without needing any
- * of the full objects themselves. However, it is the responsibility of
- * the client that the ComponentTypeID parameter and the VMComponentDefnID
- * parameter both indicate the vm type. Also, the local
- * Configuration object represented by the ConfigurationID will <i>not</i>
- * be updated with this new DeployedComponent object.
- * @param instanceName is the name assigned to this instance
- * @param configurationID the configuration the vm is deployed within.
- * @param hostId the host the vm is deployed on.
- * @param vmComponentDefnID is the ID of the VM component definition to be deployed.
- * @param componentTypeID is the <i>type</i> of the service to be deployed
- * @return the DeployedComponent instance with the specified ID.
- * @throws IllegalArgumentException if either of the IDs are null
- *
- * @see createDeployedVMComponent(String, Configuration, HostID, VMComponentDefn)
- */
- // DeployedComponent createDeployedVMComponent(String instanceName, ConfigurationID configurationID, HostID hostId, VMComponentDefnID vmComponentDefnID, ComponentTypeID vmComponentTypeID);
-
- /**
* Create a new DeployedComponent instance respresenting a deployed Service.
* This method has the advantage of allowing the creation of
* a deployed component entirely with ID objects, without needing any
@@ -410,82 +295,6 @@
DeployedComponent createDeployedServiceComponent(String instanceName, ConfigurationID configurationID, HostID hostId, VMComponentDefnID vmId, ServiceComponentDefnID serviceComponentDefnID, ComponentTypeID serviceComponentTypeID);
/**
- * Create a new DeployedComponent instance respresenting a deployed Service.
- * The Configuration parameter <i>will</i> be updated with the new
- * deployed component.
- * @param instanceName is the name assigned to this instance
- * @param configuration the vm is deployed within.
- * @param hostId the host the vm is deployed in.
- * @param vmId the VM that the service is deployed in.
- * @param serviceComponentDefnID is the service component definition to be deployed
- * @param componentTypeID is the <i>type</i> of the service to be deployed
- * @return the DeployedComponent instance with the specified ID.
- * @throws IllegalArgumentException if either of the IDs null
- */
-// DeployedComponent createDeployedServiceComponent(String instanceName, Configuration configuration, HostID hostId, VMComponentDefnID vmId, ServiceComponentDefn serviceComponentDefn, ProductServiceConfigID pscID);
-
- /**
- * Copy-creation method, creates a new PSC from the given PSC, with the
- * new given name, and inserts it into the given Configuration. The
- * configuration parameter must match the configuration which the
- * original PSC belongs to. This will also deep-copy the
- * ServiceComponentDefns that are grouped by the originalPSC
- * parameter.
- * @param configuration which the originalPSC is from, and
- * which the new PSC will be put in; this will be modified
- * @param originalPSC the PSC to copy from
- * @param newName new String name for the new PSC
- * @return newly-created ProductServiceConfig object
- */
-// ProductServiceConfig createProductServiceConfig(Configuration configuration, ProductServiceConfig originalPSC, String newName);
-
- /**
- * Copy-creation method, creates a new PSC from the given PSC, with the
- * new given name, and inserts it into the target Configuration. Any
- * ServiceComponentDefns grouped by the originalPSC will be deep-copied
- * to the targetConfiguration.
- * The originConfiguration parameter must be the Configuration which the
- * orignalPSC originates from (because it must contain the
- * ServiceComponentDefns which are grouped by the originalPSC).
- * @param targetConfiguration to put the new PSC in; this will be modified
- * @param originConfiguration which the originalPSC exists in - this is
- * needed to retrieve any original ServiceComponentDefns from
- * @param originalPSC the PSC to copy from
- * @param newName new String name for the new PSC
- * @return newly-created ProductServiceConfig object
- */
- // ProductServiceConfig createProductServiceConfig(Configuration targetConfiguration, Configuration originConfiguration, ProductServiceConfig originalPSC, String newName);
-
- /**
- * Allows the creation of an empty ProductServiceConfig entirely from
- * ID objects. Use {@link #addServiceComponentDefn} or
- * {@link #removeServiceComponentDefn} in conjuncture with this method.
- */
- // ProductServiceConfig createProductServiceConfig(ConfigurationID configurationID, ProductTypeID productTypeID, String componentName);
-
- /**
- * Allows the creation of an empty ProductServiceConfig entirely from
- * ID objects. Use {@link #addServiceComponentDefn} or
- * {@link #removeServiceComponentDefn} in conjuncture with this method.
- */
-// ProductServiceConfig createProductServiceConfig(Configuration configuration, ProductTypeID productTypeID, String componentName);
-
- /**
- * Deploys the ServiceComponentDefns indicated by the ProductServiceConfig,
- * contained by the Configuration, onto the specified Host and VM.
- * @param configuration the Configuration which contains the
- * ServiceComponentDefns, the ProductServiceConfig, and the VMComponentDefn
- * @param psc the ProductServiceConfig which groups the ServiceComponentDefns
- * to be deployed
- * @param hostId ID of the host on which the services will be deployed
- * @param vmId ID of the VMComponentDefn on which the services will be
- * deployed
- * @return Collection of DeployedComponent objects, each representing
- * one of the deployed ServiceComponentDefns
- */
- // Collection deployProductServiceConfig(Configuration configuration, ProductServiceConfig psc, HostID hostId, VMComponentDefnID vmId);
-
- /**
* Deploys a ServiceComponentDefn to the specified VM.
* This method is harmless to call if the
* ServiceComponentDefn is already deployed. It is
@@ -519,7 +328,7 @@
void setRoutingUUID(ServiceComponentDefn serviceComponentDefn, String newRoutingUUID);
/**
- * <p>Sets whether the indicated ServiceComponentDefn is enabled for deployment
+ * <p>Sets whether the indicated ServiceComponentDefn is enabled for starting
* (when the PSC which contains it is
* {@link #deployProductServiceConfig deployed}) or not. This method
* can also either automatically create the necessary
@@ -575,16 +384,15 @@
* @see #deployProductServiceConfig deployProductServiceConfig
*/
+//
+// DeployedComponent setEnabled(Configuration configuration, ServiceComponentDefn serviceComponentDefn, VMComponentDefn vm, boolean enabled)
+// throws ConfigurationException;
- DeployedComponent setEnabled(Configuration configuration, ServiceComponentDefn serviceComponentDefn, VMComponentDefn vm, boolean enabled)
- throws ConfigurationException;
-
/**
- * It simply updates the DeployedComponent by setting the specified service
- * enabled value.
+ * It updates the DeployedComponent by setting its enabled flag.
*/
- DeployedComponent setEnabled(ServiceComponentDefnID serviceComponentDefnID, DeployedComponent deployComponent, boolean enabled);
+ DeployedComponent setEnabled(DeployedComponent deployComponent, boolean enabled);
/**
Modified: branches/remove_psc/common-internal/src/main/java/com/metamatrix/common/config/model/BasicConfigurationObjectEditor.java
===================================================================
--- branches/remove_psc/common-internal/src/main/java/com/metamatrix/common/config/model/BasicConfigurationObjectEditor.java 2009-04-13 22:26:25 UTC (rev 770)
+++ branches/remove_psc/common-internal/src/main/java/com/metamatrix/common/config/model/BasicConfigurationObjectEditor.java 2009-04-14 17:58:10 UTC (rev 771)
@@ -1718,18 +1718,11 @@
}
- public DeployedComponent setEnabled(ServiceComponentDefnID serviceComponentDefnID, DeployedComponent deployedcomponent, boolean enabled) {
- if ( serviceComponentDefnID == null ) {
- throw new IllegalArgumentException(CommonPlugin.Util.getString(ErrorMessageKeys.CONFIG_ERR_0089, ServiceComponentDefnID.class.getName()));
- }
+ public DeployedComponent setEnabled(DeployedComponent deployedcomponent, boolean enabled) {
if ( deployedcomponent == null ) {
throw new IllegalArgumentException(CommonPlugin.Util.getString(ErrorMessageKeys.CONFIG_ERR_0089, DeployedComponent.class.getName()));
}
- if (!deployedcomponent.getDeployedComponentDefnID().equals(serviceComponentDefnID)) {
- return deployedcomponent;
- }
-
boolean oldEnabled = deployedcomponent.isEnabled();
//if a change is not being made to the enabled value, this whole method
//will be essentially bypassed
@@ -1738,9 +1731,8 @@
BasicDeployedComponent basicDC = (BasicDeployedComponent) verifyTargetClass(deployedcomponent,BasicDeployedComponent.class);
basicDC.setIsEnabled(enabled);
- createExchangeAction(basicDC.getID(),ConfigurationModel.Attribute.IS_ENABLED, serviceComponentDefnID, Boolean.valueOf(enabled));
+ createExchangeAction(basicDC.getID(),ConfigurationModel.Attribute.IS_ENABLED, deployedcomponent.getDeployedComponentDefnID(), Boolean.valueOf(enabled));
-
return basicDC;
} //end if enabled!= oldEnabled
@@ -1748,171 +1740,31 @@
return deployedcomponent;
}
-
- public DeployedComponent setEnabled(Configuration configuration, ServiceComponentDefn serviceComponentDefn, VMComponentDefn vm, boolean enabled)
- throws ConfigurationException {
- if ( configuration == null ) {
- throw new IllegalArgumentException(CommonPlugin.Util.getString(ErrorMessageKeys.CONFIG_ERR_0089, Configuration.class.getName()));
- }
- if ( serviceComponentDefn == null ) {
- throw new IllegalArgumentException(CommonPlugin.Util.getString(ErrorMessageKeys.CONFIG_ERR_0089, ServiceComponentDefn.class.getName()));
- }
- if ( vm == null ) {
- throw new IllegalArgumentException(CommonPlugin.Util.getString(ErrorMessageKeys.CONFIG_ERR_0089, VMComponentDefn.class.getName()));
- }
-
- ServiceComponentDefnID svcID = (ServiceComponentDefnID) serviceComponentDefn.getID();
-
- DeployedComponent dc = configuration.getDeployedServiceForVM(svcID, vm);
- return this.setEnabled(svcID, dc, enabled);
-
-
- //if a change is not being made to the enabled value, this whole method
- //will be essentially bypassed
-// if (enabled != dc.isEnabled()){
-// dc = this.setEnabled(svcID, dc, enabled);
//
-// BasicConfiguration targetConfig = (BasicConfiguration) verifyTargetClass(configuration,BasicConfiguration.class);
-//
-//
-// // if disabling and there are deployed components, then undeploy the components
-// if (!enabled && deleteDeployedComps) {
-//
-// if (!deps.isEmpty()) {
-// DeployedComponent deployedService;
-// DeployedComponentID deployedServiceID;
-// result = new ArrayList(deps.size());
-// for (Iterator it=deps.iterator(); it.hasNext(); ) {
-// deployedService = (DeployedComponent) it.next();
-// deployedServiceID = (DeployedComponentID) deployedService.getID();
-//
-// this.createDestroyAction(deployedServiceID, deployedService);
-// targetConfig.removeComponentObject(deployedServiceID );
-//
-// DeployedComponent ds = targetConfig.getDeployedComponent(deployedServiceID);
-// if (ds != null) {
-// throw new ConfigurationException("Deployed Component " + deployedServiceID + " was not removed"); //$NON-NLS-1$ //$NON-NLS-2$
-// }
-// DeployedComponent newService = (DeployedComponent) deployedService.clone();
-// result.add(newService);
-// }
-// }
-// } else if (enabled){
-// //we must automagically create DeployedComponents for the newly-
-// //enabled service defn, wherever its PSC has already been deployed
-// ProductServiceConfigID pscID = (ProductServiceConfigID) psc.getID();
-// result = this.deployServiceDefn(targetConfig,serviceComponentDefn,pscID);
-//
-// }
-//
-// //this will overwrite the service if it already is in the Configuration
-// targetConfig.addComponentDefn(psc);
-//
-// } //end if enabled!= oldEnabled
-// if (result == null){
-// result = Collections.EMPTY_LIST;
-//
+// public DeployedComponent setEnabled(Configuration configuration, ServiceComponentDefn serviceComponentDefn, VMComponentDefn vm, boolean enabled)
+// throws ConfigurationException {
+// if ( configuration == null ) {
+// throw new IllegalArgumentException(CommonPlugin.Util.getString(ErrorMessageKeys.CONFIG_ERR_0089, Configuration.class.getName()));
// }
-// return result;
-
-
- }
-
-
-// public Configuration addHostComponent(Configuration t, Host host) {
-//
-// BasicConfiguration target = (BasicConfiguration) verifyTargetClass(t,BasicConfiguration.class);
-//
-// target.addHost(host);
-//
-// createCreationAction(host.getID(), host);
-//
-// return target;
-// }
-
-
- /**
- * Adds an existing ServiceComponentDefn to indicated PSC; the
- * ServiceComponentDefn is assumed to already belong to the indicated
- * Configuration. The ServiceComponentDefn will be removed from
- * any PSC it previously belonged to.
- * @param configuration the Configuration containing the
- * ServiceComponentDefn
- * @param psc ProductServiceConfig to have service comp defn added to
- * @param serviceComponentDefnID will be added to the indicated
- * ProductServiceConfiguration (and removed from any PSC it previously
- * belonged to).
- */
-// public ProductServiceConfig addServiceComponentDefn(Configuration configuration, ProductServiceConfig psc, ServiceComponentDefnID serviceComponentDefnID){
-// return this.addServiceComponentDefn(psc, serviceComponentDefnID);
-// }
-
- /**
- * Adds an existing ServiceComponentDefn to indicated PSC.
- * The ServiceComponentDefn will be removed from
- * any PSC it previously belonged to.
-
- * @param psc ProductServiceConfig to have service comp defn added to
- * @param serviceComponentDefnID will be added to the indicated
- * ProductServiceConfiguration (and removed from any PSC it previously
- * belonged to).
- */
-// public ProductServiceConfig addServiceComponentDefn(ProductServiceConfig psc, ServiceComponentDefnID serviceComponentDefnID){
-// if ( psc == null ) {
-// throw new IllegalArgumentException(CommonPlugin.Util.getString(ErrorMessageKeys.CONFIG_ERR_0089, ProductServiceConfig.class.getName()));
+// if ( serviceComponentDefn == null ) {
+// throw new IllegalArgumentException(CommonPlugin.Util.getString(ErrorMessageKeys.CONFIG_ERR_0089, ServiceComponentDefn.class.getName()));
// }
-// if ( serviceComponentDefnID == null ) {
-// throw new IllegalArgumentException(CommonPlugin.Util.getString(ErrorMessageKeys.CONFIG_ERR_0089, ServiceComponentDefnID.class.getName()));
+// if ( vm == null ) {
+// throw new IllegalArgumentException(CommonPlugin.Util.getString(ErrorMessageKeys.CONFIG_ERR_0089, VMComponentDefn.class.getName()));
// }
//
-// BasicProductServiceConfig basicPSC = (BasicProductServiceConfig) verifyTargetClass(psc,BasicProductServiceConfig.class);
-// basicPSC.addServiceComponentDefnID(serviceComponentDefnID);
+// ServiceComponentDefnID svcID = (ServiceComponentDefnID) serviceComponentDefn.getID();
//
-// //todo get old PSC of this service defn
-// //ProductServiceConfigID oldValue = serviceComponentDefn.getParentComponentTypeID();
-// createExchangeAction(serviceComponentDefnID,ConfigurationModel.Attribute.PSC_NAME, null, basicPSC.getID());
+// DeployedComponent dc = configuration.getDeployedServiceForVM(svcID, vm);
+// return this.setEnabled(dc, enabled);
//
//
-// ProductServiceConfig newDefn = (ProductServiceConfig) basicPSC.clone();
-// return newDefn;
-// }
-
- /**
- * Adds the service type represented by the indicated ComponentType to
- * the list of legal service types of the indicated ProductType.
- * @param productType ProductType to have a new service type added to
- * @param serviceComponentType ComponentType to be added to the
- * ProductType
- */
-// public ProductType addServiceComponentType(ProductType productType, ComponentType serviceComponentType){
-// BasicProductType basicProdType = (BasicProductType)productType;
//
-// ComponentTypeID productTypeID = (ComponentTypeID)basicProdType.getID();
-// this.setParentComponentTypeID(serviceComponentType, productTypeID);
-// //add the service ComponentTypeID to the BasicProductType
-// basicProdType.addServiceTypeID((ComponentTypeID)serviceComponentType.getID());
-//
-// return basicProdType;
// }
- /**
- * Removes the service type represented by the indicated ComponentType from
- * the list of legal service types of the indicated ProductType.
- * @param productType ProductType to have the service type taken from
- * @param serviceComponentType ComponentType to be taken from the
- * ProductType
- */
-// public ProductType removeServiceComponentType(ProductType productType, ComponentType serviceComponentType){
-// BasicProductType basicProdType = (BasicProductType)productType;
-//
-// ComponentTypeID productTypeID = (ComponentTypeID)basicProdType.getID();
-// this.setParentComponentTypeID(serviceComponentType, productTypeID);
-// //add the service ComponentTypeID to the BasicProductType
-// basicProdType.removeServiceTypeID((ComponentTypeID)serviceComponentType.getID());
-//
-// return basicProdType;
-// }
+
+
/**
* Sets the LogConfiguration in effect for the Configuration
*/
15 years, 8 months
teiid SVN: r770 - trunk/connectors/connector-text/src/test/java/com/metamatrix/connector/text.
by teiid-commits@lists.jboss.org
Author: mdrillin
Date: 2009-04-13 18:26:25 -0400 (Mon, 13 Apr 2009)
New Revision: 770
Modified:
trunk/connectors/connector-text/src/test/java/com/metamatrix/connector/text/TestTextConnector.java
Log:
checkin test, changed comment only
Modified: trunk/connectors/connector-text/src/test/java/com/metamatrix/connector/text/TestTextConnector.java
===================================================================
--- trunk/connectors/connector-text/src/test/java/com/metamatrix/connector/text/TestTextConnector.java 2009-04-13 22:21:45 UTC (rev 769)
+++ trunk/connectors/connector-text/src/test/java/com/metamatrix/connector/text/TestTextConnector.java 2009-04-13 22:26:25 UTC (rev 770)
@@ -47,7 +47,7 @@
ConnectorEnvironment env = EnvironmentUtility.createEnvironment(props, false);
TextConnector connector = new TextConnector();
- // Init license checker with class, non-GUI notifier and don't exitOnFailure
+ // Initialize license checker with class, non-GUI notifier and don't exitOnFailure
connector.start(env);
return connector;
}
15 years, 8 months
teiid SVN: r768 - in branches/6.0.x/documentation: admin-guide and 4 other directories.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2009-04-13 13:58:12 -0400 (Mon, 13 Apr 2009)
New Revision: 768
Modified:
branches/6.0.x/documentation/
branches/6.0.x/documentation/admin-guide/
branches/6.0.x/documentation/connector-developer-guide/
branches/6.0.x/documentation/quick-start-example/
branches/6.0.x/documentation/reference/
branches/6.0.x/documentation/server-extensions-guide/
Log:
adding svn ignores
Property changes on: branches/6.0.x/documentation
___________________________________________________________________
Name: svn:ignore
- target
.classpath
.project
+ target
.classpath
.project
.settings
Property changes on: branches/6.0.x/documentation/admin-guide
___________________________________________________________________
Name: svn:ignore
- target
.classpath
.project
+ target
.classpath
.project
.settings
Property changes on: branches/6.0.x/documentation/connector-developer-guide
___________________________________________________________________
Name: svn:ignore
- target
.project
.classpath
+ target
.project
.classpath
.settings
Property changes on: branches/6.0.x/documentation/quick-start-example
___________________________________________________________________
Name: svn:ignore
- target
.classpath
.project
+ target
.classpath
.project
.settings
Property changes on: branches/6.0.x/documentation/reference
___________________________________________________________________
Name: svn:ignore
- target
.classpath
.project
+ target
.classpath
.project
.settings
Property changes on: branches/6.0.x/documentation/server-extensions-guide
___________________________________________________________________
Name: svn:ignore
- target
.project
.classpath
+ target
.project
.classpath
.settings
15 years, 8 months
teiid SVN: r767 - in branches/6.0.x: embedded/src/main/java/com/metamatrix/dqp/embedded/configuration and 3 other directories.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2009-04-13 13:56:26 -0400 (Mon, 13 Apr 2009)
New Revision: 767
Modified:
branches/6.0.x/client-jdbc/src/main/java/com/metamatrix/jdbc/EmbeddedDriver.java
branches/6.0.x/embedded/src/main/java/com/metamatrix/dqp/embedded/configuration/ExtensionModuleReader.java
branches/6.0.x/embedded/src/main/java/com/metamatrix/dqp/embedded/configuration/ExtensionModuleWriter.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/dqp/embedded/services/EmbeddedDataService.java
branches/6.0.x/embedded/src/test/java/com/metamatrix/dqp/embedded/services/TestEmbeddedConfigurationService.java
branches/6.0.x/engine/src/main/java/com/metamatrix/dqp/service/ConfigurationService.java
Log:
TEIID-479
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-04-13 17:46:02 UTC (rev 766)
+++ branches/6.0.x/client-jdbc/src/main/java/com/metamatrix/jdbc/EmbeddedDriver.java 2009-04-13 17:56:26 UTC (rev 767)
@@ -27,6 +27,7 @@
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.net.URL;
+import java.net.URLClassLoader;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.DriverPropertyInfo;
@@ -359,22 +360,25 @@
// a non-delegating class loader will be created from where all third party dependent jars can be loaded
ArrayList<URL> runtimeClasspath = new ArrayList<URL>();
+ String libLocation = info.getProperty("dqp.lib", "./lib/"); //$NON-NLS-1$ //$NON-NLS-2$
+ if (!libLocation.endsWith("/")) { //$NON-NLS-1$
+ libLocation = libLocation + "/"; //$NON-NLS-1$
+ }
// find jars in the "lib" directory; patches is reverse alpaha and not case sensitive so small letters then capitals
if (!EmbeddedDriver.getDefaultConnectionURL().equals(dqpURL.toString())) {
- runtimeClasspath.addAll(libClassPath(dqpURL, "lib/patches/", MMURLConnection.REVERSEALPHA)); //$NON-NLS-1$
- runtimeClasspath.addAll(libClassPath(dqpURL, "lib/", MMURLConnection.DATE)); //$NON-NLS-1$
+ runtimeClasspath.addAll(libClassPath(dqpURL, libLocation+"patches/", MMURLConnection.REVERSEALPHA)); //$NON-NLS-1$
+ runtimeClasspath.addAll(libClassPath(dqpURL, libLocation, MMURLConnection.DATE));
}
URL[] dqpClassPath = runtimeClasspath.toArray(new URL[runtimeClasspath.size()]);
- this.classLoader = new NonDelegatingClassLoader(dqpClassPath, Thread.currentThread().getContextClassLoader(), new MetaMatrixURLStreamHandlerFactory());
+ 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++) {
DriverManager.println(dqpClassPath[i].toString());
}
-
// Now using this class loader create the connection factory to the dqp.
ClassLoader current = null;
try {
Modified: branches/6.0.x/embedded/src/main/java/com/metamatrix/dqp/embedded/configuration/ExtensionModuleReader.java
===================================================================
--- branches/6.0.x/embedded/src/main/java/com/metamatrix/dqp/embedded/configuration/ExtensionModuleReader.java 2009-04-13 17:46:02 UTC (rev 766)
+++ branches/6.0.x/embedded/src/main/java/com/metamatrix/dqp/embedded/configuration/ExtensionModuleReader.java 2009-04-13 17:56:26 UTC (rev 767)
@@ -46,19 +46,25 @@
* @since 4.3
*/
public class ExtensionModuleReader {
- private static final String MM_JAR_PROTOCOL = "extensionjar"; //$NON-NLS-1$
+ public static final String MM_JAR_PROTOCOL = "extensionjar"; //$NON-NLS-1$
/**
* Load the extension module from the file system
* @return
* @since 4.3
*/
- public static ExtensionModule loadExtensionModule(String extModuleName, URL extModuleURL) throws MetaMatrixComponentException{
+ public static ExtensionModule loadExtensionModule(String extModuleName, URL[] contexts) throws MetaMatrixComponentException{
byte[] contents = null;
InputStream in = null;
try {
- in = extModuleURL.openStream();
- contents = ByteArrayHelper.toByteArray(in);
+ URL extModuleURL = resolveExtensionModule(MM_JAR_PROTOCOL+":"+extModuleName, contexts); //$NON-NLS-1$
+ if (extModuleURL != null) {
+ in = extModuleURL.openStream();
+ contents = ByteArrayHelper.toByteArray(in);
+ }
+ else {
+ throw new MetaMatrixComponentException(DQPEmbeddedPlugin.Util.getString("ExtensionModuleReader.ext_module_does_not_exist", extModuleName)); //$NON-NLS-1$
+ }
} catch (FileNotFoundException e) {
throw new MetaMatrixComponentException(DQPEmbeddedPlugin.Util.getString("ExtensionModuleReader.ext_module_does_not_exist", extModuleName)); //$NON-NLS-1$
} catch (IOException e) {
@@ -77,39 +83,44 @@
* @return list of Extension Modules {@link com.metamatrix.common.config.api.ExtensionModule}
* @since 4.3
*/
- public static List loadExtensionModules(URL extensionPathURL) throws MetaMatrixComponentException{
+ public static List<ExtensionModule> loadExtensionModules(URL[] contexts) throws MetaMatrixComponentException{
ObjectInputStream in = null;
- List extModuleList = new ArrayList();
- String extensionPath = extensionPathURL.toString()+"?action=list&filter=.jar"; //$NON-NLS-1$
+ List<ExtensionModule> extModuleList = new ArrayList<ExtensionModule>();
+
+ for (URL extensionPathURL: contexts) {
+ String extensionPath = extensionPathURL.toString()+"?action=list&filter=.jar"; //$NON-NLS-1$
- try {
- extensionPathURL = URLHelper.buildURL(extensionPath);
- in = new ObjectInputStream(extensionPathURL.openStream());
- String[] jarFiles = (String[])in.readObject();
- for (int i = 0; i < jarFiles.length; i++) {
- String jarName = jarFiles[i];
- jarName = jarName.substring(jarName.lastIndexOf('/')+1);
- byte[] contents = null;
- try {
- URL jarFileURL = URLHelper.buildURL(jarFiles[i]);
- InputStream jarStream = jarFileURL.openStream();
- contents = ByteArrayHelper.toByteArray(jarStream);
- jarStream.close();
- } catch (IOException e) {
- throw new MetaMatrixComponentException(e, DQPEmbeddedPlugin.Util.getString("ExtensionModuleReader.ext_module_failed_to_read", new Object[] {jarFiles[i]})); //$NON-NLS-1$
- }
- extModuleList.add(new BasicExtensionModule(jarName, ExtensionModule.JAR_FILE_TYPE, "Jar File", contents)); //$NON-NLS-1$
- }
- } catch (FileNotFoundException e) {
- // if the file not found then it means no extensions directory and no extension
- // modules, just return a empty list.
- } catch (Exception e) {
- throw new MetaMatrixComponentException(e);
- }finally {
- if (in != null) {
- try{in.close();}catch(IOException e) {}
- }
+ try {
+ extensionPathURL = URLHelper.buildURL(extensionPath);
+ in = new ObjectInputStream(extensionPathURL.openStream());
+ String[] jarFiles = (String[])in.readObject();
+ for (int i = 0; i < jarFiles.length; i++) {
+ String jarName = jarFiles[i];
+ jarName = jarName.substring(jarName.lastIndexOf('/')+1);
+ byte[] contents = null;
+ try {
+ URL jarFileURL = URLHelper.buildURL(jarFiles[i]);
+ InputStream jarStream = jarFileURL.openStream();
+ contents = ByteArrayHelper.toByteArray(jarStream);
+ jarStream.close();
+ } catch (IOException e) {
+ throw new MetaMatrixComponentException(e, DQPEmbeddedPlugin.Util.getString("ExtensionModuleReader.ext_module_failed_to_read", new Object[] {jarFiles[i]})); //$NON-NLS-1$
+ }
+ extModuleList.add(new BasicExtensionModule(jarName, ExtensionModule.JAR_FILE_TYPE, "Jar File", contents)); //$NON-NLS-1$
+ }
+ } catch (FileNotFoundException e) {
+ // if the file not found then it means no extensions directory and no extension
+ // modules, just return a empty list.
+ } catch (IOException e) {
+ throw new MetaMatrixComponentException(e);
+ } catch(ClassNotFoundException e){
+ throw new MetaMatrixComponentException(e);
+ } finally {
+ if (in != null) {
+ try{in.close();}catch(IOException e) {}
+ }
+ }
}
return extModuleList;
}
@@ -124,31 +135,45 @@
* @throws MalformedURLException
* @since 4.3
*/
- public static URL[] resolveExtensionClasspath(String extClassPath, URL context)
+ public static List<URL> resolveExtensionClasspath(String extClassPath, URL[] contexts)
throws IOException {
- List urls = new ArrayList();
+ List<URL> urls = new ArrayList<URL>();
StringTokenizer st = new StringTokenizer(extClassPath, ";"); //$NON-NLS-1$
while (st.hasMoreTokens()) {
- URL entry = null;
- String temp = st.nextToken();
- int idx = temp.indexOf(MM_JAR_PROTOCOL);
- if (idx != -1) {
- entry = URLHelper.buildURL(context, temp.substring(idx + MM_JAR_PROTOCOL.length() + 1));
- InputStream in = null;
- try {
- in = entry.openStream();
- in.close();
- } catch (IOException e) {
- // do nothing as this is just a test to see if the resource is available
- // Defect 22736 - Change message from warning to detail so this doesn't look as scary.
- LogManager.logDetail(LogConstants.CTX_DQP, DQPEmbeddedPlugin.Util.getString("DataService.ext_module_not_found", entry)); //$NON-NLS-1$
- }
- } else {
- entry = new URL(temp);
+ String extModule = st.nextToken();
+ URL entry = resolveExtensionModule(extModule, contexts);
+ if (entry != null) {
+ urls.add(entry);
}
- urls.add(entry);
}
- return (URL[])urls.toArray(new URL[urls.size()]);
- }
+ return urls;
+ }
+
+ public static URL resolveExtensionModule(String extModule, URL[] contexts) throws IOException {
+ int idx = extModule.indexOf(MM_JAR_PROTOCOL);
+ if (idx != -1) {
+ for (URL context : contexts) {
+ URL entry = URLHelper.buildURL(context, extModule.substring(idx + MM_JAR_PROTOCOL.length() + 1));
+ if (urlExists(entry)) {
+ return entry;
+ }
+ }
+
+ } else {
+ return new URL(extModule);
+ }
+ return null;
+ }
+
+ private static boolean urlExists(URL url) {
+ InputStream in = null;
+ try {
+ in = url.openStream();
+ in.close();
+ return true;
+ } catch (IOException e) {
+ }
+ return false;
+ }
}
Modified: branches/6.0.x/embedded/src/main/java/com/metamatrix/dqp/embedded/configuration/ExtensionModuleWriter.java
===================================================================
--- branches/6.0.x/embedded/src/main/java/com/metamatrix/dqp/embedded/configuration/ExtensionModuleWriter.java 2009-04-13 17:46:02 UTC (rev 766)
+++ branches/6.0.x/embedded/src/main/java/com/metamatrix/dqp/embedded/configuration/ExtensionModuleWriter.java 2009-04-13 17:56:26 UTC (rev 767)
@@ -41,11 +41,12 @@
*/
public class ExtensionModuleWriter {
- public static void write(ExtensionModule extModule, URL extModuleURL) throws MetaMatrixComponentException {
+ public static void write(ExtensionModule extModule, URL[] contexts) throws MetaMatrixComponentException {
OutputStream out = null;
try {
- String extFile = extModuleURL.toString()+"?action=write"; //$NON-NLS-1$
- extModuleURL = URLHelper.buildURL(extFile);
+ String extFile = extModule.getFullName()+"?action=write"; //$NON-NLS-1$
+ // NOTE: only write to the very first context.
+ URL extModuleURL = URLHelper.buildURL(contexts[0], extFile);
URLConnection conn = extModuleURL.openConnection();
out = conn.getOutputStream();
@@ -65,27 +66,38 @@
* @param extModule
* @since 4.3
*/
- public static void deleteModule(URL extModuleURL) throws MetaMatrixComponentException{
- String extensionPath = extModuleURL.toString()+"?action=delete"; //$NON-NLS-1$
+ public static void deleteModule(String extModuleName, URL[] contexts) throws MetaMatrixComponentException{
+ URL extModuleURL = null;
+ try {
+ extModuleURL = ExtensionModuleReader.resolveExtensionModule(ExtensionModuleReader.MM_JAR_PROTOCOL+":"+extModuleName, contexts); //$NON-NLS-1$
+ if (extModuleURL == null) {
+ throw new MetaMatrixComponentException(DQPEmbeddedPlugin.Util.getString("ExtensionModuleReader.ext_module_does_not_exist", extModuleName)); //$NON-NLS-1$
+ }
+ } catch (IOException e) {
+ throw new MetaMatrixComponentException(DQPEmbeddedPlugin.Util.getString("ExtensionModuleReader.ext_module_does_not_exist", extModuleName)); //$NON-NLS-1$
+ }
+
+ String extFile = extModuleURL.toString()+"?action=delete"; //$NON-NLS-1$
+
InputStream in = null;
try {
- extModuleURL = URLHelper.buildURL(extensionPath);
+ extModuleURL = URLHelper.buildURL(extFile);
in = extModuleURL.openStream();
if (in != null) {
// now delete file from the extensions directory..
throw new MetaMatrixComponentException(DQPEmbeddedPlugin.Util.getString("ExtensionModuleWriter.ext_module_delete_failed", new Object[] {extModuleURL})); //$NON-NLS-1$
}
- DQPEmbeddedPlugin.logInfo("ExtensionModuleWriter.ext_module_delete", new Object[] {extModuleURL.getPath(), extModuleURL}); //$NON-NLS-1$
+ DQPEmbeddedPlugin.logInfo("ExtensionModuleWriter.ext_module_delete", new Object[] {extModuleName, extModuleURL}); //$NON-NLS-1$
}catch(FileNotFoundException e) {
// this is what we should expect if open the stream.
- DQPEmbeddedPlugin.logInfo("ExtensionModuleWriter.ext_module_delete", new Object[] {extModuleURL.getPath(), extModuleURL}); //$NON-NLS-1$
+ DQPEmbeddedPlugin.logInfo("ExtensionModuleWriter.ext_module_delete", new Object[] {extModuleName, extModuleURL}); //$NON-NLS-1$
}catch(IOException e) {
throw new MetaMatrixComponentException(DQPEmbeddedPlugin.Util.getString("ExtensionModuleWriter.ext_module_delete_failed", new Object[] {extModuleURL})); //$NON-NLS-1$
} finally {
if (in != null) {
try {in.close();}catch(IOException e) {}
}
- }
+ }
}
}
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-04-13 17:46:02 UTC (rev 766)
+++ branches/6.0.x/embedded/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedConfigurationService.java 2009-04-13 17:56:26 UTC (rev 767)
@@ -207,43 +207,47 @@
* @since 4.3
*/
public URL getUDFFile() {
- String udfFile = userPreferences.getProperty(DQPEmbeddedProperties.USER_DEFINED_FUNCTIONS);
- if (valid(udfFile)) {
- return getFullyQualifiedPath(udfFile);
- }
try {
- return getFullyQualifiedPath(getDefaultExtensionPath(), USER_DEFINED_FUNCTION_MODEL);
- } catch (MetaMatrixComponentException e) {
- return null;
- }
+ String udfFile = userPreferences.getProperty(DQPEmbeddedProperties.USER_DEFINED_FUNCTIONS);
+ if (valid(udfFile)) {
+ return ExtensionModuleReader.resolveExtensionModule(udfFile, getExtensionPath());
+ }
+ return ExtensionModuleReader.resolveExtensionModule(ExtensionModuleReader.MM_JAR_PROTOCOL+":"+USER_DEFINED_FUNCTION_MODEL, getExtensionPath()); //$NON-NLS-1$
+ } catch (IOException e) {
+ return null;
+ }
}
/**
* @see com.metamatrix.dqp.service.ConfigurationService#getCommonExtensionClasspath()
*/
- public URL[] getCommonExtensionClasspath() {
+ public List<URL> getCommonExtensionClasspath() {
String classpath= userPreferences.getProperty(DQPEmbeddedProperties.COMMON_EXTENSION_CLASPATH);
if (valid(classpath)) {
try {
- URL context = getExtensionPath();
- return ExtensionModuleReader.resolveExtensionClasspath(classpath, context);
+ return ExtensionModuleReader.resolveExtensionClasspath(classpath, getExtensionPath());
} catch (IOException e) {
DQPEmbeddedPlugin.logError(e, "EmbeddedConfigurationService.udf_classspath_failure", new Object[] {}); //$NON-NLS-1$
}
}
+ /*
else {
try {
StringBuffer sb = new StringBuffer();
- List extModules = getExtensionModules();
+ List<ExtensionModule> extModules = getExtensionModules();
boolean valid = false;
- for (Iterator i = extModules.iterator(); i.hasNext();) {
- ExtensionModule module = (ExtensionModule)i.next();
+ for (ExtensionModule module:extModules) {
sb.append("extensionjar:").append(module.getFullName()).append(";"); //$NON-NLS-1$ //$NON-NLS-2$
valid = true;
}
if (valid) {
- URL context = getExtensionPath();
- return ExtensionModuleReader.resolveExtensionClasspath(sb.toString(), context);
+ 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
@@ -251,6 +255,7 @@
DQPEmbeddedPlugin.logError(e, "EmbeddedConfigurationService.udf_classspath_failure", new Object[] {}); //$NON-NLS-1$
}
}
+ */
return null;
}
@@ -323,7 +328,7 @@
return fileToSave;
}
- URL getVDBSaveLocation() throws MetaMatrixComponentException {
+ URL getVDBSaveLocation() {
URL[] urls = getVDBLocations();
for (int i = 0; i < urls.length; i++) {
String vdblocation = urls[i].toString().toLowerCase();
@@ -634,7 +639,7 @@
*/
public ConnectorBinding getConnectorBinding(String deployedBindingName)
throws MetaMatrixComponentException {
- return (ConnectorBinding)loadedConnectorBindings.get(deployedBindingName);
+ return loadedConnectorBindings.get(deployedBindingName);
}
/**
@@ -803,10 +808,15 @@
* @see com.metamatrix.dqp.service.ConfigurationService#getExtensionPath()
* @since 4.3
*/
- public URL getExtensionPath() {
- String path = userPreferences.getProperty(DQPEmbeddedProperties.DQP_EXTENSIONS);
+ public URL[] getExtensionPath() {
+ String path = userPreferences.getProperty(DQPEmbeddedProperties.DQP_EXTENSIONS, "./extensions/"); //$NON-NLS-1$
if (valid(path)) {
- return getFullyQualifiedPath(path);
+ ArrayList<URL> urlPaths = new ArrayList<URL>();
+ StringTokenizer st = new StringTokenizer(path, ";"); //$NON-NLS-1$
+ while(st.hasMoreElements()) {
+ urlPaths.add(getFullyQualifiedPath(st.nextToken()));
+ }
+ return urlPaths.toArray(new URL[urlPaths.size()]);
}
return null;
}
@@ -815,46 +825,32 @@
* @see com.metamatrix.dqp.service.ConfigurationService#useExtensionClasspath()
*/
public boolean useExtensionClasspath() {
- return (getExtensionPath() != null);
+ String path = userPreferences.getProperty(DQPEmbeddedProperties.DQP_EXTENSIONS);
+ return valid(path);
}
- /**
- * @return - returns a non null default path if the extension path is not defined
- * @throws MetaMatrixComponentException
- */
- URL getDefaultExtensionPath() throws MetaMatrixComponentException{
- URL extPath = getExtensionPath();
- if (extPath != null) {
- return extPath;
- }
- return getFullyQualifiedPath("./extensions/"); //$NON-NLS-1$
- }
-
/**
* @see com.metamatrix.dqp.service.ConfigurationService#getExtensionModule(java.lang.String)
* @since 4.3
*/
public ExtensionModule getExtensionModule(String extModuleName) throws MetaMatrixComponentException {
- URL extModulePath = getFullyQualifiedPath(getDefaultExtensionPath(), extModuleName);
- return ExtensionModuleReader.loadExtensionModule(extModuleName, extModulePath);
+ return ExtensionModuleReader.loadExtensionModule(extModuleName, getExtensionPath());
}
/**
* @see com.metamatrix.dqp.service.ConfigurationService#getExtensionModules()
* @since 4.3
*/
- public List getExtensionModules() throws MetaMatrixComponentException {
- URL extPath = getDefaultExtensionPath();
- return ExtensionModuleReader.loadExtensionModules(extPath);
+ public List<ExtensionModule> getExtensionModules() throws MetaMatrixComponentException {
+ return ExtensionModuleReader.loadExtensionModules(getExtensionPath());
}
/**
* @see com.metamatrix.dqp.service.ConfigurationService#saveExtensionModule(com.metamatrix.common.config.api.ExtensionModule)
* @since 4.3
*/
- public void saveExtensionModule(ExtensionModule extModule) throws MetaMatrixComponentException {
- URL extModuleURL = getFullyQualifiedPath(getDefaultExtensionPath(), extModule.getFullName());
- ExtensionModuleWriter.write(extModule, extModuleURL);
+ public void saveExtensionModule(ExtensionModule extModule) throws MetaMatrixComponentException {
+ ExtensionModuleWriter.write(extModule, getExtensionPath());
}
/**
@@ -862,8 +858,7 @@
* @since 4.3
*/
public void deleteExtensionModule(String extModuleName) throws MetaMatrixComponentException {
- URL extModuleURL = getFullyQualifiedPath(getDefaultExtensionPath(), extModuleName);
- ExtensionModuleWriter.deleteModule(extModuleURL);
+ ExtensionModuleWriter.deleteModule(extModuleName, getExtensionPath());
}
/**
@@ -930,9 +925,9 @@
public void loadUDF() throws MetaMatrixComponentException {
URL udfFile = getUDFFile();
if(udfFile != null && exists(udfFile)) {
- URL[] urls = getCommonExtensionClasspath();
+ List<URL> urls = getCommonExtensionClasspath();
try {
- this.udfSource = new UDFSource(udfFile, urls);
+ 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) {
Modified: branches/6.0.x/embedded/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedDataService.java
===================================================================
--- branches/6.0.x/embedded/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedDataService.java 2009-04-13 17:46:02 UTC (rev 766)
+++ branches/6.0.x/embedded/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedDataService.java 2009-04-13 17:56:26 UTC (rev 767)
@@ -452,7 +452,7 @@
}
private void removeConnectorBinding(String connectorBindingName)
- throws MetaMatrixComponentException, ApplicationLifecycleException{
+ throws MetaMatrixComponentException {
// do house cleanup of the objects.
ConnectorID id = selectConnector(connectorBindingName);
connectorMgrs.remove(id);
@@ -565,17 +565,17 @@
}
DQPEmbeddedPlugin.logInfo("DataService.useClassloader", new Object[] {classPath}); //$NON-NLS-1$
- URL context = getConfigurationService().getExtensionPath();
- URL[] userPath = ExtensionModuleReader.resolveExtensionClasspath(classPath, context);
+ List<URL> userPath = ExtensionModuleReader.resolveExtensionClasspath(classPath, getConfigurationService().getExtensionPath());
// since we are using the extensions, get the common extension path
- URL[] commonExtensionPath = getConfigurationService().getCommonExtensionClasspath();
- ArrayList<URL> urlPath = new ArrayList<URL>();
+ List<URL> commonExtensionPath = getConfigurationService().getCommonExtensionClasspath();
- urlPath.addAll(Arrays.asList(userPath));
+ ArrayList<URL> urlPath = new ArrayList<URL>();
+ urlPath.addAll(userPath);
+
if (commonExtensionPath != null) {
- urlPath.addAll(Arrays.asList(commonExtensionPath));
+ urlPath.addAll(commonExtensionPath);
}
ClassLoader classLoader = new URLFilteringClassLoader(urlPath.toArray(new URL[urlPath.size()]), Thread.currentThread().getContextClassLoader(), new MetaMatrixURLStreamHandlerFactory());
Modified: branches/6.0.x/embedded/src/test/java/com/metamatrix/dqp/embedded/services/TestEmbeddedConfigurationService.java
===================================================================
--- branches/6.0.x/embedded/src/test/java/com/metamatrix/dqp/embedded/services/TestEmbeddedConfigurationService.java 2009-04-13 17:46:02 UTC (rev 766)
+++ branches/6.0.x/embedded/src/test/java/com/metamatrix/dqp/embedded/services/TestEmbeddedConfigurationService.java 2009-04-13 17:56:26 UTC (rev 767)
@@ -22,6 +22,8 @@
package com.metamatrix.dqp.embedded.services;
+import java.io.File;
+import java.io.FileWriter;
import java.net.URL;
import java.util.Collection;
import java.util.HashMap;
@@ -39,8 +41,10 @@
import com.metamatrix.common.config.api.ConfigurationID;
import com.metamatrix.common.config.api.ConnectorBinding;
import com.metamatrix.common.config.api.ConnectorBindingID;
+import com.metamatrix.common.config.api.ExtensionModule;
import com.metamatrix.common.config.model.BasicConnectorBinding;
import com.metamatrix.common.config.model.BasicConnectorBindingType;
+import com.metamatrix.common.config.model.BasicExtensionModule;
import com.metamatrix.common.util.crypto.CryptoUtil;
import com.metamatrix.common.util.crypto.NullCryptor;
import com.metamatrix.common.vdb.api.VDBArchive;
@@ -128,7 +132,7 @@
Properties p = EmbeddedTestUtil.getProperties();
p.remove(DQPEmbeddedProperties.DQP_EXTENSIONS);
service.userPreferences = p;
- assertTrue(service.getDefaultExtensionPath().toString().endsWith("dqp/extensions/")); //$NON-NLS-1$
+ assertTrue(service.getExtensionPath()[0].toString().endsWith("dqp/extensions/")); //$NON-NLS-1$
}
public void testGetDirectoryToStoreVDBS() throws Exception {
@@ -320,11 +324,39 @@
assertNotNull(service.getSystemVdb());
}
- public void testGetUDFFileName() throws Exception{
+ public void testUDF() throws Exception{
Properties p = EmbeddedTestUtil.getProperties();
- p.setProperty(DQPEmbeddedProperties.USER_DEFINED_FUNCTIONS, "./lib/foo.txt"); //$NON-NLS-1$
+ p.setProperty(DQPEmbeddedProperties.USER_DEFINED_FUNCTIONS, "extensionjar:foo.xmi"); //$NON-NLS-1$
+ p.setProperty("dqp.extensions", "./foo/;./bar/"); //$NON-NLS-1$ //$NON-NLS-2$
service.userPreferences = p;
- assertTrue(service.getUDFFile().toString().endsWith(UnitTestUtil.getTestScratchPath()+"/dqp/lib/foo.txt")); //$NON-NLS-1$
+
+ assertNull(service.getUDFFile());
+
+ File f = new File("target/scratch/dqp/bar"); //$NON-NLS-1$
+ f.mkdirs();
+ File xmiFile = new File("target/scratch/dqp/bar/foo.xmi"); //$NON-NLS-1$
+ FileWriter fw = new FileWriter(xmiFile);
+ fw.write("testing extension modules"); //$NON-NLS-1$
+ fw.flush();
+ fw.close();
+
+
+ assertTrue(service.getUDFFile().toString().endsWith(UnitTestUtil.getTestScratchPath()+"/dqp/bar/foo.xmi")); //$NON-NLS-1$
+
+ p.setProperty(DQPEmbeddedProperties.USER_DEFINED_FUNCTIONS, xmiFile.toURL().toString());
+ assertEquals(xmiFile.toURL().toString(), service.getUDFFile().toString());
+
+ xmiFile.delete();
+
+ // now look for the default
+ p.remove(DQPEmbeddedProperties.USER_DEFINED_FUNCTIONS);
+ assertNull(service.getUDFFile());
+
+ service.saveExtensionModule(new BasicExtensionModule(ConfigurationService.USER_DEFINED_FUNCTION_MODEL, "adding extension module", "xmi", "testing extension modules".getBytes())); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+
+ assertTrue(service.getUDFFile().toString().endsWith("/dqp/foo/"+ConfigurationService.USER_DEFINED_FUNCTION_MODEL)); //$NON-NLS-1$
+
+ f.delete();
}
public void testGetVDBs() throws Exception{
@@ -461,4 +493,65 @@
assertEquals(23, service.loadedConnectorTypes.size());
}
+ public void testUseMultipleExtensionPath() throws Exception {
+ Properties p = EmbeddedTestUtil.getProperties();
+ p.setProperty("dqp.extensions", "/foo/;../x/bar/"); //$NON-NLS-1$ //$NON-NLS-2$
+ service.userPreferences = p;
+ assertEquals("mmfile:/foo/", service.getExtensionPath()[0].toExternalForm()); //$NON-NLS-1$
+ assertEquals("mmfile:target/scratch/x/bar/", service.getExtensionPath()[1].toExternalForm()); //$NON-NLS-1$
+ }
+
+ public void testGetExtensionModule() throws Exception {
+ Properties p = EmbeddedTestUtil.getProperties();
+
+ File f = new File("target/scratch/dqp/bar"); //$NON-NLS-1$
+ f.mkdirs();
+ FileWriter fw = new FileWriter("target/scratch/dqp/bar/extfile.jar"); //$NON-NLS-1$
+ fw.write("testing extension modules"); //$NON-NLS-1$
+ fw.flush();
+ fw.close();
+
+ p.setProperty("dqp.extensions", "./foo/;./bar/"); //$NON-NLS-1$ //$NON-NLS-2$
+ service.userPreferences = p;
+
+ // get all the modules in the system.
+ List<ExtensionModule> modules = service.getExtensionModules();
+ assertEquals("extfile.jar", modules.get(0).getID().getFullName()); //$NON-NLS-1$
+ assertEquals("testing extension modules", new String(modules.get(0).getFileContents())); //$NON-NLS-1$
+
+ // get individual module
+ ExtensionModule m = service.getExtensionModule("extfile.jar"); //$NON-NLS-1$
+ assertEquals("testing extension modules", new String(m.getFileContents())); //$NON-NLS-1$
+
+ // test adding of the extension module
+ service.saveExtensionModule(new BasicExtensionModule("added-ext.jar", "adding extension module", "jar", "testing extension modules".getBytes())); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ modules = service.getExtensionModules();
+ assertEquals(2, modules.size());
+
+ m = service.getExtensionModule("added-ext.jar"); //$NON-NLS-1$
+ assertEquals("testing extension modules", new String(m.getFileContents())); //$NON-NLS-1$
+
+ modules = service.getExtensionModules();
+ assertEquals(2, modules.size());
+
+ // test common class path; also makes sure that the conect in position (1) has the newly added module
+ service.userPreferences.setProperty("dqp.extension.CommonClasspath", "extensionjar:added-ext.jar;extensionjar:extfile.jar"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals("mmfile:target/scratch/dqp/foo/added-ext.jar", service.getCommonExtensionClasspath().get(0).toString()); //$NON-NLS-1$
+ assertEquals("mmfile:target/scratch/dqp/bar/extfile.jar", service.getCommonExtensionClasspath().get(1).toString()); //$NON-NLS-1$
+
+ // test delete
+ service.deleteExtensionModule("added-ext.jar"); //$NON-NLS-1$
+ modules = service.getExtensionModules();
+ assertEquals(1, modules.size());
+
+ // test for non-existent module
+ try {
+ m = service.getExtensionModule("added-ext.jar"); //$NON-NLS-1$
+ fail("must have failed to find"); //$NON-NLS-1$
+ } catch (MetaMatrixComponentException e) {
+ }
+
+ f.delete();
+ }
+
}
Modified: branches/6.0.x/engine/src/main/java/com/metamatrix/dqp/service/ConfigurationService.java
===================================================================
--- branches/6.0.x/engine/src/main/java/com/metamatrix/dqp/service/ConfigurationService.java 2009-04-13 17:46:02 UTC (rev 766)
+++ branches/6.0.x/engine/src/main/java/com/metamatrix/dqp/service/ConfigurationService.java 2009-04-13 17:56:26 UTC (rev 767)
@@ -102,7 +102,7 @@
* files are loaded usually as the extension modules.
* @return URL[] - Classpath for the UDF jar files
*/
- public URL[] getCommonExtensionClasspath();
+ public List<URL> getCommonExtensionClasspath();
/**
* URL to Log file name
@@ -262,7 +262,7 @@
* @return String URL - url to extension path; null if extensions are not used
* @since 4.3
*/
- public URL getExtensionPath();
+ public URL[] getExtensionPath();
/**
* Get the list of extension modules available in the store
@@ -270,7 +270,7 @@
* @throws MetaMatrixComponentException
* @since 4.3
*/
- public List getExtensionModules() throws MetaMatrixComponentException;
+ public List<ExtensionModule> getExtensionModules() throws MetaMatrixComponentException;
/**
* Get the extension module by the given identifier
15 years, 8 months
teiid SVN: r766 - branches/6.0.x/engine/src/main/java/org/teiid/dqp/internal/pooling/connector.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2009-04-13 13:46:02 -0400 (Mon, 13 Apr 2009)
New Revision: 766
Modified:
branches/6.0.x/engine/src/main/java/org/teiid/dqp/internal/pooling/connector/PooledConnector.java
Log:
TEIID-481
Modified: branches/6.0.x/engine/src/main/java/org/teiid/dqp/internal/pooling/connector/PooledConnector.java
===================================================================
--- branches/6.0.x/engine/src/main/java/org/teiid/dqp/internal/pooling/connector/PooledConnector.java 2009-04-13 16:47:42 UTC (rev 765)
+++ branches/6.0.x/engine/src/main/java/org/teiid/dqp/internal/pooling/connector/PooledConnector.java 2009-04-13 17:46:02 UTC (rev 766)
@@ -101,6 +101,7 @@
@Override
public void start(ConnectorEnvironment environment)
throws ConnectorException {
+ this.environment = environment;
Properties p = environment.getProperties();
pool.initialize(p);
if (xaPool != null) {
15 years, 8 months
teiid SVN: r765 - in branches/remove_psc/server/src: main/java/com/metamatrix/platform/config/spi/xml and 1 other directories.
by teiid-commits@lists.jboss.org
Author: vhalbert(a)redhat.com
Date: 2009-04-13 12:47:42 -0400 (Mon, 13 Apr 2009)
New Revision: 765
Modified:
branches/remove_psc/server/src/main/java/com/metamatrix/metadata/runtime/vdb/defn/VDBCreation.java
branches/remove_psc/server/src/main/java/com/metamatrix/platform/config/spi/xml/XMLActionUpdateStrategy.java
branches/remove_psc/server/src/test/java/com/metamatrix/admin/server/FakeConfiguration.java
branches/remove_psc/server/src/test/java/com/metamatrix/admin/server/FakeConfigurationService.java
Log:
Teiid 323 - refactured, removing unused Config API classes: ProductType, ProductTypeID and ConfigurationLock
Modified: branches/remove_psc/server/src/main/java/com/metamatrix/metadata/runtime/vdb/defn/VDBCreation.java
===================================================================
--- branches/remove_psc/server/src/main/java/com/metamatrix/metadata/runtime/vdb/defn/VDBCreation.java 2009-04-13 16:46:55 UTC (rev 764)
+++ branches/remove_psc/server/src/main/java/com/metamatrix/metadata/runtime/vdb/defn/VDBCreation.java 2009-04-13 16:47:42 UTC (rev 765)
@@ -27,10 +27,12 @@
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
+import java.util.Set;
import com.metamatrix.api.exception.MetaMatrixException;
import com.metamatrix.common.actions.ObjectEditor;
@@ -110,6 +112,8 @@
VDBDefn def = vdbArchive.getConfigurationDef();
Map connectorBindings = def.getConnectorBindings();
Map connectorTypes = def.getConnectorTypes();
+
+ Set addedTypes = new HashSet(connectorTypes.size());
ConfigurationModelContainer cmc =null;
@@ -117,22 +121,24 @@
XMLConfigurationConnector writer = getWriter();
BasicConfigurationObjectEditor editor = new BasicConfigurationObjectEditor(true);
+ if (cmc == null) {
+ cmc = CurrentConfiguration.getInstance().getConfigurationModel();
+ }
+
for (Iterator it= connectorBindings.values().iterator(); it.hasNext(); ) {
ConnectorBinding cb = (ConnectorBinding) it.next();
// add the components to configuration
ComponentType ct = (ComponentType) connectorTypes.get(cb.getComponentTypeID().getName());
-
- if (cmc == null) {
- cmc = CurrentConfiguration.getInstance().getConfigurationModel();
- }
- ConnectorBinding existingBinding = addConfigurationObjects(cmc, cb, ct, writer, editor);
+
+ ConnectorBinding existingBinding = addConfigurationObjects(cmc, cb, ct, writer, editor, addedTypes);
// if the binding is returned, it indicates the binding already existed and
// therefore will need to be remapped in its related model so that the
// model-to-binding mapping is correct
if (existingBinding != null) {
reMapBinding.put(cb.getRoutingUUID(), existingBinding);
}
+
}
writer.executeActions(editor.getDestination().popActions());
@@ -176,24 +182,30 @@
* @throws Exception
* @since 4.2
*/
- protected ConnectorBinding addConfigurationObjects(ConfigurationModelContainer cmc, ConnectorBinding binding, ComponentType type, XMLConfigurationConnector writer, BasicConfigurationObjectEditor editor)throws Exception {
- ComponentType tExist = null;
- if (type != null) {
- tExist = cmc.getComponentType(type.getFullName());
+ protected ConnectorBinding addConfigurationObjects(ConfigurationModelContainer cmc, ConnectorBinding binding, ComponentType type, XMLConfigurationConnector writer, BasicConfigurationObjectEditor editor, Set addedTypes)throws Exception {
+ boolean addType = false;
+
+ ComponentType tExist = null;
+ if (type != null ) {
+ if ( ! addedTypes.contains(type.getID())) {
+
+ tExist = cmc.getComponentType(type.getFullName());
+ if (tExist == null) {
+ addType=true;
+ }
+ }
} else {
+ // if here, the type wasnt in the .def file, therefore it must already exist
+
tExist = cmc.getComponentType(binding.getComponentTypeID().getFullName());
+ if (tExist == null) {
+ throw new MetaMatrixException(RuntimeMetadataPlugin.Util.getString("VDBCreation.No_type_passed_and_bindingtype_not_found", new Object[] { binding.getFullName(), binding.getComponentTypeID().getFullName()})); //$NON-NLS-1$
+
+ }
type = tExist;
}
- boolean addType = false;
- if (tExist != null) {
- addType = false;
- } else if (type != null) {
- addType = true;
- } else {
- throw new MetaMatrixException(RuntimeMetadataPlugin.Util.getString("VDBCreation.No_type_passed_and_bindingtype_not_found", new Object[] { binding.getFullName(), binding.getComponentTypeID().getFullName()})); //$NON-NLS-1$
- }
-
+
boolean bindingExist = false;
// determine if the binding exist,
@@ -224,6 +236,8 @@
editor.createComponentTypeDefn(type, ctd.getPropertyDefinition(), false);
}
+
+ addedTypes.add(type.getID());
} else if (updateBindingProperties) {
// if the bindings are being updated, the type needs to be updated to ensure
// the matching componenttypedefns exists.
Modified: branches/remove_psc/server/src/main/java/com/metamatrix/platform/config/spi/xml/XMLActionUpdateStrategy.java
===================================================================
--- branches/remove_psc/server/src/main/java/com/metamatrix/platform/config/spi/xml/XMLActionUpdateStrategy.java 2009-04-13 16:46:55 UTC (rev 764)
+++ branches/remove_psc/server/src/main/java/com/metamatrix/platform/config/spi/xml/XMLActionUpdateStrategy.java 2009-04-13 16:47:42 UTC (rev 765)
@@ -46,6 +46,7 @@
import com.metamatrix.common.config.api.ComponentDefn;
import com.metamatrix.common.config.api.ComponentDefnID;
import com.metamatrix.common.config.api.ComponentObject;
+import com.metamatrix.common.config.api.ComponentObjectID;
import com.metamatrix.common.config.api.ComponentType;
import com.metamatrix.common.config.api.ComponentTypeDefn;
import com.metamatrix.common.config.api.ComponentTypeDefnID;
@@ -74,15 +75,17 @@
import com.metamatrix.common.config.api.exceptions.InvalidConfigurationException;
import com.metamatrix.common.config.api.exceptions.InvalidDeployedComponentException;
import com.metamatrix.common.config.api.exceptions.InvalidPropertyValueException;
+import com.metamatrix.common.config.model.BasicComponentObject;
import com.metamatrix.common.config.model.BasicComponentType;
import com.metamatrix.common.config.model.BasicComponentTypeDefn;
import com.metamatrix.common.config.model.BasicConfiguration;
import com.metamatrix.common.config.model.BasicDeployedComponent;
import com.metamatrix.common.config.model.BasicHost;
+import com.metamatrix.common.config.model.BasicServiceComponentDefn;
import com.metamatrix.common.config.model.BasicSharedResource;
+import com.metamatrix.common.config.model.BasicUtil;
import com.metamatrix.common.config.model.ConfigurationModel;
import com.metamatrix.common.config.model.ConfigurationModelContainerImpl;
-import com.metamatrix.common.config.model.ConfigurationObjectEditorHelper;
import com.metamatrix.common.config.model.PropertyValidations;
import com.metamatrix.common.log.LogManager;
import com.metamatrix.common.namedobject.BaseID;
@@ -91,7 +94,6 @@
import com.metamatrix.common.util.crypto.CryptoUtil;
import com.metamatrix.core.util.Assertion;
import com.metamatrix.core.util.DateUtil;
-import com.metamatrix.core.util.MetaMatrixProductVersion;
import com.metamatrix.platform.config.ConfigMessages;
import com.metamatrix.platform.config.ConfigPlugin;
@@ -327,7 +329,7 @@
affectedIDs.add(targetID);
- Configuration cfg = config.getConfiguration();
+ BasicConfiguration cfg = (BasicConfiguration) config.getConfiguration();
try {
@@ -362,8 +364,7 @@
processPropertyForNewObject(rd, type, config, transaction
.getLockAcquiredBy());
- ConfigurationObjectEditorHelper
- .addConfigurationComponentDefn(cfg, rd);
+ cfg.addComponentDefn(rd);
} else if (action instanceof AddObject
|| action instanceof RemoveObject
@@ -389,7 +390,7 @@
} else if (action instanceof DestroyObject) {
if (rd != null) {
- ConfigurationObjectEditorHelper.delete(targetID, cfg);
+ delete(targetID, cfg);
setLastChangedDate(config.getConfiguration(), transaction.getLockAcquiredBy());
}
@@ -427,7 +428,7 @@
int actionIndex = -1;
affectedIDs.add(targetID);
- Configuration cfg = config.getConfiguration();
+ BasicConfiguration cfg = (BasicConfiguration) config.getConfiguration();
try {
@@ -459,7 +460,7 @@
throw new InvalidDeployedComponentException(ConfigMessages.CONFIG_0077, ConfigPlugin.Util.getString(ConfigMessages.CONFIG_0077, targetID.getName()));
}
- ConfigurationObjectEditorHelper.addDeployedComponent(cfg, dc);
+ cfg.addDeployedComponent(dc);
} else if (action instanceof AddObject ||
action instanceof RemoveObject ||
@@ -484,7 +485,7 @@
if (dc != null) {
- ConfigurationObjectEditorHelper.delete(targetID, config.getConfiguration());
+ delete(targetID, config.getConfiguration());
setLastChangedDate(config.getConfiguration(), transaction.getLockAcquiredBy());
}
@@ -522,7 +523,7 @@
affectedIDs.add(targetID);
- Configuration cfg = config.getConfiguration();
+ BasicConfiguration cfg = (BasicConfiguration) config.getConfiguration();
try {
@@ -555,7 +556,7 @@
// System.out.println("STRATEGY: Add ComponentDefn Target " + targetID);
- ConfigurationObjectEditorHelper.addConfigurationComponentDefn(cfg, cd);
+ cfg.addComponentDefn(cd);
} else if (action instanceof AddObject ||
action instanceof RemoveObject) {
@@ -616,7 +617,7 @@
} else if (anAction.hasAttributeCode() && anAction.getAttributeCode().intValue() == ConfigurationModel.Attribute.ROUTING_UUID.getCode()) {
if (cd instanceof ServiceComponentDefn) {
- ConfigurationObjectEditorHelper.setRoutingUUID((ServiceComponentDefn) cd, (String) anAction.getNewValue());
+ setRoutingUUID((ServiceComponentDefn) cd, (String) anAction.getNewValue());
setLastChangedDate(cd, transaction.getLockAcquiredBy());
@@ -638,7 +639,7 @@
if (cd != null) {
// System.out.println("STRATEGY: Destroy ServiceDefn Target " + targetID);
- ConfigurationObjectEditorHelper.delete(targetID, cfg);
+ delete(targetID, cfg);
setLastChangedDate(config.getConfiguration(), transaction.getLockAcquiredBy());
}
@@ -676,7 +677,7 @@
affectedIDs.add(targetID);
- Configuration cfg = config.getConfiguration();
+ BasicConfiguration cfg = (BasicConfiguration) config.getConfiguration();
try {
@@ -706,8 +707,8 @@
// process properties for any encryptions
processPropertyForNewObject(cd, type, config, transaction.getLockAcquiredBy());
- ConfigurationObjectEditorHelper.addConfigurationComponentDefn(cfg, cd);
-
+ cfg.addComponentDefn(cd);
+
} else if (action instanceof AddObject ||
action instanceof RemoveObject) {
@@ -780,7 +781,7 @@
if (cd != null) {
// System.out.println("STRATEGY: Destroy ComponentDefn Target " + targetID);
- ConfigurationObjectEditorHelper.delete(targetID, cfg);
+ delete(targetID, cfg);
setLastChangedDate(config.getConfiguration(), transaction.getLockAcquiredBy());
}
@@ -819,7 +820,7 @@
affectedIDs.add(targetID);
- Configuration cfg = config.getConfiguration();
+ BasicConfiguration cfg = (BasicConfiguration) config.getConfiguration();
try {
@@ -851,7 +852,7 @@
// System.out.println("STRATEGY: Add ConnectorBinding Target " + dvt.getID() + " to config " + cfg.getID());
- ConfigurationObjectEditorHelper.addConfigurationComponentDefn(cfg, cd);
+ cfg.addComponentDefn(cd);
} else if (action instanceof AddObject ||
action instanceof RemoveObject) {
@@ -930,7 +931,7 @@
cd = (ConnectorBinding) setLastChangedDate(cd, transaction.getLockAcquiredBy());
- ConfigurationObjectEditorHelper.setRoutingUUID((ConnectorBinding) cd, (String) anAction.getNewValue());
+ setRoutingUUID((ConnectorBinding) cd, (String) anAction.getNewValue());
} else {
throw new InvalidArgumentException(ConfigMessages.CONFIG_0096, ConfigPlugin.Util.getString(ConfigMessages.CONFIG_0096, anAction.getActionDescription() ));
@@ -941,7 +942,7 @@
if (cd != null) {
// System.out.println("STRATEGY: Destroy ConnectorBinding Target " + targetID);
- ConfigurationObjectEditorHelper.delete(targetID, cfg);
+ delete(targetID, cfg);
setLastChangedDate(config.getConfiguration(), transaction.getLockAcquiredBy());
}
@@ -1380,9 +1381,10 @@
dvt = (BasicHost) setCreationDate(dvt, transaction.getLockAcquiredBy());
+
+ BasicConfiguration bc = (BasicConfiguration) config.getConfiguration();
+ bc.addHost(dvt);
- ConfigurationObjectEditorHelper.addHostComponent(config.getConfiguration(), dvt);
-
} else if (action instanceof AddObject ||
action instanceof RemoveObject ||
action instanceof ExchangeObject) {
@@ -1410,7 +1412,7 @@
if (host != null) {
// if the host is deleted, so must the dependent objects be deleted (if they exist)
- ConfigurationObjectEditorHelper.delete(targetID, config.getConfiguration());
+ delete(targetID, config.getConfiguration());
setLastChangedDate(config.getConfiguration(), transaction.getLockAcquiredBy());
}
@@ -1691,7 +1693,10 @@
// because new objects may no longer have seperate actions for their properties, the
// properties that they have must be checked for passwords so that
// they can be encrypted.
- Properties props = ConfigurationObjectEditorHelper.getEditableProperties(object);
+
+ BasicComponentObject bco = (BasicComponentObject) object;
+
+ Properties props = bco.getEditableProperties();
updateProperties(object, props, ConfigurationObjectEditor.SET, type, config, principal);
@@ -1806,7 +1811,7 @@
}
- ConfigurationObjectEditorHelper.modifyProperties(object, passwordProps, operation);
+ modifyProperties(object, passwordProps, operation);
}
@@ -1832,15 +1837,24 @@
if (operation == ConfigurationObjectEditor.ADD) {
LogManager.logDetail(LogCommonConstants.CTX_CONFIG, "adding", propName, "with value", propValue); //$NON-NLS-1$ //$NON-NLS-2$
- ConfigurationObjectEditorHelper.addProperty(object, propName, propValue);
+ BasicComponentObject target = (BasicComponentObject) object;
+ target.addProperty(propName, propValue);
+
} else if (operation == ConfigurationObjectEditor.SET) {
LogManager.logDetail(LogCommonConstants.CTX_CONFIG, "setting", propName, "to value", propValue); //$NON-NLS-1$ //$NON-NLS-2$
- ConfigurationObjectEditorHelper.setProperty(object, propName, propValue);
+ BasicComponentObject target = (BasicComponentObject) object;
+
+ target.removeProperty(propName);
+
+ target.addProperty(propName, propValue);
+
} else if (operation == ConfigurationObjectEditor.REMOVE) {
LogManager.logDetail(LogCommonConstants.CTX_CONFIG, "removing", propName); //$NON-NLS-1$
- ConfigurationObjectEditorHelper.removeProperty(object, propName);
+ BasicComponentObject target = (BasicComponentObject) object;
+
+ target.removeProperty(propName);
}
}
@@ -1946,14 +1960,14 @@
String lastChangedDate = DateUtil.getCurrentDateAsString();
- return ConfigurationObjectEditorHelper.setLastChangedHistory(defn, principal, lastChangedDate);
+ return BasicUtil.setLastChangedHistory(defn, principal, lastChangedDate);
}
private ComponentType setLastChangedDate(ComponentType defn, String principal) {
String lastChangedDate = DateUtil.getCurrentDateAsString();
- return ConfigurationObjectEditorHelper.setLastChangedHistory(defn, principal, lastChangedDate);
+ return BasicUtil.setLastChangedHistory(defn, principal, lastChangedDate);
}
@@ -1961,20 +1975,92 @@
String creationDate = DateUtil.getCurrentDateAsString();
- defn = ConfigurationObjectEditorHelper.setLastChangedHistory(defn, principal, creationDate);
+ defn = BasicUtil.setLastChangedHistory(defn, principal, creationDate);
- return ConfigurationObjectEditorHelper.setCreationChangedHistory(defn, principal, creationDate);
+ return BasicUtil.setCreationChangedHistory(defn, principal, creationDate);
}
private ComponentType setCreationDate(ComponentType defn, String principal) {
String creationDate = DateUtil.getCurrentDateAsString();
- defn = ConfigurationObjectEditorHelper.setLastChangedHistory(defn, principal, creationDate);
+ defn = BasicUtil.setLastChangedHistory(defn, principal, creationDate);
- return ConfigurationObjectEditorHelper.setCreationChangedHistory(defn, principal, creationDate);
+ return BasicUtil.setCreationChangedHistory(defn, principal, creationDate);
}
+
+
+ private Configuration delete( ComponentObjectID targetID, Configuration configuration ) throws ConfigurationException {
+ //System.out.println("<!><!><!><!>deleting " + target + ", delete dependencies: " + deleteDependencies);
+ BasicConfiguration basicConfig = (BasicConfiguration) configuration;
+ basicConfig.removeComponentObject( targetID);
+
+ return basicConfig;
+ }
+
+ /**
+ * The command to signify setting of an attribute.
+ */
+ public static final int SET = 0;
+
+ /**
+ * The command to signify addition of an attribute.
+ */
+ public static final int ADD = 1;
+
+ /**
+ * The command to signify removal of an attribute.
+ */
+ public static final int REMOVE = 2;
+ private ComponentObject modifyProperties( ComponentObject t, Properties props, int command ) {
+ Assertion.isNotNull(t);
+
+ if (props == null) {
+ return t;
+ }
+
+
+ BasicComponentObject target = (BasicComponentObject) t;
+ Properties newProps = null;
+
+ switch ( command ) {
+ case ADD:
+ newProps = new Properties();
+ newProps.putAll( target.getEditableProperties() );
+ newProps.putAll( props );
+
+ target.addProperties(newProps);
+
+ break;
+ case REMOVE:
+ newProps = new Properties();
+ newProps.putAll( target.getEditableProperties() );
+ Iterator iter = props.keySet().iterator();
+ while ( iter.hasNext() ) {
+ newProps.remove( iter.next() );
+ }
+
+ target.setProperties(newProps);
+ break;
+ case SET:
+ target.setProperties(props);
+ break;
+ }
+
+ return target;
+
+
+ }
+
+ private void setRoutingUUID(ServiceComponentDefn serviceComponentDefn, String newRoutingUUID){
+ Assertion.isNotNull(serviceComponentDefn);
+
+ BasicServiceComponentDefn basicService = (BasicServiceComponentDefn) serviceComponentDefn;
+ basicService.setRoutingUUID(newRoutingUUID);
+
+ }
+
}
Modified: branches/remove_psc/server/src/test/java/com/metamatrix/admin/server/FakeConfiguration.java
===================================================================
--- branches/remove_psc/server/src/test/java/com/metamatrix/admin/server/FakeConfiguration.java 2009-04-13 16:46:55 UTC (rev 764)
+++ branches/remove_psc/server/src/test/java/com/metamatrix/admin/server/FakeConfiguration.java 2009-04-13 16:47:42 UTC (rev 765)
@@ -49,11 +49,11 @@
import com.metamatrix.common.config.api.ServiceComponentDefnID;
import com.metamatrix.common.config.api.VMComponentDefn;
import com.metamatrix.common.config.api.VMComponentDefnID;
+import com.metamatrix.common.config.model.BasicComponentObject;
import com.metamatrix.common.config.model.BasicConfigurationObjectEditor;
import com.metamatrix.common.config.model.BasicConnectorBinding;
import com.metamatrix.common.config.model.BasicDeployedComponent;
import com.metamatrix.common.config.model.BasicVMComponentDefn;
-import com.metamatrix.common.config.model.ConfigurationObjectEditorHelper;
import com.metamatrix.common.config.model.ConfigurationVisitor;
import com.metamatrix.common.log.LogConfiguration;
import com.metamatrix.common.namedobject.BaseID;
@@ -345,9 +345,11 @@
BasicConnectorBinding connectorBinding = new BasicConnectorBinding(Configuration.NEXT_STARTUP_ID, connectorBindingID,
ConnectorBindingType.CONNECTOR_TYPE_ID);
connectorBinding.setRoutingUUID(name+"uuid"); //$NON-NLS-1$
-
- ConfigurationObjectEditorHelper.addProperty(connectorBinding, "prop1", "value1"); //$NON-NLS-1$ //$NON-NLS-2$
- ConfigurationObjectEditorHelper.addProperty(connectorBinding, "prop2", "value2"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ BasicComponentObject target = (BasicComponentObject) connectorBinding;
+
+ target.addProperty("prop1", "value1");
+ target.addProperty("prop2", "value2");
return connectorBinding;
Modified: branches/remove_psc/server/src/test/java/com/metamatrix/admin/server/FakeConfigurationService.java
===================================================================
--- branches/remove_psc/server/src/test/java/com/metamatrix/admin/server/FakeConfigurationService.java 2009-04-13 16:46:55 UTC (rev 764)
+++ branches/remove_psc/server/src/test/java/com/metamatrix/admin/server/FakeConfigurationService.java 2009-04-13 16:47:42 UTC (rev 765)
@@ -61,12 +61,12 @@
import com.metamatrix.common.config.api.VMComponentDefnID;
import com.metamatrix.common.config.api.exceptions.ConfigurationException;
import com.metamatrix.common.config.api.exceptions.InvalidConfigurationException;
+import com.metamatrix.common.config.model.BasicComponentObject;
import com.metamatrix.common.config.model.BasicConfigurationObjectEditor;
import com.metamatrix.common.config.model.BasicConnectorBindingType;
import com.metamatrix.common.config.model.BasicHost;
import com.metamatrix.common.config.model.BasicSharedResource;
import com.metamatrix.common.config.model.ConfigurationModelContainerImpl;
-import com.metamatrix.common.config.model.ConfigurationObjectEditorHelper;
import com.metamatrix.common.config.xml.XMLConfigurationImportExportUtility;
import com.metamatrix.common.queue.WorkerPoolStats;
import com.metamatrix.common.util.PropertiesUtils;
@@ -398,9 +398,12 @@
SharedResourceID resourceID1 = new SharedResourceID("resource1"); //$NON-NLS-1$
SharedResource resource1 = new BasicSharedResource(resourceID1, SharedResource.MISC_COMPONENT_TYPE_ID);
- ConfigurationObjectEditorHelper.addProperty(resource1, "prop1", "value1"); //$NON-NLS-1$ //$NON-NLS-2$
- ConfigurationObjectEditorHelper.addProperty(resource1, Resource.RESOURCE_POOL, "pool"); //$NON-NLS-1$
+ BasicComponentObject target = (BasicComponentObject) resource1;
+
+ target.addProperty("prop1", "value1");
+ target.addProperty(Resource.RESOURCE_POOL, "pool");
+
results.add(resource1);
15 years, 8 months
teiid SVN: r764 - branches/remove_psc/common-internal/src/main/java/com/metamatrix/common/config/model.
by teiid-commits@lists.jboss.org
Author: vhalbert(a)redhat.com
Date: 2009-04-13 12:46:55 -0400 (Mon, 13 Apr 2009)
New Revision: 764
Removed:
branches/remove_psc/common-internal/src/main/java/com/metamatrix/common/config/model/ConfigurationObjectEditorHelper.java
Modified:
branches/remove_psc/common-internal/src/main/java/com/metamatrix/common/config/model/BasicComponentObject.java
branches/remove_psc/common-internal/src/main/java/com/metamatrix/common/config/model/BasicConfigurationObjectEditor.java
branches/remove_psc/common-internal/src/main/java/com/metamatrix/common/config/model/BasicUtil.java
branches/remove_psc/common-internal/src/main/java/com/metamatrix/common/config/model/ConfigurationModelContainerImpl.java
Log:
Teiid 323 - refactured, removing unused Config API classes: ProductType, ProductTypeID and ConfigurationLock
Modified: branches/remove_psc/common-internal/src/main/java/com/metamatrix/common/config/model/BasicComponentObject.java
===================================================================
--- branches/remove_psc/common-internal/src/main/java/com/metamatrix/common/config/model/BasicComponentObject.java 2009-04-13 13:25:55 UTC (rev 763)
+++ branches/remove_psc/common-internal/src/main/java/com/metamatrix/common/config/model/BasicComponentObject.java 2009-04-13 16:46:55 UTC (rev 764)
@@ -102,7 +102,7 @@
* @param properties the set of properties for this service; a reference to
* this Properties instance should <i>not</i> be maintained by the caller
*/
- void setProperties(Properties properties){
+ public void setProperties(Properties properties){
Properties p = null;
if (properties != null) {
@@ -123,25 +123,25 @@
/**
* Add a name/value pair as a new property setting for the current <code>Configuration</code>.
*/
- void addProperty(String name, String value) {
+ public void addProperty(String name, String value) {
properties.put(name, value);
}
/**
* Add a the newProperties to the current properties settings.
*/
- void addProperties(Properties newProperties) {
+ public void addProperties(Properties newProperties) {
properties.putAll(newProperties);
}
/**
* Remove a property setting based on the name
*/
- void removeProperty(String name) {
+ public void removeProperty(String name) {
properties.remove(name);
}
/**
* Remove the <code>Collection</code> of propertyNames from tthe current properties settings.
*/
- void removeProperties(Collection propertyNames) {
+ public void removeProperties(Collection propertyNames) {
for (Iterator it = propertyNames.iterator(); it.hasNext(); ) {
removeProperty( (String) it.next() );
}
@@ -228,7 +228,7 @@
/**
* Helper method to enable building the property hierarchy for deployed Components
*/
- Properties getEditableProperties() {
+ public Properties getEditableProperties() {
return this.properties;
}
Modified: branches/remove_psc/common-internal/src/main/java/com/metamatrix/common/config/model/BasicConfigurationObjectEditor.java
===================================================================
--- branches/remove_psc/common-internal/src/main/java/com/metamatrix/common/config/model/BasicConfigurationObjectEditor.java 2009-04-13 13:25:55 UTC (rev 763)
+++ branches/remove_psc/common-internal/src/main/java/com/metamatrix/common/config/model/BasicConfigurationObjectEditor.java 2009-04-13 16:46:55 UTC (rev 764)
@@ -2208,19 +2208,19 @@
}
public ComponentType setLastChangedHistory(ComponentType type, String lastChangedBy, String lastChangedDate) {
- return ConfigurationObjectEditorHelper.setLastChangedHistory(type, lastChangedBy, lastChangedDate);
+ return BasicUtil.setLastChangedHistory(type, lastChangedBy, lastChangedDate);
}
public ComponentType setCreationChangedHistory(ComponentType type, String createdBy, String creationDate) {
- return ConfigurationObjectEditorHelper.setCreationChangedHistory(type, createdBy, creationDate);
+ return BasicUtil.setCreationChangedHistory(type, createdBy, creationDate);
}
public ComponentObject setLastChangedHistory(ComponentObject defn, String lastChangedBy, String lastChangedDate) {
- return ConfigurationObjectEditorHelper.setLastChangedHistory(defn, lastChangedBy, lastChangedDate);
+ return BasicUtil.setLastChangedHistory(defn, lastChangedBy, lastChangedDate);
}
public ComponentObject setCreationChangedHistory(ComponentObject defn, String createdBy, String creationDate) {
- return ConfigurationObjectEditorHelper.setCreationChangedHistory(defn, createdBy, creationDate);
+ return BasicUtil.setCreationChangedHistory(defn, createdBy, creationDate);
}
@@ -2316,39 +2316,18 @@
// this should never happen except in development, no need to translate
throw new UnsupportedOperationException("Cannot call method delete(ComponentObject, Configuration) to delete a configuration, call delete(Configuration)."); //$NON-NLS-1$
}
+
+ BasicConfiguration basicConfig = (BasicConfiguration) verifyTargetClass(configuration,BasicConfiguration.class);
- Configuration config = ConfigurationObjectEditorHelper.delete((ComponentObjectID) target.getID(), configuration);
+ basicConfig.removeComponentObject( (ComponentObjectID) target.getID());
this.createDestroyAction(target.getID(), target);
- return config;
+ return basicConfig;
}
+
/**
- * Change the name of a previously defined PSC in the Next Startup config.
- * @param psc The psc whose name to change.
- * @param name The new name.
- * @return The PSC with its name changed.
- */
-// public ProductServiceConfig renamePSC(ProductServiceConfig psc, String name) throws ConfigurationException {
-// if ( psc == null ) {
-// throw new IllegalArgumentException(CommonPlugin.Util.getString(ErrorMessageKeys.CONFIG_ERR_0089, ProductServiceConfig.class.getName()));
-// }
-// BasicProductServiceConfig target = (BasicProductServiceConfig) verifyTargetClass(psc,BasicProductServiceConfig.class);
-// ConfigurationID configID = target.getConfigurationID();
-//
-//// ProductServiceConfigID newID = new ProductServiceConfigID(configID, name);
-//// ComponentTypeID typeID = target.getComponentTypeID();
-// target = (BasicProductServiceConfig) BasicUtil.createComponentDefn(ComponentDefn.PSC_COMPONENT_CODE, configID, psc.getComponentTypeID(), name) ;
-//
-// createExchangeAction( target.getID(), ConfigurationModel.Attribute.NAME,
-// target.getName(), name );
-//
-//// new BasicProductServiceConfig(configID, newID, psc.getProductTypeID());
-// return target;
-// }
-
- /**
* Change the name of a previously defined VM in the Next Startup config.
* @param vm The VM whose name to change.
* @param name The new name.
@@ -2384,19 +2363,6 @@
return false;
}
- // since a component name must be unique within a configuration then
- // this simple method can validate an existance of a service defn.
-// public boolean doesComponentDefnExist(String name, Configuration config) {
-// Iterator iterator = config.getComponentDefns().values().iterator();
-// while (iterator.hasNext()) {
-// ComponentDefn comp = (ComponentDefn)iterator.next();
-// if (name.equalsIgnoreCase(comp.getName())) {
-// return true;
-// }
-// }
-// return false;
-// }
-
/**
* Sets the system next startup configuration
* @deprecated as of v 2.0 beta 1, use {@link #setNextStartupConfiguration}
@@ -2408,24 +2374,6 @@
/**
* Sets the system next startup configuration
*/
-/*
- public void setOperationalConfiguration(ConfigurationID configurationID) throws ConfigurationException {
- this.createExchangeAction(configurationID, ConfigurationModel.Attribute.CURRENT_CONFIGURATION, configurationID, configurationID);
- }
-*/
- /**
- * Sets the system startup configuration (This method will not be declared
- * in the public interface {@link ConfigurationObjectEditor}, since
- * the startup configuration should not be modifiable. But, this method
- * is needed by the JDBC service provider.)
- */
-// public void setStartupConfiguration(ConfigurationID configurationID) throws ConfigurationException {
-// this.createExchangeAction(configurationID, ConfigurationModel.Attribute.STARTUP_CONFIGURATION, configurationID, configurationID);
-// }
-
- /**
- * Sets the system next startup configuration
- */
public void setNextStartupConfiguration(ConfigurationID configurationID) throws ConfigurationException {
this.createExchangeAction(configurationID, ConfigurationModel.Attribute.NEXT_STARTUP_CONFIGURATION, configurationID, configurationID);
}
@@ -2488,14 +2436,6 @@
return target;
}
-// public Configuration addConfigurationComponentDefn(Configuration t, ComponentDefn defn ) {
-//
-// BasicConfiguration target = (BasicConfiguration) verifyTargetClass(t,BasicConfiguration.class);
-// target.addComponentDefn(defn);
-//
-// return target;
-// }
-
public Configuration setConfigurationDeployedComponents(Configuration t, Collection deployedComponents) {
BasicConfiguration target = (BasicConfiguration) verifyTargetClass(t,BasicConfiguration.class);
@@ -2512,13 +2452,6 @@
return target;
}
-// public Configuration addConfigurationDeployedComponent(Configuration t, DeployedComponent deployedComponent) {
-//
-// BasicConfiguration target = (BasicConfiguration) verifyTargetClass(t,BasicConfiguration.class);
-//
-// target.addDeployedComponent(deployedComponent);
-// return target;
-// }
public Configuration setConfigurationHostComponents(Configuration t, Collection hostComponents) {
@@ -2536,14 +2469,7 @@
return target;
}
-// public Configuration addConfigurationHostComponent(Configuration t, Host host) {
-//
-// BasicConfiguration target = (BasicConfiguration) verifyTargetClass(t,BasicConfiguration.class);
-// target.addHost(host);
-// return target;
-// }
-
public Properties getEditableProperties(ComponentObject t) {
BasicComponentObject bco = (BasicComponentObject) verifyTargetClass(t,BasicComponentObject.class);
return bco.getEditableProperties();
@@ -2592,34 +2518,6 @@
return newDefn;
}
-// public ConnectorBinding createConnectorComponent(Configuration configuration, ComponentTypeID typeID, String componentName, ProductServiceConfigID pscID) {
-// if ( configuration == null ) {
-// throw new IllegalArgumentException(CommonPlugin.Util.getString(ErrorMessageKeys.CONFIG_ERR_0089, Configuration.class.getName()));
-// }
-// if ( pscID == null ) {
-// throw new IllegalArgumentException(CommonPlugin.Util.getString(ErrorMessageKeys.CONFIG_ERR_0089, ProductServiceConfigID.class.getName()));
-// }
-// ProductServiceConfig psc = (ProductServiceConfig)configuration.getComponentDefn(pscID);
-// if (psc == null ) {
-// throw new IllegalArgumentException(CommonPlugin.Util.getString(ErrorMessageKeys.CONFIG_ERR_0089, ProductServiceConfig.class.getName()));
-// }
-//
-// BasicConnectorBinding newServiceDefn = (BasicConnectorBinding)
-// createConnectorComponent((ConfigurationID) configuration.getID(), typeID, componentName, null);
-//
-// // add the service to the psc so that this relationship is found in the deployServiceDefn method
-// addServiceComponentDefn(psc, (ServiceComponentDefnID) newServiceDefn.getID());
-//
-// BasicConfiguration bc = (BasicConfiguration) verifyTargetClass(configuration,BasicConfiguration.class);
-// bc.addComponentDefn(newServiceDefn);
-//
-// //automatically deploy the service anywhere that the PSC is already deployed
-// this.deployServiceDefn(bc,newServiceDefn,pscID);
-//
-// return newServiceDefn;
-// }
-
-
public ConnectorBinding createConnectorComponent(ConfigurationID configurationID, ConnectorBinding original, String newName, String routingUUID) {
if (original == null ) {
@@ -2800,59 +2698,6 @@
}
-// HashSet deployedIDs = new HashSet();
-// for ( Iterator iter = targetConfig.getDeployedServiceForVM(serviceDefnID, vm).iterator(); iter.hasNext(); ){
-// aDeployedComponent = (DeployedComponent)iter.next();
-// VMComponentDefnID aVMID = aDeployedComponent.getVMComponentDefnID();
-// if (aVMID != null && aVMID.equals(vmID)){
-// hostID = aDeployedComponent.getHostID();
-// // vmID = aDeployedComponent.getVMComponentDefnID();
-//
-//
-// DeployedComponentID id = new DeployedComponentID(serviceDefnID.getName(), configID, hostID, vmID, serviceDefnID);
-// if (!deployedIDs.contains(id)){
-// deployedIDs.add(id);
-//
-// DeployedComponent deployComponent = this.createDeployedServiceComponent(serviceDefnID.getName(), configuration, hostID, vmID, basicService, aPscID);
-//// BasicDeployedComponent deployComponent = new BasicDeployedComponent(id,
-//// configID,
-//// hostID,
-//// vmID,
-//// serviceDefnID,
-//// pscID,
-//// basicService.getComponentTypeID());
-////
-//// createCreationAction(id, deployComponent );
-//
-//// try {
-//// DeployedComponent newService = (DeployedComponent) deployComponent.clone();
-//// targetConfig.addDeployedComponent(newService);
-// if (result == null){
-// result = new ArrayList();
-// }
-// result.add(deployComponent);
-//
-//
-// if (psc.getServiceComponentDefnIDs() == null) {
-// addServiceComponentDefn(psc, serviceDefnID);
-//
-// } else {
-// if (!psc.getServiceComponentDefnIDs().contains(serviceDefnID)) {
-// addServiceComponentDefn(psc, serviceDefnID);
-// }
-// }
-//
-//// } catch (CloneNotSupportedException e) {
-//// throw new RuntimeException(CommonPlugin.Util.getString(ErrorMessageKeys.CONFIG_ERR_0078,
-//// new Object[] {DeployedComponent.class.getName(), e.getMessage()}));
-//// }
-// }
-// }
-// }
- //this will overwrite the service if it already is in the Configuration
- // targetConfig.addComponentDefn(basicService);
-
-
return deployComponent;
}
Modified: branches/remove_psc/common-internal/src/main/java/com/metamatrix/common/config/model/BasicUtil.java
===================================================================
--- branches/remove_psc/common-internal/src/main/java/com/metamatrix/common/config/model/BasicUtil.java 2009-04-13 13:25:55 UTC (rev 763)
+++ branches/remove_psc/common-internal/src/main/java/com/metamatrix/common/config/model/BasicUtil.java 2009-04-13 16:46:55 UTC (rev 764)
@@ -58,7 +58,7 @@
*/
public class BasicUtil {
- private static ConfigurationObjectEditor editor = new BasicConfigurationObjectEditor();
+ private static BasicConfigurationObjectEditor editor = new BasicConfigurationObjectEditor();
/**
@@ -354,6 +354,62 @@
}
return false;
}
+
+
+// ----------------------------------------------------------------------------------
+// M O D I F I C A T I O N M E T H O D S
+// ----------------------------------------------------------------------------------
+
+public static ComponentType setLastChangedHistory(ComponentType type, String lastChangedBy, String lastChangedDate) {
+ Assertion.isNotNull(type);
+
+ BasicComponentType target = (BasicComponentType) type;
+
+ target.setLastChangedBy(lastChangedBy);
+ target.setLastChangedDate(lastChangedDate);
+
+ return target;
+
+}
+public static ComponentType setCreationChangedHistory(ComponentType type, String createdBy, String creationDate) {
+ Assertion.isNotNull(type);
+
+ BasicComponentType target = (BasicComponentType) type;
+
+ target.setCreatedBy(createdBy);
+ target.setCreatedDate(creationDate);
+
+ return target;
+}
+
+
+public static ComponentObject setLastChangedHistory(ComponentObject defn, String lastChangedBy, String lastChangedDate) {
+ Assertion.isNotNull(defn);
+
+ BasicComponentObject target = (BasicComponentObject) defn;
+
+ target.setLastChangedBy(lastChangedBy);
+
+ target.setLastChangedDate(lastChangedDate);
+
+ return target;
+
+}
+//public static boolean set = false;
+public static ComponentObject setCreationChangedHistory(ComponentObject defn, String createdBy, String creationDate) {
+ Assertion.isNotNull(defn);
+
+ BasicComponentObject target = (BasicComponentObject) defn;
+
+ target.setCreatedBy(createdBy);
+ target.setCreatedDate(creationDate);
+
+
+ return target;
+
+}
+
+
}
Modified: branches/remove_psc/common-internal/src/main/java/com/metamatrix/common/config/model/ConfigurationModelContainerImpl.java
===================================================================
--- branches/remove_psc/common-internal/src/main/java/com/metamatrix/common/config/model/ConfigurationModelContainerImpl.java 2009-04-13 13:25:55 UTC (rev 763)
+++ branches/remove_psc/common-internal/src/main/java/com/metamatrix/common/config/model/ConfigurationModelContainerImpl.java 2009-04-13 16:46:55 UTC (rev 764)
@@ -33,6 +33,7 @@
import com.metamatrix.common.CommonPlugin;
import com.metamatrix.common.config.api.AuthenticationProvider;
+import com.metamatrix.common.config.api.ComponentObjectID;
import com.metamatrix.common.config.api.ComponentType;
import com.metamatrix.common.config.api.ComponentTypeDefn;
import com.metamatrix.common.config.api.ComponentTypeID;
@@ -59,8 +60,6 @@
private BasicConfiguration configuration=null;
- private transient ConfigurationObjectEditorHelper editor = null;
-
private Map compTypes = Collections.synchronizedMap(new HashMap(45));
private Map resources = Collections.synchronizedMap(new HashMap(25));
@@ -85,13 +84,6 @@
this.configuration = (BasicConfiguration) config;
}
- protected ConfigurationObjectEditorHelper getEditor() {
- if (editor == null) {
- editor = new ConfigurationObjectEditorHelper();
- }
- return editor;
- }
-
public Configuration getConfiguration() {
return this.configuration;
}
@@ -463,9 +455,8 @@
if (configuration == null) {
throw new ConfigurationException(ErrorMessageKeys.CONFIG_0001, CommonPlugin.Util.getString(ErrorMessageKeys.CONFIG_0001));
}
+ configuration.addComponentDefn(scd);
- ConfigurationObjectEditorHelper.addConfigurationComponentDefn(configuration, scd);
-
} else if(obj instanceof DeployedComponent) {
DeployedComponent deployedComp = (DeployedComponent) obj;
@@ -473,7 +464,7 @@
throw new ConfigurationException(ErrorMessageKeys.CONFIG_0001, CommonPlugin.Util.getString(ErrorMessageKeys.CONFIG_0001));
}
- ConfigurationObjectEditorHelper.addConfigurationDeployedComponent(configuration, deployedComp);
+ configuration.addDeployedComponent(deployedComp);
} else if (obj instanceof VMComponentDefn) {
VMComponentDefn vm = (VMComponentDefn) obj;
@@ -482,7 +473,7 @@
throw new ConfigurationException(ErrorMessageKeys.CONFIG_0001, CommonPlugin.Util.getString(ErrorMessageKeys.CONFIG_0001));
}
- ConfigurationObjectEditorHelper.addConfigurationComponentDefn(configuration, vm);
+ configuration.addComponentDefn(vm);
} else if (obj instanceof Host) {
Host host = (Host) obj;
@@ -490,7 +481,7 @@
throw new ConfigurationException(ErrorMessageKeys.CONFIG_0001, CommonPlugin.Util.getString(ErrorMessageKeys.CONFIG_0001));
}
- ConfigurationObjectEditorHelper.addConfigurationHostComponent(configuration, host);
+ configuration.addHost(host);
// } else if (obj instanceof ProductServiceConfig) {
// ProductServiceConfig psc = (ProductServiceConfig) obj;
@@ -512,9 +503,9 @@
AuthenticationProvider rd = (AuthenticationProvider) obj;
- ConfigurationObjectEditorHelper.addConfigurationComponentDefn(configuration, rd);
+ configuration.addComponentDefn(rd);
+
-
} else if (obj instanceof ResourceDescriptor) {
ResourceDescriptor rd = (ResourceDescriptor) obj;
@@ -523,7 +514,7 @@
throw new ConfigurationException(ErrorMessageKeys.CONFIG_0001, CommonPlugin.Util.getString(ErrorMessageKeys.CONFIG_0001));
}
- ConfigurationObjectEditorHelper.addConfigurationComponentDefn(configuration, rd);
+ configuration.addComponentDefn(rd);
} else if (obj instanceof Configuration) {
@@ -533,10 +524,7 @@
throw new ConfigurationException(ErrorMessageKeys.CONFIG_0002, CommonPlugin.Util.getString(ErrorMessageKeys.CONFIG_0002));
}
-// } else if (obj instanceof ProductType) {
-// addProductType((ProductType) obj);
-
} else if (obj instanceof ComponentType) {
addComponentType((ComponentType) obj);
@@ -665,7 +653,7 @@
throw new ConfigurationException(ErrorMessageKeys.CONFIG_0001, CommonPlugin.Util.getString(ErrorMessageKeys.CONFIG_0001));
}
- ConfigurationObjectEditorHelper.delete(defnID, configuration);
+ delete(defnID, configuration);
}
private void remove(VMComponentDefnID defnID) throws ConfigurationException {
@@ -674,7 +662,7 @@
throw new ConfigurationException(ErrorMessageKeys.CONFIG_0001, CommonPlugin.Util.getString(ErrorMessageKeys.CONFIG_0001));
}
- ConfigurationObjectEditorHelper.delete(defnID, configuration);
+ delete(defnID, configuration);
}
private void remove(DeployedComponentID dcID) throws ConfigurationException {
@@ -683,7 +671,7 @@
throw new ConfigurationException(ErrorMessageKeys.CONFIG_0001, CommonPlugin.Util.getString(ErrorMessageKeys.CONFIG_0001));
}
- ConfigurationObjectEditorHelper.delete(dcID, configuration);
+ delete(dcID, configuration);
}
private void remove(HostID hostID) throws ConfigurationException {
@@ -692,25 +680,16 @@
throw new ConfigurationException(ErrorMessageKeys.CONFIG_0001, CommonPlugin.Util.getString(ErrorMessageKeys.CONFIG_0001));
}
- ConfigurationObjectEditorHelper.delete(hostID, configuration);
+ delete(hostID, configuration);
}
-// private void remove(ProductServiceConfigID pscID) throws ConfigurationException {
-//
-// if (configuration == null) {
-// throw new ConfigurationException(ErrorMessageKeys.CONFIG_0001, CommonPlugin.Util.getString(ErrorMessageKeys.CONFIG_0001));
-// }
-//
-// ConfigurationObjectEditorHelper.delete(pscID, configuration);
-// }
-
private void remove(ResourceDescriptorID rdID) throws ConfigurationException {
if (configuration == null) {
throw new ConfigurationException(ErrorMessageKeys.CONFIG_0001, CommonPlugin.Util.getString(ErrorMessageKeys.CONFIG_0001));
}
- ConfigurationObjectEditorHelper.delete(rdID, configuration);
+ delete(rdID, configuration);
}
@@ -725,5 +704,15 @@
return newConfig;
}
+
+ private Configuration delete( ComponentObjectID targetID, Configuration configuration ) throws ConfigurationException {
+ //System.out.println("<!><!><!><!>deleting " + target + ", delete dependencies: " + deleteDependencies);
+ BasicConfiguration basicConfig = (BasicConfiguration) configuration;
+ basicConfig.removeComponentObject( targetID);
+
+ return basicConfig;
+ }
+
+
}
Deleted: branches/remove_psc/common-internal/src/main/java/com/metamatrix/common/config/model/ConfigurationObjectEditorHelper.java
===================================================================
--- branches/remove_psc/common-internal/src/main/java/com/metamatrix/common/config/model/ConfigurationObjectEditorHelper.java 2009-04-13 13:25:55 UTC (rev 763)
+++ branches/remove_psc/common-internal/src/main/java/com/metamatrix/common/config/model/ConfigurationObjectEditorHelper.java 2009-04-13 16:46:55 UTC (rev 764)
@@ -1,584 +0,0 @@
-/*
- * 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 com.metamatrix.common.config.model;
-
-import java.util.*;
-
-import com.metamatrix.common.CommonPlugin;
-import com.metamatrix.common.config.api.*;
-import com.metamatrix.common.config.api.exceptions.ConfigurationException;
-import com.metamatrix.common.util.ErrorMessageKeys;
-import com.metamatrix.core.util.ArgCheck;
-import com.metamatrix.core.util.Assertion;
-
-
-/**
- * The ConfigurationObjectEditorHelper provides methods that do not deal with actions.
- *
- * This is new for the implementation of using configuration models
- */
-
-public class ConfigurationObjectEditorHelper {
-
- /**
- * The command to signify setting of an attribute.
- */
- public static final int SET = 0;
-
- /**
- * The command to signify addition of an attribute.
- */
- public static final int ADD = 1;
-
- /**
- * The command to signify removal of an attribute.
- */
- public static final int REMOVE = 2;
-
- // ----------------------------------------------------------------------------------
- // C R E A T E M E T H O D S
- // ----------------------------------------------------------------------------------
- public static Host createHost(Configuration config, String hostName ) throws ConfigurationException {
- ArgCheck.isNotNull(hostName);
- ArgCheck.isNotNull(config);
-
- BasicHost bh = (BasicHost) BasicUtil.createComponentDefn(ComponentDefn.HOST_COMPONENT_CODE, (ConfigurationID) config.getID(), Host.HOST_COMPONENT_TYPE_ID, hostName);
-// HostID id = new HostID(hostName);
-// ComponentTypeID ctID = new ComponentTypeID(Host.COMPONENT_TYPE_NAME);
-
-// BasicHost bh = new BasicHost((ConfigurationID) config.getID(), id, Host.HOST_COMPONENT_TYPE_ID);
-
-
- BasicConfiguration bc = (BasicConfiguration) verifyTargetClass(config,BasicConfiguration.class);
- bc.addHost(bh);
-
-
- return bh;
-
- }
-
-
- // ----------------------------------------------------------------------------------
- // M O D I F I C A T I O N M E T H O D S
- // ----------------------------------------------------------------------------------
-
- public static ComponentType setLastChangedHistory(ComponentType type, String lastChangedBy, String lastChangedDate) {
- Assertion.isNotNull(type);
-
- BasicComponentType target = (BasicComponentType) verifyTargetClass(type,BasicComponentType.class);
-
- target.setLastChangedBy(lastChangedBy);
- target.setLastChangedDate(lastChangedDate);
-
- return target;
-
- }
- public static ComponentType setCreationChangedHistory(ComponentType type, String createdBy, String creationDate) {
- Assertion.isNotNull(type);
-
- BasicComponentType target = (BasicComponentType) verifyTargetClass(type,BasicComponentType.class);
-
- target.setCreatedBy(createdBy);
- target.setCreatedDate(creationDate);
-
- return target;
- }
-
-
- public static ComponentObject setLastChangedHistory(ComponentObject defn, String lastChangedBy, String lastChangedDate) {
- Assertion.isNotNull(defn);
-
- BasicComponentObject target = (BasicComponentObject) verifyTargetClass(defn,BasicComponentObject.class);
-
- target.setLastChangedBy(lastChangedBy);
-
- target.setLastChangedDate(lastChangedDate);
-
- return target;
-
- }
- public static boolean set = false;
- public static ComponentObject setCreationChangedHistory(ComponentObject defn, String createdBy, String creationDate) {
- Assertion.isNotNull(defn);
-
- BasicComponentObject target = (BasicComponentObject) verifyTargetClass(defn,BasicComponentObject.class);
-
- target.setCreatedBy(createdBy);
- target.setCreatedDate(creationDate);
-
-
- return target;
-
- }
-
-
-
- /**
- * Sets this ServiceComponentDefn's String routing UUID. This method
- * will modify the ServiceComponentDefn parameter, and also create the
- * action to set the routing UUID at the remote server.
- * @param serviceComponentDefn ServiceComponentDefn to have it's routing
- * UUID modified - this instance will be locally modified, and an action
- * will also be created for execution as a transaction later on
- * @param newRoutingUUID new String routing UUID for the indicated
- * ServiceComponentDefn
- */
- public static void setRoutingUUID(ServiceComponentDefn serviceComponentDefn, String newRoutingUUID){
- Assertion.isNotNull(serviceComponentDefn);
-
- BasicServiceComponentDefn basicService = (BasicServiceComponentDefn) verifyTargetClass(serviceComponentDefn,BasicServiceComponentDefn.class);
- basicService.setRoutingUUID(newRoutingUUID);
-
- }
-
-
-
- /**
- * This is a lighterweight version of the other
- * {@link #setEnabled(Configuration, ServiceComponentDefn, boolean, boolean) setEnabled}
- * method. It simply modifies the ServiceComponentDefn parameter and
- * creates the necessary change object. It cannot update the
- * Configuration of the ServiceComponentDefn, nor can it automatically
- * delete any DeployedComponents of the ServiceComponentDefn parameter,
- * if the ServiceComponentDefn is being disabled. This method is only
- * needed by the JDBC spi and maybe the import/export tool.
- */
-
-// public static void setEnabled(ServiceComponentDefnID serviceComponentDefnID, ProductServiceConfig psc, boolean enabled) {
-// Assertion.isNotNull(serviceComponentDefnID);
-// Assertion.isNotNull(psc);
-//
-//
-// if (!psc.containsService(serviceComponentDefnID)) {
-// return;
-// }
-//
-// boolean oldEnabled = psc.isServiceEnabled(serviceComponentDefnID);
-// //if a change is not being made to the enabled value, this whole method
-// //will be essentially bypassed
-// if (enabled != oldEnabled){
-// BasicProductServiceConfig basicPSC = (BasicProductServiceConfig) verifyTargetClass(psc,BasicProductServiceConfig.class);
-// basicPSC.setServiceEnabled(serviceComponentDefnID, enabled);
-//
-// } //end if enabled!= oldEnabled
-// }
-
- public static Configuration addHostComponent(Configuration t, Host host) {
- if (host == null) {
- return t;
- }
-
- BasicConfiguration target = (BasicConfiguration) verifyTargetClass(t,BasicConfiguration.class);
-
- target.addHost(host);
-
- return target;
- }
-
-
-
- /**
- * Adds an existing ServiceComponentDefn to indicated PSC.
- * The ServiceComponentDefn will be removed from
- * any PSC it previously belonged to.
-
- * @param psc ProductServiceConfig to have service comp defn added to
- * @param serviceComponentDefnID will be added to the indicated
- * ProductServiceConfiguration (and removed from any PSC it previously
- * belonged to).
- */
-// public static ProductServiceConfig addServiceComponentDefn(ProductServiceConfig psc, ServiceComponentDefnID serviceComponentDefnID){
-// Assertion.isNotNull(psc);
-// Assertion.isNotNull(serviceComponentDefnID);
-//
-// BasicProductServiceConfig basicPSC = (BasicProductServiceConfig) verifyTargetClass(psc,BasicProductServiceConfig.class);
-// basicPSC.addServiceComponentDefnID(serviceComponentDefnID);
-//
-// return basicPSC;
-// }
-
-
- public static Configuration addComponentDefn( Configuration t, ComponentDefn defn) {
- BasicConfiguration target = (BasicConfiguration) verifyTargetClass(t,BasicConfiguration.class);
- target.addComponentDefn(defn);
- return target;
- }
-
-
- public static Configuration addDeployedComponent( Configuration t, DeployedComponent deployComponent) {
- BasicConfiguration target = (BasicConfiguration) verifyTargetClass(t,BasicConfiguration.class);
- target.addDeployedComponent(deployComponent);
- return target;
- }
-
-
- public static ComponentObject addProperty( ComponentObject t, String name, String value ) {
- Assertion.isNotNull(t);
- Assertion.isNotNull(name);
- Assertion.isNotNull(value);
-
-
- BasicComponentObject target = (BasicComponentObject) verifyTargetClass(t,BasicComponentObject.class);
-
- target.addProperty(name, value);
-
- return target;
- }
-
- public static ComponentObject setProperty( ComponentObject t, String name, String value ) {
- Assertion.isNotNull(t);
- Assertion.isNotNull(name);
- Assertion.isNotNull(value);
-
- BasicComponentObject target = (BasicComponentObject) verifyTargetClass(t,BasicComponentObject.class);
-
- target.removeProperty(name);
-
- target.addProperty(name, value);
-
- return target;
- }
-
-// public static ProductServiceConfig resetServices(ProductServiceConfig psc) {
-// Assertion.isNotNull(psc);
-//
-// BasicProductServiceConfig basicPSC = (BasicProductServiceConfig) verifyTargetClass(psc,BasicProductServiceConfig.class);
-// basicPSC.resetServices();
-//
-// return basicPSC;
-// }
-
-
-
-
- public static ComponentObject removeProperty( ComponentObject t, String name) {
- Assertion.isNotNull(t);
- Assertion.isNotNull(name);
-
- BasicComponentObject target = (BasicComponentObject) verifyTargetClass(t,BasicComponentObject.class);
-
- target.removeProperty(name);
-
- return target;
-
- }
-
- public static ComponentObject modifyProperties( ComponentObject t, Properties props, int command ) {
- Assertion.isNotNull(t);
-
- if (props == null) {
- return t;
- }
-
-
- BasicComponentObject target = (BasicComponentObject) verifyTargetClass(t,BasicComponentObject.class);
- Properties newProps = null;
-
- switch ( command ) {
- case ADD:
- newProps = new Properties();
- newProps.putAll( target.getEditableProperties() );
- newProps.putAll( props );
-
- target.addProperties(newProps);
-
- break;
- case REMOVE:
- newProps = new Properties();
- newProps.putAll( target.getEditableProperties() );
- Iterator iter = props.keySet().iterator();
- while ( iter.hasNext() ) {
- newProps.remove( iter.next() );
- }
-
- target.setProperties(newProps);
- break;
- case SET:
- target.setProperties(props);
- break;
- }
-
- return target;
-
-
- }
-
-
-
- public static Configuration delete( ComponentObjectID targetID, Configuration configuration ) throws ConfigurationException {
- //System.out.println("<!><!><!><!>deleting " + target + ", delete dependencies: " + deleteDependencies);
-
- BasicConfiguration basicConfig = (BasicConfiguration) verifyTargetClass(configuration,BasicConfiguration.class);
-
-// if (targetID instanceof ProductServiceConfigID) {
-//
-// if (ProductServiceConfigID.ALL_STANDARD_PSC_NAMES.contains(targetID.getName())){
-// throw new IllegalArgumentException(CommonPlugin.Util.getString(ErrorMessageKeys.CONFIG_ERR_0070));
-// }
-//
-// basicConfig.removeComponentObject( targetID);
-// } else {
- basicConfig.removeComponentObject( targetID);
- // }
-
- return basicConfig;
- }
-
- /**
- * Adds the service type represented by the indicated ComponentType to
- * the list of legal service types of the indicated ProductType.
- * @param productType ProductType to have a new service type added to
- * @param serviceComponentType ComponentType to be added to the
- * ProductType
- */
-// public static ProductType addServiceComponentType(ProductType productType, ComponentType serviceComponentType){
-// BasicProductType basicProdType = (BasicProductType)productType;
-//
-// ComponentTypeID productTypeID = (ComponentTypeID)basicProdType.getID();
-// setParentComponentTypeID(serviceComponentType, productTypeID);
-// //add the service ComponentTypeID to the BasicProductType
-// basicProdType.addServiceTypeID((ComponentTypeID)serviceComponentType.getID());
-//
-// return basicProdType;
-// }
-
- protected static ComponentType setParentComponentTypeID(ComponentType t, ComponentTypeID parentID) {
-
- BasicComponentType target = (BasicComponentType) verifyTargetClass(t,BasicComponentType.class);
- ComponentTypeID oldValue = target.getParentComponentTypeID();
-
- if ( (parentID == null && oldValue != null) ||
- ( oldValue==null ||!oldValue.equals(parentID)) ) {
- target.setParentComponentTypeID(parentID);
- }
-
- return target;
-
- }
-
-
-
-
- /**
- * Removes the service type represented by the indicated ComponentType from
- * the list of legal service types of the indicated ProductType.
- * @param productType ProductType to have the service type taken from
- * @param serviceComponentType ComponentType to be taken from the
- * ProductType
- */
-// public static ProductType removeServiceComponentType(ProductType productType, ComponentType serviceComponentType){
-// BasicProductType basicProdType = (BasicProductType)productType;
-//
-// //add the service ComponentTypeID to the BasicProductType
-// basicProdType.removeServiceTypeID((ComponentTypeID)serviceComponentType.getID());
-//
-// return basicProdType;
-// }
-
-
-// public static void renameHostAndDeployedComponents(ConfigurationModelContainer cmc, String oldHostName, String newHostName, String newPortNumber) throws ConfigurationException {
-//
-// /**
-// * We must add the host controller port property to this Host to
-// * allow it to be contacted over this port by the metamatrix platform.
-// */
-// Host oldHost = cmc.getHost(oldHostName);
-// if (oldHost == null) {
-// throw new ConfigurationException(ErrorMessageKeys.CONFIG_ERR_0070, CommonPlugin.Util.getString(ErrorMessageKeys.CONFIG_ERR_0070, new Object[] {oldHostName, cmc.getConfiguration().getName()}));
-// }
-//
-//
-// /**
-// * Create a new host based on that URL
-// */
-//
-// Host host = createHost(cmc.getConfiguration(), newHostName);
-//
-// HostID hostID = (HostID) host.getID();
-// setProperty(host, HostPropertyNames.PORT_NUMBER, newPortNumber);
-//
-//
-//
-// Collection configObjects = cmc.getConfiguration().getDeployedComponents();
-//
-// Collection deployedObjects = new ArrayList();
-// Map vmObjects = new HashMap(5);
-// Iterator iterator = configObjects.iterator();
-// while (iterator.hasNext()) {
-// Object obj = iterator.next();
-// DeployedComponent origComponent = (DeployedComponent)obj;
-// HostID hID = origComponent.getHostID();
-// if (hID.getFullName().equalsIgnoreCase(oldHostName)) {
-//// VMComponentDefnID vmID = origComponent.getVMComponentDefnID();
-//// if (origComponent.isDeployedService()) {
-// deployedObjects.add(origComponent);
-//// } else if (!vmObjects.containsKey(vmID)) {
-//// VMComponentDefn vmDefn = cmc.getConfiguration().getVMComponentDefn(vmID);
-//// vmObjects.put(vmID, vmDefn);
-//// deployedObjects.add(origComponent);
-//// }
-// }
-// }
-//
-// delete((ComponentObjectID) oldHost.getID(), cmc.getConfiguration());
-//
-// Iterator iterator2 = cmc.getConfiguration().getVMComponentDefns().iterator();
-// //vmObjects.keySet().iterator();
-// while (iterator2.hasNext()) {
-// Object obj = iterator2.next();
-// VMComponentDefnID vmDefnID = (VMComponentDefnID)obj;
-// VMComponentDefn vmDefn = (VMComponentDefn) vmObjects.get(vmDefnID);
-// addConfigurationComponentDefn(cmc.getConfiguration(), vmDefn);
-//
-// }
-//
-// Iterator iterator3 = deployedObjects.iterator();
-// while (iterator3.hasNext()) {
-// Object obj = iterator3.next();
-// DeployedComponent origComponent = (DeployedComponent)obj;
-// String depComponentName = origComponent.getName();
-// ConfigurationID configID = origComponent.getConfigurationID();
-// VMComponentDefnID vmID = origComponent.getVMComponentDefnID();
-// ServiceComponentDefnID defnID = origComponent.getServiceComponentDefnID();
-// ProductServiceConfigID pscID = origComponent.getProductServiceConfigID();
-// ComponentTypeID typeID = origComponent.getComponentTypeID();
-//
-// /**
-// * We need to create a new Deployed ComponentID as the Host
-// * name is incorporated into the ID name of every Deployed
-// * Component.
-// */
-// DeployedComponentID newID = null;
-// if (origComponent.getServiceComponentDefnID() == null) {
-//
-// newID= new DeployedComponentID(depComponentName,
-// configID,
-// hostID,
-// vmID);
-// } else {
-//
-// newID= new DeployedComponentID(depComponentName,
-// configID,
-// hostID,
-// vmID,
-// pscID,
-// defnID);
-// }
-// /**
-// * Here we create a new DeployedComponent that is a clone of
-// * the original DeployedComponent in the list except for we
-// * switch out the HostID to reflect the new Host in the new
-// * server install.
-// */
-// BasicDeployedComponent newComponent = new BasicDeployedComponent(
-// newID,
-// configID,
-// hostID,
-// vmID,
-// defnID,
-// pscID,
-// typeID
-// );
-// /**
-// * Now we remove the original deployed component from the list of
-// * objects to be commited to the database and add the modified
-// * deployed component to the list of objects to be commited
-// * to the configuraiton database.
-// */
-//
-// addDeployedComponent(cmc.getConfiguration(), newComponent);
-//
-//
-// }
-//
-//
-//
-// }
-
- public static Configuration addConfigurationComponentDefn(Configuration t, ComponentDefn defn ) {
- Assertion.isNotNull(defn);
-
- BasicConfiguration target = (BasicConfiguration) verifyTargetClass(t,BasicConfiguration.class);
- target.addComponentDefn(defn);
-
- return target;
- }
-
- public static Configuration addConfigurationDeployedComponent(Configuration t, DeployedComponent deployedComponent) {
- Assertion.isNotNull(deployedComponent);
-
- BasicConfiguration target = (BasicConfiguration) verifyTargetClass(t,BasicConfiguration.class);
-
- target.addDeployedComponent(deployedComponent);
- return target;
- }
- public static Configuration addConfigurationHostComponent(Configuration t, Host host) {
- Assertion.isNotNull(host);
-
- BasicConfiguration target = (BasicConfiguration) verifyTargetClass(t,BasicConfiguration.class);
- target.addHost(host);
- return target;
- }
-
- public static Configuration addAuthenticationProviderComponent(Configuration t, AuthenticationProvider provider) {
- Assertion.isNotNull(provider);
-
- BasicConfiguration target = (BasicConfiguration) verifyTargetClass(t,BasicConfiguration.class);
- target.addComponentDefn(provider);
- return target;
- }
-
-
-
- public static Properties getEditableProperties(ComponentObject t) {
- BasicComponentObject bco = (BasicComponentObject) verifyTargetClass(t,BasicComponentObject.class);
- return bco.getEditableProperties();
- }
-
-
-
-
- // ----------------------------------------------------------------------------------
- // P R I V A T E
- // ----------------------------------------------------------------------------------
-
- /**
- * Subclass helper method that simply verifies that the specified target is either an instance of
- * the specified class (or interface).
- * @param target the target or target identifier.
- * @param requiredClass the class/interface that the target must be an instance of.
- * @return the target object (for convenience)
- * @throws IllegalArgumentException if either the target is not an instance of the specified class.
- */
- protected static Object verifyTargetClass( Object target, Class requiredClass ) throws IllegalArgumentException {
- if ( ! requiredClass.isInstance(target) ) {
- throw new IllegalArgumentException(CommonPlugin.Util.getString(ErrorMessageKeys.CONFIG_ERR_0072, requiredClass.getName()) );
- }
- return target;
- }
-
-
-}
-
-
-
15 years, 8 months
teiid SVN: r763 - branches/remove_psc/common-internal/src/main/java/com/metamatrix/common/config/api.
by teiid-commits@lists.jboss.org
Author: vhalbert(a)redhat.com
Date: 2009-04-13 09:25:55 -0400 (Mon, 13 Apr 2009)
New Revision: 763
Removed:
branches/remove_psc/common-internal/src/main/java/com/metamatrix/common/config/api/LockedConfigurationID.java
branches/remove_psc/common-internal/src/main/java/com/metamatrix/common/config/api/ProductType.java
branches/remove_psc/common-internal/src/main/java/com/metamatrix/common/config/api/ProductTypeID.java
Log:
Teiid 323 - refactured, removing unused Config API classes: ProductType, ProductTypeID and ConfigurationLock
Deleted: branches/remove_psc/common-internal/src/main/java/com/metamatrix/common/config/api/LockedConfigurationID.java
===================================================================
--- branches/remove_psc/common-internal/src/main/java/com/metamatrix/common/config/api/LockedConfigurationID.java 2009-04-13 01:32:50 UTC (rev 762)
+++ branches/remove_psc/common-internal/src/main/java/com/metamatrix/common/config/api/LockedConfigurationID.java 2009-04-13 13:25:55 UTC (rev 763)
@@ -1,127 +0,0 @@
-/*
- * 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 com.metamatrix.common.config.api;
-
-import java.util.Date;
-
-/**
- * This class acts as a wrapper around a single ConfigurationID, denoting that ID
- * as being locked. However, this lock wrapper, since it extends ConfigurationID,
- * can be treated like a ConfigurationID. In other words, this class uses the
- * Decorator pattern to add a locked attribute to any ConfigurationID instance.
- */
-public class LockedConfigurationID extends ConfigurationID{
-
- private ConfigurationID originalID;
- private String version;
- private String lockHolder;
- private long lockAcquiredAt;
-
- /**
- * Create a locked wrapper around the specified MetadataID instance.
- * @param configrationName is the configuration that is to be locked.
- * @param versionName along with configurationName uniquely identifies the configuration
- * @throws IllegalArgumentException if the ID is null
- */
- public LockedConfigurationID( ConfigurationID id, String versionName, String lockHolder, long lockAcquiredAt ){
- // The following allows this class to NOT overload and forward
- // most methods, but does make a copy of the full name.
- super( ((id!=null)?id.getFullName():"")); //$NON-NLS-1$
- if ( id == null || versionName == null || lockHolder == null ) {
- throw new IllegalArgumentException("A null parameter has been passed when identifying a locked configuration"); //$NON-NLS-1$
- }
- this.originalID = id;
- this.version = versionName;
- this.lockHolder = lockHolder;
- this.lockAcquiredAt = lockAcquiredAt;
-
- }
-
- public ConfigurationID getOriginalID() {
- return originalID;
- }
-
- public String getVersion() {
- return version;
- }
-
- public String getLockHolder() {
- return lockHolder;
- }
-
- public long getTimeOfAcquisitionAsLong() {
- return lockAcquiredAt;
- }
-
- public Date getTimeOfAcquisition() {
- return new Date(lockAcquiredAt);
- }
-
- /**
- * Compares this object to another. If the specified object is an instance of
- * the same class, then this method compares the name; otherwise, it throws a
- * ClassCastException (as instances are comparable only to instances of the same
- * class). Note: this method is consistent with <code>equals()</code>.
- * <p>
- * @param obj the object that this instance is to be compared to.
- * @return a negative integer, zero, or a positive integer as this object
- * is less than, equal to, or greater than the specified object, respectively.
- * @throws IllegalArgumentException if the specified object reference is null
- * @throws ClassCastException if the specified object's type prevents it
- * from being compared to this instance.
- */
- public int compareTo(Object obj) {
- return this.originalID.compareTo(obj);
- }
-
- /**
- * Returns true if the specified object is semantically equal to this instance.
- * Note: this method is consistent with <code>compareTo()</code>.
- * <p>
- * @param obj the object that this instance is to be compared to.
- * @return whether the object is equal to this object.
- */
- public boolean equals(Object obj) {
- // Check if instances are identical ...
- if (this == obj) {
- return true;
- }
- return this.originalID.equals(obj);
- }
- /**
- * Return a deep cloned instance of this object. Subclasses must override
- * this method.
- * @return the object that is the clone of this instance.
- * @throws CloneNotSupportedException if this object cannot be cloned (i.e., only objects in
- * {@link com.metamatrix.metadata.api.Defaults Defaults} cannot be cloned).
- */
- public synchronized Object clone() throws CloneNotSupportedException {
- Object result = null;
- try {
- result = new LockedConfigurationID(this.originalID, this.version, this.lockHolder, this.lockAcquiredAt );
- } catch ( Exception e ) {
- }
- return result;
- }
-}
-
Deleted: branches/remove_psc/common-internal/src/main/java/com/metamatrix/common/config/api/ProductType.java
===================================================================
--- branches/remove_psc/common-internal/src/main/java/com/metamatrix/common/config/api/ProductType.java 2009-04-13 01:32:50 UTC (rev 762)
+++ branches/remove_psc/common-internal/src/main/java/com/metamatrix/common/config/api/ProductType.java 2009-04-13 13:25:55 UTC (rev 763)
@@ -1,68 +0,0 @@
-/*
- * 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 com.metamatrix.common.config.api;
-
-import java.util.Collection;
-
-
-/**
- * <p>A Product, in this context, is simply a named collection of
- * Service types. For example, the MetaMatrix Server product has
- * these service types: Query service, Transaction service, and
- * RuntimeMetadata service.</p>
- *
- * <p>A Product is a ComponentType subclass; it is a ComponentType, but
- * has references to other ComponentTypes (specifically, ComponentTypes
- * representing types of services). Since it is a ComponentType, it
- * can be thought of as representing a type of Product (either Platform,
- * MetaData Server, or MetaMatrix Server).</p>
- *
- * <p><b>Note:</b> Product type names where moved to
- * {@link com.metamatrix.core.util.MetaMatrixProductVersion} in
- * version 5.0 so that other classes that don't have a dependency on
- * com.metamatrix.common can reference them.</p>
- */
-public interface ProductType extends ComponentType {
- public static final String COMPONENT_TYPE_NAME = "Product"; //$NON-NLS-1$
-
- public static final ComponentTypeID PRODUCT_TYPE_ID = new ComponentTypeID(COMPONENT_TYPE_NAME);
- public static final ComponentTypeID PRODUCT_SUPER_TYPE_ID = new ComponentTypeID(COMPONENT_TYPE_NAME);
-
-
- /**
- * Returns a Collection of ComponentTypeID objects, each representing
- * a type of service that this Product is comprised of
- * @return Collection of ComponentTypeID objects
- */
- Collection getComponentTypeIDs();
-
-
- /**
- * Returns true if thie component type is contained in
- * this instance of the product type.
- * @param componentTypeID is the id of the component type to check for.
- * @return boolean is true if the component type is contained in the product type
- */
- boolean contains(ComponentTypeID componentTypeID);
-}
-
Deleted: branches/remove_psc/common-internal/src/main/java/com/metamatrix/common/config/api/ProductTypeID.java
===================================================================
--- branches/remove_psc/common-internal/src/main/java/com/metamatrix/common/config/api/ProductTypeID.java 2009-04-13 01:32:50 UTC (rev 762)
+++ branches/remove_psc/common-internal/src/main/java/com/metamatrix/common/config/api/ProductTypeID.java 2009-04-13 13:25:55 UTC (rev 763)
@@ -1,60 +0,0 @@
-/*
- * 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 com.metamatrix.common.config.api;
-
-
-public class ProductTypeID extends ComponentTypeID {
- public static final ProductTypeID PRODUCT_TYPE_ID = new ProductTypeID(ProductType.COMPONENT_TYPE_NAME);
-
-// /**
-// * This is a Collection of all known type names of
-// * products - it is needed by the JDBC spi impl and is
-// * not really intended for public use. (In other words,
-// * it is a hack!)
-// */
-// public static final Collection ALL_PRODUCT_TYPES;
-//
-//
-//
-// static{
-// ALL_PRODUCT_TYPES = new ArrayList(3);
-// ALL_PRODUCT_TYPES.add(ProductType.PLATFORM_TYPE_NAME);
-// ALL_PRODUCT_TYPES.add(ProductType.METAMATRIX_SERVER_TYPE_NAME);
-// ALL_PRODUCT_TYPES.add(ProductType.METADATA_SERVER_TYPE_NAME);
-// ALL_PRODUCT_TYPES.add(ProductType.CONNECTOR_PRODUCT_TYPE_NAME);
-//
-// }
-//
-
-
-
-
- public ProductTypeID(String fullName) {
- super(fullName);
- }
-}
-
-
-
-
-
15 years, 8 months
teiid SVN: r762 - in trunk/engine/src: main/java/com/metamatrix/query/optimizer/relational/plantree and 3 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2009-04-12 21:32:50 -0400 (Sun, 12 Apr 2009)
New Revision: 762
Added:
trunk/engine/src/test/java/com/metamatrix/query/optimizer/TestSubqueryPushdown.java
Modified:
trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/RelationalPlanner.java
trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/plantree/PlanNode.java
trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/FrameUtil.java
trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/JoinUtil.java
trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RulePushSelectCriteria.java
trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RuleRaiseAccess.java
trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RuleRemoveOptionalJoins.java
trunk/engine/src/main/java/com/metamatrix/query/sql/visitor/ElementCollectorVisitor.java
trunk/engine/src/test/java/com/metamatrix/query/optimizer/TestOptimizer.java
Log:
TEIID-370 adding the ability push subqueries through virtual groups.
Modified: trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/RelationalPlanner.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/RelationalPlanner.java 2009-04-12 21:32:20 UTC (rev 761)
+++ trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/RelationalPlanner.java 2009-04-13 01:32:50 UTC (rev 762)
@@ -57,6 +57,7 @@
import com.metamatrix.query.sql.symbol.SingleElementSymbol;
import com.metamatrix.query.sql.visitor.CorrelatedReferenceCollectorVisitor;
import com.metamatrix.query.sql.visitor.GroupCollectorVisitor;
+import com.metamatrix.query.sql.visitor.GroupsUsedByElementsVisitor;
import com.metamatrix.query.sql.visitor.ValueIteratorProviderCollectorVisitor;
import com.metamatrix.query.util.CommandContext;
import com.metamatrix.query.util.ErrorMessageKeys;
@@ -203,6 +204,7 @@
node.setProperty(NodeConstants.Info.SUBQUERY_PLANS, plans);
node.setProperty(NodeConstants.Info.SUBQUERY_VALUE_PROVIDERS, subqueryContainers);
node.setProperty(NodeConstants.Info.CORRELATED_REFERENCES, correlatedReferences);
+ node.addGroups(GroupsUsedByElementsVisitor.getGroups(node.getCorrelatedReferenceElements()));
}
}
}
Modified: trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/plantree/PlanNode.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/plantree/PlanNode.java 2009-04-12 21:32:20 UTC (rev 761)
+++ trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/plantree/PlanNode.java 2009-04-13 01:32:50 UTC (rev 762)
@@ -25,6 +25,7 @@
import java.util.*;
import com.metamatrix.query.sql.symbol.*;
+import com.metamatrix.query.sql.visitor.ElementCollectorVisitor;
public class PlanNode {
@@ -276,5 +277,20 @@
assert node.getChildCount() == 0;
node.addLastChild(this);
}
+
+ public Set<ElementSymbol> getCorrelatedReferenceElements() {
+ List<Reference> refs = (List<Reference>) this.getProperty(NodeConstants.Info.CORRELATED_REFERENCES);
+ if(refs == null || refs.isEmpty()) {
+ return Collections.emptySet();
+ }
+
+ HashSet<ElementSymbol> result = new HashSet<ElementSymbol>(refs.size());
+ for (Reference ref : refs) {
+ Expression expr = ref.getExpression();
+ ElementCollectorVisitor.getElements(expr, result);
+ }
+ return result;
+ }
+
}
Modified: trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/FrameUtil.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/FrameUtil.java 2009-04-12 21:32:20 UTC (rev 761)
+++ trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/FrameUtil.java 2009-04-13 01:32:50 UTC (rev 762)
@@ -110,7 +110,7 @@
}
- static boolean canConvertAccessPatterns(PlanNode sourceNode) throws QueryPlannerException {
+ static boolean canConvertAccessPatterns(PlanNode sourceNode) {
List accessPatterns = (List)sourceNode.getProperty(NodeConstants.Info.ACCESS_PATTERNS);
if (accessPatterns == null) {
return true;
@@ -168,8 +168,21 @@
throws QueryPlannerException {
// Update groups for current node
- Set groups = node.getGroups();
+ Set<GroupSymbol> groups = node.getGroups();
+
+ boolean hasOld = groups.remove(oldGroup);
+ int type = node.getType();
+
+ if(newGroup != null) {
+ if (!hasOld) {
+ return;
+ }
+ groups.add(newGroup);
+ } else if (type != NodeConstants.Types.SOURCE && type != NodeConstants.Types.ACCESS) {
+ groups.clear();
+ }
+
// Convert expressions from correlated subquery references;
// currently only for SELECT or PROJECT nodes
List refs = (List)node.getProperty(NodeConstants.Info.CORRELATED_REFERENCES);
@@ -180,84 +193,64 @@
Expression expr = ref.getExpression();
Expression convertedExpr = convertExpression(expr, symbolMap);
ref.setExpression(convertedExpr);
+ if (newGroup == null) {
+ GroupsUsedByElementsVisitor.getGroups(convertedExpr, groups);
+ }
}
}
-
- boolean hasOld = groups.remove(oldGroup);
-
- if(newGroup != null) {
- if (!hasOld) {
- return;
- }
- groups.add(newGroup);
- }
- // Updated elements
- List newElementSymbols = null;
- if (newGroup == null) {
- newElementSymbols = new ArrayList();
- }
-
- int type = node.getType();
if(type == NodeConstants.Types.SELECT) {
Criteria crit = (Criteria) node.getProperty(NodeConstants.Info.SELECT_CRITERIA);
- convertCriteria(crit, symbolMap);
+ crit = convertCriteria(crit, symbolMap);
+ node.setProperty(NodeConstants.Info.SELECT_CRITERIA, crit);
if (newGroup == null) {
- ElementCollectorVisitor.getElements(crit, newElementSymbols);
+ GroupsUsedByElementsVisitor.getGroups(crit, groups);
}
} else if(type == NodeConstants.Types.PROJECT) {
- List elements = (List) node.getProperty(NodeConstants.Info.PROJECT_COLS);
- List newElements = new ArrayList(elements.size());
+ List<SingleElementSymbol> elements = (List<SingleElementSymbol>) node.getProperty(NodeConstants.Info.PROJECT_COLS);
- Iterator elementIter = elements.iterator();
- while(elementIter.hasNext()) {
- SingleElementSymbol symbol = (SingleElementSymbol) elementIter.next();
+ for (int i = 0; i < elements.size(); i++) {
+ SingleElementSymbol symbol = elements.get(i);
SingleElementSymbol mappedSymbol = convertSingleElementSymbol(symbol, symbolMap, true);
- newElements.add(mappedSymbol);
+ elements.set(i, mappedSymbol);
if (newGroup == null) {
- ElementCollectorVisitor.getElements(mappedSymbol, newElementSymbols);
+ GroupsUsedByElementsVisitor.getGroups(mappedSymbol, groups);
}
}
- node.setProperty(NodeConstants.Info.PROJECT_COLS, newElements);
-
} else if(type == NodeConstants.Types.JOIN) {
// Convert join criteria property
- List joinCrits = (List) node.getProperty(NodeConstants.Info.JOIN_CRITERIA);
- if(joinCrits != null && joinCrits.size() > 0) {
- Iterator critIter = joinCrits.iterator();
- while(critIter.hasNext()) {
- Criteria crit = (Criteria) critIter.next();
- convertCriteria(crit, symbolMap);
+ List<Criteria> joinCrits = (List<Criteria>) node.getProperty(NodeConstants.Info.JOIN_CRITERIA);
+ if(joinCrits != null) {
+ for (int i = 0; i < joinCrits.size(); i++) {
+ Criteria crit = joinCrits.get(i);
+ crit = convertCriteria(crit, symbolMap);
if (newGroup == null) {
- ElementCollectorVisitor.getElements(crit, newElementSymbols);
+ GroupsUsedByElementsVisitor.getGroups(crit, groups);
}
+ joinCrits.set(i, crit);
}
}
convertAccessPatterns(symbolMap, node);
} else if(type == NodeConstants.Types.SORT) {
- List elements = (List) node.getProperty(NodeConstants.Info.SORT_ORDER);
- List newElements = new ArrayList(elements.size());
+ List<SingleElementSymbol> elements = (List<SingleElementSymbol>) node.getProperty(NodeConstants.Info.SORT_ORDER);
- Iterator elementIter = elements.iterator();
- while(elementIter.hasNext()) {
- SingleElementSymbol symbol = (SingleElementSymbol) elementIter.next();
+ for (int i = 0; i < elements.size(); i++) {
+ SingleElementSymbol symbol = elements.get(i);
SingleElementSymbol mappedSymbol = convertSingleElementSymbol(symbol, symbolMap, true);
- newElements.add( mappedSymbol );
-
+ elements.set(i, mappedSymbol);
+
if (newGroup == null) {
- ElementCollectorVisitor.getElements(mappedSymbol, newElementSymbols);
+ GroupsUsedByElementsVisitor.getGroups(mappedSymbol, groups);
}
}
- node.setProperty(NodeConstants.Info.SORT_ORDER, newElements);
-
} else if(type == NodeConstants.Types.GROUP) {
// Grouping columns
List groupCols = (List) node.getProperty(NodeConstants.Info.GROUP_COLS);
@@ -270,7 +263,7 @@
newGroupCols.add( mappedCol );
if (newGroup == null) {
- ElementCollectorVisitor.getElements(mappedCol, newElementSymbols);
+ GroupsUsedByElementsVisitor.getGroups(mappedCol, groups);
}
}
node.setProperty(NodeConstants.Info.GROUP_COLS, newGroupCols);
@@ -278,10 +271,6 @@
} else if (type == NodeConstants.Types.SOURCE || type == NodeConstants.Types.ACCESS) {
convertAccessPatterns(symbolMap, node);
}
-
- if (newGroup == null) {
- GroupsUsedByElementsVisitor.getGroups(newElementSymbols, groups);
- }
}
static SingleElementSymbol convertSingleElementSymbol(SingleElementSymbol symbol, Map symbolMap, boolean shouldAlias) {
@@ -419,7 +408,7 @@
* @param groups
* @return
*/
- static PlanNode findOriginatingNode(PlanNode root, Set groups) {
+ static PlanNode findOriginatingNode(PlanNode root, Set<GroupSymbol> groups) {
return findOriginatingNode(root, groups, false);
}
@@ -438,7 +427,7 @@
return findOriginatingNode(root, root.getGroups(), true);
}
- private static PlanNode findOriginatingNode(PlanNode root, Set groups, boolean joinSource) {
+ private static PlanNode findOriginatingNode(PlanNode root, Set<GroupSymbol> groups, boolean joinSource) {
boolean containsGroups = false;
if(root.getType() == NodeConstants.Types.NULL || root.getType() == NodeConstants.Types.SOURCE
Modified: trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/JoinUtil.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/JoinUtil.java 2009-04-12 21:32:20 UTC (rev 761)
+++ trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/JoinUtil.java 2009-04-13 01:32:50 UTC (rev 762)
@@ -87,8 +87,8 @@
PlanNode right = joinNode.getLastChild();
right = FrameUtil.findJoinSourceNode(right);
- Collection outerGroups = left.getGroups();
- Collection innerGroups = right.getGroups();
+ Collection<GroupSymbol> outerGroups = left.getGroups();
+ Collection<GroupSymbol> innerGroups = right.getGroups();
if (joinType == JoinType.JOIN_RIGHT_OUTER) {
outerGroups = innerGroups;
innerGroups = left.getGroups();
@@ -135,7 +135,7 @@
* given all null values for elements in the inner groups
*/
public static boolean isNullDependent(QueryMetadataInterface metadata,
- final Collection innerGroups,
+ final Collection<GroupSymbol> innerGroups,
Criteria crit) {
Criteria simplifiedCrit = (Criteria)replaceWithNullValues(innerGroups, crit);
try {
@@ -148,7 +148,7 @@
}
public static boolean isNullDependent(QueryMetadataInterface metadata,
- final Collection innerGroups,
+ final Collection<GroupSymbol> innerGroups,
Expression expr) {
Expression simplifiedExpression = (Expression)replaceWithNullValues(innerGroups, expr);
try {
@@ -160,7 +160,7 @@
return !QueryRewriter.isNull(simplifiedExpression);
}
- private static LanguageObject replaceWithNullValues(final Collection innerGroups,
+ private static LanguageObject replaceWithNullValues(final Collection<GroupSymbol> innerGroups,
LanguageObject obj) {
ExpressionMappingVisitor emv = new ExpressionMappingVisitor(null) {
@@ -188,7 +188,7 @@
}
static JoinType getJoinTypePreventingCriteriaOptimization(PlanNode joinNode, PlanNode critNode) {
- Set groups = critNode.getGroups();
+ Set<GroupSymbol> groups = critNode.getGroups();
//special case for 0 group criteria
if (groups.size() == 0) {
Modified: trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RulePushSelectCriteria.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RulePushSelectCriteria.java 2009-04-12 21:32:20 UTC (rev 761)
+++ trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RulePushSelectCriteria.java 2009-04-13 01:32:50 UTC (rev 762)
@@ -26,6 +26,7 @@
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
+import java.util.IdentityHashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
@@ -59,10 +60,10 @@
import com.metamatrix.query.sql.symbol.GroupSymbol;
import com.metamatrix.query.sql.symbol.Reference;
import com.metamatrix.query.sql.util.SymbolMap;
+import com.metamatrix.query.sql.util.ValueIteratorProvider;
import com.metamatrix.query.sql.visitor.AggregateSymbolCollectorVisitor;
import com.metamatrix.query.sql.visitor.ElementCollectorVisitor;
import com.metamatrix.query.sql.visitor.GroupCollectorVisitor;
-import com.metamatrix.query.sql.visitor.GroupsUsedByElementsVisitor;
import com.metamatrix.query.sql.visitor.ValueIteratorProviderCollectorVisitor;
import com.metamatrix.query.util.CommandContext;
import com.metamatrix.query.util.ErrorMessageKeys;
@@ -92,23 +93,20 @@
movedAnyNode = false;
// Find criteria nodes that could be pushed
- List critNodes = new ArrayList();
- findCriteria(plan, critNodes, deadNodes, metadata, capFinder);
-
- // For each crit node, try to move toward the originating node
- Iterator nodeIter = critNodes.iterator();
- while(nodeIter.hasNext()) {
- PlanNode critNode = (PlanNode) nodeIter.next();
- pushTowardOriginatingNode(critNode, metadata, capFinder);
- }
-
- // For each crit node, try to move across the originating node
- nodeIter = critNodes.iterator();
- while(nodeIter.hasNext()) {
- PlanNode critNode = (PlanNode) nodeIter.next();
+ List<PlanNode> critNodes = NodeEditor.findAllNodes(plan, NodeConstants.Types.SELECT);
+ Collections.reverse(critNodes);
+ for (PlanNode critNode : critNodes) {
+ boolean isPhantom = critNode.hasBooleanProperty(NodeConstants.Info.IS_PHANTOM);
+ boolean isCopied = critNode.hasBooleanProperty(NodeConstants.Info.IS_COPIED);
+ boolean isPushed = critNode.hasBooleanProperty(NodeConstants.Info.IS_PUSHED);
+ if (isPhantom || isCopied || isPushed || deadNodes.contains(critNode)) {
+ continue;
+ }
+ pushTowardOriginatingNode(critNode, metadata, capFinder);
+
boolean moved = false;
- if(FrameUtil.hasSubquery(critNode) || critNode.getGroups().size() == 0) {
+ if(critNode.getGroups().isEmpty()) {
deadNodes.add(critNode);
continue;
}
@@ -152,6 +150,10 @@
* @return
*/
private boolean handleJoinCriteria(PlanNode joinNode, PlanNode critNode, QueryMetadataInterface metadata) {
+ //we currently don't allow subqueries in join criteria
+ if (FrameUtil.hasSubquery(critNode)) {
+ return false;
+ }
JoinType jt = (JoinType)joinNode.getProperty(NodeConstants.Info.JOIN_TYPE);
if (jt == JoinType.JOIN_CROSS || jt == JoinType.JOIN_INNER) {
@@ -194,26 +196,6 @@
NodeEditor.removeChildNode(critNode.getParent(), critNode);
}
- void findCriteria(PlanNode root, List foundNodes, Set deadNodes, QueryMetadataInterface metadata, CapabilitiesFinder capFinder)
- throws QueryPlannerException, MetaMatrixComponentException {
-
- if( ! deadNodes.contains(root) &&
- root.getType() == NodeConstants.Types.SELECT) {
-
- boolean isPhantom = root.hasBooleanProperty(NodeConstants.Info.IS_PHANTOM);
- boolean isCopied = root.hasBooleanProperty(NodeConstants.Info.IS_COPIED);
- boolean isPushed = root.hasBooleanProperty(NodeConstants.Info.IS_PUSHED);
-
- if( !(isPhantom || isCopied || isPushed) ) {
- foundNodes.add(0, root);
- }
- }
-
- for (PlanNode child : root.getChildren()) {
- findCriteria(child, foundNodes, deadNodes, metadata, capFinder);
- }
- }
-
/**
*
* @param critNode
@@ -229,15 +211,8 @@
PlanNode sourceNode = null;
Set<GroupSymbol> groups = critNode.getGroups();
-
- Set<GroupSymbol> correlatedReferenceGroups = getCorrelatedReferenceGroups(critNode);
-
- //check the correlation groups
- if (!correlatedReferenceGroups.isEmpty()) {
- groups = new HashSet<GroupSymbol>(groups);
- groups.addAll(correlatedReferenceGroups);
- }
-
+
+ //check for an uncorrelated subquery
if(groups.isEmpty() && FrameUtil.hasSubquery(critNode)) {
Object modelID = getUniqueModel(critNode, metadata);
if(modelID != null) {
@@ -272,25 +247,6 @@
NodeEditor.removeChildNode(critNode.getParent(), critNode);
destination.addAsParent(critNode);
}
-
- static Set<GroupSymbol> getCorrelatedReferenceGroups(PlanNode critNode) {
- List refs = (List) critNode.getProperty(NodeConstants.Info.CORRELATED_REFERENCES);
-
- // Check whether there are correlated subquery references
- if(refs == null || refs.size() == 0) {
- return Collections.emptySet();
- }
-
- // Get group used in correlated reference
- HashSet<GroupSymbol> refGroups = new HashSet<GroupSymbol>(refs.size());
- Iterator refIter = refs.iterator();
- while(refIter.hasNext()) {
- Reference ref = (Reference) refIter.next();
- Expression expr = ref.getExpression();
- GroupsUsedByElementsVisitor.getGroups(expr, refGroups);
- }
- return refGroups;
- }
private Object getUniqueModel(PlanNode critNode, QueryMetadataInterface metadata)
throws QueryMetadataException, MetaMatrixComponentException {
@@ -348,7 +304,7 @@
throws QueryPlannerException, MetaMatrixComponentException {
// Walk from source node up to critNode to build list of intervening nodes
- Stack path = new Stack();
+ Stack<PlanNode> path = new Stack<PlanNode>();
PlanNode currentNode = sourceNode.getParent();
while(currentNode != critNode) {
path.push(currentNode);
@@ -357,7 +313,7 @@
// Examine path in reverse order (by popping stack)
while(! path.empty()) {
- currentNode = (PlanNode) path.pop();
+ currentNode = path.pop();
// Look for situations where we don't allow SELECT to be pushed
if(currentNode.getType() == NodeConstants.Types.ACCESS) {
@@ -421,7 +377,9 @@
PlanNode child = sourceNode.getFirstChild();
child = FrameUtil.findOriginatingNode(child, child.getGroups());
if (child != null && child.getType() == NodeConstants.Types.SET_OP) {
- if (child == sourceNode.getFirstChild()) {
+ //only allow criteria without subqueires - node cloning doesn't allow for the proper creation of
+ //multiple nodes with the same subqueries
+ if (child == sourceNode.getFirstChild() && !FrameUtil.hasSubquery(critNode)) {
return pushAcrossSetOp(critNode, child);
}
//this could be an access node in the middle of the source and set op,
@@ -468,7 +426,7 @@
SymbolMap symbolMap = (SymbolMap) sourceNode.getProperty(NodeConstants.Info.SYMBOL_MAP);
- if (!createConvertedSelectNode(critNode, projectNode, symbolMap)) {
+ if (!createConvertedSelectNode(critNode, sourceNode.getGroups().iterator().next(), projectNode, symbolMap)) {
return false;
}
@@ -552,22 +510,20 @@
copyNode.setProperty(NodeConstants.Info.SELECT_CRITERIA, copyCrit);
copyNode.addGroups(critNode.getGroups());
// Copy subquery properties
- Object subqueryPlans = critNode.getProperty(NodeConstants.Info.SUBQUERY_PLANS);
+ List<RelationalPlan> subqueryPlans = (List<RelationalPlan>)critNode.getProperty(NodeConstants.Info.SUBQUERY_PLANS);
if(subqueryPlans != null) {
- copyNode.setProperty(NodeConstants.Info.SUBQUERY_PLANS, subqueryPlans);
+ copyNode.setProperty(NodeConstants.Info.SUBQUERY_PLANS, new ArrayList<RelationalPlan>(subqueryPlans));
}
- Object subqueryValueProviders = critNode.getProperty(NodeConstants.Info.SUBQUERY_VALUE_PROVIDERS);
+ List<ValueIteratorProvider> subqueryValueProviders = (List<ValueIteratorProvider>)critNode.getProperty(NodeConstants.Info.SUBQUERY_VALUE_PROVIDERS);
if(subqueryValueProviders != null) {
- copyNode.setProperty(NodeConstants.Info.SUBQUERY_VALUE_PROVIDERS, subqueryValueProviders);
+ copyNode.setProperty(NodeConstants.Info.SUBQUERY_VALUE_PROVIDERS, new ArrayList<ValueIteratorProvider>(subqueryValueProviders));
}
- Object correlatedReferences = critNode.getProperty(NodeConstants.Info.CORRELATED_REFERENCES);
+ List<Reference> correlatedReferences = (List<Reference>)critNode.getProperty(NodeConstants.Info.CORRELATED_REFERENCES);
if(correlatedReferences != null) {
- copyNode.setProperty(NodeConstants.Info.CORRELATED_REFERENCES, correlatedReferences);
+ copyNode.setProperty(NodeConstants.Info.CORRELATED_REFERENCES, new ArrayList<Reference>(correlatedReferences));
}
-
- Object depCrits = critNode.getProperty(NodeConstants.Info.IS_DEPENDENT_SET);
- if(depCrits != null) {
- copyNode.setProperty(NodeConstants.Info.IS_DEPENDENT_SET, depCrits);
+ if(critNode.hasBooleanProperty(NodeConstants.Info.IS_DEPENDENT_SET)) {
+ copyNode.setProperty(NodeConstants.Info.IS_DEPENDENT_SET, Boolean.TRUE);
}
return copyNode;
}
@@ -577,7 +533,7 @@
// Find source node above union and grab the symbol map
PlanNode sourceNode = NodeEditor.findParent(setOp, NodeConstants.Types.SOURCE);
-
+ GroupSymbol virtualGroup = sourceNode.getGroups().iterator().next();
satisfyAccessPatterns(critNode, sourceNode);
SymbolMap symbolMap = (SymbolMap) sourceNode.getProperty(NodeConstants.Info.SYMBOL_MAP);
@@ -593,7 +549,7 @@
PlanNode firstBranchNode = NodeEditor.findNodePreOrder(firstChild, NodeConstants.Types.PROJECT);
- if(createConvertedSelectNode(critNode, firstBranchNode, symbolMap)) {
+ if(createConvertedSelectNode(critNode, virtualGroup, firstBranchNode, symbolMap)) {
movedCount++;
}
@@ -611,7 +567,7 @@
symbolMap = SymbolMap.createSymbolMap(sourceGroup, firstProjectCols, (List) projectNode.getProperty(NodeConstants.Info.PROJECT_COLS));
// Move the node
- if(createConvertedSelectNode(critNode, projectNode, symbolMap)) {
+ if(createConvertedSelectNode(critNode, virtualGroup, projectNode, symbolMap)) {
movedCount++;
}
}
@@ -626,7 +582,7 @@
return false;
}
- void collectUnionChildren(PlanNode unionNode, LinkedList unionChildren) {
+ void collectUnionChildren(PlanNode unionNode, LinkedList<PlanNode> unionChildren) {
for (PlanNode child : unionNode.getChildren()) {
if(child.getType() == NodeConstants.Types.SET_OP) {
collectUnionChildren(child, unionChildren);
@@ -637,18 +593,43 @@
}
private boolean createConvertedSelectNode(PlanNode critNode,
+ GroupSymbol sourceGroup,
PlanNode projectNode,
SymbolMap symbolMap) throws QueryPlannerException {
// If projectNode has children, then it is from a SELECT without a FROM and the criteria should not be pushed
if(projectNode.getChildCount() == 0) {
return false;
}
-
+
Criteria crit = (Criteria) critNode.getProperty(NodeConstants.Info.SELECT_CRITERIA);
+
+ Boolean conversionResult = checkConversion(symbolMap, ElementCollectorVisitor.getElements(crit, true));
- boolean hasAggregate = false;
+ if (conversionResult == Boolean.FALSE) {
+ return false; //not convertable
+ }
- for (ElementSymbol element : ElementCollectorVisitor.getElements(crit, true)) {
+ if (FrameUtil.hasSubquery(critNode)
+ && checkConversion(symbolMap, critNode.getCorrelatedReferenceElements()) != null) {
+ return false; //not convertable, or has an aggregate for a correlated reference
+ }
+
+ PlanNode copyNode = copyNode(critNode);
+
+ if (conversionResult == Boolean.TRUE) {
+ copyNode.setProperty(NodeConstants.Info.IS_HAVING, Boolean.TRUE);
+ }
+
+ FrameUtil.convertNode(copyNode, sourceGroup, null, symbolMap.asMap());
+ projectNode.getFirstChild().addAsParent(copyNode);
+ return true;
+ }
+
+ private Boolean checkConversion(SymbolMap symbolMap,
+ Collection<ElementSymbol> elements) {
+ Boolean result = null;
+
+ for (ElementSymbol element : elements) {
Expression converted = symbolMap.getMappedExpression(element);
if(converted == null) {
@@ -661,29 +642,11 @@
}
if (!AggregateSymbolCollectorVisitor.getAggregates(converted, false).isEmpty()) {
- hasAggregate = true;
+ result = Boolean.TRUE;
}
}
-
- PlanNode copyNode = copyNode(critNode);
-
- if (hasAggregate) {
- copyNode.setProperty(NodeConstants.Info.IS_HAVING, Boolean.TRUE);
- }
-
- // Do symbol mapping to switch to new frames symbols
- crit = FrameUtil.convertCriteria((Criteria)crit.clone(), symbolMap.asMap());
- copyNode.setProperty(NodeConstants.Info.SELECT_CRITERIA, crit);
-
- // Reset groups
- copyNode.getGroups().clear();
- copyNode.addGroups(GroupsUsedByElementsVisitor.getGroups(crit));
-
- // Insert new node
- projectNode.getFirstChild().addAsParent(copyNode);
-
- return true;
- }
+ return result;
+ }
public String toString() {
return "PushSelectCriteria"; //$NON-NLS-1$
Modified: trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RuleRaiseAccess.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RuleRaiseAccess.java 2009-04-12 21:32:20 UTC (rev 761)
+++ trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RuleRaiseAccess.java 2009-04-13 01:32:50 UTC (rev 762)
@@ -354,19 +354,10 @@
if(!(plan instanceof RelationalPlan)) {
return false;
}
- // We are expecting the following for an eligible subquery:
- // 1. Plan should be Access, nothing else
- // 2. Access should be returning a single column
- // 3. should not be returning a constant or scalar function,
- // only an element or aggregate
- // 4. Access node command should be a Query
- // 5. Access node should be for the same model as critNode
- // 6. If subquery has correlated references, model supports correlated
- // Check that root node is a project
RelationalPlan rplan = (RelationalPlan) plan;
- // Check that the second node is an access node and that it has no children
+ // Check that the plan is just an access node
RelationalNode accessNode = rplan.getRootNode();
if(accessNode == null || ! (accessNode instanceof AccessNode) || accessNode.getChildren()[0] != null) {
return false;
Modified: trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RuleRemoveOptionalJoins.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RuleRemoveOptionalJoins.java 2009-04-12 21:32:20 UTC (rev 761)
+++ trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RuleRemoveOptionalJoins.java 2009-04-13 01:32:50 UTC (rev 762)
@@ -131,7 +131,7 @@
if (isRoot) {
List columns = (List)node.getProperty(NodeConstants.Info.PROJECT_COLS);
ElementCollectorVisitor.getElements(columns, elements);
- collectCorrelatedReferences(node, elements);
+ elements.addAll(node.getCorrelatedReferenceElements());
}
break;
@@ -158,7 +158,7 @@
if (elements != null) {
Criteria crit = (Criteria)node.getProperty(NodeConstants.Info.SELECT_CRITERIA);
ElementCollectorVisitor.getElements(crit, elements);
- collectCorrelatedReferences(node, elements);
+ elements.addAll(node.getCorrelatedReferenceElements());
}
break;
}
@@ -199,19 +199,6 @@
return false;
}
- private void collectCorrelatedReferences(PlanNode node,
- Set<ElementSymbol> elements) {
- List refs = (List)node.getProperty(NodeConstants.Info.CORRELATED_REFERENCES);
- if (refs != null){
- Iterator refIter = refs.iterator();
- while (refIter.hasNext()) {
- Reference ref = (Reference)refIter.next();
- Expression expr = ref.getExpression();
- ElementCollectorVisitor.getElements(expr, elements);
- }
- }
- }
-
/**
* remove the optional node if possible
*/
Modified: trunk/engine/src/main/java/com/metamatrix/query/sql/visitor/ElementCollectorVisitor.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/sql/visitor/ElementCollectorVisitor.java 2009-04-12 21:32:20 UTC (rev 761)
+++ trunk/engine/src/main/java/com/metamatrix/query/sql/visitor/ElementCollectorVisitor.java 2009-04-13 01:32:50 UTC (rev 762)
@@ -49,7 +49,7 @@
*/
public class ElementCollectorVisitor extends LanguageVisitor {
- private Collection elements;
+ private Collection<ElementSymbol> elements;
/**
* Construct a new visitor with the specified collection, which should
@@ -57,7 +57,7 @@
* @param elements Collection to use for elements
* @throws IllegalArgumentException If elements is null
*/
- public ElementCollectorVisitor(Collection elements) {
+ public ElementCollectorVisitor(Collection<ElementSymbol> elements) {
if(elements == null) {
throw new IllegalArgumentException(QueryPlugin.Util.getString(ErrorMessageKeys.SQL_0021));
}
@@ -69,7 +69,7 @@
* after the visitor has been run on the language object tree.
* @return Collection of {@link com.metamatrix.query.sql.symbol.ElementSymbol}
*/
- public Collection getElements() {
+ public Collection<ElementSymbol> getElements() {
return this.elements;
}
@@ -109,7 +109,7 @@
* @param obj Language object
* @param elements Collection to collect elements in
*/
- public static final void getElements(LanguageObject obj, Collection elements) {
+ public static final void getElements(LanguageObject obj, Collection<ElementSymbol> elements) {
if(obj == null) {
return;
}
@@ -117,7 +117,7 @@
PreOrderNavigator.doVisit(obj, visitor);
}
- public static final void getElements(Collection<LanguageObject> objs, Collection elements) {
+ public static final void getElements(Collection<LanguageObject> objs, Collection<ElementSymbol> elements) {
if(objs == null) {
return;
}
@@ -149,15 +149,15 @@
* subqueries of the query
* @return Collection of {@link com.metamatrix.query.sql.symbol.ElementSymbol}
*/
- public static final Collection getElements(LanguageObject obj, boolean removeDuplicates, boolean useDeepIteration) {
+ public static final Collection<ElementSymbol> getElements(LanguageObject obj, boolean removeDuplicates, boolean useDeepIteration) {
if(obj == null) {
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
}
- Collection elements = null;
+ Collection<ElementSymbol> elements = null;
if(removeDuplicates) {
- elements = new HashSet();
+ elements = new HashSet<ElementSymbol>();
} else {
- elements = new ArrayList();
+ elements = new ArrayList<ElementSymbol>();
}
ElementCollectorVisitor visitor = null;
if (useDeepIteration){
Modified: trunk/engine/src/test/java/com/metamatrix/query/optimizer/TestOptimizer.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/query/optimizer/TestOptimizer.java 2009-04-12 21:32:20 UTC (rev 761)
+++ trunk/engine/src/test/java/com/metamatrix/query/optimizer/TestOptimizer.java 2009-04-13 01:32:50 UTC (rev 762)
@@ -1439,136 +1439,6 @@
0 // UnionAll
});
}
-
- public void testCorrelatedSubquery1() {
- ProcessorPlan plan = helpPlan("Select e1 from pm1.g1 where e1 in (select e1 FROM pm2.g1 WHERE pm1.g1.e2 = pm2.g1.e2)", example1(), //$NON-NLS-1$
- new String[] { "SELECT e1, pm1.g1.e2 FROM pm1.g1" }); //$NON-NLS-1$
- checkNodeTypes(plan, new int[] {
- 1, // Access
- 0, // DependentAccess
- 1, // DependentSelect
- 0, // DependentProject
- 0, // DupRemove
- 0, // Grouping
- 0, // NestedLoopJoinStrategy
- 0, // MergeJoinStrategy
- 0, // Null
- 0, // PlanExecution
- 1, // Project
- 0, // Select
- 0, // Sort
- 0 // UnionAll
- });
-
- checkSubPlanCount(plan, 1);
- }
-
- public void testCorrelatedSubquery2() {
- ProcessorPlan plan = helpPlan("Select e1, (select e1 FROM pm2.g1 WHERE pm1.g1.e2 = pm2.g1.e2) from pm1.g1", example1(), //$NON-NLS-1$
- new String[] { "SELECT e1, pm1.g1.e2 FROM pm1.g1" }); //$NON-NLS-1$
- checkNodeTypes(plan, new int[] {
- 1, // Access
- 0, // DependentAccess
- 0, // DependentSelect
- 1, // DependentProject
- 0, // DupRemove
- 0, // Grouping
- 0, // NestedLoopJoinStrategy
- 0, // MergeJoinStrategy
- 0, // Null
- 0, // PlanExecution
- 0, // Project
- 0, // Select
- 0, // Sort
- 0 // UnionAll
- });
- }
-
- public void testCorrelatedSubqueryVirtualLayer1() {
- ProcessorPlan plan = helpPlan("Select e1 from vm1.g6 where e1 in (select e1 FROM pm2.g1 WHERE vm1.g6.e3 = pm2.g1.e2)", example1(), //$NON-NLS-1$
- new String[] { "SELECT e1 FROM pm1.g1" }); //$NON-NLS-1$
- checkNodeTypes(plan, new int[] {
- 1, // Access
- 0, // DependentAccess
- 1, // DependentSelect
- 0, // DependentProject
- 0, // DupRemove
- 0, // Grouping
- 0, // NestedLoopJoinStrategy
- 0, // MergeJoinStrategy
- 0, // Null
- 0, // PlanExecution
- 1, // Project
- 0, // Select
- 0, // Sort
- 0 // UnionAll
- });
- }
-
- public void testCorrelatedSubqueryVirtualLayer2() {
- ProcessorPlan plan = helpPlan("Select e1 from vm1.g6 where e1 in (select e1 FROM pm2.g1 WHERE vm1.g6.e4 = pm2.g1.e4)", example1(), //$NON-NLS-1$
- new String[] { "SELECT e1, e2, e4 FROM pm1.g1" }); //$NON-NLS-1$
- checkNodeTypes(plan, new int[] {
- 1, // Access
- 0, // DependentAccess
- 1, // DependentSelect
- 0, // DependentProject
- 0, // DupRemove
- 0, // Grouping
- 0, // NestedLoopJoinStrategy
- 0, // MergeJoinStrategy
- 0, // Null
- 0, // PlanExecution
- 1, // Project
- 0, // Select
- 0, // Sort
- 0 // UnionAll
- });
- }
-
- public void testCorrelatedSubqueryVirtualLayer3() {
- ProcessorPlan plan = helpPlan("Select e1, (select e1 FROM pm2.g1 WHERE vm1.g6.e4 = pm2.g1.e4) from vm1.g6", example1(), //$NON-NLS-1$
- new String[] { "SELECT e1, e2, e4 FROM pm1.g1" }); //$NON-NLS-1$
- checkNodeTypes(plan, new int[] {
- 1, // Access
- 0, // DependentAccess
- 0, // DependentSelect
- 1, // DependentProject
- 0, // DupRemove
- 0, // Grouping
- 0, // NestedLoopJoinStrategy
- 0, // MergeJoinStrategy
- 0, // Null
- 0, // PlanExecution
- 0, // Project
- 0, // Select
- 0, // Sort
- 0 // UnionAll
- });
- checkSubPlanCount(plan, 1);
- }
-
- public void testCorrelatedSubqueryInTransformation2() {
- String sql = "Select * from vm1.g20"; //$NON-NLS-1$
- ProcessorPlan plan = helpPlan(sql, FakeMetadataFactory.example1Cached(),
- new String[] { "SELECT pm1.g1.e1, pm1.g1.e2, pm1.g1.e3, pm1.g1.e4 FROM pm1.g1" }); //$NON-NLS-1$
- checkNodeTypes(plan, new int[] {
- 1, // Access
- 0, // DependentAccess
- 1, // DependentSelect
- 0, // DependentProject
- 0, // DupRemove
- 0, // Grouping
- 0, // NestedLoopJoinStrategy
- 0, // MergeJoinStrategy
- 0, // Null
- 0, // PlanExecution
- 1, // Project
- 0, // Select
- 0, // Sort
- 0 // UnionAll
- });
- }
public void testTempGroup() {
ProcessorPlan plan = helpPlan("select e1 from tm1.g1 where e1 = 'x'", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
@@ -3163,455 +3033,6 @@
checkNodeTypes(plan, FULL_PUSHDOWN);
}
- /**
- * Check that subquery is not pushed if the subquery cannot all be pushed to the source.
- */
- public void testNoPushSubqueryInWhereClause1() {
- FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
- BasicSourceCapabilities caps = getTypicalCapabilities();
- caps.setCapabilitySupport(Capability.QUERY_WHERE_IN_SUBQUERY, true);
- caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, false);
- capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
-
- ProcessorPlan plan = helpPlan("Select e1 from pm1.g1 where e1 in (select max(e1) FROM pm1.g2)", example1(), //$NON-NLS-1$
- null, capFinder,
- new String[] { "SELECT e1 FROM pm1.g1" }, SHOULD_SUCCEED); //$NON-NLS-1$
- checkNodeTypes(plan, new int[] {
- 1, // Access
- 0, // DependentAccess
- 1, // DependentSelect
- 0, // DependentProject
- 0, // DupRemove
- 0, // Grouping
- 0, // NestedLoopJoinStrategy
- 0, // MergeJoinStrategy
- 0, // Null
- 0, // PlanExecution
- 1, // Project
- 0, // Select
- 0, // Sort
- 0 // UnionAll
- });
- }
-
- /**
- * Check that subquery is not pushed if the subquery is from a different model
- * than the outer query.
- */
- public void testNoPushSubqueryInWhereClause2() {
- FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
- BasicSourceCapabilities caps = getTypicalCapabilities();
- caps.setCapabilitySupport(Capability.QUERY_WHERE_IN_SUBQUERY, true);
- capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- capFinder.addCapabilities("pm2", getTypicalCapabilities()); //$NON-NLS-1$
-
- ProcessorPlan plan = helpPlan("Select e1 from pm1.g1 where e1 in (select e1 FROM pm2.g1)", example1(), //$NON-NLS-1$
- null, capFinder,
- new String[] { "SELECT e1 FROM pm1.g1" }, SHOULD_SUCCEED); //$NON-NLS-1$
- checkNodeTypes(plan, new int[] {
- 1, // Access
- 0, // DependentAccess
- 1, // DependentSelect
- 0, // DependentProject
- 0, // DupRemove
- 0, // Grouping
- 0, // NestedLoopJoinStrategy
- 0, // MergeJoinStrategy
- 0, // Null
- 0, // PlanExecution
- 1, // Project
- 0, // Select
- 0, // Sort
- 0 // UnionAll
- });
- }
-
- /**
- * Do not support XML query as subquery
- * Check that subquery is not pushed if the subquery is not relational.
- */
- public void defer_testNoPushSubqueryInWhereClause3() {
- FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
- BasicSourceCapabilities caps = new BasicSourceCapabilities();
- caps.setCapabilitySupport(Capability.QUERY_WHERE, true);
- caps.setCapabilitySupport(Capability.QUERY_WHERE_IN, true);
- caps.setCapabilitySupport(Capability.QUERY_WHERE_IN_SUBQUERY, true);
- capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- capFinder.addCapabilities("pm2", new BasicSourceCapabilities()); //$NON-NLS-1$
-
- ProcessorPlan plan = helpPlan("Select e1 from pm1.g1 where e1 in (select * from xmltest.doc1)", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
- null, capFinder,
- new String[] { "SELECT e1 FROM pm1.g1" }, SHOULD_SUCCEED); //$NON-NLS-1$
- checkNodeTypes(plan, new int[] {
- 1, // Access
- 0, // DependentAccess
- 1, // DependentSelect
- 0, // DependentProject
- 0, // DupRemove
- 0, // Grouping
- 0, // NestedLoopJoinStrategy
- 0, // MergeJoinStrategy
- 0, // Null
- 0, // PlanExecution
- 1, // Project
- 0, // Select
- 0, // Sort
- 0 // UnionAll
- });
- }
-
- /**
- * Check that subquery is not pushed if the subquery has a function that can't be pushed
- * in the SELECT clause
- */
- public void testNoPushSubqueryInWhereClause4() {
- FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
- BasicSourceCapabilities caps = new BasicSourceCapabilities();
- caps.setCapabilitySupport(Capability.QUERY_WHERE, true);
- caps.setCapabilitySupport(Capability.QUERY_WHERE_IN, true);
- caps.setCapabilitySupport(Capability.QUERY_WHERE_IN_SUBQUERY, true);
- capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- capFinder.addCapabilities("pm2", new BasicSourceCapabilities()); //$NON-NLS-1$
-
- ProcessorPlan plan = helpPlan("Select e1 from pm1.g1 where e1 in (SELECT ltrim(e1) FROM pm1.g2)", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
- null, capFinder,
- new String[] { "SELECT e1 FROM pm1.g1" }, SHOULD_SUCCEED); //$NON-NLS-1$
- checkNodeTypes(plan, new int[] {
- 1, // Access
- 0, // DependentAccess
- 1, // DependentSelect
- 0, // DependentProject
- 0, // DupRemove
- 0, // Grouping
- 0, // NestedLoopJoinStrategy
- 0, // MergeJoinStrategy
- 0, // Null
- 0, // PlanExecution
- 1, // Project
- 0, // Select
- 0, // Sort
- 0 // UnionAll
- });
- }
-
- /**
- * Check that subquery is not pushed if the subquery selects a constant value
- */
- public void testNoPushSubqueryInWhereClause5() {
- FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
- BasicSourceCapabilities caps = new BasicSourceCapabilities();
- caps.setCapabilitySupport(Capability.QUERY_WHERE, true);
- caps.setCapabilitySupport(Capability.QUERY_WHERE_IN, true);
- caps.setCapabilitySupport(Capability.QUERY_WHERE_IN_SUBQUERY, true);
- capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- capFinder.addCapabilities("pm2", new BasicSourceCapabilities()); //$NON-NLS-1$
-
- ProcessorPlan plan = helpPlan("Select e1 from pm1.g1 where e1 in (SELECT 'xyz' FROM pm1.g2)", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
- null, capFinder,
- new String[] { "SELECT e1 FROM pm1.g1" }, SHOULD_SUCCEED); //$NON-NLS-1$
- checkNodeTypes(plan, new int[] {
- 1, // Access
- 0, // DependentAccess
- 1, // DependentSelect
- 0, // DependentProject
- 0, // DupRemove
- 0, // Grouping
- 0, // NestedLoopJoinStrategy
- 0, // MergeJoinStrategy
- 0, // Null
- 0, // PlanExecution
- 1, // Project
- 0, // Select
- 0, // Sort
- 0 // UnionAll
- });
- }
-
- /**
- * Check that subquery is not pushed if the subquery does ORDER BY
- */
- public void testNoPushSubqueryInWhereClause6() {
- FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
- BasicSourceCapabilities caps = new BasicSourceCapabilities();
- caps.setCapabilitySupport(Capability.QUERY_WHERE, true);
- caps.setCapabilitySupport(Capability.QUERY_WHERE_IN, true);
- caps.setCapabilitySupport(Capability.QUERY_WHERE_IN_SUBQUERY, true);
- capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- capFinder.addCapabilities("pm2", new BasicSourceCapabilities()); //$NON-NLS-1$
-
- ProcessorPlan plan = helpPlan("Select e1 from pm1.g1 where e1 in (SELECT e1 FROM pm1.g2 ORDER BY e1)", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
- null, capFinder,
- new String[] { "SELECT e1 FROM pm1.g1" }, SHOULD_SUCCEED); //$NON-NLS-1$
- checkNodeTypes(plan, new int[] {
- 1, // Access
- 0, // DependentAccess
- 1, // DependentSelect
- 0, // DependentProject
- 0, // DupRemove
- 0, // Grouping
- 0, // NestedLoopJoinStrategy
- 0, // MergeJoinStrategy
- 0, // Null
- 0, // PlanExecution
- 1, // Project
- 0, // Select
- 0, // Sort
- 0 // UnionAll
- });
- }
-
- /**
- * Check that subquery is not pushed if the subquery has a function that can't be pushed
- * in the SELECT clause
- */
- public void testNoPushSubqueryInWhereClause7() {
- FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
- BasicSourceCapabilities caps = new BasicSourceCapabilities();
- caps.setCapabilitySupport(Capability.QUERY_WHERE, true);
- caps.setCapabilitySupport(Capability.QUERY_WHERE_IN, true);
- caps.setCapabilitySupport(Capability.QUERY_WHERE_IN_SUBQUERY, true);
- caps.setCapabilitySupport(Capability.FUNCTION, true);
- caps.setFunctionSupport("ltrim", true); //$NON-NLS-1$
- capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- capFinder.addCapabilities("pm2", new BasicSourceCapabilities()); //$NON-NLS-1$
-
- ProcessorPlan plan = helpPlan("Select e1 from pm1.g1 where e1 in (SELECT rtrim(ltrim(e1)) FROM pm1.g2)", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
- null, capFinder,
- new String[] { "SELECT e1 FROM pm1.g1" }, SHOULD_SUCCEED); //$NON-NLS-1$
- checkNodeTypes(plan, new int[] {
- 1, // Access
- 0, // DependentAccess
- 1, // DependentSelect
- 0, // DependentProject
- 0, // DupRemove
- 0, // Grouping
- 0, // NestedLoopJoinStrategy
- 0, // MergeJoinStrategy
- 0, // Null
- 0, // PlanExecution
- 1, // Project
- 0, // Select
- 0, // Sort
- 0 // UnionAll
- });
-
- checkSubPlanCount(plan, 1);
-
- }
-
- /**
- * Check that subquery is not pushed if the subquery holds non-query access node.
- */
- public void testNoPushSubqueryInWhereClause8() {
- FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
- BasicSourceCapabilities caps = new BasicSourceCapabilities();
- caps.setCapabilitySupport(Capability.QUERY_WHERE, true);
- caps.setCapabilitySupport(Capability.QUERY_WHERE_IN, true);
- caps.setCapabilitySupport(Capability.QUERY_WHERE_IN_SUBQUERY, true);
- capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- capFinder.addCapabilities("pm2", new BasicSourceCapabilities()); //$NON-NLS-1$
-
- ProcessorPlan plan = helpPlan("Select e1 from pm1.g1 where e1 in (EXEC pm1.sqsp1())", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
- null, capFinder,
- new String[] { "SELECT e1 FROM pm1.g1" }, SHOULD_SUCCEED); //$NON-NLS-1$
- checkNodeTypes(plan, new int[] {
- 1, // Access
- 0, // DependentAccess
- 1, // DependentSelect
- 0, // DependentProject
- 0, // DupRemove
- 0, // Grouping
- 0, // NestedLoopJoinStrategy
- 0, // MergeJoinStrategy
- 0, // Null
- 0, // PlanExecution
- 1, // Project
- 0, // Select
- 0, // Sort
- 0 // UnionAll
- });
- }
-
- /**
- * Check that subquery is not pushed if the subquery is correlated and correlated not supported
- */
- public void testNoPushSubqueryInWhereClause9() {
- FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
- BasicSourceCapabilities caps = new BasicSourceCapabilities();
- caps.setCapabilitySupport(Capability.QUERY_WHERE, true);
- caps.setCapabilitySupport(Capability.QUERY_WHERE_IN, true);
- caps.setCapabilitySupport(Capability.QUERY_WHERE_IN_SUBQUERY, true);
- caps.setCapabilitySupport(Capability.QUERY_SUBQUERIES_CORRELATED, false);
- capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
-
- ProcessorPlan plan = helpPlan("Select e1 from pm1.g1 where e1 in (SELECT pm1.g2.e1 FROM pm1.g2 WHERE pm1.g2.e1 = pm1.g1.e1)", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
- null, capFinder,
- new String[] { "SELECT e1 FROM pm1.g1" }, SHOULD_SUCCEED); //$NON-NLS-1$
- checkNodeTypes(plan, new int[] {
- 1, // Access
- 0, // DependentAccess
- 1, // DependentSelect
- 0, // DependentProject
- 0, // DupRemove
- 0, // Grouping
- 0, // NestedLoopJoinStrategy
- 0, // MergeJoinStrategy
- 0, // Null
- 0, // PlanExecution
- 1, // Project
- 0, // Select
- 0, // Sort
- 0 // UnionAll
- });
- }
-
- public void testPushCorrelatedSubquery1() {
- FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
- BasicSourceCapabilities caps = new BasicSourceCapabilities();
- caps.setCapabilitySupport(Capability.QUERY_WHERE, true);
- caps.setCapabilitySupport(Capability.QUERY_WHERE_COMPARE, true);
- caps.setCapabilitySupport(Capability.QUERY_WHERE_COMPARE_EQ, true);
- caps.setCapabilitySupport(Capability.QUERY_WHERE_QUANTIFIED_COMPARISON, true);
- caps.setCapabilitySupport(Capability.QUERY_WHERE_QUANTIFIED_ALL, true);
- caps.setCapabilitySupport(Capability.QUERY_WHERE_QUANTIFIED_SOME, true);
- caps.setCapabilitySupport(Capability.QUERY_WHERE_IN, true);
- caps.setCapabilitySupport(Capability.QUERY_WHERE_IN_SUBQUERY, true);
- caps.setCapabilitySupport(Capability.QUERY_SUBQUERIES_SCALAR, true);
- caps.setCapabilitySupport(Capability.QUERY_SUBQUERIES_CORRELATED, true);
- caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, true);
- caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_MAX, true);
- caps.setCapabilitySupport(Capability.QUERY_FROM_GROUP_ALIAS, true);
- capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
-
- ProcessorPlan plan = helpPlan("SELECT intkey FROM bqt1.smalla AS n WHERE intkey = (SELECT MAX(intkey) FROM bqt1.smallb AS s WHERE s.stringkey = n.stringkey )", FakeMetadataFactory.exampleBQTCached(), //$NON-NLS-1$
- null, capFinder,
- new String[] { "SELECT intkey FROM bqt1.smalla AS n WHERE intkey = (SELECT MAX(intkey) FROM bqt1.smallb AS s WHERE s.stringkey = n.stringkey)" }, SHOULD_SUCCEED); //$NON-NLS-1$
- checkNodeTypes(plan, FULL_PUSHDOWN);
- }
-
- public void testPushCorrelatedSubquery2() {
- FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
- BasicSourceCapabilities caps = new BasicSourceCapabilities();
- caps.setCapabilitySupport(Capability.QUERY_WHERE, true);
- caps.setCapabilitySupport(Capability.QUERY_WHERE_AND, true);
- caps.setCapabilitySupport(Capability.QUERY_WHERE_COMPARE, true);
- caps.setCapabilitySupport(Capability.QUERY_WHERE_COMPARE_EQ, true);
- caps.setCapabilitySupport(Capability.QUERY_WHERE_LIKE, true);
- caps.setCapabilitySupport(Capability.QUERY_WHERE_QUANTIFIED_COMPARISON, true);
- caps.setCapabilitySupport(Capability.QUERY_WHERE_QUANTIFIED_ALL, true);
- caps.setCapabilitySupport(Capability.QUERY_WHERE_QUANTIFIED_SOME, true);
- caps.setCapabilitySupport(Capability.QUERY_WHERE_IN, true);
- caps.setCapabilitySupport(Capability.QUERY_WHERE_IN_SUBQUERY, true);
- caps.setCapabilitySupport(Capability.QUERY_SUBQUERIES_SCALAR, true);
- caps.setCapabilitySupport(Capability.QUERY_SUBQUERIES_CORRELATED, true);
- caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, true);
- caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_MAX, true);
- caps.setCapabilitySupport(Capability.QUERY_FROM_GROUP_ALIAS, true);
- caps.setCapabilitySupport(Capability.QUERY_FROM_JOIN, true);
- caps.setCapabilitySupport(Capability.QUERY_FROM_JOIN_SELFJOIN, true);
- caps.setCapabilitySupport(Capability.FUNCTION, true);
- caps.setFunctionSupport(SourceSystemFunctions.CONCAT, true); //$NON-NLS-1$
- caps.setFunctionSupport("convert", true); //$NON-NLS-1$
- capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
-
- String sqlIn =
- "SELECT c37n.intkey " + //$NON-NLS-1$
- "FROM bqt1.mediuma AS c37n, bqt1.smallb AS m37n " + //$NON-NLS-1$
- "WHERE (m37n.stringkey LIKE '%0') AND " + //$NON-NLS-1$
- "(c37n.stringkey = ('1' || (m37n.intkey || '0'))) AND " + //$NON-NLS-1$
- "(c37n.datevalue = (" + //$NON-NLS-1$
- "SELECT MAX(c37s.datevalue) " + //$NON-NLS-1$
- "FROM bqt1.mediuma AS c37s, bqt1.smallb AS m37s " + //$NON-NLS-1$
- "WHERE (m37s.stringkey LIKE '%0') AND " + //$NON-NLS-1$
- "(c37s.stringkey = ('1' || (m37s.intkey || '0'))) AND " + //$NON-NLS-1$
- "(m37s.stringkey = m37n.stringkey) ))"; //$NON-NLS-1$
-
- String sqlOut = "SELECT c37n.intkey FROM bqt1.mediuma AS c37n, bqt1.smallb AS m37n WHERE (c37n.datevalue = (SELECT MAX(c37s.datevalue) FROM bqt1.mediuma AS c37s, bqt1.smallb AS m37s WHERE (c37s.stringkey = ('1' || (m37s.intkey || '0'))) AND (m37s.stringkey LIKE '%0') AND (m37s.stringkey = m37n.stringkey))) AND (c37n.stringkey = ('1' || (m37n.intkey || '0'))) AND (m37n.stringkey LIKE '%0')"; //$NON-NLS-1$
-
- ProcessorPlan plan = helpPlan(sqlIn, FakeMetadataFactory.exampleBQTCached(),
- null, capFinder,
- new String[] { sqlOut }, SHOULD_SUCCEED);
- checkNodeTypes(plan, FULL_PUSHDOWN);
- }
-
- public void testPushCorrelatedSubquery3() {
- FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
- BasicSourceCapabilities caps = new BasicSourceCapabilities();
- caps.setCapabilitySupport(Capability.QUERY_WHERE, true);
- caps.setCapabilitySupport(Capability.QUERY_WHERE_AND, true);
- caps.setCapabilitySupport(Capability.QUERY_WHERE_COMPARE, true);
- caps.setCapabilitySupport(Capability.QUERY_WHERE_COMPARE_EQ, true);
- caps.setCapabilitySupport(Capability.QUERY_WHERE_LIKE, true);
- caps.setCapabilitySupport(Capability.QUERY_WHERE_QUANTIFIED_COMPARISON, true);
- caps.setCapabilitySupport(Capability.QUERY_WHERE_QUANTIFIED_ALL, true);
- caps.setCapabilitySupport(Capability.QUERY_WHERE_QUANTIFIED_SOME, true);
- caps.setCapabilitySupport(Capability.QUERY_WHERE_IN, true);
- caps.setCapabilitySupport(Capability.QUERY_WHERE_IN_SUBQUERY, true);
- caps.setCapabilitySupport(Capability.QUERY_SUBQUERIES_SCALAR, true);
- caps.setCapabilitySupport(Capability.QUERY_SUBQUERIES_CORRELATED, true);
- caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, true);
- caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_MAX, true);
- caps.setCapabilitySupport(Capability.QUERY_FROM_GROUP_ALIAS, true);
- caps.setCapabilitySupport(Capability.QUERY_FROM_JOIN, true);
- caps.setCapabilitySupport(Capability.QUERY_FROM_JOIN_SELFJOIN, true);
- caps.setCapabilitySupport(Capability.FUNCTION, true);
- caps.setFunctionSupport("||", true); //$NON-NLS-1$
- caps.setFunctionSupport("convert", true); //$NON-NLS-1$
- capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
-
- String sqlIn =
- "SELECT intkey " + //$NON-NLS-1$
- "FROM vqt.smalla AS e " + //$NON-NLS-1$
- "WHERE (stringkey = 'VOD.L') AND " + //$NON-NLS-1$
- "(datevalue = (" + //$NON-NLS-1$
- "SELECT MAX(datevalue) " + //$NON-NLS-1$
- "FROM vqt.smalla " + //$NON-NLS-1$
- "WHERE (stringkey = e.stringkey) ))"; //$NON-NLS-1$
-
- String sqlOut =
- "SELECT SmallA__1.IntKey FROM BQT1.SmallA AS SmallA__1 WHERE (SmallA__1.StringKey = 'VOD.L') AND (SmallA__1.DateValue = (SELECT MAX(BQT1.SmallA.DateValue) FROM BQT1.SmallA WHERE BQT1.SmallA.StringKey = SmallA__1.StringKey))"; //$NON-NLS-1$
-
- ProcessorPlan plan = helpPlan(sqlIn, FakeMetadataFactory.exampleBQTCached(),
- null, capFinder,
- new String[] { sqlOut }, SHOULD_SUCCEED);
- checkNodeTypes(plan, FULL_PUSHDOWN);
- }
-
- /**
- * Check that scalar subquery in select is pushed
- */
- public void DEFER_testPushSubqueryInSelectClause1() {
- FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
- BasicSourceCapabilities caps = new BasicSourceCapabilities();
- caps.setCapabilitySupport(Capability.QUERY_WHERE, true);
- caps.setCapabilitySupport(Capability.QUERY_WHERE_COMPARE, true);
- caps.setCapabilitySupport(Capability.QUERY_WHERE_COMPARE_EQ, true);
- caps.setCapabilitySupport(Capability.QUERY_FROM_GROUP_ALIAS, true);
- caps.setCapabilitySupport(Capability.QUERY_SUBQUERIES_CORRELATED, true);
- caps.setCapabilitySupport(Capability.QUERY_SUBQUERIES_SCALAR, true);
- capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
-
- ProcessorPlan plan = helpPlan("SELECT stringkey, (SELECT intkey FROM BQT1.SmallA AS b WHERE Intnum = 22) FROM BQT1.SmallA", FakeMetadataFactory.exampleBQTCached(), //$NON-NLS-1$
- null, capFinder,
- new String[] { "SELECT stringkey, (SELECT intkey FROM BQT1.SmallA AS b WHERE Intnum = 22) FROM BQT1.SmallA" }, SHOULD_SUCCEED); //$NON-NLS-1$
- checkNodeTypes(plan, new int[] {
- 1, // Access
- 0, // DependentAccess
- 0, // DependentSelect
- 0, // DependentProject
- 0, // DupRemove
- 0, // Grouping
- 0, // NestedLoopJoinStrategy
- 0, // MergeJoinStrategy
- 0, // Null
- 0, // PlanExecution
- 1, // Project
- 0, // Select
- 0, // Sort
- 0 // UnionAll
- });
- }
-
/** Case 1456, defect 10492*/
public void testAliasingDefect1(){
// Create query
@@ -6740,7 +6161,7 @@
ProcessorPlan plan = helpPlan(
"select a.e1, b.e1 from vm2.g1 a, vm2.g1 b where a.e1 = b.e1 and a.e2 in (select e2 from vm1.g1)", //$NON-NLS-1$
- metadata, null, capFinder, new String[] {"SELECT g_1.e1, g_3.e1 FROM pm1.g1 AS g_0, pm1.g2 AS g_1, pm1.g1 AS g_2, pm1.g2 AS g_3 WHERE (g_1.e1 = g_3.e1) AND (g_1.e2 IN (SELECT g_4.e2 FROM pm1.g1 AS g_4)) AND (g_0.e2 = g_1.e2) AND (g_2.e2 = g_3.e2)"}, true); //$NON-NLS-1$
+ metadata, null, capFinder, new String[] {"SELECT g_1.e1, g_3.e1 FROM pm1.g1 AS g_0, pm1.g2 AS g_1, pm1.g1 AS g_2, pm1.g2 AS g_3 WHERE (g_1.e1 = g_3.e1) AND (g_0.e2 = g_1.e2) AND (g_1.e2 IN (SELECT g_4.e2 FROM pm1.g1 AS g_4)) AND (g_2.e2 = g_3.e2)"}, true); //$NON-NLS-1$
checkNodeTypes(plan, FULL_PUSHDOWN);
Added: trunk/engine/src/test/java/com/metamatrix/query/optimizer/TestSubqueryPushdown.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/query/optimizer/TestSubqueryPushdown.java (rev 0)
+++ trunk/engine/src/test/java/com/metamatrix/query/optimizer/TestSubqueryPushdown.java 2009-04-13 01:32:50 UTC (rev 762)
@@ -0,0 +1,694 @@
+/*
+ * 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 com.metamatrix.query.optimizer;
+
+import static com.metamatrix.query.optimizer.TestOptimizer.*;
+
+import org.junit.Test;
+import org.teiid.connector.api.SourceSystemFunctions;
+
+import com.metamatrix.query.optimizer.capabilities.BasicSourceCapabilities;
+import com.metamatrix.query.optimizer.capabilities.FakeCapabilitiesFinder;
+import com.metamatrix.query.optimizer.capabilities.SourceCapabilities.Capability;
+import com.metamatrix.query.processor.ProcessorPlan;
+import com.metamatrix.query.unittest.FakeMetadataFacade;
+import com.metamatrix.query.unittest.FakeMetadataFactory;
+
+public class TestSubqueryPushdown {
+
+ @Test public void testPushSubqueryBelowVirtual() throws Exception {
+ String sql = "select g3.e1 from (select e1, max(e2) y from pm1.g1 group by e1) x, pm1.g3 where exists (select e1 from pm1.g2 where x.e1 = e1)"; //$NON-NLS-1$
+
+ // Create capabilities
+ FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
+ BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();
+ caps.setCapabilitySupport(Capability.QUERY_SUBQUERIES_CORRELATED, true);
+ caps.setCapabilitySupport(Capability.QUERY_WHERE_EXISTS, true);
+ capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
+
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+
+ // Plan query
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, metadata,
+ null, capFinder,
+ new String[] { "SELECT g_0.e1 FROM pm1.g1 AS g_0 WHERE EXISTS (SELECT g_1.e1 FROM pm1.g2 AS g_1 WHERE g_1.e1 = g_0.e1)", //$NON-NLS-1$
+ "SELECT g_0.e1 FROM pm1.g3 AS g_0" }, //$NON-NLS-1$
+ TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING);
+ TestOptimizer.checkNodeTypes(plan, new int[] {
+ 2, // Access
+ 0, // DependentAccess
+ 0, // DependentSelect
+ 0, // DependentProject
+ 0, // DupRemove
+ 1, // Grouping
+ 1, // NestedLoopJoinStrategy
+ 0, // MergeJoinStrategy
+ 0, // Null
+ 0, // PlanExecution
+ 2, // Project
+ 0, // Select
+ 0, // Sort
+ 0 // UnionAll
+ });
+ }
+
+ /**
+ * Same as above, but using a correlated variable based on an aggregate
+ * @throws Exception
+ */
+ @Test public void testDontPushSubqueryBelowVirtual() throws Exception {
+ String sql = "select g3.e1 from (select e1, max(e2) y from pm1.g1 group by e1) x, pm1.g3 where exists (select e1 from pm1.g2 where x.y = e1)"; //$NON-NLS-1$
+
+ // Create capabilities
+ FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
+ BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();
+ caps.setCapabilitySupport(Capability.QUERY_SUBQUERIES_CORRELATED, true);
+ caps.setCapabilitySupport(Capability.QUERY_WHERE_EXISTS, true);
+ capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
+
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+
+ // Plan query
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, metadata,
+ null, capFinder,
+ new String[] { "SELECT g_0.e1 FROM pm1.g3 AS g_0", //$NON-NLS-1$
+ "SELECT g_0.e1, g_0.e2 FROM pm1.g1 AS g_0" }, //$NON-NLS-1$
+ TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING);
+ TestOptimizer.checkNodeTypes(plan, new int[] {
+ 2, // Access
+ 0, // DependentAccess
+ 1, // DependentSelect
+ 0, // DependentProject
+ 0, // DupRemove
+ 1, // Grouping
+ 1, // NestedLoopJoinStrategy
+ 0, // MergeJoinStrategy
+ 0, // Null
+ 0, // PlanExecution
+ 2, // Project
+ 0, // Select
+ 0, // Sort
+ 0 // UnionAll
+ });
+ }
+
+ @Test public void testPushCorrelatedSubquery1() {
+ FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
+ BasicSourceCapabilities caps = new BasicSourceCapabilities();
+ caps.setCapabilitySupport(Capability.QUERY_WHERE, true);
+ caps.setCapabilitySupport(Capability.QUERY_WHERE_COMPARE, true);
+ caps.setCapabilitySupport(Capability.QUERY_WHERE_COMPARE_EQ, true);
+ caps.setCapabilitySupport(Capability.QUERY_WHERE_QUANTIFIED_COMPARISON, true);
+ caps.setCapabilitySupport(Capability.QUERY_WHERE_QUANTIFIED_ALL, true);
+ caps.setCapabilitySupport(Capability.QUERY_WHERE_QUANTIFIED_SOME, true);
+ caps.setCapabilitySupport(Capability.QUERY_WHERE_IN, true);
+ caps.setCapabilitySupport(Capability.QUERY_WHERE_IN_SUBQUERY, true);
+ caps.setCapabilitySupport(Capability.QUERY_SUBQUERIES_SCALAR, true);
+ caps.setCapabilitySupport(Capability.QUERY_SUBQUERIES_CORRELATED, true);
+ caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, true);
+ caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_MAX, true);
+ caps.setCapabilitySupport(Capability.QUERY_FROM_GROUP_ALIAS, true);
+ capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
+
+ ProcessorPlan plan = helpPlan("SELECT intkey FROM bqt1.smalla AS n WHERE intkey = (SELECT MAX(intkey) FROM bqt1.smallb AS s WHERE s.stringkey = n.stringkey )", FakeMetadataFactory.exampleBQTCached(), //$NON-NLS-1$
+ null, capFinder,
+ new String[] { "SELECT intkey FROM bqt1.smalla AS n WHERE intkey = (SELECT MAX(intkey) FROM bqt1.smallb AS s WHERE s.stringkey = n.stringkey)" }, SHOULD_SUCCEED); //$NON-NLS-1$
+ checkNodeTypes(plan, FULL_PUSHDOWN);
+ }
+
+ @Test public void testPushCorrelatedSubquery2() {
+ FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
+ BasicSourceCapabilities caps = new BasicSourceCapabilities();
+ caps.setCapabilitySupport(Capability.QUERY_WHERE, true);
+ caps.setCapabilitySupport(Capability.QUERY_WHERE_AND, true);
+ caps.setCapabilitySupport(Capability.QUERY_WHERE_COMPARE, true);
+ caps.setCapabilitySupport(Capability.QUERY_WHERE_COMPARE_EQ, true);
+ caps.setCapabilitySupport(Capability.QUERY_WHERE_LIKE, true);
+ caps.setCapabilitySupport(Capability.QUERY_WHERE_QUANTIFIED_COMPARISON, true);
+ caps.setCapabilitySupport(Capability.QUERY_WHERE_QUANTIFIED_ALL, true);
+ caps.setCapabilitySupport(Capability.QUERY_WHERE_QUANTIFIED_SOME, true);
+ caps.setCapabilitySupport(Capability.QUERY_WHERE_IN, true);
+ caps.setCapabilitySupport(Capability.QUERY_WHERE_IN_SUBQUERY, true);
+ caps.setCapabilitySupport(Capability.QUERY_SUBQUERIES_SCALAR, true);
+ caps.setCapabilitySupport(Capability.QUERY_SUBQUERIES_CORRELATED, true);
+ caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, true);
+ caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_MAX, true);
+ caps.setCapabilitySupport(Capability.QUERY_FROM_GROUP_ALIAS, true);
+ caps.setCapabilitySupport(Capability.QUERY_FROM_JOIN, true);
+ caps.setCapabilitySupport(Capability.QUERY_FROM_JOIN_SELFJOIN, true);
+ caps.setCapabilitySupport(Capability.FUNCTION, true);
+ caps.setFunctionSupport(SourceSystemFunctions.CONCAT, true);
+ caps.setFunctionSupport("convert", true); //$NON-NLS-1$
+ capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
+
+ String sqlIn =
+ "SELECT c37n.intkey " + //$NON-NLS-1$
+ "FROM bqt1.mediuma AS c37n, bqt1.smallb AS m37n " + //$NON-NLS-1$
+ "WHERE (m37n.stringkey LIKE '%0') AND " + //$NON-NLS-1$
+ "(c37n.stringkey = ('1' || (m37n.intkey || '0'))) AND " + //$NON-NLS-1$
+ "(c37n.datevalue = (" + //$NON-NLS-1$
+ "SELECT MAX(c37s.datevalue) " + //$NON-NLS-1$
+ "FROM bqt1.mediuma AS c37s, bqt1.smallb AS m37s " + //$NON-NLS-1$
+ "WHERE (m37s.stringkey LIKE '%0') AND " + //$NON-NLS-1$
+ "(c37s.stringkey = ('1' || (m37s.intkey || '0'))) AND " + //$NON-NLS-1$
+ "(m37s.stringkey = m37n.stringkey) ))"; //$NON-NLS-1$
+
+ String sqlOut = "SELECT c37n.intkey FROM bqt1.mediuma AS c37n, bqt1.smallb AS m37n WHERE (c37n.datevalue = (SELECT MAX(c37s.datevalue) FROM bqt1.mediuma AS c37s, bqt1.smallb AS m37s WHERE (c37s.stringkey = ('1' || (m37s.intkey || '0'))) AND (m37s.stringkey LIKE '%0') AND (m37s.stringkey = m37n.stringkey))) AND (c37n.stringkey = ('1' || (m37n.intkey || '0'))) AND (m37n.stringkey LIKE '%0')"; //$NON-NLS-1$
+
+ ProcessorPlan plan = helpPlan(sqlIn, FakeMetadataFactory.exampleBQTCached(),
+ null, capFinder,
+ new String[] { sqlOut }, SHOULD_SUCCEED);
+ checkNodeTypes(plan, FULL_PUSHDOWN);
+ }
+
+ @Test public void testPushCorrelatedSubquery3() {
+ FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
+ BasicSourceCapabilities caps = new BasicSourceCapabilities();
+ caps.setCapabilitySupport(Capability.QUERY_WHERE, true);
+ caps.setCapabilitySupport(Capability.QUERY_WHERE_AND, true);
+ caps.setCapabilitySupport(Capability.QUERY_WHERE_COMPARE, true);
+ caps.setCapabilitySupport(Capability.QUERY_WHERE_COMPARE_EQ, true);
+ caps.setCapabilitySupport(Capability.QUERY_WHERE_LIKE, true);
+ caps.setCapabilitySupport(Capability.QUERY_WHERE_QUANTIFIED_COMPARISON, true);
+ caps.setCapabilitySupport(Capability.QUERY_WHERE_QUANTIFIED_ALL, true);
+ caps.setCapabilitySupport(Capability.QUERY_WHERE_QUANTIFIED_SOME, true);
+ caps.setCapabilitySupport(Capability.QUERY_WHERE_IN, true);
+ caps.setCapabilitySupport(Capability.QUERY_WHERE_IN_SUBQUERY, true);
+ caps.setCapabilitySupport(Capability.QUERY_SUBQUERIES_SCALAR, true);
+ caps.setCapabilitySupport(Capability.QUERY_SUBQUERIES_CORRELATED, true);
+ caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, true);
+ caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_MAX, true);
+ caps.setCapabilitySupport(Capability.QUERY_FROM_GROUP_ALIAS, true);
+ caps.setCapabilitySupport(Capability.QUERY_FROM_JOIN, true);
+ caps.setCapabilitySupport(Capability.QUERY_FROM_JOIN_SELFJOIN, true);
+ caps.setCapabilitySupport(Capability.FUNCTION, true);
+ caps.setFunctionSupport("||", true); //$NON-NLS-1$
+ caps.setFunctionSupport("convert", true); //$NON-NLS-1$
+ capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
+
+ String sqlIn =
+ "SELECT intkey " + //$NON-NLS-1$
+ "FROM vqt.smalla AS e " + //$NON-NLS-1$
+ "WHERE (stringkey = 'VOD.L') AND " + //$NON-NLS-1$
+ "(datevalue = (" + //$NON-NLS-1$
+ "SELECT MAX(datevalue) " + //$NON-NLS-1$
+ "FROM vqt.smalla " + //$NON-NLS-1$
+ "WHERE (stringkey = e.stringkey) ))"; //$NON-NLS-1$
+
+ String sqlOut =
+ "SELECT SmallA__1.IntKey FROM BQT1.SmallA AS SmallA__1 WHERE (SmallA__1.StringKey = 'VOD.L') AND (SmallA__1.DateValue = (SELECT MAX(BQT1.SmallA.DateValue) FROM BQT1.SmallA WHERE BQT1.SmallA.StringKey = SmallA__1.StringKey))"; //$NON-NLS-1$
+
+ ProcessorPlan plan = helpPlan(sqlIn, FakeMetadataFactory.exampleBQTCached(),
+ null, capFinder,
+ new String[] { sqlOut }, SHOULD_SUCCEED);
+ checkNodeTypes(plan, FULL_PUSHDOWN);
+ }
+
+ /**
+ * Check that scalar subquery in select is pushed
+ */
+ public void DEFER_testPushSubqueryInSelectClause1() {
+ FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
+ BasicSourceCapabilities caps = new BasicSourceCapabilities();
+ caps.setCapabilitySupport(Capability.QUERY_WHERE, true);
+ caps.setCapabilitySupport(Capability.QUERY_WHERE_COMPARE, true);
+ caps.setCapabilitySupport(Capability.QUERY_WHERE_COMPARE_EQ, true);
+ caps.setCapabilitySupport(Capability.QUERY_FROM_GROUP_ALIAS, true);
+ caps.setCapabilitySupport(Capability.QUERY_SUBQUERIES_CORRELATED, true);
+ caps.setCapabilitySupport(Capability.QUERY_SUBQUERIES_SCALAR, true);
+ capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
+
+ ProcessorPlan plan = helpPlan("SELECT stringkey, (SELECT intkey FROM BQT1.SmallA AS b WHERE Intnum = 22) FROM BQT1.SmallA", FakeMetadataFactory.exampleBQTCached(), //$NON-NLS-1$
+ null, capFinder,
+ new String[] { "SELECT stringkey, (SELECT intkey FROM BQT1.SmallA AS b WHERE Intnum = 22) FROM BQT1.SmallA" }, SHOULD_SUCCEED); //$NON-NLS-1$
+ checkNodeTypes(plan, new int[] {
+ 1, // Access
+ 0, // DependentAccess
+ 0, // DependentSelect
+ 0, // DependentProject
+ 0, // DupRemove
+ 0, // Grouping
+ 0, // NestedLoopJoinStrategy
+ 0, // MergeJoinStrategy
+ 0, // Null
+ 0, // PlanExecution
+ 1, // Project
+ 0, // Select
+ 0, // Sort
+ 0 // UnionAll
+ });
+ }
+
+ @Test public void testCorrelatedSubquery1() {
+ ProcessorPlan plan = helpPlan("Select e1 from pm1.g1 where e1 in (select e1 FROM pm2.g1 WHERE pm1.g1.e2 = pm2.g1.e2)", example1(), //$NON-NLS-1$
+ new String[] { "SELECT e1, pm1.g1.e2 FROM pm1.g1" }); //$NON-NLS-1$
+ checkNodeTypes(plan, new int[] {
+ 1, // Access
+ 0, // DependentAccess
+ 1, // DependentSelect
+ 0, // DependentProject
+ 0, // DupRemove
+ 0, // Grouping
+ 0, // NestedLoopJoinStrategy
+ 0, // MergeJoinStrategy
+ 0, // Null
+ 0, // PlanExecution
+ 1, // Project
+ 0, // Select
+ 0, // Sort
+ 0 // UnionAll
+ });
+
+ checkSubPlanCount(plan, 1);
+ }
+
+ @Test public void testCorrelatedSubquery2() {
+ ProcessorPlan plan = helpPlan("Select e1, (select e1 FROM pm2.g1 WHERE pm1.g1.e2 = pm2.g1.e2) from pm1.g1", example1(), //$NON-NLS-1$
+ new String[] { "SELECT e1, pm1.g1.e2 FROM pm1.g1" }); //$NON-NLS-1$
+ checkNodeTypes(plan, new int[] {
+ 1, // Access
+ 0, // DependentAccess
+ 0, // DependentSelect
+ 1, // DependentProject
+ 0, // DupRemove
+ 0, // Grouping
+ 0, // NestedLoopJoinStrategy
+ 0, // MergeJoinStrategy
+ 0, // Null
+ 0, // PlanExecution
+ 0, // Project
+ 0, // Select
+ 0, // Sort
+ 0 // UnionAll
+ });
+ }
+
+ @Test public void testCorrelatedSubqueryVirtualLayer1() {
+ ProcessorPlan plan = helpPlan("Select e1 from vm1.g6 where e1 in (select e1 FROM pm2.g1 WHERE vm1.g6.e3 = pm2.g1.e2)", example1(), //$NON-NLS-1$
+ new String[] { "SELECT e1 FROM pm1.g1" }); //$NON-NLS-1$
+ checkNodeTypes(plan, new int[] {
+ 1, // Access
+ 0, // DependentAccess
+ 1, // DependentSelect
+ 0, // DependentProject
+ 0, // DupRemove
+ 0, // Grouping
+ 0, // NestedLoopJoinStrategy
+ 0, // MergeJoinStrategy
+ 0, // Null
+ 0, // PlanExecution
+ 1, // Project
+ 0, // Select
+ 0, // Sort
+ 0 // UnionAll
+ });
+ }
+
+ @Test public void testCorrelatedSubqueryVirtualLayer2() {
+ ProcessorPlan plan = helpPlan("Select e1 from vm1.g6 where e1 in (select e1 FROM pm2.g1 WHERE vm1.g6.e4 = pm2.g1.e4)", example1(), //$NON-NLS-1$
+ new String[] { "SELECT e1, e2, e4 FROM pm1.g1" }); //$NON-NLS-1$
+ checkNodeTypes(plan, new int[] {
+ 1, // Access
+ 0, // DependentAccess
+ 1, // DependentSelect
+ 0, // DependentProject
+ 0, // DupRemove
+ 0, // Grouping
+ 0, // NestedLoopJoinStrategy
+ 0, // MergeJoinStrategy
+ 0, // Null
+ 0, // PlanExecution
+ 1, // Project
+ 0, // Select
+ 0, // Sort
+ 0 // UnionAll
+ });
+ }
+
+ @Test public void testCorrelatedSubqueryVirtualLayer3() {
+ ProcessorPlan plan = helpPlan("Select e1, (select e1 FROM pm2.g1 WHERE vm1.g6.e4 = pm2.g1.e4) from vm1.g6", example1(), //$NON-NLS-1$
+ new String[] { "SELECT e1, e2, e4 FROM pm1.g1" }); //$NON-NLS-1$
+ checkNodeTypes(plan, new int[] {
+ 1, // Access
+ 0, // DependentAccess
+ 0, // DependentSelect
+ 1, // DependentProject
+ 0, // DupRemove
+ 0, // Grouping
+ 0, // NestedLoopJoinStrategy
+ 0, // MergeJoinStrategy
+ 0, // Null
+ 0, // PlanExecution
+ 0, // Project
+ 0, // Select
+ 0, // Sort
+ 0 // UnionAll
+ });
+ checkSubPlanCount(plan, 1);
+ }
+
+ @Test public void testCorrelatedSubqueryInTransformation2() {
+ String sql = "Select * from vm1.g20"; //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan(sql, FakeMetadataFactory.example1Cached(),
+ new String[] { "SELECT pm1.g1.e1, pm1.g1.e2, pm1.g1.e3, pm1.g1.e4 FROM pm1.g1" }); //$NON-NLS-1$
+ checkNodeTypes(plan, new int[] {
+ 1, // Access
+ 0, // DependentAccess
+ 1, // DependentSelect
+ 0, // DependentProject
+ 0, // DupRemove
+ 0, // Grouping
+ 0, // NestedLoopJoinStrategy
+ 0, // MergeJoinStrategy
+ 0, // Null
+ 0, // PlanExecution
+ 1, // Project
+ 0, // Select
+ 0, // Sort
+ 0 // UnionAll
+ });
+ }
+
+ /**
+ * Check that subquery is not pushed if the subquery cannot all be pushed to the source.
+ */
+ @Test public void testNoPushSubqueryInWhereClause1() {
+ FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
+ BasicSourceCapabilities caps = getTypicalCapabilities();
+ caps.setCapabilitySupport(Capability.QUERY_WHERE_IN_SUBQUERY, true);
+ caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, false);
+ capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
+
+ ProcessorPlan plan = helpPlan("Select e1 from pm1.g1 where e1 in (select max(e1) FROM pm1.g2)", example1(), //$NON-NLS-1$
+ null, capFinder,
+ new String[] { "SELECT e1 FROM pm1.g1" }, SHOULD_SUCCEED); //$NON-NLS-1$
+ checkNodeTypes(plan, new int[] {
+ 1, // Access
+ 0, // DependentAccess
+ 1, // DependentSelect
+ 0, // DependentProject
+ 0, // DupRemove
+ 0, // Grouping
+ 0, // NestedLoopJoinStrategy
+ 0, // MergeJoinStrategy
+ 0, // Null
+ 0, // PlanExecution
+ 1, // Project
+ 0, // Select
+ 0, // Sort
+ 0 // UnionAll
+ });
+ }
+
+ /**
+ * Check that subquery is not pushed if the subquery is from a different model
+ * than the outer query.
+ */
+ @Test public void testNoPushSubqueryInWhereClause2() {
+ FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
+ BasicSourceCapabilities caps = getTypicalCapabilities();
+ caps.setCapabilitySupport(Capability.QUERY_WHERE_IN_SUBQUERY, true);
+ capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
+ capFinder.addCapabilities("pm2", getTypicalCapabilities()); //$NON-NLS-1$
+
+ ProcessorPlan plan = helpPlan("Select e1 from pm1.g1 where e1 in (select e1 FROM pm2.g1)", example1(), //$NON-NLS-1$
+ null, capFinder,
+ new String[] { "SELECT e1 FROM pm1.g1" }, SHOULD_SUCCEED); //$NON-NLS-1$
+ checkNodeTypes(plan, new int[] {
+ 1, // Access
+ 0, // DependentAccess
+ 1, // DependentSelect
+ 0, // DependentProject
+ 0, // DupRemove
+ 0, // Grouping
+ 0, // NestedLoopJoinStrategy
+ 0, // MergeJoinStrategy
+ 0, // Null
+ 0, // PlanExecution
+ 1, // Project
+ 0, // Select
+ 0, // Sort
+ 0 // UnionAll
+ });
+ }
+
+ /**
+ * Do not support XML query as subquery
+ * Check that subquery is not pushed if the subquery is not relational.
+ */
+ public void defer_testNoPushSubqueryInWhereClause3() {
+ FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
+ BasicSourceCapabilities caps = new BasicSourceCapabilities();
+ caps.setCapabilitySupport(Capability.QUERY_WHERE, true);
+ caps.setCapabilitySupport(Capability.QUERY_WHERE_IN, true);
+ caps.setCapabilitySupport(Capability.QUERY_WHERE_IN_SUBQUERY, true);
+ capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
+ capFinder.addCapabilities("pm2", new BasicSourceCapabilities()); //$NON-NLS-1$
+
+ ProcessorPlan plan = helpPlan("Select e1 from pm1.g1 where e1 in (select * from xmltest.doc1)", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ null, capFinder,
+ new String[] { "SELECT e1 FROM pm1.g1" }, SHOULD_SUCCEED); //$NON-NLS-1$
+ checkNodeTypes(plan, new int[] {
+ 1, // Access
+ 0, // DependentAccess
+ 1, // DependentSelect
+ 0, // DependentProject
+ 0, // DupRemove
+ 0, // Grouping
+ 0, // NestedLoopJoinStrategy
+ 0, // MergeJoinStrategy
+ 0, // Null
+ 0, // PlanExecution
+ 1, // Project
+ 0, // Select
+ 0, // Sort
+ 0 // UnionAll
+ });
+ }
+
+ /**
+ * Check that subquery is not pushed if the subquery has a function that can't be pushed
+ * in the SELECT clause
+ */
+ @Test public void testNoPushSubqueryInWhereClause4() {
+ FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
+ BasicSourceCapabilities caps = new BasicSourceCapabilities();
+ caps.setCapabilitySupport(Capability.QUERY_WHERE, true);
+ caps.setCapabilitySupport(Capability.QUERY_WHERE_IN, true);
+ caps.setCapabilitySupport(Capability.QUERY_WHERE_IN_SUBQUERY, true);
+ capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
+ capFinder.addCapabilities("pm2", new BasicSourceCapabilities()); //$NON-NLS-1$
+
+ ProcessorPlan plan = helpPlan("Select e1 from pm1.g1 where e1 in (SELECT ltrim(e1) FROM pm1.g2)", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ null, capFinder,
+ new String[] { "SELECT e1 FROM pm1.g1" }, SHOULD_SUCCEED); //$NON-NLS-1$
+ checkNodeTypes(plan, new int[] {
+ 1, // Access
+ 0, // DependentAccess
+ 1, // DependentSelect
+ 0, // DependentProject
+ 0, // DupRemove
+ 0, // Grouping
+ 0, // NestedLoopJoinStrategy
+ 0, // MergeJoinStrategy
+ 0, // Null
+ 0, // PlanExecution
+ 1, // Project
+ 0, // Select
+ 0, // Sort
+ 0 // UnionAll
+ });
+ }
+
+ /**
+ * Check that subquery is not pushed if the subquery selects a constant value
+ */
+ @Test public void testNoPushSubqueryInWhereClause5() {
+ FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
+ BasicSourceCapabilities caps = new BasicSourceCapabilities();
+ caps.setCapabilitySupport(Capability.QUERY_WHERE, true);
+ caps.setCapabilitySupport(Capability.QUERY_WHERE_IN, true);
+ caps.setCapabilitySupport(Capability.QUERY_WHERE_IN_SUBQUERY, true);
+ capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
+ capFinder.addCapabilities("pm2", new BasicSourceCapabilities()); //$NON-NLS-1$
+
+ ProcessorPlan plan = helpPlan("Select e1 from pm1.g1 where e1 in (SELECT 'xyz' FROM pm1.g2)", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ null, capFinder,
+ new String[] { "SELECT e1 FROM pm1.g1" }, SHOULD_SUCCEED); //$NON-NLS-1$
+ checkNodeTypes(plan, new int[] {
+ 1, // Access
+ 0, // DependentAccess
+ 1, // DependentSelect
+ 0, // DependentProject
+ 0, // DupRemove
+ 0, // Grouping
+ 0, // NestedLoopJoinStrategy
+ 0, // MergeJoinStrategy
+ 0, // Null
+ 0, // PlanExecution
+ 1, // Project
+ 0, // Select
+ 0, // Sort
+ 0 // UnionAll
+ });
+ }
+
+ /**
+ * Check that subquery is not pushed if the subquery does ORDER BY
+ */
+ @Test public void testNoPushSubqueryInWhereClause6() {
+ FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
+ BasicSourceCapabilities caps = new BasicSourceCapabilities();
+ caps.setCapabilitySupport(Capability.QUERY_WHERE, true);
+ caps.setCapabilitySupport(Capability.QUERY_WHERE_IN, true);
+ caps.setCapabilitySupport(Capability.QUERY_WHERE_IN_SUBQUERY, true);
+ capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
+ capFinder.addCapabilities("pm2", new BasicSourceCapabilities()); //$NON-NLS-1$
+
+ ProcessorPlan plan = helpPlan("Select e1 from pm1.g1 where e1 in (SELECT e1 FROM pm1.g2 ORDER BY e1)", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ null, capFinder,
+ new String[] { "SELECT e1 FROM pm1.g1" }, SHOULD_SUCCEED); //$NON-NLS-1$
+ checkNodeTypes(plan, new int[] {
+ 1, // Access
+ 0, // DependentAccess
+ 1, // DependentSelect
+ 0, // DependentProject
+ 0, // DupRemove
+ 0, // Grouping
+ 0, // NestedLoopJoinStrategy
+ 0, // MergeJoinStrategy
+ 0, // Null
+ 0, // PlanExecution
+ 1, // Project
+ 0, // Select
+ 0, // Sort
+ 0 // UnionAll
+ });
+ }
+
+ /**
+ * Check that subquery is not pushed if the subquery has a function that can't be pushed
+ * in the SELECT clause
+ */
+ @Test public void testNoPushSubqueryInWhereClause7() {
+ FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
+ BasicSourceCapabilities caps = new BasicSourceCapabilities();
+ caps.setCapabilitySupport(Capability.QUERY_WHERE, true);
+ caps.setCapabilitySupport(Capability.QUERY_WHERE_IN, true);
+ caps.setCapabilitySupport(Capability.QUERY_WHERE_IN_SUBQUERY, true);
+ caps.setCapabilitySupport(Capability.FUNCTION, true);
+ caps.setFunctionSupport("ltrim", true); //$NON-NLS-1$
+ capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
+ capFinder.addCapabilities("pm2", new BasicSourceCapabilities()); //$NON-NLS-1$
+
+ ProcessorPlan plan = helpPlan("Select e1 from pm1.g1 where e1 in (SELECT rtrim(ltrim(e1)) FROM pm1.g2)", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ null, capFinder,
+ new String[] { "SELECT e1 FROM pm1.g1" }, SHOULD_SUCCEED); //$NON-NLS-1$
+ checkNodeTypes(plan, new int[] {
+ 1, // Access
+ 0, // DependentAccess
+ 1, // DependentSelect
+ 0, // DependentProject
+ 0, // DupRemove
+ 0, // Grouping
+ 0, // NestedLoopJoinStrategy
+ 0, // MergeJoinStrategy
+ 0, // Null
+ 0, // PlanExecution
+ 1, // Project
+ 0, // Select
+ 0, // Sort
+ 0 // UnionAll
+ });
+
+ checkSubPlanCount(plan, 1);
+
+ }
+
+ /**
+ * Check that subquery is not pushed if the subquery holds non-query access node.
+ */
+ @Test public void testNoPushSubqueryInWhereClause8() {
+ FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
+ BasicSourceCapabilities caps = new BasicSourceCapabilities();
+ caps.setCapabilitySupport(Capability.QUERY_WHERE, true);
+ caps.setCapabilitySupport(Capability.QUERY_WHERE_IN, true);
+ caps.setCapabilitySupport(Capability.QUERY_WHERE_IN_SUBQUERY, true);
+ capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
+ capFinder.addCapabilities("pm2", new BasicSourceCapabilities()); //$NON-NLS-1$
+
+ ProcessorPlan plan = helpPlan("Select e1 from pm1.g1 where e1 in (EXEC pm1.sqsp1())", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ null, capFinder,
+ new String[] { "SELECT e1 FROM pm1.g1" }, SHOULD_SUCCEED); //$NON-NLS-1$
+ checkNodeTypes(plan, new int[] {
+ 1, // Access
+ 0, // DependentAccess
+ 1, // DependentSelect
+ 0, // DependentProject
+ 0, // DupRemove
+ 0, // Grouping
+ 0, // NestedLoopJoinStrategy
+ 0, // MergeJoinStrategy
+ 0, // Null
+ 0, // PlanExecution
+ 1, // Project
+ 0, // Select
+ 0, // Sort
+ 0 // UnionAll
+ });
+ }
+
+ /**
+ * Check that subquery is not pushed if the subquery is correlated and correlated not supported
+ */
+ @Test public void testNoPushSubqueryInWhereClause9() {
+ FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
+ BasicSourceCapabilities caps = new BasicSourceCapabilities();
+ caps.setCapabilitySupport(Capability.QUERY_WHERE, true);
+ caps.setCapabilitySupport(Capability.QUERY_WHERE_IN, true);
+ caps.setCapabilitySupport(Capability.QUERY_WHERE_IN_SUBQUERY, true);
+ caps.setCapabilitySupport(Capability.QUERY_SUBQUERIES_CORRELATED, false);
+ capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
+
+ ProcessorPlan plan = helpPlan("Select e1 from pm1.g1 where e1 in (SELECT pm1.g2.e1 FROM pm1.g2 WHERE pm1.g2.e1 = pm1.g1.e1)", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ null, capFinder,
+ new String[] { "SELECT e1 FROM pm1.g1" }, SHOULD_SUCCEED); //$NON-NLS-1$
+ checkNodeTypes(plan, new int[] {
+ 1, // Access
+ 0, // DependentAccess
+ 1, // DependentSelect
+ 0, // DependentProject
+ 0, // DupRemove
+ 0, // Grouping
+ 0, // NestedLoopJoinStrategy
+ 0, // MergeJoinStrategy
+ 0, // Null
+ 0, // PlanExecution
+ 1, // Project
+ 0, // Select
+ 0, // Sort
+ 0 // UnionAll
+ });
+ }
+
+}
Property changes on: trunk/engine/src/test/java/com/metamatrix/query/optimizer/TestSubqueryPushdown.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
15 years, 8 months
teiid SVN: r761 - branches/remove_psc/common-internal/src/main/java/com/metamatrix/common/config/xml.
by teiid-commits@lists.jboss.org
Author: vhalbert(a)redhat.com
Date: 2009-04-12 17:32:20 -0400 (Sun, 12 Apr 2009)
New Revision: 761
Modified:
branches/remove_psc/common-internal/src/main/java/com/metamatrix/common/config/xml/XMLConfigurationImportExportUtility.java
Log:
Teiid 323 - refactured, removing duplicate methods
Modified: branches/remove_psc/common-internal/src/main/java/com/metamatrix/common/config/xml/XMLConfigurationImportExportUtility.java
===================================================================
--- branches/remove_psc/common-internal/src/main/java/com/metamatrix/common/config/xml/XMLConfigurationImportExportUtility.java 2009-04-12 21:30:53 UTC (rev 760)
+++ branches/remove_psc/common-internal/src/main/java/com/metamatrix/common/config/xml/XMLConfigurationImportExportUtility.java 2009-04-12 21:32:20 UTC (rev 761)
@@ -653,39 +653,8 @@
ConfigurationImportExport util = new ConfigurationImportExport();
util.exportConnectorBindings(stream, bindings, types, props);
}
-
-
- public ComponentType importConnector(InputStream stream, ConfigurationObjectEditor editor, String newName)throws IOException, InvalidConfigurationElementException {
- // no special implementation changes needed to import Connectors
- return importComponentType(stream, editor, newName);
- }
-// public static ConnectorBinding importConnectorBinding(String fileName, ConfigurationObjectEditor editor, String newName) throws IOException, ConfigObjectsNotResolvableException, InvalidConfigurationElementException {
-// // vah 7/22/04 bindings didnt change when the import/exporter utility was changed
-// // therefore, it doesn't matter which importer is used
-// ConfigurationImportExport util = new ConfigurationImportExport();
-//
-// File f = new File(fileName);
-//
-// if (!f.exists()) {
-// throw new IOException(CommonPlugin.Util.getString(ErrorMessageKeys.CONFIG_ERR_0009, fileName));
-// }
-// FileInputStream fis = null;
-// try {
-// fis = new FileInputStream(f);
-//
-// ConnectorBinding cb = util.importConnectorBinding(fis, editor, newName);
-//
-//
-// return cb;
-// } finally {
-// if (fis != null) {
-// fis.close();
-// }
-// }
-//
-// }
public ConnectorBinding importConnectorBinding(InputStream stream, ConfigurationObjectEditor editor, String newName)throws IOException, ConfigObjectsNotResolvableException, InvalidConfigurationElementException {
ConfigurationImportExport util = new ConfigurationImportExport();
15 years, 8 months