teiid SVN: r1608 - in trunk/console/src/main/java/org/teiid/rhq/plugin: util and 1 other directory.
by teiid-commits@lists.jboss.org
Author: tejones
Date: 2009-11-30 15:16:38 -0500 (Mon, 30 Nov 2009)
New Revision: 1608
Added:
trunk/console/src/main/java/org/teiid/rhq/plugin/util/PluginConstants.java
Modified:
trunk/console/src/main/java/org/teiid/rhq/plugin/PlatformDiscoveryComponent.java
Log:
TEIID-807: Moved constants to separate class
Modified: trunk/console/src/main/java/org/teiid/rhq/plugin/PlatformDiscoveryComponent.java
===================================================================
--- trunk/console/src/main/java/org/teiid/rhq/plugin/PlatformDiscoveryComponent.java 2009-11-30 18:04:19 UTC (rev 1607)
+++ trunk/console/src/main/java/org/teiid/rhq/plugin/PlatformDiscoveryComponent.java 2009-11-30 20:16:38 UTC (rev 1608)
@@ -21,10 +21,7 @@
*/
package org.teiid.rhq.plugin;
-import java.io.File;
-import java.util.HashMap;
import java.util.HashSet;
-import java.util.Map;
import java.util.Set;
import javax.naming.InitialContext;
@@ -32,22 +29,16 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.deployers.spi.management.ManagementView;
-import org.jboss.deployers.spi.management.deploy.DeploymentManager;
import org.jboss.managed.api.ComponentType;
import org.jboss.managed.api.ManagedComponent;
-import org.jboss.profileservice.spi.Profile;
-import org.jboss.profileservice.spi.ProfileKey;
import org.jboss.profileservice.spi.ProfileService;
-import org.mc4j.ems.connection.EmsConnection;
-import org.mc4j.ems.connection.bean.EmsBean;
-import org.mc4j.ems.connection.bean.attribute.EmsAttribute;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails;
import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
import org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent;
import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
-import org.rhq.plugins.jmx.JMXDiscoveryComponent;
+import org.teiid.rhq.plugin.util.PluginConstants;
/**
* This is the parent node for a MetaMatrix system
@@ -56,7 +47,10 @@
private static final Log LOG = LogFactory
.getLog(PlatformDiscoveryComponent.class);
+
+ public static final String p = "connectorAddress"; //$NON-NLS-1$
+
private final Log log = LogFactory.getLog(this.getClass());
/**
@@ -73,12 +67,12 @@
Set<DiscoveredResourceDetails> discoveredResources = new HashSet<DiscoveredResourceDetails>();
InitialContext ic = new InitialContext();
- ProfileService ps = (ProfileService) ic.lookup("ProfileService");
+ ProfileService ps = (ProfileService) ic.lookup(PluginConstants.PROFILE_SERVICE);
ManagementView vm = ps.getViewManager();
vm.load();
- ComponentType type = new ComponentType("ConnectionFactory", "NoTx");
- ManagedComponent mc = vm.getComponent("teiid-runtime-engine",
+ ComponentType type = new ComponentType(PluginConstants.CONNECTION_FACTORY_TYPE, PluginConstants.NO_TX_SUBTYPE);
+ ManagedComponent mc = vm.getComponent(PluginConstants.TEIID_RUNTIME_ENGINE,
type);
/*
@@ -90,6 +84,7 @@
// defaultPluginConfig
String managerName = mc.getName();
+
c.put(new PropertySimple("objectName", managerName));
/**
*
@@ -99,9 +94,9 @@
DiscoveredResourceDetails detail = new DiscoveredResourceDetails(
discoveryContext.getResourceType(), // ResourceType
managerName, // Resource Key
- "Data Service Runtime Engine", // Resource Name
+ PluginConstants.TEIID_ENGINE_RESOURCE_NAME, // Resource Name
null, // Version TODO can we get that from discovery ?
- "The JBoss Enterprise Data Service Engine", // Description
+ PluginConstants.TEIID_ENGINE_RESOURCE_DESCRIPTION, // Description
c, // Plugin Config
null // Process info from a process scan
);
@@ -110,67 +105,6 @@
discoveredResources.add(detail);
log.info("Discovered Teiid instance: " + managerName);
return discoveredResources;
-
- // String name = discoveryContext.getResourceType().getName();
- // String desc = discoveryContext.getResourceType().getDescription();
- // String version = ConnectionConstants.VERSION;
- //
- // LOG.info("Discovering " + desc); //$NON-NLS-1$
- //
- //
- // // now perform your own discovery mechanism, if you have one. For
- // each
- // // resource discovered, you need to
- // // create a details object that describe the resource that you
- // // discovered.
- // HashSet<DiscoveredResourceDetails> set = new
- // HashSet<DiscoveredResourceDetails>();
- //
- // Set<String> systemkeys = null ;
- //
- // try {
- // systemkeys = connMgr.getInstallationSystemKeys();
- // } catch (Exception e) {
- // systemkeys = new HashSet(1);
- // systemkeys.add("NotDefined");
- //
- // // TODO
- // // - when the serverList cannot be obtained
- //
- // // DO NOT throw exception, still want to create the
- // // resource, but it will show not active / available
- // }
- //
- //
- //
- // Iterator<String> serverIter = systemkeys.iterator();
- // int hostCount = -1;
- // while (serverIter.hasNext()) {
- // hostCount++;
- // String systemKey = serverIter.next();
- //
- // DiscoveredResourceDetails resource = new
- // DiscoveredResourceDetails(discoveryContext.getResourceType(),
- // systemKey, name,
- // version, desc, null, null);
- //
- // Configuration configuration = resource.getPluginConfiguration();
- // configuration.put(new PropertySimple(Component.NAME, name));
- // configuration.put(new PropertySimple(Component.IDENTIFIER, name));
- // configuration.put(new PropertySimple(Component.SYSTEM_KEY,
- // systemKey));
- //
- //
- // set.add(resource);
- //
- // }
- //
- // return set;
- // } catch (InvalidPluginConfigurationException ipe) {
- // throw ipe;
- // } catch (Throwable t) {
- // throw new InvalidPluginConfigurationException(t);
- // }
- //
+
}
}
\ No newline at end of file
Added: trunk/console/src/main/java/org/teiid/rhq/plugin/util/PluginConstants.java
===================================================================
--- trunk/console/src/main/java/org/teiid/rhq/plugin/util/PluginConstants.java (rev 0)
+++ trunk/console/src/main/java/org/teiid/rhq/plugin/util/PluginConstants.java 2009-11-30 20:16:38 UTC (rev 1608)
@@ -0,0 +1,235 @@
+/*
+ * 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 org.teiid.rhq.plugin.util;
+
+
+/**
+ * These are the Constants that used in conjunction with using the
+ * @since 5.5.3
+ */
+public interface PluginConstants {
+
+ /**
+ * These are properties required for connecting to the profile service and getting a handle
+ * to a specific component related to Teiid.
+ */
+
+ // The system key is the value used to obtain a connection.
+ // In embedded, its a predefined value
+ // In enterprise, its the installation directory
+ public final static String PROFILE_SERVICE = "ProfileService"; //$NON-NLS-1$
+ public final static String CONNECTION_FACTORY_TYPE = "ConnectionFactory"; //$NON-NLS-1$
+ public final static String NO_TX_SUBTYPE = "NoTx"; //$NON-NLS-1$
+ public final static String TEIID_RUNTIME_ENGINE = "teiid-runtime-engine"; //$NON-NLS-1$
+ public final static String TEIID_ENGINE_RESOURCE_NAME = "Data Service Runtime Engine"; //$NON-NLS-1$
+ public final static String TEIID_ENGINE_RESOURCE_DESCRIPTION = "JBoss Enterprise Data Service Runtime Engine"; //$NON-NLS-1$
+// public final static String INSTALL_DIR = "install.dir"; //$NON-NLS-1$
+
+ /**
+ * These are global properties used by all components
+ */
+ /*
+ * This is the key for the fully qualified identifier.
+ * For Runtime components it should be the deployedcomponent full name
+ * For Resource components it should be the Service Defn full name
+ * for adding to the value maps for metrics and operations.
+ */
+ public final static String IDENTIFIER = "identifier"; //$NON-NLS-1$
+
+
+ /**
+ * These properties are exposed via the #getProperty method call.
+ */
+ public static String SYSTEM_NAME = "cluster.name"; //$NON-NLS-1$
+ public static String SYSTEM_NAME_IDENTIFIER = "JGroups"; //$NON-NLS-1$
+
+ /**
+ * Use these component type names when calling Connection related methods
+ * that require the type.
+ * @since 1.0
+ */
+ public interface ComponentType {
+ public final static String PLATFORM = "Platform"; //$NON-NLS-1$
+
+ public interface Runtime {
+
+ public interface System {
+ public final static String TYPE = "Runtime.System"; //$NON-NLS-1$
+
+ public static interface Operations {
+
+ public final static String BOUNCE_SYSTEM = "bounceSystem"; //$NON-NLS-1$
+ public final static String GET_LONGRUNNINGQUERIES = "listLongRunningQueries"; //$NON-NLS-1$
+
+ }
+
+ public static interface Metrics {
+
+ public final static String QUERY_COUNT = "queryCount"; //$NON-NLS-1$
+ public final static String SESSION_COUNT = "sessionCount"; //$NON-NLS-1$
+ public final static String LONG_RUNNING_QUERIES = "longRunningQueries"; //$NON-NLS-1$
+
+ }
+ }
+
+ public interface Host {
+ public final static String TYPE = "Runtime.Host"; //$NON-NLS-1$
+
+ public static interface Operations {
+ public final static String GET_HOSTS = "getHosts"; //$NON-NLS-1$
+
+ }
+ }
+
+ public interface Process {
+
+ public final static String TYPE = "Runtime.Process"; //$NON-NLS-1$
+ public static interface Operations {
+
+ }
+
+ }
+
+
+ public interface Connector {
+
+ public final static String TYPE = "Runtime.Connector"; //$NON-NLS-1$
+ public static interface Operations {
+
+ public final static String RESTART_CONNECTOR = "restart"; //$NON-NLS-1$
+ public final static String STOP_CONNECTOR = "stop"; //$NON-NLS-1$
+
+ }
+
+ }
+
+// public interface Service {
+//
+// public final static String TYPE = "Runtime.Service"; //$NON-NLS-1$
+// public static interface Operations {
+//
+// public final static String RESTART_SERVICE = "restart"; //$NON-NLS-1$
+// public final static String STOP_SERVICE = "stop"; //$NON-NLS-1$
+//
+// }
+//
+// }
+
+ public interface Session {
+
+ public final static String TYPE = "Runtime.Sesssion"; //$NON-NLS-1$
+ public static interface Query {
+
+ public final static String GET_SESSIONS = "getSessions"; //$NON-NLS-1$
+ }
+
+
+
+ }
+
+ public interface Queries {
+
+ public final static String TYPE = "Runtime.Queries"; //$NON-NLS-1$
+ public static interface Query {
+
+ public final static String GET_QUERIES = "listQueries"; //$NON-NLS-1$
+ }
+
+
+
+ }
+
+ }
+ public interface Resource {
+ public interface Service {
+
+ public final static String TYPE = "Resource.Service"; //$NON-NLS-1$
+ public static interface Operations {
+
+ }
+
+ public static interface Query {
+
+ }
+
+ }
+ public interface Connector {
+
+ public final static String TYPE = "Resource.Connector"; //$NON-NLS-1$
+ public static interface Operations {
+
+ }
+
+ }
+ }
+
+ public interface Security {
+
+ }
+ /**
+ * Use these metric names when calling getValues() on the connection
+ * interface.
+ * @since 1.0
+ */
+ public interface Metric {
+ public final static String HIGH_WATER_MARK = "highWatermark"; //$NON-NLS-1$
+
+ }
+
+ /**
+ * Use these operation names when calling executeOperation() on the connection
+ * interface.
+ * @since 1.0
+ */
+ public static interface Operation {
+ public final static String KILL_REQUEST = "killRequest"; //$NON-NLS-1$
+ public final static String GET_VDBS = "listVDBs"; //$NON-NLS-1$
+
+ public final static String GET_PROPERTIES = "getProperties"; //$NON-NLS-1$
+
+ /**
+ * Use these value names when calling executeOperation() on the connection
+ * interface. These will correlate with parameters used in operations.
+ * @since 1.0
+ */
+ public static interface Value {
+ public final static String STOP_NOW = "stopNow"; //$NON-NLS-1$
+ public final static String WAIT_UNTIL_FINISHED = "waitUntilFinished"; //$NON-NLS-1$
+
+ public final static String INCLUDE_SOURCE_QUERIES = "includeSourceQueries"; //$NON-NLS-1$
+
+ public final static String LONG_RUNNING_QUERY_LIMIT = "longRunningQueryLimit"; //$NON-NLS-1$
+
+ public final static String FIELD_LIST = "fieldList"; //$NON-NLS-1$
+
+ public final static String REQUEST_ID = "requestID"; //$NON-NLS-1$
+
+ public final static String NAME = "Name"; //$NON-NLS-1$
+ public final static String VALUE = "Value"; //$NON-NLS-1$
+
+ }
+
+ }
+
+ }
+
+ }
15 years, 1 month
teiid SVN: r1607 - in branches/JCA: build/kit-jboss-container and 10 other directories.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2009-11-30 13:04:19 -0500 (Mon, 30 Nov 2009)
New Revision: 1607
Added:
branches/JCA/build/kit-jboss-container/deployers/
branches/JCA/build/kit-jboss-container/deployers/teiid-deployer-jboss-beans.xml
branches/JCA/client/src/main/java/org/teiid/adminapi/impl/ConnectorBindingMetaData.java
branches/JCA/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java
branches/JCA/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java
branches/JCA/runtime/src/main/java/org/teiid/deployers/
branches/JCA/runtime/src/main/java/org/teiid/deployers/DefParser.java
branches/JCA/runtime/src/main/java/org/teiid/deployers/ManifestMetaData.java
branches/JCA/runtime/src/main/java/org/teiid/deployers/ManifestParser.java
branches/JCA/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java
branches/JCA/runtime/src/main/java/org/teiid/deployers/VDBParserDeployer.java
branches/JCA/runtime/src/main/java/org/teiid/deployers/VDBRepository.java
branches/JCA/runtime/src/main/java/org/teiid/deployers/VDBStructure.java
branches/JCA/runtime/src/main/java/org/teiid/services/
Removed:
branches/JCA/client/src/main/java/com/metamatrix/admin/objects/MMModel.java
branches/JCA/client/src/main/java/com/metamatrix/admin/objects/MMVDB.java
branches/JCA/client/src/main/java/org/teiid/adminapi/impl/ConnectorBindingImpl.java
Modified:
branches/JCA/client/src/main/java/org/teiid/adminapi/Model.java
branches/JCA/client/src/main/java/org/teiid/adminapi/VDB.java
branches/JCA/client/src/main/java/org/teiid/adminapi/impl/AdminObjectImpl.java
branches/JCA/common-internal/src/main/java/com/metamatrix/vdb/runtime/VDBKey.java
branches/JCA/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java
branches/JCA/pom.xml
branches/JCA/runtime/pom.xml
branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/admin/BaseAdmin.java
branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/admin/DQPConfigAdminImpl.java
Log:
TEIID-833, TEIID-838: Intial checkin of the VDB deployer work.
Added: branches/JCA/build/kit-jboss-container/deployers/teiid-deployer-jboss-beans.xml
===================================================================
--- branches/JCA/build/kit-jboss-container/deployers/teiid-deployer-jboss-beans.xml (rev 0)
+++ branches/JCA/build/kit-jboss-container/deployers/teiid-deployer-jboss-beans.xml 2009-11-30 18:04:19 UTC (rev 1607)
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <bean name="VDBStructure" class="org.teiid.deployers.VDBStructure" />
+ <bean name="VDBParserDeployer" class="org.teiid.deployers.VDBParserDeployer" />
+
+ <bean name="VDBDeployer" class="org.teiid.deployers.VDBDeployer">
+ <install bean="ManagedDeploymentCreator" method="addAttachmentType">
+ <parameter>
+ <value>org.teiid.adminapi.impl.VDBMetaData</value>
+ </parameter>
+ <parameter>
+ <value>teiid-vdb</value>
+ </parameter>
+ </install>
+ <uninstall bean="ManagedDeploymentCreator" method="removeAttachmentType">
+ <parameter>
+ <value>org.teiid.adminapi.impl.VDBMetaData</value>
+ </parameter>
+ </uninstall>
+ <property name="managedObjectFactory"><inject bean="ManagedObjectFactory"/></property>
+ <property name="VDBRepository"><inject bean="VDBRepository"/></property>
+ </bean>
+
+ <bean name="VDBRepository" class="org.teiid.deployers.VDBRepository"/>
+</deployment>
\ No newline at end of file
Property changes on: branches/JCA/build/kit-jboss-container/deployers/teiid-deployer-jboss-beans.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: branches/JCA/client/src/main/java/com/metamatrix/admin/objects/MMModel.java
===================================================================
--- branches/JCA/client/src/main/java/com/metamatrix/admin/objects/MMModel.java 2009-11-30 17:12:55 UTC (rev 1606)
+++ branches/JCA/client/src/main/java/com/metamatrix/admin/objects/MMModel.java 2009-11-30 18:04:19 UTC (rev 1607)
@@ -1,191 +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.admin.objects;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.teiid.adminapi.Model;
-
-import com.metamatrix.admin.AdminPlugin;
-
-/**
- */
-public class MMModel extends MMAdminObject implements Model {
-
- private static final long serialVersionUID = 3714234763056162230L;
- private List connectorBindingNames = new ArrayList();
- private String modelType = ""; //$NON-NLS-1$
- private String modelURI = ""; //$NON-NLS-1$
- private boolean isMaterialization = false;
- private boolean isPhysical = false;
- private boolean isVisible = false;
- private boolean supportsMultiSourceBindings = false;
-
-
-
- /**
- * Construct a new MMModel
- * @param identifierParts
- */
- public MMModel(String[] identifierParts) {
- super(identifierParts);
- }
-
-
- /**
- * @see java.lang.Object#toString()
- * @return String for display purposes
- */
- public String toString() {
-
- StringBuffer result = new StringBuffer();
- result.append(AdminPlugin.Util.getString("MMModel.MMModel")).append(getIdentifier()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMModel.type")).append(getModelType()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMModel.physical")).append(isPhysical); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMModel.visible")).append(isVisible); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMModel.connector_bindings")).append(getConnectorBindingNames()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMModel.modelURI")).append(getModelURI()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMModel.properties")).append(getPropertiesAsString()); //$NON-NLS-1$
- return result.toString();
- }
-
- /**
- * @see org.teiid.adminapi.Model#getConnectorBindingNames()
- * @since 4.3
- */
- public List getConnectorBindingNames() {
- return connectorBindingNames;
- }
-
- /**
- * @see org.teiid.adminapi.Model#isPhysical()
- * @since 4.3
- */
- public boolean isPhysical() {
- return isPhysical;
- }
-
- /**
- * @see org.teiid.adminapi.Model#isVisible()
- * @since 4.3
- */
- public boolean isVisible() {
- return isVisible;
- }
-
- /**
- * @see org.teiid.adminapi.Model#getModelType()
- * @since 4.3
- */
- public String getModelType() {
- return modelType;
- }
-
- /**
- * @see org.teiid.adminapi.Model#getModelURI()
- * @since 4.3
- */
- public String getModelURI() {
- return modelURI;
- }
-
- /**
- * @see org.teiid.adminapi.Model#supportsMultiSourceBindings()
- * @since 4.3
- */
- public boolean supportsMultiSourceBindings() {
- return this.supportsMultiSourceBindings;
- }
-
- /**
- * @param bindings
- */
- public void setConnectorBindingNames(List bindings) {
- connectorBindingNames = bindings;
- }
-
- /**
- * @param supports
- * @since 4.3
- */
- public void setSupportsMultiSourceBindings(boolean supports) {
- this.supportsMultiSourceBindings = supports;
- }
-
-
-
- /**
- * @param isPhysical Whether this model is visible.
- * @since 4.3
- */
- public void setPhysical(boolean isPhysical) {
- this.isPhysical = isPhysical;
- }
-
-
- /**
- * @param isVisible Whether this model is visible.
- * @since 4.3
- */
- public void setVisible(boolean isVisible) {
- this.isVisible = isVisible;
- }
-
-
- /**
- * @param modelType The modelType to set.
- * @since 4.3
- */
- public void setModelType(String modelType) {
- this.modelType = modelType;
- }
-
-
- /**
- * @param modelURI The modelURI to set.
- * @since 4.3
- */
- public void setModelURI(String modelURI) {
- this.modelURI = modelURI;
- }
-
-
- /**
- * @return Returns whether the model is a materialization.
- * @since 4.3
- */
- public boolean isMaterialization() {
- return this.isMaterialization;
- }
-
-
- /**
- * @param isMaterialization whether the model is a materialization..
- * @since 4.3
- */
- public void setMaterialization(boolean isMaterialization) {
- this.isMaterialization = isMaterialization;
- }
-
-}
Deleted: branches/JCA/client/src/main/java/com/metamatrix/admin/objects/MMVDB.java
===================================================================
--- branches/JCA/client/src/main/java/com/metamatrix/admin/objects/MMVDB.java 2009-11-30 17:12:55 UTC (rev 1606)
+++ branches/JCA/client/src/main/java/com/metamatrix/admin/objects/MMVDB.java 2009-11-30 18:04:19 UTC (rev 1607)
@@ -1,289 +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.admin.objects;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Date;
-
-import org.teiid.adminapi.VDB;
-
-import com.metamatrix.admin.AdminPlugin;
-import com.metamatrix.core.util.HashCodeUtil;
-
-/**
- * Dataholder object for information about a VDB (Virtual Database)
- */
-public final class MMVDB extends MMAdminObject implements VDB, Comparable {
-
- private static final long serialVersionUID = -3755957080991586389L;
- /**VDB is registered but incomplete*/
- public static final int STATUS_INCOMPLETE = 1;
- /**VDB is deployed but inactive*/
- public static final int STATUS_INACTIVE = 2;
- /**VDB is deployed and active*/
- public static final int STATUS_ACTIVE = 3;
- /**VDB has been deleted*/
- public static final int STATUS_DELETED = 4;
-
- final static String[] VDB_STATUS_NAMES = {"Incomplete", //$NON-NLS-1$
- "Inactive", //$NON-NLS-1$
- "Active", //$NON-NLS-1$
- "Deleted"}; //$NON-NLS-1$
-
-
-
- private Collection models = new ArrayList();
- private short status;
- private Date versionedDate;
- private String versionedBy;
- private long uid;
- private boolean hasMaterializedViews;
- private int cachedHashcode;
- private boolean hasWSDL;
-
-
-
- /**
- * VDBs are identified by name and version.
- * @param identifierParts the VDB name and version parts
- */
- public MMVDB(String[] identifierParts) {
- super(identifierParts);
- this.cachedHashcode = HashCodeUtil.hashCode(13, getIdentifier());
- }
-
- /**
- * @see java.lang.Object#toString()
- * @since 4.3
- */
- public String toString() {
- StringBuffer result = new StringBuffer();
- result.append(AdminPlugin.Util.getString("MMVDB.MMVDB")).append(getIdentifier()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMVDB.status")).append(getState()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMVDB.versionedDate")).append(versionedDate); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMVDB.versionedBy")).append(versionedBy); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMVDB.properties")).append(getPropertiesAsString()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMVDB.models")).append(models); //$NON-NLS-1$
- return result.toString();
- }
-
- /**
- * Add an MMModel
- * @param mmModel
- * @since 4.3
- */
- public void addModel(MMModel mmModel) {
- models.add(mmModel);
- }
-
- /**
- * @return date the VDB was versioned
- */
- public Date getVersionedDate() {
- return versionedDate;
- }
-
- /**
- * @return user that versioned the VDB
- */
- public String getVersionedBy() {
- return versionedBy;
- }
-
- /**
- * @return Collection of MMModels
- */
- public Collection getModels() {
- return models;
- }
-
- /**
- * @return the status
- */
- public int getState() {
- return status;
- }
-
- /**
- * @return the status
- */
- public String getStateAsString() {
- return VDB_STATUS_NAMES[this.status - 1];
- }
-
- /**
- * Must be overridden since, unlike other admin objects, the
- * name component of a VDB is the first component of the
- * identifier. VDB version is the second component.
- * @see com.metamatrix.admin.objects.MMAdminObject#getName()
- * @return The Name of the VDB
- * @since 4.3
- */
- public String getName() {
- return identifierParts[0];
- }
-
- /**
- * @return the VDB version
- */
- public String getVDBVersion() {
- return identifierParts[1];
- }
-
-
- /**
- * @param bound The date the VDB was bound.
- * @since 4.3
- */
- public void setVersionedDate(Date bound) {
- this.versionedDate = bound;
- }
-
-
- /**
- * @param boundBy The user that bound the VDB.
- * @since 4.3
- */
- public void setVersionedBy(String boundBy) {
- this.versionedBy = boundBy;
- }
-
-
- /**
- * @param models Collection of MMModels to set.
- * @since 4.3
- */
- public void setModels(Collection models) {
- this.models = models;
- }
-
-
- /**
- * @param status The status to set.
- * @since 4.3
- */
- public void setStatus(short status) {
- this.status = status;
-
- //TODO: are these correct?
- setEnabled(status == STATUS_ACTIVE);
- setRegistered(status == STATUS_ACTIVE || status == STATUS_INACTIVE || status == STATUS_INCOMPLETE);
- }
-
-
- /**
- * @return Returns the uid.
- * @since 4.3
- */
- public long getUID() {
- return this.uid;
- }
-
-
- /**
- * @param uid The uid to set.
- * @since 4.3
- */
- public void setUID(long uid) {
- this.uid = uid;
- }
-
- /**
- * @see org.teiid.adminapi.VDB#hasMaterializedViews()
- * @since 4.3
- */
- public boolean hasMaterializedViews() {
- return hasMaterializedViews;
- }
-
-
- /**
- * @param hasMaterializedViews The hasMaterializedViews to set.
- * @since 4.3
- */
- public void setMaterializedViews(boolean hasMaterializedViews) {
- this.hasMaterializedViews = hasMaterializedViews;
- }
-
-
-
-
- /**
- * @return Returns the hasWSDL.
- * @since 5.5.3
- */
- public boolean hasWSDL() {
- return this.hasWSDL;
- }
-
-
- /**
- * @param hasWSDL The hasWSDL to set.
- * @since 5.5.3
- */
- public void setHasWSDL(boolean hasWSDL) {
- this.hasWSDL = hasWSDL;
- }
-
- /**
- * @see java.lang.Object#equals(java.lang.Object)
- * @since 4.3
- */
- public boolean equals(Object obj) {
- if ( ! (obj instanceof MMVDB) ) {
- return false;
- }
-
- MMVDB other = (MMVDB)obj;
- if ( ! identifier.equals(other.identifier) ) {
- return false;
- }
-
- return true;
- }
-
- /**
- * @see java.lang.Object#hashCode()
- * @since 4.3
- */
- public int hashCode() {
- return this.cachedHashcode;
- }
-
- /**
- * @see java.lang.Comparable#compareTo(java.lang.Object)
- * @since 4.3
- */
- public int compareTo(Object obj) {
- if ( ! (obj instanceof MMVDB) ) {
- return -1;
- }
-
- MMVDB other = (MMVDB)obj;
- return identifier.compareTo(other.identifier);
- }
-
-
-
-}
Modified: branches/JCA/client/src/main/java/org/teiid/adminapi/Model.java
===================================================================
--- branches/JCA/client/src/main/java/org/teiid/adminapi/Model.java 2009-11-30 17:12:55 UTC (rev 1606)
+++ branches/JCA/client/src/main/java/org/teiid/adminapi/Model.java 2009-11-30 18:04:19 UTC (rev 1607)
@@ -25,29 +25,35 @@
import java.util.List;
/**
- * Represents a metadata model in the MetaMatrix system.
+ * Represents a metadata model in the Teiid system.
*
* @since 4.3
*/
public interface Model extends AdminObject {
+ public final static String PRIVATE_VISIBILITY = "Private"; //$NON-NLS-1$
+ public final static String PUBLIC_VISIBILITY = "Public"; //$NON-NLS-1$
+ public final static short PRIVATE = 2;
+ public final static short PUBLIC = 0;
+
+
/**
- * Return the connector binding names for this Virtual Databse.
+ * Return the connector binding names for this Virtual Database.
* @return connector bindings bound to this model.
*/
- List getConnectorBindingNames();
+ List<String> getConnectorBindingNames();
/**
- * Determine if this model is a physical type.
+ * Determine if this model is a Source model.
*
- * @return <code>true</code> iff it contains physical group(s).
+ * @return <code>true</code> if it contains physical group(s).
*/
- boolean isPhysical();
+ boolean isSource();
/**
* Determine whether this model is exposed for querying.
*
- * @return <code>true</code> iff the model is visible
+ * @return <code>true</code> if the model is visible
* for querying.
*/
boolean isVisible();
@@ -69,17 +75,12 @@
/**
* Determine whether this model can support more than one connector binding.
*
- * @return <code>true</code> iff this model supports multi-source bindings
+ * @return <code>true</code> if this model supports multi-source bindings
*/
- boolean supportsMultiSourceBindings();
+ boolean isSupportsMultiSourceBindings();
- /**
- * Determine whether this model is a Materialization Model
- *
- * @return isMaterialization whether the model is a Materialization Model.
- * @since 4.3
- */
+ String getPath();
- boolean isMaterialization();
-
+ String getUuid();
+
}
\ No newline at end of file
Modified: branches/JCA/client/src/main/java/org/teiid/adminapi/VDB.java
===================================================================
--- branches/JCA/client/src/main/java/org/teiid/adminapi/VDB.java 2009-11-30 17:12:55 UTC (rev 1606)
+++ branches/JCA/client/src/main/java/org/teiid/adminapi/VDB.java 2009-11-30 18:04:19 UTC (rev 1607)
@@ -22,11 +22,12 @@
package org.teiid.adminapi;
-import java.util.Collection;
-import java.util.Date;
+import java.net.URL;
+import java.util.Collection;
+import java.util.List;
/**
- * Represents a Virtual Database in the MetaMatrix system.
+ * Represents a Virtual Database in the Teiid System.
* <br>A VDB has a name and a version.</br>
*
* <p>The identifier pattern for a VDB is <CODE>"name<{@link #DELIMITER_CHAR}>version"</CODE>,
@@ -39,8 +40,7 @@
*
* @since 4.3
*/
-public interface VDB extends
- AdminObject {
+public interface VDB extends AdminObject {
/**
* Constant to denote the latest version of a VDB located
@@ -48,75 +48,40 @@
* VDB to the MetaMatrix Server from the server repository.
*/
public static final String SERVER_REPOSITORY_LATEST_VERSION = "LATEST"; //$NON-NLS-1$
-
- /**
- * Incomplete (if import does not have all the connector bindings)
- *
- * @since 4.3
- */
- public static final int INCOMPLETE = 1;
- /**
- * Inactive VDB (can edit connector binding)
- *
- * @since 4.3
- */
- public static final int INACTIVE = 2;
- /**
- * Active VDB
- *
- * @since 4.3
- */
- public static final int ACTIVE = 3;
- /**
- * Mark VDB for Deletion
- *
- * @since 4.3
- */
- public static final int DELETED = 4;
+
+ enum Status{INCOMPLETE, INACTIVE, ACTIVE, DELETED};
- /**
- * @return date the VDB was versioned
- */
- public Date getVersionedDate();
/**
- * @return user that versioned the VDB
- */
- public String getVersionedBy();
-
- /**
* @return Collection of MMModels
*/
- public Collection getModels();
-
+ public Collection<? extends Model> getModels();
+
/**
* @return the status
*/
- public int getState();
+ public Status getStatus();
/**
- * @return the status
- */
- public String getStateAsString();
-
- /**
* @return the VDB version
*/
- public String getVDBVersion();
-
- /**
- * Check to see if this VDB has any Materialized Models
- *
- * @return true or false
- * @since 4.3
- */
- public boolean hasMaterializedViews();
-
- /**
- * Check to see if this VDB contains a WSDL.
- * @return true if it contains a WSDL.
- * @since 5.5.3
- */
- public boolean hasWSDL();
-
+ public int getVersion();
+
+ /**
+ * Get the URL for the VDB
+ * @return
+ */
+ public URL getUrl();
+
+ /**
+ * Get the description of the VDB
+ * @return
+ */
+ public String getDescription();
+
+ /**
+ * Shows any validity errors present in the VDB
+ * @return
+ */
+ public List<String> getValidityErrors();
}
Modified: branches/JCA/client/src/main/java/org/teiid/adminapi/impl/AdminObjectImpl.java
===================================================================
--- branches/JCA/client/src/main/java/org/teiid/adminapi/impl/AdminObjectImpl.java 2009-11-30 17:12:55 UTC (rev 1606)
+++ branches/JCA/client/src/main/java/org/teiid/adminapi/impl/AdminObjectImpl.java 2009-11-30 18:04:19 UTC (rev 1607)
@@ -31,15 +31,15 @@
private static final long serialVersionUID = -6381303538713462682L;
String name;
Properties properties;
-
- public AdminObjectImpl(String name) {
- this.name = name;
- }
-
+
@Override
public String getName() {
return this.name;
}
+
+ public void setName(String name) {
+ this.name = name;
+ }
@Override
public Properties getProperties() {
Deleted: branches/JCA/client/src/main/java/org/teiid/adminapi/impl/ConnectorBindingImpl.java
===================================================================
--- branches/JCA/client/src/main/java/org/teiid/adminapi/impl/ConnectorBindingImpl.java 2009-11-30 17:12:55 UTC (rev 1606)
+++ branches/JCA/client/src/main/java/org/teiid/adminapi/impl/ConnectorBindingImpl.java 2009-11-30 18:04:19 UTC (rev 1607)
@@ -1,52 +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 org.teiid.adminapi.impl;
-
-import org.teiid.adminapi.ConnectorBinding;
-
-public class ConnectorBindingImpl extends AdminObjectImpl implements ConnectorBinding {
-
- private static final long serialVersionUID = -4865836616882247016L;
- private transient Object type;
-
- public ConnectorBindingImpl(String name) {
- super(name);
- }
-
- @Override
- public String getRARFileName() {
- return getPropertyValue("rar-name");
- }
-
- @Override
- public String getJNDIName() {
- return getPropertyValue("jndi-name");
- }
-
- public void setComponentType(Object type) {
- this.type = type;
- }
-
- public Object getComponentType() {
- return this.type;
- }
-}
Copied: branches/JCA/client/src/main/java/org/teiid/adminapi/impl/ConnectorBindingMetaData.java (from rev 1569, branches/JCA/client/src/main/java/org/teiid/adminapi/impl/ConnectorBindingImpl.java)
===================================================================
--- branches/JCA/client/src/main/java/org/teiid/adminapi/impl/ConnectorBindingMetaData.java (rev 0)
+++ branches/JCA/client/src/main/java/org/teiid/adminapi/impl/ConnectorBindingMetaData.java 2009-11-30 18:04:19 UTC (rev 1607)
@@ -0,0 +1,65 @@
+/*
+ * 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 org.teiid.adminapi.impl;
+
+import org.jboss.managed.api.annotation.ManagementComponent;
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementObjectID;
+import org.jboss.managed.api.annotation.ManagementProperty;
+import org.teiid.adminapi.ConnectorBinding;
+
+@ManagementObject(componentType=@ManagementComponent(type="teiid",subtype="connector"))
+public class ConnectorBindingMetaData extends AdminObjectImpl implements ConnectorBinding {
+
+ private static final long serialVersionUID = -4865836616882247016L;
+ private transient Object type;
+
+ @ManagementProperty(description="Connector Binding Name", readOnly=true)
+ @ManagementObjectID(type="binding")
+ public String getName() {
+ return super.getName();
+ }
+
+ @Override
+ @ManagementProperty(description="RAR file name", readOnly=true)
+ public String getRARFileName() {
+ return getPropertyValue("rar-name");
+ }
+
+ @Override
+ @ManagementProperty(description="JNDI name", readOnly=true)
+ public String getJNDIName() {
+ return getPropertyValue("jndi-name");
+ }
+
+ public void setComponentType(Object type) {
+ this.type = type;
+ }
+
+ public Object getComponentType() {
+ return this.type;
+ }
+
+ public String toString() {
+ return name;
+ }
+}
Property changes on: branches/JCA/client/src/main/java/org/teiid/adminapi/impl/ConnectorBindingMetaData.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/JCA/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java
===================================================================
--- branches/JCA/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java (rev 0)
+++ branches/JCA/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java 2009-11-30 18:04:19 UTC (rev 1607)
@@ -0,0 +1,143 @@
+/*
+ * 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 org.teiid.adminapi.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import org.jboss.managed.api.annotation.ManagementComponent;
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementObjectID;
+import org.jboss.managed.api.annotation.ManagementProperty;
+import org.teiid.adminapi.Model;
+
+import com.metamatrix.core.vdb.ModelType;
+
+@ManagementObject(componentType=@ManagementComponent(type="teiid",subtype="model"))
+public class ModelMetaData extends AdminObjectImpl implements Model {
+
+ private static final long serialVersionUID = 3714234763056162230L;
+ private List<String> connectorBindings = new ArrayList<String>();
+ private String modelType = ""; //$NON-NLS-1$
+ private String modelURI = ""; //$NON-NLS-1$
+ private boolean isVisible = false;
+ private boolean supportsMultiSourceBindings = false;
+ private String path;
+ private String uuid;
+
+ @ManagementProperty(description="Model Name", readOnly=true)
+ @ManagementObjectID(type="model")
+ public String getName() {
+ return super.getName();
+ }
+
+
+ @ManagementProperty(description="Connector Bindings for model")
+ public List<String> getConnectorBindingNames(){
+ return this.connectorBindings;
+ }
+
+ @Override
+ @ManagementProperty(description = "Is Model Source model", readOnly=true)
+ public boolean isSource() {
+ if (modelType != null) {
+ return ModelType.parseString(modelType) == ModelType.PHYSICAL;
+ }
+ throw new IllegalStateException("Model state is not correctly set");
+ }
+
+ @Override
+ @ManagementProperty(description = "Is Model Visible", readOnly=true)
+ public boolean isVisible() {
+ return isVisible;
+ }
+
+ @Override
+ @ManagementProperty(description = "Model Type", readOnly=true)
+ public String getModelType() {
+ return modelType;
+ }
+
+ @Override
+ @ManagementProperty(description = "Model URI", readOnly=true)
+ public String getModelURI() {
+ return modelURI;
+ }
+
+ @Override
+ @ManagementProperty(description = "Does Model supports multi-source bindings", readOnly=true)
+ public boolean isSupportsMultiSourceBindings() {
+ return this.supportsMultiSourceBindings;
+ }
+
+ @Override
+ @ManagementProperty(description = "Model path", readOnly=true)
+ public String getPath() {
+ return this.path;
+ }
+
+ @Override
+ @ManagementProperty(description = "Model UUID", readOnly=true)
+ public String getUuid() {
+ return this.uuid;
+ }
+
+ @Override
+ @ManagementProperty(description = "Properties", readOnly=true)
+ public Properties getProperties() {
+ return new Properties(super.getProperties());
+ }
+
+ public void addConnectorBinding(String binding) {
+ this.connectorBindings.add(binding);
+ }
+
+ public void setSupportsMultiSourceBindings(boolean supports) {
+ this.supportsMultiSourceBindings = supports;
+ }
+
+ public void setVisible(boolean isVisible) {
+ this.isVisible = isVisible;
+ }
+
+ public void setModelType(String modelType) {
+ this.modelType = modelType;
+ }
+
+ public void setModelURI(String modelURI) {
+ this.modelURI = modelURI;
+ }
+
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+ public void setUuid(String uuid) {
+ this.uuid = uuid;
+ }
+
+ public String toString() {
+ return name + connectorBindings;
+ }
+}
Property changes on: branches/JCA/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/JCA/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java
===================================================================
--- branches/JCA/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java (rev 0)
+++ branches/JCA/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java 2009-11-30 18:04:19 UTC (rev 1607)
@@ -0,0 +1,145 @@
+/*
+ * 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 org.teiid.adminapi.impl;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.jboss.managed.api.annotation.ManagementComponent;
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementObjectID;
+import org.jboss.managed.api.annotation.ManagementOperation;
+import org.jboss.managed.api.annotation.ManagementProperty;
+import org.teiid.adminapi.VDB;
+
+@ManagementObject(componentType=@ManagementComponent(type="teiid",subtype="vdb"))
+public class VDBMetaData extends AdminObjectImpl implements VDB {
+
+ private static final long serialVersionUID = -4723595252013356436L;
+ private HashSet<ModelMetaData> models = new HashSet<ModelMetaData>();
+ private URL fileUrl = null;
+ private int version = 1;
+ private Status status;
+ private String description;
+ private List<String> errors;
+
+ @ManagementProperty(description="Name of the VDB", readOnly=true)
+ @ManagementObjectID(type="vdb")
+ public String getName() {
+ return super.getName();
+ }
+
+ @Override
+ @ManagementProperty(description="VDB Status", readOnly=true)
+ public Status getStatus() {
+ return this.status;
+ }
+
+ public void setStatus(Status s) {
+ this.status = s;
+ }
+
+ @Override
+ @ManagementProperty(description="VDB version", readOnly=true)
+ public int getVersion() {
+ return this.version;
+ }
+
+ public void setVersion(int version) {
+ this.version = version;
+ }
+
+ @Override
+ @ManagementProperty(description = "The VDB file url", readOnly=true)
+ public URL getUrl() {
+ return this.fileUrl;
+ }
+
+ public void setUrl(URL url) {
+ this.fileUrl = url;
+ }
+
+ @ManagementProperty(description="Model list in a VDB", managed=true)
+ public Set<ModelMetaData> getModels(){
+ return models;
+ }
+
+ public void addModel(ModelMetaData m) {
+ this.models.add(m);
+ }
+
+ @Override
+ @ManagementProperty(description = "Description", readOnly=true)
+ public String getDescription() {
+ return this.description;
+ }
+
+ public void setDescription(String desc) {
+ this.description = desc;
+ }
+
+ @Override
+ @ManagementProperty(description = "VDB validity errors", readOnly=true)
+ public List<String> getValidityErrors(){
+ if (this.errors != null) {
+ return this.errors;
+ }
+ return Collections.EMPTY_LIST;
+ }
+
+ public void addValidityError(String error) {
+ if (this.errors == null) {
+ errors = new ArrayList<String>();
+ }
+ this.errors.add(error);
+ }
+
+ public String toString() {
+ return this.name + models;
+ }
+
+ @ManagementOperation(description = "Get the model with given name")
+ public ModelMetaData getModel(String modelName) {
+ for(ModelMetaData m: models) {
+ if (m.getName().equalsIgnoreCase(modelName)) {
+ return m;
+ }
+ }
+ return null;
+ }
+
+ public List<ModelMetaData> getMultiSourceModels(){
+ List<ModelMetaData> list = new ArrayList<ModelMetaData>();
+ for(ModelMetaData m: models) {
+ if (m.isSupportsMultiSourceBindings()) {
+ list.add(m);
+ }
+ }
+ return list;
+ }
+
+
+}
Property changes on: branches/JCA/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: branches/JCA/common-internal/src/main/java/com/metamatrix/vdb/runtime/VDBKey.java
===================================================================
--- branches/JCA/common-internal/src/main/java/com/metamatrix/vdb/runtime/VDBKey.java 2009-11-30 17:12:55 UTC (rev 1606)
+++ branches/JCA/common-internal/src/main/java/com/metamatrix/vdb/runtime/VDBKey.java 2009-11-30 18:04:19 UTC (rev 1607)
@@ -36,6 +36,11 @@
}
}
+ public VDBKey(String name, int version) {
+ this.name = name.toUpperCase();
+ this.version = String.valueOf(version);
+ }
+
public String getName() {
return name;
}
Modified: branches/JCA/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java
===================================================================
--- branches/JCA/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java 2009-11-30 17:12:55 UTC (rev 1606)
+++ branches/JCA/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java 2009-11-30 18:04:19 UTC (rev 1607)
@@ -57,7 +57,7 @@
import org.teiid.adminapi.ConnectorBinding;
import org.teiid.adminapi.TeiidAdminMBean;
import org.teiid.adminapi.impl.BaseAdmin;
-import org.teiid.adminapi.impl.ConnectorBindingImpl;
+import org.teiid.adminapi.impl.ConnectorBindingMetaData;
@ManagementObject(description="Teiid Admin Interface", componentType=@ManagementComponent(type="teiid",subtype="admin"), properties=ManagementProperties.EXPLICIT, isRuntime=true)
@JMX(name="jboss.teiid:service=teiid-admin", exposedInterface=TeiidAdminMBean.class, registerDirectly=true)
@@ -110,7 +110,8 @@
SimpleValueSupport v = (SimpleValueSupport)mp.getValue();
if (v.getValue().equals("org.teiid.connector.api.Connector")){
- ConnectorBindingImpl cb = new ConnectorBindingImpl(mc.getName());
+ ConnectorBindingMetaData cb = new ConnectorBindingMetaData();
+ cb.setName(mc.getName());
cb.setComponentType(type);
for (String key:mc.getProperties().keySet()) {
ManagedProperty property = mc.getProperty(key);
@@ -196,7 +197,7 @@
@Override
public void deleteConnectorBinding(String deployedName) throws AdminException {
- ConnectorBindingImpl cb = (ConnectorBindingImpl)getConnectorBinding(deployedName);
+ ConnectorBindingMetaData cb = (ConnectorBindingMetaData)getConnectorBinding(deployedName);
if (cb != null) {
try {
ManagedComponent mc = getView().getComponent(cb.getName(), (ComponentType)cb.getComponentType());
Modified: branches/JCA/pom.xml
===================================================================
--- branches/JCA/pom.xml 2009-11-30 17:12:55 UTC (rev 1606)
+++ branches/JCA/pom.xml 2009-11-30 18:04:19 UTC (rev 1607)
@@ -438,6 +438,18 @@
<version>2.1.2.GA</version>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-vfs-spi</artifactId>
+ <version>2.0.7.GA</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-vfs</artifactId>
+ <version>2.0.7.GA</version>
+ <scope>provided</scope>
+ </dependency>
<dependency>
<groupId>org.jboss.jbossas</groupId>
<artifactId>jboss-as-connector</artifactId>
Modified: branches/JCA/runtime/pom.xml
===================================================================
--- branches/JCA/runtime/pom.xml 2009-11-30 17:12:55 UTC (rev 1606)
+++ branches/JCA/runtime/pom.xml 2009-11-30 18:04:19 UTC (rev 1607)
@@ -87,6 +87,17 @@
<groupId>javax.resource</groupId>
<artifactId>connector-api</artifactId>
<scope>provided</scope>
- </dependency>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-vfs-spi</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-vfs</artifactId>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
</project>
\ No newline at end of file
Modified: branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/admin/BaseAdmin.java
===================================================================
--- branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/admin/BaseAdmin.java 2009-11-30 17:12:55 UTC (rev 1606)
+++ branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/admin/BaseAdmin.java 2009-11-30 18:04:19 UTC (rev 1607)
@@ -45,11 +45,9 @@
import com.metamatrix.admin.objects.MMConnectorType;
import com.metamatrix.admin.objects.MMExtensionModule;
import com.metamatrix.admin.objects.MMLogConfiguration;
-import com.metamatrix.admin.objects.MMModel;
import com.metamatrix.admin.objects.MMPropertyDefinition;
import com.metamatrix.admin.objects.MMRequest;
import com.metamatrix.admin.objects.MMSession;
-import com.metamatrix.admin.objects.MMVDB;
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.security.SessionServiceException;
import com.metamatrix.common.application.exception.ApplicationLifecycleException;
@@ -384,51 +382,53 @@
*/
private org.teiid.adminapi.VDB convertVDB(final com.metamatrix.common.vdb.api.VDBDefn src, final Object parent) {
- MMVDB vdb = new MMVDB(new String[] {src.getName(), src.getVersion()});
- vdb.setCreated(src.getDateCreated());
- vdb.setCreatedBy(src.getCreatedBy());
- vdb.setEnabled(src.isActiveStatus());
- vdb.setLastUpdated(src.getDateCreated());
- vdb.setLastUpdatedBy(src.getCreatedBy());
- vdb.setMaterializedViews(src.getMatertializationModel() != null);
- vdb.setModels((Collection)convertToAdminObjects(src.getModels(), src));
- vdb.setProperties(null);
- vdb.setRegistered(true);
- vdb.setStatus(src.getStatus());
- vdb.setUID(0); // TODO: src.getUUID());
- vdb.setVersionedBy(src.getCreatedBy());
- vdb.setVersionedDate(src.getDateCreated());
- vdb.setHasWSDL(src.hasWSDLDefined());
-
- return vdb;
+// MMVDB vdb = new MMVDB(new String[] {src.getName(), src.getVersion()});
+// vdb.setCreated(src.getDateCreated());
+// vdb.setCreatedBy(src.getCreatedBy());
+// vdb.setEnabled(src.isActiveStatus());
+// vdb.setLastUpdated(src.getDateCreated());
+// vdb.setLastUpdatedBy(src.getCreatedBy());
+// vdb.setMaterializedViews(src.getMatertializationModel() != null);
+// vdb.setModels((Collection)convertToAdminObjects(src.getModels(), src));
+// vdb.setProperties(null);
+// vdb.setRegistered(true);
+// vdb.setStatus(src.getStatus());
+// vdb.setUID(0); // TODO: src.getUUID());
+// vdb.setVersionedBy(src.getCreatedBy());
+// vdb.setVersionedDate(src.getDateCreated());
+// vdb.setHasWSDL(src.hasWSDLDefined());
+//
+// return vdb;
+ return null;
}
private org.teiid.adminapi.Model convertModel(final com.metamatrix.common.vdb.api.ModelInfo src, final Object parent) {
- final com.metamatrix.common.vdb.api.VDBDefn vdb = (com.metamatrix.common.vdb.api.VDBDefn)parent;
- MMModel model = new MMModel(new String[] {src.getName()});
- model.setCreated(vdb.getDateCreated());
- model.setCreatedBy(vdb.getCreatedBy());
- model.setEnabled(vdb.isActiveStatus());
- model.setLastUpdated(vdb.getDateCreated());
- model.setLastUpdatedBy(vdb.getCreatedBy());
- model.setModelType(src.getModelTypeName());
- model.setModelURI(src.getModelURI());
- model.setMaterialization(src.isMaterialization());
- model.setPhysical(src.isPhysical());
- model.setRegistered(true);
- model.setSupportsMultiSourceBindings(src.isMultiSourceBindingEnabled());
- model.setVisible(src.isVisible());
- if (src.isPhysical()) {
- List bindings = src.getConnectorBindingNames();
- if (bindings != null && !bindings.isEmpty()) {
- List names = new ArrayList();
- for (int i=0; i<bindings.size();i++) {
- names.add(convertToAdminObject(vdb.getConnectorBindingByName((String)bindings.get(i)), parent));
- }
- model.setConnectorBindingNames(names);
- }
- }
- return model;
+// final com.metamatrix.common.vdb.api.VDBDefn vdb = (com.metamatrix.common.vdb.api.VDBDefn)parent;
+// MMModel model = new MMModel(new String[] {src.getName()});
+// model.setCreated(vdb.getDateCreated());
+// model.setCreatedBy(vdb.getCreatedBy());
+// model.setEnabled(vdb.isActiveStatus());
+// model.setLastUpdated(vdb.getDateCreated());
+// model.setLastUpdatedBy(vdb.getCreatedBy());
+// model.setModelType(src.getModelTypeName());
+// model.setModelURI(src.getModelURI());
+// model.setMaterialization(src.isMaterialization());
+// model.setPhysical(src.isPhysical());
+// model.setRegistered(true);
+// model.setSupportsMultiSourceBindings(src.isMultiSourceBindingEnabled());
+// model.setVisible(src.isVisible());
+// if (src.isPhysical()) {
+// List bindings = src.getConnectorBindingNames();
+// if (bindings != null && !bindings.isEmpty()) {
+// List names = new ArrayList();
+// for (int i=0; i<bindings.size();i++) {
+// names.add(convertToAdminObject(vdb.getConnectorBindingByName((String)bindings.get(i)), parent));
+// }
+// model.setConnectorBindingNames(names);
+// }
+// }
+// return model;
+ return null;
}
private org.teiid.adminapi.Request convertRequest(final RequestInfo src) {
Modified: branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/admin/DQPConfigAdminImpl.java
===================================================================
--- branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/admin/DQPConfigAdminImpl.java 2009-11-30 17:12:55 UTC (rev 1606)
+++ branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/admin/DQPConfigAdminImpl.java 2009-11-30 18:04:19 UTC (rev 1607)
@@ -521,7 +521,7 @@
@Override
public void deleteVDB(String vdbName, String vdbVersion) throws AdminException {
- super.changeVDBStatus(vdbName, vdbVersion, VDB.DELETED);
+ //super.changeVDBStatus(vdbName, vdbVersion, VDB.DELETED);
}
/**
Added: branches/JCA/runtime/src/main/java/org/teiid/deployers/DefParser.java
===================================================================
--- branches/JCA/runtime/src/main/java/org/teiid/deployers/DefParser.java (rev 0)
+++ branches/JCA/runtime/src/main/java/org/teiid/deployers/DefParser.java 2009-11-30 18:04:19 UTC (rev 1607)
@@ -0,0 +1,153 @@
+package org.teiid.deployers;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+
+import org.jdom.Document;
+import org.jdom.Element;
+import org.jdom.JDOMException;
+import org.teiid.adminapi.VDB;
+import org.teiid.adminapi.impl.ConnectorBindingMetaData;
+import org.teiid.adminapi.impl.ModelMetaData;
+import org.teiid.adminapi.impl.VDBMetaData;
+
+import com.metamatrix.common.xml.XMLReaderWriter;
+import com.metamatrix.common.xml.XMLReaderWriterImpl;
+
+public class DefParser {
+
+ public static VDBMetaData load(InputStream defStream) throws IOException {
+ VDBMetaData vdb = new VDBMetaData();
+ try {
+ XMLReaderWriter reader = new XMLReaderWriterImpl();
+ Document doc = reader.readDocument(defStream);
+ Element root = doc.getRootElement();
+
+ // load VDBInfo section
+ loadVDBInfoSection(vdb, root);
+
+ // add Models section
+ loadModelsSection(vdb, root);
+
+ } catch (JDOMException e) {
+ throw new IOException(e);//$NON-NLS-1$
+ }
+ return vdb;
+ }
+
+ private static void loadVDBInfoSection(VDBMetaData vdb, Element root) throws IOException {
+
+ Element vdbInfoElement = root.getChild(VDBInfoFragment.ELEMENT);
+ if (vdbInfoElement == null) {
+ throw new IOException("VDBDefnXMLHelper.Invalid_xml_section"); //$NON-NLS-1$
+ }
+
+ Properties vdbProps = getElementProperties(vdbInfoElement);
+ if (vdbProps == null || vdbProps.isEmpty()) {
+ throw new IOException("VDBDefnXMLHelper.No_properties_defined_to_create_defn"); //$NON-NLS-1$
+ }
+
+ vdb.setName((String)vdbProps.remove(VDBInfoFragment.NAME));
+ String version = (String)vdbProps.remove(VDBInfoFragment.VERSION);
+ vdb.setVersion(version!=null?Integer.parseInt(version):1);//$NON-NLS-1$
+ vdb.setDescription((String)vdbProps.remove(VDBInfoFragment.DESCRIPTION));
+ if (TRUE.equals(vdbProps.remove(VDBInfoFragment.ACTIVE))) {
+ vdb.setStatus(VDB.Status.ACTIVE);
+ }
+ else {
+ vdb.setStatus(VDB.Status.INACTIVE);
+ }
+ vdb.setProperties(vdbProps);
+ }
+
+ private static void loadModelsSection(VDBMetaData vdb, Element root) {
+ Collection<Element> modelsElements = root.getChildren(ModelFragment.ELEMENT);
+ for(Element modelElement:modelsElements) {
+ vdb.addModel(loadModel(modelElement));
+ }
+ }
+
+ private static ModelMetaData loadModel(Element modelElement) {
+ Properties props = getElementProperties(modelElement);
+
+ ModelMetaData model = new ModelMetaData();
+ model.setName(props.getProperty(ModelFragment.NAME));
+ props.remove(ModelFragment.NAME);
+
+ String visibility = props.getProperty(ModelFragment.VISIBILITY, org.teiid.adminapi.Model.PUBLIC_VISIBILITY);
+ props.remove(ModelFragment.VISIBILITY);
+ model.setVisible(visibility.equalsIgnoreCase(org.teiid.adminapi.Model.PUBLIC_VISIBILITY)?true:false);
+
+ model.setSupportsMultiSourceBindings(Boolean.parseBoolean(props.getProperty(ModelFragment.MULTI_SOURCE_ENABLED)));
+ props.remove(ModelFragment.MULTI_SOURCE_ENABLED);
+
+ model.setProperties(props);
+
+ Element cbElement = modelElement.getChild(ModelFragment.CONNECTOR_BINDINGS_ELEMENT);
+ if (cbElement != null) {
+ Collection<Element> bindingElements = cbElement.getChildren(ModelFragment.CONNECTOR);
+ for(Element bindingElement:bindingElements) {
+ String connectorName = bindingElement.getAttributeValue(ModelFragment.CONNECTOR_ATTRIBUTE_NAME);
+ model.addConnectorBinding(connectorName);
+ }
+ }
+ return model;
+ }
+
+ protected static Properties getElementProperties(Element rootElement) {
+ Properties properties = new Properties();
+ if(rootElement == null) {
+ return properties;
+ }
+ // obtain any defaults that are defined
+ List propertyElements = rootElement.getChildren(PropertyFragment.ELEMENT);
+ if (propertyElements != null) {
+ Iterator iterator = propertyElements.iterator();
+ for (int i = 1; iterator.hasNext(); i++) {
+ Element element = (Element)iterator.next();
+ String name = element.getAttributeValue(PropertyFragment.ATTRIBUTE_NAME);
+ String value = element.getAttributeValue(PropertyFragment.ATTRIBUTE_VALUE);
+ if (name != null && name.length() > 0) {
+ properties.setProperty(name, value);
+ }
+ }
+ }
+ return properties;
+ }
+
+ static final String ROOT_ELEMENT = "VDB"; //$NON-NLS-1$
+ private static final String TRUE = "true"; //$NON-NLS-1$
+ private static class VDBInfoFragment {
+ public static final String ELEMENT = "VDBInfo"; //$NON-NLS-1$
+ public static final String NAME = "Name"; //$NON-NLS-1$
+ public static final String VERSION = "Version"; //$NON-NLS-1$
+
+ // Optional - defaults to VDB Name
+ public static final String DESCRIPTION = "Description"; //$NON-NLS-1$
+ public static final String ACTIVE = "Active"; //$NON-NLS-1$
+ }
+
+ private static class PropertyFragment {
+ public static final String ELEMENT = "Property"; //$NON-NLS-1$
+ public static final String ATTRIBUTE_NAME = "Name"; //$NON-NLS-1$
+ public static final String ATTRIBUTE_VALUE = "Value"; //$NON-NLS-1$
+ }
+
+ private static class ModelFragment {
+ public static final String ELEMENT = "Model"; //$NON-NLS-1$
+ public static final String NAME = "Name"; //$NON-NLS-1$
+
+ // Optional - Default - physical=false, virtual=true
+ public static final String VISIBILITY = "Visibility"; //$NON-NLS-1$
+ public static final String MULTI_SOURCE_ENABLED = "MultiSourceEnabled"; //$NON-NLS-1$
+
+ // Optional - no binding set
+ public static final String CONNECTOR_BINDINGS_ELEMENT = "ConnectorBindings"; //$NON-NLS-1$
+ public static final String CONNECTOR = "Connector"; //$NON-NLS-1$
+ public static final String CONNECTOR_ATTRIBUTE_NAME = "Name"; //$NON-NLS-1$
+ }
+}
Property changes on: branches/JCA/runtime/src/main/java/org/teiid/deployers/DefParser.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/JCA/runtime/src/main/java/org/teiid/deployers/ManifestMetaData.java
===================================================================
--- branches/JCA/runtime/src/main/java/org/teiid/deployers/ManifestMetaData.java (rev 0)
+++ branches/JCA/runtime/src/main/java/org/teiid/deployers/ManifestMetaData.java 2009-11-30 18:04:19 UTC (rev 1607)
@@ -0,0 +1,36 @@
+/*
+ * 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 org.teiid.deployers;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.teiid.adminapi.impl.ModelMetaData;
+
+@ManagementObject
+public class ManifestMetaData {
+ String vdbName;
+ String vdbDescription;
+ List<ModelMetaData> models = new ArrayList<ModelMetaData>();
+ List<String> errors = new ArrayList<String>();
+}
Property changes on: branches/JCA/runtime/src/main/java/org/teiid/deployers/ManifestMetaData.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/JCA/runtime/src/main/java/org/teiid/deployers/ManifestParser.java
===================================================================
--- branches/JCA/runtime/src/main/java/org/teiid/deployers/ManifestParser.java (rev 0)
+++ branches/JCA/runtime/src/main/java/org/teiid/deployers/ManifestParser.java 2009-11-30 18:04:19 UTC (rev 1607)
@@ -0,0 +1,111 @@
+/*
+ * 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 org.teiid.deployers;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.List;
+
+import org.jdom.Document;
+import org.jdom.Element;
+import org.jdom.JDOMException;
+import org.jdom.Namespace;
+import org.teiid.adminapi.impl.ModelMetaData;
+
+import com.metamatrix.common.xml.XMLReaderWriter;
+import com.metamatrix.common.xml.XMLReaderWriterImpl;
+import com.metamatrix.core.util.StringUtil;
+
+
+/**
+ * VDB Manifest file; right now this is defined as EMF resource in the vdb.edit code,
+ * so to break the dependency from EMF we have defined as the simple XML type here. This
+ * will defined as simple xml in future then we can remove this. There is defect logged on this
+ * in JIRA
+ */
+public class ManifestParser{
+
+ public static ManifestMetaData load(InputStream in) throws IOException {
+
+ ManifestMetaData vdb = new ManifestMetaData();
+
+ try {
+ XMLReaderWriter reader = new XMLReaderWriterImpl();
+ Document doc = reader.readDocument(in);
+ Element root = doc.getRootElement();
+
+ Namespace ns= root.getNamespace(NS);
+ Element vdbElement = root.getChild(VDB_ELEMENT, ns);
+ if (vdbElement != null) {
+ vdb.vdbName = vdbElement.getAttributeValue(NAME);
+ vdb.vdbDescription = vdbElement.getAttributeValue(DESCRIPTION);
+
+ // build the models
+ List<Element> modelElements = vdbElement.getChildren(MODELS);
+ for(Element modelElement:modelElements) {
+
+ String modelName = StringUtil.getFirstToken(modelElement.getAttributeValue(NAME), ".");
+ ModelMetaData model = new ModelMetaData();
+ model.setName(modelName);
+
+ model.setModelType(modelElement.getAttributeValue(MODEL_TYPE));
+ model.setPath(modelElement.getAttributeValue(MODEL_PATH,""));
+ model.setUuid(modelElement.getAttributeValue(UUID));
+ model.setModelURI(modelElement.getAttributeValue(PRIMARY_METAMODEL_URI));
+
+ String visibility = modelElement.getAttributeValue(ACCESSIBILITY);
+ if (visibility != null) {
+ model.setVisible("Public".equals(visibility)?true:false);
+ }
+
+ List<Element> markers = modelElement.getChildren(MARKERS);
+ for(Element marker:markers) {
+ String severity = marker.getAttributeValue(SEVERITY);
+ if (severity.equals(ERROR)) {
+ vdb.errors.add(marker.getAttributeValue(MESSAGE));
+ }
+ }
+ vdb.models.add(model);
+ }
+ }
+ } catch (JDOMException e) {
+ throw new IOException("Failed to read the VDB-Manifest file"); //$NON-NLS-1$
+ }
+ return vdb;
+ }
+
+ private static final String MODELS = "models"; //$NON-NLS-1$
+ private static final String ACCESSIBILITY = "accessibility"; //$NON-NLS-1$
+ private static final String PRIMARY_METAMODEL_URI = "primaryMetamodelUri"; //$NON-NLS-1$
+ private static final String UUID = "uuid"; //$NON-NLS-1$
+ private static final String NS = "vdb"; //$NON-NLS-1$
+ private static final String MESSAGE = "message"; //$NON-NLS-1$
+ private static final String ERROR = "ERROR"; //$NON-NLS-1$
+ private static final String SEVERITY = "severity"; //$NON-NLS-1$
+ private static final String NAME = "name"; //$NON-NLS-1$
+ private static final String MODEL_PATH = "modelLocation";//$NON-NLS-1$
+ private static final String MODEL_TYPE = "modelType";//$NON-NLS-1$
+ private static final String VDB_ELEMENT = "VirtualDatabase";//$NON-NLS-1$
+ private static final String DESCRIPTION = "description";//$NON-NLS-1$
+ private static final String MARKERS = "markers";//$NON-NLS-1$
+}
Property changes on: branches/JCA/runtime/src/main/java/org/teiid/deployers/ManifestParser.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/JCA/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java
===================================================================
--- branches/JCA/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java (rev 0)
+++ branches/JCA/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java 2009-11-30 18:04:19 UTC (rev 1607)
@@ -0,0 +1,64 @@
+package org.teiid.deployers;
+
+import java.util.Map;
+import java.util.Set;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
+import org.jboss.deployers.spi.deployer.managed.ManagedObjectCreator;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.api.factory.ManagedObjectFactory;
+import org.teiid.adminapi.impl.ModelMetaData;
+import org.teiid.adminapi.impl.VDBMetaData;
+
+public class VDBDeployer extends AbstractSimpleRealDeployer<VDBMetaData> implements ManagedObjectCreator {
+ private ManagedObjectFactory mof;
+ private VDBRepository vdbRepository;
+
+ public VDBDeployer() {
+ super(VDBMetaData.class);
+ setInput(VDBMetaData.class);
+ setOutput(VDBMetaData.class);
+ }
+
+ @Override
+ public void deploy(DeploymentUnit unit, VDBMetaData deployment) throws DeploymentException {
+ this.vdbRepository.addVDB(deployment);
+ System.out.println("VDB = "+deployment + " deployed");
+ }
+
+ @Override
+ public void build(DeploymentUnit unit, Set<String> attachmentNames, Map<String, ManagedObject> managedObjects)
+ throws DeploymentException {
+
+ ManagedObject vdbMO = managedObjects.get(VDBMetaData.class.getName());
+ if (vdbMO != null) {
+ VDBMetaData vdb = (VDBMetaData) vdbMO.getAttachment();
+ for (ModelMetaData m : vdb.getModels()) {
+
+ ManagedObject mo = this.mof.initManagedObject(m, ModelMetaData.class, m.getName(),m.getName());
+ if (mo == null) {
+ throw new DeploymentException("could not create managed object");
+ }
+ managedObjects.put(mo.getName(), mo);
+ }
+ }
+ }
+
+ public void setManagedObjectFactory(ManagedObjectFactory mof) {
+ this.mof = mof;
+ }
+
+ public void setVDBRepository(VDBRepository repo) {
+ this.vdbRepository = repo;
+ }
+
+ @Override
+ public void undeploy(DeploymentUnit unit, VDBMetaData deployment) {
+ super.undeploy(unit, deployment);
+ this.vdbRepository.removeVDB(deployment.getName(), deployment.getVersion());
+ System.out.println("VDB = "+deployment + " undeployed");
+ }
+
+}
Property changes on: branches/JCA/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/JCA/runtime/src/main/java/org/teiid/deployers/VDBParserDeployer.java
===================================================================
--- branches/JCA/runtime/src/main/java/org/teiid/deployers/VDBParserDeployer.java (rev 0)
+++ branches/JCA/runtime/src/main/java/org/teiid/deployers/VDBParserDeployer.java 2009-11-30 18:04:19 UTC (rev 1607)
@@ -0,0 +1,93 @@
+/*
+ * 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 org.teiid.deployers;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.deployers.vfs.spi.deployer.MultipleVFSParsingDeployer;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.logging.Logger;
+import org.jboss.virtual.VirtualFile;
+import org.teiid.adminapi.impl.ModelMetaData;
+import org.teiid.adminapi.impl.VDBMetaData;
+
+/**
+ * This file loads the ".def" file and "manifest" file inside a VDB file.
+ */
+public class VDBParserDeployer extends MultipleVFSParsingDeployer<VDBMetaData> {
+ protected Logger log = Logger.getLogger(getClass());
+
+ public VDBParserDeployer() {
+ super(VDBMetaData.class, getCustomMappings());
+ }
+
+ private static Map<String, Class<?>> getCustomMappings() {
+ Map<String, Class<?>> mappings = new HashMap<String, Class<?>>();
+ mappings.put("ConfigurationInfo.def", VDBMetaData.class);
+ mappings.put("MetaMatrix-VdbManifestModel.xmi", ManifestMetaData.class);
+ return mappings;
+ }
+
+ @Override
+ protected <U> U parse(Class<U> expectedType, VirtualFile file, Object root) throws Exception {
+ if (expectedType.equals(VDBMetaData.class)) {
+ VDBMetaData def = DefParser.load(file.openStream());
+ return expectedType.cast(def);
+ }
+ else if (expectedType.equals(ManifestMetaData.class)) {
+ ManifestMetaData manifest = ManifestParser.load(file.openStream());
+ return expectedType.cast(manifest);
+ }
+ else {
+ throw new IllegalArgumentException("Cannot match arguments: expectedClass=" + expectedType );
+ }
+ }
+
+ @Override
+ protected VDBMetaData mergeMetaData(VFSDeploymentUnit unit, Map<Class<?>, List<Object>> metadata) throws Exception {
+ VDBMetaData def = getInstance(metadata, VDBMetaData.class);
+ ManifestMetaData manifest = getInstance(metadata, ManifestMetaData.class);
+
+ if (def == null || manifest == null) {
+ log.error("Invalid VDB file deployment failed ="+unit.getRoot().getName());
+ return null;
+ }
+ log.debug("VDB "+unit.getRoot().getName()+" has been parsed.");
+ return merge(def, manifest);
+ }
+
+ private VDBMetaData merge(VDBMetaData def, ManifestMetaData manifest) {
+ for(ModelMetaData manifestModel: manifest.models) {
+ ModelMetaData model = def.getModel(manifestModel.getName());
+ if (model != null) {
+ model.setModelType(manifestModel.getModelType());
+ model.setModelURI(manifestModel.getModelURI());
+ model.setPath(manifestModel.getPath());
+ model.setUuid(manifestModel.getUuid());
+ model.setVisible(manifestModel.isVisible());
+ }
+ }
+ return def;
+ }
+}
Property changes on: branches/JCA/runtime/src/main/java/org/teiid/deployers/VDBParserDeployer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/JCA/runtime/src/main/java/org/teiid/deployers/VDBRepository.java
===================================================================
--- branches/JCA/runtime/src/main/java/org/teiid/deployers/VDBRepository.java (rev 0)
+++ branches/JCA/runtime/src/main/java/org/teiid/deployers/VDBRepository.java 2009-11-30 18:04:19 UTC (rev 1607)
@@ -0,0 +1,87 @@
+/*
+ * 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 org.teiid.deployers;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.teiid.adminapi.VDB;
+import org.teiid.adminapi.impl.VDBMetaData;
+
+import com.metamatrix.dqp.embedded.DQPEmbeddedPlugin;
+import com.metamatrix.metadata.runtime.api.VirtualDatabaseDoesNotExistException;
+import com.metamatrix.metadata.runtime.api.VirtualDatabaseException;
+import com.metamatrix.vdb.runtime.VDBKey;
+
+/**
+ * Repository for VDBs
+ */
+public class VDBRepository {
+
+ Map<VDBKey, VDBMetaData> repo = new ConcurrentHashMap<VDBKey, VDBMetaData>();
+
+ public void addVDB(VDBMetaData vdb) throws DeploymentException {
+ if (getVDB(vdb.getName(), vdb.getVersion()) != null) {
+ throw new DeploymentException("VDB with given name and version already exists!");
+ }
+ this.repo.put(vdbId(vdb), vdb);
+ }
+
+ public VDBMetaData getVDB(String name, int version) {
+ return this.repo.get(vdbId(name, version));
+ }
+
+
+ protected VDBKey vdbId(VDBMetaData vdb) {
+ return new VDBKey(vdb.getName(), vdb.getVersion());
+ }
+
+ protected VDBKey vdbId(String name, int version) {
+ return new VDBKey(name, version);
+ }
+
+ public void removeVDB(String name, int version) {
+ if (getVDB(name, version) != null) {
+ this.repo.remove(vdbId(name, version));
+ }
+ }
+
+ public VDBMetaData getActiveVDB(String vdbName) throws VirtualDatabaseDoesNotExistException, VirtualDatabaseException {
+ int latestVersion = 0;
+ for (VDBKey key:this.repo.keySet()) {
+ if(key.getName().equalsIgnoreCase(vdbName)) {
+ // Make sure the VDB Name and version number are the only parts of this vdb key
+ latestVersion = Math.max(latestVersion, Integer.parseInt(key.getVersion()));
+ }
+ }
+ if(latestVersion == 0) {
+ throw new VirtualDatabaseDoesNotExistException(DQPEmbeddedPlugin.Util.getString("VDBService.VDB_does_not_exist._2", vdbName, "latest")); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ VDBMetaData vdb = getVDB(vdbName, latestVersion);
+ if (vdb.getStatus() != VDB.Status.ACTIVE) {
+ throw new VirtualDatabaseException(DQPEmbeddedPlugin.Util.getString("VDBService.VDB_does_not_exist._2", vdbName, latestVersion)); //$NON-NLS-1$
+ }
+ return vdb;
+ }
+}
Property changes on: branches/JCA/runtime/src/main/java/org/teiid/deployers/VDBRepository.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/JCA/runtime/src/main/java/org/teiid/deployers/VDBStructure.java
===================================================================
--- branches/JCA/runtime/src/main/java/org/teiid/deployers/VDBStructure.java (rev 0)
+++ branches/JCA/runtime/src/main/java/org/teiid/deployers/VDBStructure.java 2009-11-30 18:04:19 UTC (rev 1607)
@@ -0,0 +1,41 @@
+package org.teiid.deployers;
+
+import java.io.IOException;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.vfs.plugins.structure.AbstractVFSStructureDeployer;
+import org.jboss.deployers.vfs.spi.structure.StructureContext;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.plugins.context.jar.JarUtils;
+
+
+public class VDBStructure extends AbstractVFSStructureDeployer{
+
+ public VDBStructure(){
+ setRelativeOrder(1000);
+ JarUtils.addJarSuffix(".vdb");
+ }
+
+ @Override
+ public boolean determineStructure(StructureContext structureContext) throws DeploymentException {
+ VirtualFile file = structureContext.getFile();
+ try {
+ if (isLeaf(file) == false) {
+ if (file.getName().endsWith(".vdb")) {
+ if (file.getChild("ConfigurationInfo.def") == null) {
+ return false;
+ }
+ if (file.getChild("MetaMatrix-VdbManifestModel.xmi") == null) {
+ return false;
+ }
+ createContext(structureContext, new String[] {"/"});
+ return true;
+ }
+ }
+ } catch (IOException e) {
+ throw DeploymentException.rethrowAsDeploymentException("Error determining structure: " + file.getName(), e);
+ }
+ return false;
+ }
+
+}
Property changes on: branches/JCA/runtime/src/main/java/org/teiid/deployers/VDBStructure.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
15 years, 1 month
teiid SVN: r1606 - in trunk: common-internal/src/main/java/com/metamatrix/common/tree and 16 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2009-11-30 12:12:55 -0500 (Mon, 30 Nov 2009)
New Revision: 1606
Added:
trunk/engine/src/test/java/org/teiid/metadata/TestTransformationMetadata.java
Removed:
trunk/common-internal/src/main/java/com/metamatrix/common/tree/PassThroughTreeNodeFilter.java
trunk/common-internal/src/main/java/com/metamatrix/common/tree/TreeNode.java
trunk/common-internal/src/main/java/com/metamatrix/common/tree/TreeNodeComparator.java
trunk/common-internal/src/main/java/com/metamatrix/common/tree/TreeNodeEditor.java
trunk/common-internal/src/main/java/com/metamatrix/common/tree/TreeNodeException.java
trunk/common-internal/src/main/java/com/metamatrix/common/tree/TreeNodeFilter.java
trunk/common-internal/src/main/java/com/metamatrix/common/tree/TreeNodeIterator.java
trunk/common-internal/src/main/java/com/metamatrix/common/tree/TreeNodeNameComparator.java
trunk/common-internal/src/main/java/com/metamatrix/common/tree/TreeNodePathComparator.java
trunk/common-internal/src/main/java/com/metamatrix/common/tree/TreeNodePropertyComparator.java
trunk/common-internal/src/main/java/com/metamatrix/common/tree/TreeNodeSource.java
trunk/common-internal/src/main/java/com/metamatrix/common/tree/TreeView.java
trunk/common-internal/src/main/java/com/metamatrix/common/tree/basic/
trunk/common-internal/src/main/java/com/metamatrix/common/tree/directory/
trunk/common-internal/src/main/java/com/metamatrix/common/vdb/api/SystemVdbUtility.java
trunk/common-internal/src/test/java/com/metamatrix/common/config/model/
trunk/common-internal/src/test/java/com/metamatrix/common/tree/directory/
trunk/engine/src/main/java/org/teiid/dqp/internal/process/QueryMetadataWrapper.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/validator/ModelVisibilityValidationVisitor.java
trunk/engine/src/test/java/org/teiid/dqp/internal/process/validator/TestModelVisibilityValidationVisitor.java
trunk/engine/src/test/java/org/teiid/metadata/TestCompositeMetadataStore.java
Modified:
trunk/common-internal/src/main/java/com/metamatrix/common/object/PropertyType.java
trunk/common-internal/src/main/java/com/metamatrix/common/object/StandardPropertyTypeValidator.java
trunk/common-internal/src/main/java/com/metamatrix/common/vdb/api/VDBArchive.java
trunk/common-internal/src/main/java/com/metamatrix/platform/admin/api/PermissionNode.java
trunk/common-internal/src/main/java/com/metamatrix/platform/admin/apiimpl/PermissionDataNodeImpl.java
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/MetadataFactory.java
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Schema.java
trunk/engine/src/main/java/com/metamatrix/dqp/service/AuthorizationService.java
trunk/engine/src/main/java/com/metamatrix/platform/security/api/service/MembershipServiceInterface.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/CachedRequestWorkItem.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/MetaDataProcessor.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/validator/AuthorizationValidationVisitor.java
trunk/engine/src/main/java/org/teiid/metadata/CompositeMetadataStore.java
trunk/engine/src/main/java/org/teiid/metadata/TransformationMetadata.java
trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java
trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestMetaDataProcessor.java
trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestRequest.java
trunk/engine/src/test/java/org/teiid/dqp/internal/process/validator/TestAuthorizationValidationVisitor.java
trunk/runtime/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedVDBService.java
trunk/runtime/src/main/java/com/metamatrix/platform/security/membership/service/MembershipServiceImpl.java
Log:
TEIID-750 consolidating the entitlement and visibility checking and ensuring that visibility is checked on prepared statements. also removing common tree code
Modified: trunk/common-internal/src/main/java/com/metamatrix/common/object/PropertyType.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/object/PropertyType.java 2009-11-30 15:24:24 UTC (rev 1605)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/object/PropertyType.java 2009-11-30 17:12:55 UTC (rev 1606)
@@ -22,6 +22,7 @@
package com.metamatrix.common.object;
+import java.io.File;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
@@ -73,7 +74,7 @@
public static final PropertyType SET = new PropertyType(113, SET_NAME, java.util.Set.class.getName() );
public static final PropertyType URL = new PropertyType(114, URL_NAME, java.net.URL.class.getName() );
public static final PropertyType HOSTNAME = new PropertyType(115, HOSTNAME_NAME, java.net.InetAddress.class.getName() );
- public static final PropertyType FILE = new PropertyType(116, FILE_NAME, com.metamatrix.common.tree.directory.DirectoryEntry.class.getName() );
+ public static final PropertyType FILE = new PropertyType(116, FILE_NAME, File.class.getName() );
public static final PropertyType OBJECT_ID = new PropertyType(117, OBJECT_ID_NAME, com.metamatrix.core.id.ObjectID.class.getName() );
public static final PropertyType PASSWORD = new PropertyType(119, PASSWORD_NAME, PASSWORD_CLASS.getName() );
public static final PropertyType PROPERTIED_OBJECT = new PropertyType(120, PROPERTIED_OBJECT_NAME, com.metamatrix.common.object.PropertiedObject.class.getName() );
Modified: trunk/common-internal/src/main/java/com/metamatrix/common/object/StandardPropertyTypeValidator.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/object/StandardPropertyTypeValidator.java 2009-11-30 15:24:24 UTC (rev 1605)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/object/StandardPropertyTypeValidator.java 2009-11-30 17:12:55 UTC (rev 1606)
@@ -22,6 +22,7 @@
package com.metamatrix.common.object;
+import java.io.File;
import java.io.Serializable;
import java.net.InetAddress;
import java.net.MalformedURLException;
@@ -31,7 +32,6 @@
import java.util.HashMap;
import java.util.Map;
-import com.metamatrix.common.tree.directory.DirectoryEntry;
import com.metamatrix.core.id.ObjectID;
public final class StandardPropertyTypeValidator implements Serializable {
@@ -331,7 +331,9 @@
}
class DirectoryEntryValidator implements PropertyTypeValidator, Serializable {
public boolean isValidValue(Object value ) {
- if ( value instanceof DirectoryEntry ) {
+ if (value instanceof String) {
+ return true;
+ } else if ( value instanceof File ) {
return true;
}else if(value instanceof Object[]) {
return StandardPropertyTypeValidator.isValidValue((Object[])value, this);
Deleted: trunk/common-internal/src/main/java/com/metamatrix/common/tree/PassThroughTreeNodeFilter.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/tree/PassThroughTreeNodeFilter.java 2009-11-30 15:24:24 UTC (rev 1605)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/tree/PassThroughTreeNodeFilter.java 2009-11-30 17:12:55 UTC (rev 1606)
@@ -1,44 +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.tree;
-
-
-
-public class PassThroughTreeNodeFilter implements TreeNodeFilter {
-
- /**
- * Obtain a description for this filter.
- * @return the readable description. For example: "JPG and GIF Images"
- */
- public String getDescription(){
- return "All files (*.*)"; //$NON-NLS-1$
- }
- /**
- * Determine whether the given TreeNode is accepted by this filter.
- * @return true if accepted, or false otherwise.
- */
- public boolean accept(TreeNode entry){
- return true;
- }
-}
-
Deleted: trunk/common-internal/src/main/java/com/metamatrix/common/tree/TreeNode.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/tree/TreeNode.java 2009-11-30 15:24:24 UTC (rev 1605)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/tree/TreeNode.java 2009-11-30 17:12:55 UTC (rev 1606)
@@ -1,124 +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.tree;
-
-import com.metamatrix.common.object.ObjectDefinition;
-import com.metamatrix.common.object.PropertiedObject;
-
-/**
- * This interface represents a single entry on a hierarchical system.
- */
-public interface TreeNode extends Comparable, PropertiedObject {
-
- /**
- * Return whether this TreeNode represents an existing resource.
- * @return true the entry exists, or false otherwise.
- */
- boolean exists();
-
- /**
- * Obtain the name of this TreeNode. The name does not contain the
- * namespace but is unique within the namespace of the TreeNode.
- * @return the name of the node; never null or zero-length
- */
- String getName();
-
- /**
- * Obtain the full name of the TreeNode which is unique within the TreeView.
- * The full name is the concatenation of the namespace, separator, and
- * name of this TreeNode.
- * @return the fully qualified name of this node; never null
- */
- String getFullName();
-
- /**
- * Obtain the namespace to which this tree node belongs. The separator
- * character is used between each of the components of the namespace.
- * @return the string that represents the namespace of this node; never null
- */
- String getNamespace();
-
- /**
- * Get this type for this tree node.
- * @return the entity's type; never null
- */
- ObjectDefinition getType();
-
- /**
- * Obtain the character that is used to separate names in a path sequence for
- * the abstract path. This character is completely dependent upon the implementation.
- * @return the charater used to delimit names in the abstract path.
- */
- char getSeparatorChar();
-
- /**
- * Obtain the character (as a String) that is used to separate names in a path sequence for
- * the abstract path.
- * @return the string containing the charater used to delimit names in the abstract path; never null
- */
- String getSeparator();
-
- /**
- * Return whether this node has undergone changes. The time from which changes are
- * maintained is left to the implementation.
- * @return true if this TreeNode has changes, or false otherwise.
- */
- boolean isModified();
-
- /**
- * Compares this object to another. If the specified object is
- * an instance of the TreeNode class, then this
- * method compares the contents; otherwise, it throws a
- * ClassCastException (as instances are comparable only to
- * instances of the same
- * class).
- * <p>
- * Note: this method <i>is</i> consistent with
- * <code>equals()</code>, meaning that
- * <code>(compare(x, y)==0) == (x.equals(y))</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.
- */
- int compareTo(Object par1);
- /**
- * Returns true if the specified object is semantically equal
- * to this instance.
- * Note: this method is consistent with
- * <code>compareTo()</code>.
- * @param obj the object that this instance is to be compared to.
- * @return whether the object is equal to this object.
- */
- boolean equals(Object par1);
-
- /**
- * Return the string form of this TreeNode.
- * @return the stringified abstract path, equivalent to <code>getPath</code>
- */
- String toString();
-
-}
Deleted: trunk/common-internal/src/main/java/com/metamatrix/common/tree/TreeNodeComparator.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/tree/TreeNodeComparator.java 2009-11-30 15:24:24 UTC (rev 1605)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/tree/TreeNodeComparator.java 2009-11-30 17:12:55 UTC (rev 1606)
@@ -1,31 +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.tree;
-
-import java.util.Comparator;
-
-public interface TreeNodeComparator extends Comparator {
-
- void setTreeNodeEditor(TreeNodeEditor editor);
-}
-
Deleted: trunk/common-internal/src/main/java/com/metamatrix/common/tree/TreeNodeEditor.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/tree/TreeNodeEditor.java 2009-11-30 15:24:24 UTC (rev 1605)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/tree/TreeNodeEditor.java 2009-11-30 17:12:55 UTC (rev 1606)
@@ -1,200 +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.tree;
-
-import com.metamatrix.common.object.ObjectDefinition;
-import com.metamatrix.common.object.PropertiedObjectEditor;
-import com.metamatrix.common.object.PropertyDefinition;
-
-/**
- * This interface defines a view of a hierarchy of TreeNode instances.
- */
-public interface TreeNodeEditor extends PropertiedObjectEditor {
-
- /**
- * Set the marked state of the TreeNode node.
- * @param marked the marked state of the node.
- */
- void setMarked(TreeNode node, boolean marked);
-
- /**
- * Return the marked state of the specified node.
- * @return the marked state of the node.
- */
- boolean isMarked(TreeNode node);
-
- /**
- * Determine whether the specified node is a child of the given parent node.
- * @return true if the node is a child of the given parent node.
- */
- boolean isParentOf(TreeNode parent, TreeNode child);
-
- /**
- * Determine whether the specified node is a descendent of the given ancestor node.
- * @return true if the node is a descendent of the given ancestor node.
- */
- boolean isAncestorOf(TreeNode ancestor, TreeNode descendent);
-
- /**
- * Create a new instance of a TreeNode under the specified parent and
- * with the specified type. The name of the new object is created automatically.
- * @param parent the TreeNode that is to be the parent of the new tree node object
- * @param type the ObjectDefinition instance that defines the type of tree node
- * object to instantiate.
- * @return the new instance or null if the new instance could not be created.
- * @throws IllegalArgumentException if the parent and the new TreeNode
- * are not compatible
- * @throws AssertionError if <code>parent</code> or <code>type</code>
- * is null
- */
- TreeNode create(TreeNode parent, ObjectDefinition type);
-
- /**
- * Create a new instance of a TreeNode under the specified parent,
- * with the specified type and with the specified name
- * @param parent the TreeNode that is to be the parent of the new tree node object
- * @param name the name for the new object
- * @param type the ObjectDefinition instance that defines the type of tree node
- * object to instantiate.
- * @return the new instance or null if the new instance could not be created.
- * @throws IllegalArgumentException if the parent and the new TreeNode
- * are not compatible
- * @throws AssertionError if <code>parent</code> or <code>type</code>
- * is null
- */
- TreeNode create(TreeNode parent, String name, ObjectDefinition type);
-
- /**
- * Removes the specified TreeNode instance (and all its children) from
- * its parent. After this method is called, the caller is responsible for
- * maintaining the referenced to the specified object (to prevent garbage
- * collection).
- * @param obj the node to be deleted; may not be null
- * @return true if deletion is successful, or false otherwise.
- * @throws AssertionError if <code>obj</code> is null
- */
- boolean delete(TreeNode node);
-
- /**
- * Creates and places a copy of the specified original TreeNode under the specified new parent.
- * This method does not affect the original TreeNode or its contents.
- * <p>
- * This methods may be used in conjunction with a reference
- * to an existing TreeNode instance in this or another session to <i>copy</i>
- * TreeNode instances and paste them in this session.
- * @param original the original node to be copied; may not be null
- * @param newParent the nodethat is to be considered the
- * parent of the newly created instances; may not be null
- * @param deepCopy true if this paste operation is to place a deep copy of
- * <code>original</code>, or false if only the <code>original</code>
- * node and its immediate properties are to be pasted.
- * @return the node that resulted from the paste, or null if the paste failed.
- * @throws AssertionError if either of <code>original</code> or <code>newParent</code> is null
- */
- TreeNode paste(TreeNode original, TreeNode newParent, boolean deepCopy);
-
- /**
- * Moves this TreeNode to be a child of the specified new parent.
- * The specified object <i>is</i> modified, since it's namespace is changed
- * to be newParent.
- * <p>
- * This method may be used in conjunction with the <code>delete</code> method
- * of an editor from this or another another session to <i>cut</i> TreeNode instances
- * from the original's session and paste them (or move them) into this session.
- * <p>
- * @param obj the node to be moved; may not be null
- * @param newParent the node that is to be considered the
- * parent of the existing instance; may not be null
- * @return true if this node was moved, or false otherwise.
- * @throws AssertionError if either of <code>obj</code> or <code>newParent</code> is null
- */
- boolean move(TreeNode node, TreeNode newParent);
-
- /**
- * Moves this TreeNode to be a child at a particular index in the specified new parent.
- * The specified object <i>is</i> modified, since it's namespace is changed
- * to be newParent.
- * <p>
- * This method may be used in conjunction with the <code>delete</code> method
- * of an editor from this or another another session to <i>cut</i> TreeNode instances
- * from the original's session and paste them (or move them) into this session.
- * <p>
- * @param obj the node to be moved; may not be null
- * @param newParent the node that is to be considered the
- * parent of the existing instance; may not be null
- * @param indexInNewParent the position that this node will occupy within the ordered list
- * of children for newParent.
- * @return true if this node was moved, or false otherwise.
- * @throws AssertionError if either of <code>obj</code> or <code>newParent</code> is null
- * @throws IndexOutOfBoundsException if the index is not within the range
- * <code>0 <= newIndex < childCount</code>
- */
- boolean move(TreeNode node, TreeNode newParent, int indexInNewParent);
-
- /**
- * Moves this TreeNode to the specified location within the ordered list of
- * children for the node's parent.
- * @param child the node to be moved; may not be null
- * @param newIndex the position that this node will occupy within the ordered list
- * of children for the node's parent.
- * @return true if this node was moved, or false otherwise.
- * @throws AssertionError if either of <code>obj</code> or <code>newParent</code> is null
- * @throws IndexOutOfBoundsException if the index is not within the range
- * <code>0 <= newIndex < childCount</code>
- */
- boolean moveChild(TreeNode child, int newIndex);
-
- /**
- * Renames this TreeNode to the specified new name. This operation will
- * not succeed if there is already a node underneath the parent
- * with the same name as the specified newName.
- * @param obj the node to be renamed; may not be null
- * @param newName the new name for the object; may not be null or zero-length,
- * and must not be used by an existing sibling
- * @return true if this node was renamed, or false otherwise.
- * @throws AssertionError if either of <code>obj</code> or <code>newName</code> is null,
- * or if <code>newName</code> is zero-length
- */
- boolean rename(TreeNode node, String newName);
-
- /**
- * Filter the specified PropertyDefinition instances and return the first
- * definition that is mapped to "the name" property for the tree node.
- * @param obj the tree node; may not be null
- * @return the first PropertyDefinition instance found in the list of
- * PropertyDefinition instances that represents the name property for the object,
- * or null if no such PropertyDefinition is found.
- */
- PropertyDefinition getNamePropertyDefinition(TreeNode obj);
-
- /**
- * Filter the specified PropertyDefinition instances and return the first
- * definition that is mapped to "the description" property for the metadata object.
- * @param obj the tree node; may not be null
- * @return the first PropertyDefinition instance found in the list of
- * PropertyDefinition instances that represents the description property for the object,
- * or null if no such PropertyDefinition is found.
- */
-// PropertyDefinition getDescriptionPropertyDefinition(TreeNode obj);
-
-}
Deleted: trunk/common-internal/src/main/java/com/metamatrix/common/tree/TreeNodeException.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/tree/TreeNodeException.java 2009-11-30 15:24:24 UTC (rev 1605)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/tree/TreeNodeException.java 2009-11-30 17:12:55 UTC (rev 1606)
@@ -1,82 +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.tree;
-
-import com.metamatrix.api.exception.MetaMatrixException;
-
-/**
- * This exception denotes that the user account could not be identified, could not be located, or was invalid.
- */
-public class TreeNodeException extends MetaMatrixException{
-
- /**
- * No-arg costructor required by Externalizable semantics
- */
- public TreeNodeException() {
- super();
- }
-
- /**
- * Construct an instance with the message specified.
- *
- * @param message A message describing the exception
- */
- public TreeNodeException( String message ) {
- super( message );
- }
-
- /**
- * Construct an instance with the message and error code specified.
- *
- * @param message A message describing the exception
- * @param code The error code
- */
- public TreeNodeException( String code, String message ) {
- super( code, message );
- }
-
- /**
- * Construct an instance from a message and an exception to chain to this one.
- *
- * @param code A code denoting the exception
- * @param e An exception to nest within this one
- */
- public TreeNodeException( Exception e, String message ) {
- super( e, message );
- }
-
- /**
- * Construct an instance from a message and a code and an exception to
- * chain to this one.
- *
- * @param e An exception to nest within this one
- * @param message A message describing the exception
- * @param code A code denoting the exception
- */
- public TreeNodeException( Exception e, String code, String message ) {
- super( e, code, message );
- }
-}
-
-
-
Deleted: trunk/common-internal/src/main/java/com/metamatrix/common/tree/TreeNodeFilter.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/tree/TreeNodeFilter.java 2009-11-30 15:24:24 UTC (rev 1605)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/tree/TreeNodeFilter.java 2009-11-30 17:12:55 UTC (rev 1606)
@@ -1,39 +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.tree;
-
-public interface TreeNodeFilter {
-
- /**
- * Obtain a description for this filter.
- * @return the readable description. For example: "JPG and GIF Images"
- */
- String getDescription();
-
- /**
- * Determine whether the given TreeNode is accepted by this filter.
- * @return true if accepted, or false otherwise.
- */
- boolean accept(TreeNode entry);
-}
-
Deleted: trunk/common-internal/src/main/java/com/metamatrix/common/tree/TreeNodeIterator.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/tree/TreeNodeIterator.java 2009-11-30 15:24:24 UTC (rev 1605)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/tree/TreeNodeIterator.java 2009-11-30 17:12:55 UTC (rev 1606)
@@ -1,144 +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.tree;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.NoSuchElementException;
-
-import com.metamatrix.common.CommonPlugin;
-import com.metamatrix.common.util.ErrorMessageKeys;
-import com.metamatrix.core.util.ArgCheck;
-
-public class TreeNodeIterator implements Iterator {
-
- private List startingNodes;
- private TreeView view;
- private TreeNode last;
- private TreeNode next;
-
- public TreeNodeIterator( List startingNodes, TreeView view ) {
- ArgCheck.isNotNull(startingNodes);
- ArgCheck.isNotNull(view);
- this.startingNodes = startingNodes;
- this.view = view;
- if ( this.startingNodes.size() != 0 ) {
- this.next = (TreeNode) this.startingNodes.get(0);
- } else {
- this.next = null;
- }
- this.last = null;
- }
-
- public TreeNodeIterator( TreeNode startingNode, TreeView view ) {
- ArgCheck.isNotNull(startingNode);
- ArgCheck.isNotNull(view);
- this.startingNodes = new ArrayList(1);
- this.startingNodes.add(startingNode);
- this.view = view;
- this.next = startingNode;
- this.last = null;
- }
-
- public boolean hasNext() {
- return this.next != null;
- }
-
- public Object next() {
- return nextPreOrder(false);
- }
-
- protected Object nextPreOrder( boolean skipChildren ) {
- if ( this.next != null ) {
- this.last = this.next;
-
- if ( !skipChildren ) {
- // The next node is the first child ...
- List children = this.view.getChildren(this.last);
- if ( children != null && children.size() != 0 ) {
- this.next = (TreeNode) children.get(0);
- return this.last;
- }
- }
-
- // If no children, the next node is the next sibling of this node ...
- this.next = getNextSibling(this.last);
- if ( this.next != null ) {
- return this.last; // found a next sibling ...
- }
-
- // If no next sibling, go up to the ancestor that has a next sibling
- TreeNode node = this.last;
- while ( ! isStartingNode(node) ) {
- node = this.view.getParent(node);
- // If there is no parent ...
- if ( node == null ) {
- break;
- }
- this.next = getNextSibling(node);
- if ( this.next != null ) {
- return this.last;
- }
- }
-
- // There's nothing left
- this.next = null;
- return this.last;
- }
- throw new NoSuchElementException(CommonPlugin.Util.getString(ErrorMessageKeys.TREE_ERR_0012));
- }
-
- public void remove() {
- throw new UnsupportedOperationException(CommonPlugin.Util.getString(ErrorMessageKeys.TREE_ERR_0013));
- }
-
- protected boolean isStartingNode( TreeNode node ) {
- return this.startingNodes.contains(node);
- }
-
- protected TreeNode getNextSibling( TreeNode node ) {
- // If the node is one of the starting nodes ...
- if ( this.startingNodes.contains(node) ) {
- int indexOfNode = this.startingNodes.indexOf(node);
- int indexOfNext = indexOfNode + 1;
- if ( indexOfNext != this.startingNodes.size() ) {
- return (TreeNode) this.startingNodes.get(indexOfNext);
- }
- return null;
- }
-
- TreeNode parent = this.view.getParent(node);
- if ( parent != null ) {
- List siblings = this.view.getChildren(parent);
- int indexOfNode = siblings.indexOf(node);
- int indexOfNext = indexOfNode + 1;
- if ( indexOfNext != siblings.size() ) {
- return (TreeNode) siblings.get(indexOfNext);
- }
- }
- return null;
- }
-
-}
-
Deleted: trunk/common-internal/src/main/java/com/metamatrix/common/tree/TreeNodeNameComparator.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/tree/TreeNodeNameComparator.java 2009-11-30 15:24:24 UTC (rev 1605)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/tree/TreeNodeNameComparator.java 2009-11-30 17:12:55 UTC (rev 1606)
@@ -1,77 +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.tree;
-
-import com.metamatrix.common.CommonPlugin;
-import com.metamatrix.common.util.ErrorMessageKeys;
-
-public class TreeNodeNameComparator implements TreeNodeComparator {
-
- private static final boolean DEFAULT_IGNORE_CASE = false;
-
-// private TreeNodeEditor editor = null;
- private boolean ignoreCase;
-
- public TreeNodeNameComparator( boolean ignoreCase ) {
- this.ignoreCase = ignoreCase;
- }
-
- public TreeNodeNameComparator() {
- this(DEFAULT_IGNORE_CASE);
- }
-
- public void setTreeNodeEditor( TreeNodeEditor editor ) {
- if ( editor == null ) {
- throw new AssertionError(CommonPlugin.Util.getString(ErrorMessageKeys.TREE_ERR_0014));
- }
-// this.editor = editor;
- }
-
- public int compare(Object obj1, Object obj2){
- TreeNode entity1 = (TreeNode) obj1; // May throw ClassCastException
- TreeNode entity2 = (TreeNode) obj2; // May throw ClassCastException
- if ( entity1 == null && entity2 == null ) {
- return 0;
- }
- if ( entity1 != null && entity2 == null ) {
- return 1;
- }
- if ( entity1 == null && entity2 != null ) {
- return -1;
- }
- int result = 0;
- if ( this.ignoreCase ) {
- result = entity1.getName().compareToIgnoreCase(entity2.getName());
- } else {
- result = entity1.getName().compareTo(entity2.getName());
- }
-//System.out.println("-- Comparing " + entity1.getFullName() + " to " + entity2.getFullName() + " = " + result);
- return result;
- }
- public boolean equals(Object obj){
- // Both classes must match exactly!!!
- // Since this class has no state, there are no attributes to compare
- return ( obj != null && this.getClass() == obj.getClass() );
- }
-}
-
Deleted: trunk/common-internal/src/main/java/com/metamatrix/common/tree/TreeNodePathComparator.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/tree/TreeNodePathComparator.java 2009-11-30 15:24:24 UTC (rev 1605)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/tree/TreeNodePathComparator.java 2009-11-30 17:12:55 UTC (rev 1606)
@@ -1,69 +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.tree;
-
-import com.metamatrix.common.CommonPlugin;
-import com.metamatrix.common.util.ErrorMessageKeys;
-
-public class TreeNodePathComparator implements TreeNodeComparator {
-
-// private TreeNodeEditor editor = null;
-
- public void setTreeNodeEditor( TreeNodeEditor editor ) {
- if ( editor == null ) {
- throw new AssertionError(CommonPlugin.Util.getString(ErrorMessageKeys.TREE_ERR_0014));
- }
-// this.editor = editor;
- }
-
- public int compare(TreeNode entry1, TreeNode entry2){
- if ( entry1 == null ) {
- throw new AssertionError(CommonPlugin.Util.getString(ErrorMessageKeys.TREE_ERR_0015));
- }
- if ( entry2 == null ) {
- throw new AssertionError(CommonPlugin.Util.getString(ErrorMessageKeys.TREE_ERR_0016));
- }
- String value1 = entry1.getFullName();
- String value2 = entry2.getFullName();
- if ( value1 == null ) {
- throw new AssertionError(CommonPlugin.Util.getString(ErrorMessageKeys.TREE_ERR_0017));
- }
- if ( value2 == null ) {
- throw new AssertionError(CommonPlugin.Util.getString(ErrorMessageKeys.TREE_ERR_0018));
- }
- return value1.compareTo(value1);
- }
- public boolean equals(TreeNodePathComparator comparator){
- if ( comparator == null ) {
- return false;
- }
- return ( comparator.getClass() == this.getClass() );
- }
- public int compare(Object entry1, Object entry2){
- throw new ClassCastException(CommonPlugin.Util.getString(ErrorMessageKeys.TREE_ERR_0019));
- }
- public boolean equals(Object entry){
- throw new ClassCastException(CommonPlugin.Util.getString(ErrorMessageKeys.TREE_ERR_0020));
- }
-}
-
Deleted: trunk/common-internal/src/main/java/com/metamatrix/common/tree/TreeNodePropertyComparator.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/tree/TreeNodePropertyComparator.java 2009-11-30 15:24:24 UTC (rev 1605)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/tree/TreeNodePropertyComparator.java 2009-11-30 17:12:55 UTC (rev 1606)
@@ -1,83 +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.tree;
-
-import com.metamatrix.common.CommonPlugin;
-import com.metamatrix.common.object.PropertyDefinition;
-import com.metamatrix.common.util.ErrorMessageKeys;
-
-public class TreeNodePropertyComparator implements TreeNodeComparator {
-
- private PropertyDefinition defn;
- private TreeNodeEditor editor = null;
-
- public void setTreeNodeEditor( TreeNodeEditor editor ) {
- if ( editor == null ) {
- throw new AssertionError(CommonPlugin.Util.getString(ErrorMessageKeys.TREE_ERR_0014));
- }
- this.editor = editor;
- }
-
-
- public void setPropertyDefinition( PropertyDefinition defn ) {
- if ( defn == null ) {
- throw new AssertionError(CommonPlugin.Util.getString(ErrorMessageKeys.TREE_ERR_0021));
- }
- this.defn = defn;
- }
-
- public int compare(TreeNode entry1, TreeNode entry2){
- if ( entry1 == null ) {
- throw new AssertionError(CommonPlugin.Util.getString(ErrorMessageKeys.TREE_ERR_0015));
- }
- if ( entry2 == null ) {
- throw new AssertionError(CommonPlugin.Util.getString(ErrorMessageKeys.TREE_ERR_0016));
- }
- if ( this.editor == null ) {
- throw new AssertionError(CommonPlugin.Util.getString(ErrorMessageKeys.TREE_ERR_0014));
- }
- String value1 = this.editor.getValue(entry1,this.defn).toString();
- String value2 = this.editor.getValue(entry2,this.defn).toString();
- if ( value1 == null ) {
- if ( value2 == null ) {
- return 0;
- }
- return value2.compareTo(value1);
- }
- return value1.compareTo(value1);
- }
- public boolean equals(TreeNodePathComparator comparator){
- if ( comparator == null ) {
- return false;
- }
- return false;
-
- }
- public int compare(Object entry1, Object entry2){
- throw new ClassCastException(CommonPlugin.Util.getString(ErrorMessageKeys.TREE_ERR_0019));
- }
- public boolean equals(Object entry){
- throw new ClassCastException(CommonPlugin.Util.getString(ErrorMessageKeys.TREE_ERR_0020));
- }
-}
-
Deleted: trunk/common-internal/src/main/java/com/metamatrix/common/tree/TreeNodeSource.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/tree/TreeNodeSource.java 2009-11-30 15:24:24 UTC (rev 1605)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/tree/TreeNodeSource.java 2009-11-30 17:12:55 UTC (rev 1606)
@@ -1,87 +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.tree;
-
-import java.util.List;
-
-/**
- * This interface defines an interface to a source of TreeNode information.
- */
-public interface TreeNodeSource {
-
- /**
- * Obtain the set of entries that are considered the children of the specified
- * TreeNode.
- * @param parent the TreeNode instance for which the child entries
- * are to be obtained; may not be null
- * @return the list of TreeNode instances that are considered the children
- * of the specified entry; never null but possibly empty
- */
- List getChildren(TreeNode parent);
-
- /**
- * Determine the parent TreeNode for the specified entry, or null if
- * the specified entry is a root.
- * @param entry the TreeNode instance for which the parent is to be obtained;
- * may not be null
- * @return the parent entry, or null if there is no parent
- */
- TreeNode getParent(TreeNode node);
-
- /**
- * Create a new instance of TreeNodeEditor, which is an editor that may
- * be used to access and/or modify a single TreeNode object.
- * @return the new editor instance; never null
- */
- TreeNodeEditor createTreeNodeEditor();
-
- /**
- * Determine whether the specified TreeNode may contain children.
- * @param entry the TreeNode instance that is to be checked; may
- * not be null
- * @return true if the entry can contain children, or false otherwise.
- */
- boolean allowsChildren(TreeNode node);
-
- /**
- * Determine whether the specified node is a child of the given parent node.
- * @return true if the node is a child of the given parent node.
- */
- boolean isParentOf(TreeNode parent, TreeNode child);
-
- /**
- * Determine whether the specified node is a descendent of the given ancestor node.
- * @return true if the node is a descendent of the given ancestor node.
- */
- boolean isAncestorOf(TreeNode ancestor, TreeNode descendent);
-
- /**
- * Determine whether the specified TreeNode is considered read-only
- * @param entry the TreeNode instance that is to be checked; may
- * not be null
- * @return true if the entry is read-only, or false otherwise.
- */
- boolean isReadOnly(TreeNode node);
-}
-
-
Deleted: trunk/common-internal/src/main/java/com/metamatrix/common/tree/TreeView.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/tree/TreeView.java 2009-11-30 15:24:24 UTC (rev 1605)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/tree/TreeView.java 2009-11-30 17:12:55 UTC (rev 1606)
@@ -1,218 +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.tree;
-
-import java.util.Comparator;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import com.metamatrix.common.object.PropertiedObjectView;
-
-/**
- * This interface defines a view of a hierarchy of TreeNode instances.
- */
-public interface TreeView extends PropertiedObjectView {
-
- /**
- * Set the filter that limits the set of TreeNode instances
- * returned from this view.
- * @param filter the filter, or null if the default "pass-through" filter should be used.
- */
- void setFilter(TreeNodeFilter filter);
-
- /**
- * Set the filter that limits the set of TreeNode instances
- * returned from this view.
- * @return the current filter; never null
- */
- TreeNodeFilter getFilter();
-
- /**
- * Set the comparator that should be used to order the children.
- * @param comparator the comparator, or null if entry name sorting should be used.
- */
- void setComparator(Comparator comparator);
-
- /**
- * Set the comparator that provides the order for children
- * returned from this view.
- * @return the current comparator; never null
- */
- Comparator getComparator();
-
- /**
- * Get the definitions of the properties for the TreeNode instances
- * returned from this view.
- * @return the unmodifiable list of PropertyDefinition instances; never null
- */
- List getPropertyDefinitions();
-
- /**
- * Returns all root partitians on this TreeNode system.
- * @return the unmodifiable list of TreeNode instances
- * that represent the roots
- */
- List getRoots();
-
- /**
- * Determine whether the specified TreeNode is a root of the underlying
- * system.
- * @param entry the TreeNode instance that is to be checked; may
- * not be null
- * @return true if the entry is a root, or false otherwise.
- */
- boolean isRoot(TreeNode entry);
-
- /**
- * Determine whether the specified TreeNode may contain children.
- * @param entry the TreeNode instance that is to be checked; may
- * not be null
- * @return true if the entry can contain children, or false otherwise.
- */
- boolean allowsChildren(TreeNode entry);
-
- /**
- * Determine whether the specified parent TreeNode may contain the
- * specified child node.
- * @param parent the TreeNode instance that is to be the parent;
- * may not be null
- * @param potentialChild the TreeNode instance that is to be the child;
- * may not be null
- * @return true if potentialChild can be placed as a child of parent,
- * or false otherwise.
- */
- boolean allowsChild(TreeNode parent, TreeNode potentialChild);
-
- /**
- * Determine whether the specified TreeNode is hidden.
- * @param entry the TreeNode instance that is to be checked; may
- * not be null
- * @return true if the entry is hidden, or false otherwise.
- */
- boolean isHidden(TreeNode entry);
-
- /**
- * Return the marked state of the specified entry.
- * @return the marked state of the entry.
- */
- boolean isMarked(TreeNode entry);
-
- /**
- * Set the marked state of the specified entry.
- * @param true if the node is to be marked, or false if it is to be un-marked.
- */
- void setMarked(TreeNode entry, boolean markedState);
-
- /**
- * Return the set of marked nodes for this view.
- * @param the unmodifiable set of marked nodes; never null
- */
- Set getMarked();
-
- /**
- * Obtain the TreeNode that represents the home for the underlying
- * system. If the underlying system does not support a home entry concept,
- * null is returned.
- * @return the entry that represents the home, or null if no home concept
- * is supported.
- */
- TreeNode getHome();
-
- /**
- * Obtain the abstract path for this TreeNode.
- * @return the string that represents the abstract path of this entry; never null
- */
- String getPath(TreeNode entry);
-
- /**
- * Obtain the character that is used to separate names in a path sequence for
- * the abstract path. This character is completely dependent upon the implementation.
- * @return the charater used to delimit names in the abstract path.
- */
- char getSeparatorChar();
-
- /**
- * Obtain the character (as a String) that is used to separate names in a path sequence for
- * the abstract path.
- * @return the string containing the charater used to delimit names in the abstract path; never null
- */
- String getSeparator();
-
- /**
- * Determine the parent TreeNode for the specified entry, or null if
- * the specified entry is a root.
- * @param entry the TreeNode instance for which the parent is to be obtained;
- * may not be null
- * @return the parent entry, or null if there is no parent
- */
- TreeNode getParent(TreeNode entry);
-
- /**
- * Obtain the set of entries that are considered the children of the specified
- * TreeNode.
- * @param parent the TreeNode instance for which the child entries
- * are to be obtained; may not be null
- * @return the unmodifiable list of TreeNode instances that are considered the children
- * of the specified entry; never null but possibly empty
- */
- List getChildren(TreeNode parent);
-
- /**
- * Determine whether the specified node is a child of the given parent node.
- * @return true if the node is a child of the given parent node.
- */
- boolean isParentOf(TreeNode parent, TreeNode child);
-
- /**
- * Determine whether the specified node is a descendent of the given ancestor node.
- * @return true if the node is a descendent of the given ancestor node.
- */
- boolean isAncestorOf(TreeNode ancestor, TreeNode descendent);
-
- /**
- * Return the tree node editor for this view.
- * @return the TreeNodeEditor instance
- */
- TreeNodeEditor getTreeNodeEditor();
-
- /**
- * Obtain an iterator for this whole view, which navigates the view's
- * nodes using pre-order rules (i.e., it visits a node before its children).
- * @return the iterator that traverses the nodes in this view; never null
- */
- Iterator iterator();
-
- /**
- * Obtain an iterator for the view starting at the specified node. This
- * implementation currently navigates the subtree using pre-order rules
- * (i.e., it visits a node before its children).
- * @param startingPoint the root of the subtree over which the iterator
- * is to navigate; may not be null
- * @return the iterator that traverses the nodes in the subtree starting
- * at the specified node; never null
- */
- Iterator iterator(TreeNode startingPoint);
-}
-
-
Deleted: trunk/common-internal/src/main/java/com/metamatrix/common/vdb/api/SystemVdbUtility.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/vdb/api/SystemVdbUtility.java 2009-11-30 15:24:24 UTC (rev 1605)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/vdb/api/SystemVdbUtility.java 2009-11-30 17:12:55 UTC (rev 1606)
@@ -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.vdb.api;
-
-import com.metamatrix.core.util.ResourceNameUtil;
-
-public class SystemVdbUtility {
-
- public static final String VDB_NAME = ResourceNameUtil.SYSTEM_NAME;;
- public static final String VIRTUAL_MODEL_NAME = ResourceNameUtil.SYSTEM_NAME;
- public static final String PHYSICAL_MODEL_NAME = ResourceNameUtil.SYSTEMPHYSICAL_NAME;
- public static final String ADMIN_PHYSICAL_MODEL_NAME = ResourceNameUtil.SYSTEMADMINPHYSICAL_NAME;
-
- public final static String[] SYSTEM_MODEL_NAMES = {
- ResourceNameUtil.SYSTEM_NAME,
- ResourceNameUtil.SYSTEMPHYSICAL_NAME,
- ResourceNameUtil.SYSTEMADMIN_NAME,
- ResourceNameUtil.SYSTEMADMINPHYSICAL_NAME,
- ResourceNameUtil.SYSTEMSCHEMA_NAME,
- ResourceNameUtil.SYSTEMODBCMODEL,
- ResourceNameUtil.DATASERVICESYSTEMMODEL_NAME,
- ResourceNameUtil.WSDL1_1_NAME, ResourceNameUtil.WSDLSOAP_NAME,
- ResourceNameUtil.JDBCSYSTEM_NAME
- };
-
-
- /**
- * Return true if the specified model name matches the name of any system
- * model of TABLE_TYPES.SYSTEM_TYPE (match ignores case)
- */
- public final static boolean isSystemModelWithSystemTableType(String modelName) {
- for(int i=0; i < SYSTEM_MODEL_NAMES.length; i++) {
- String matchName = SYSTEM_MODEL_NAMES[i];
- if(matchName.equalsIgnoreCase(modelName)) {
- return true;
- }
- }
- return false;
- }
-}
Modified: trunk/common-internal/src/main/java/com/metamatrix/common/vdb/api/VDBArchive.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/vdb/api/VDBArchive.java 2009-11-30 15:24:24 UTC (rev 1605)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/vdb/api/VDBArchive.java 2009-11-30 17:12:55 UTC (rev 1606)
@@ -44,6 +44,7 @@
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.common.protocol.URLHelper;
import com.metamatrix.common.util.PropertiesUtils;
+import com.metamatrix.core.CoreConstants;
import com.metamatrix.core.util.FileUtil;
import com.metamatrix.core.util.FileUtils;
import com.metamatrix.core.util.ObjectConverterUtil;
@@ -90,6 +91,10 @@
private boolean open;
private VDBKey key;
+
+ public final static boolean isSystemModelWithSystemTableType(String modelName) {
+ return CoreConstants.SYSTEM_MODEL.equalsIgnoreCase(modelName);
+ }
public static VDBArchive loadVDB(URL vdbURL, File deployDirectory) throws IOException {
boolean loadedFromDef = false;
Modified: trunk/common-internal/src/main/java/com/metamatrix/platform/admin/api/PermissionNode.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/platform/admin/api/PermissionNode.java 2009-11-30 15:24:24 UTC (rev 1605)
+++ trunk/common-internal/src/main/java/com/metamatrix/platform/admin/api/PermissionNode.java 2009-11-30 17:12:55 UTC (rev 1606)
@@ -23,12 +23,10 @@
package com.metamatrix.platform.admin.api;
import com.metamatrix.core.id.ObjectID;
-import com.metamatrix.common.tree.TreeNode;
-
import com.metamatrix.platform.admin.api.exception.PermissionNodeNotActionableException;
import com.metamatrix.platform.security.api.AuthorizationActions;
-public interface PermissionNode extends TreeNode {
+public interface PermissionNode {
/**
* Display name for node.
* @return The name of the data node for display.
Modified: trunk/common-internal/src/main/java/com/metamatrix/platform/admin/apiimpl/PermissionDataNodeImpl.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/platform/admin/apiimpl/PermissionDataNodeImpl.java 2009-11-30 15:24:24 UTC (rev 1605)
+++ trunk/common-internal/src/main/java/com/metamatrix/platform/admin/apiimpl/PermissionDataNodeImpl.java 2009-11-30 17:12:55 UTC (rev 1606)
@@ -22,14 +22,26 @@
package com.metamatrix.platform.admin.apiimpl;
+import java.io.PrintStream;
import java.io.Serializable;
import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.StringTokenizer;
import com.metamatrix.admin.AdminMessages;
+import com.metamatrix.common.CommonPlugin;
import com.metamatrix.common.log.LogManager;
-import com.metamatrix.common.tree.basic.BasicTreeNode;
+import com.metamatrix.common.object.ObjectDefinition;
+import com.metamatrix.common.object.PropertyDefinition;
+import com.metamatrix.common.object.PropertyType;
+import com.metamatrix.common.util.ErrorMessageKeys;
import com.metamatrix.common.util.LogConstants;
import com.metamatrix.core.id.ObjectID;
import com.metamatrix.core.util.Assertion;
@@ -45,8 +57,30 @@
/**
* Defines a tree node for displaying entitlements.
*/
-public class PermissionDataNodeImpl extends BasicTreeNode implements PermissionDataNode, Serializable, Comparable {
+public class PermissionDataNodeImpl implements PermissionDataNode, Serializable, Comparable {
+ public static final char DELIMITER_CHAR = '.';
+ public static final String DELIMITER = "."; //$NON-NLS-1$
+
+ private ObjectID globalUID;
+ private ObjectDefinition type;
+ private boolean exists = true;
+ private String name;
+ private List children; // list of TreeNode refs
+ private List unmodifiableChildren;
+ private PermissionDataNodeImpl parent;
+ private boolean marked;
+ private boolean modified;
+
+ /**
+ * The holder for the property values for this entity, keyed upon the
+ * reference to the PropertyDefinition instance.
+ * @link aggregationByValue
+ * @supplierCardinality 0..1
+ */
+ private Map properties;
+// private Map unmodifiableProperties;
+
private int actionsCreatedWith;
private int descendantActions;
private AuthorizationActions actions;
@@ -69,12 +103,28 @@
* @param nodeIsPhysical Is this node physical are virtual.
* @param guid the globally-unique identifier for this instance; may not be null
*/
- public PermissionDataNodeImpl(BasicTreeNode parent,
+ public PermissionDataNodeImpl(PermissionDataNodeImpl parent,
AuthorizationActions allowedActions,
PermissionDataNodeDefinition nodeDefinition,
boolean nodeIsPhysical,
ObjectID guid) {
- super(parent, nodeDefinition.getDisplayName(), nodeDefinition, guid);
+ Assertion.isNotNull(nodeDefinition,"The ObjectDefinition reference may not be null"); //$NON-NLS-1$
+ Assertion.isNotNull(guid,"The ObjectID reference may not be null"); //$NON-NLS-1$
+ this.type = nodeDefinition;
+ this.globalUID = guid;
+ this.children = new ArrayList(5);
+ this.unmodifiableChildren = Collections.unmodifiableList(this.children);
+ this.properties = new HashMap();
+// this.unmodifiableProperties = Collections.unmodifiableMap(this.properties);
+ this.setNameOfNode(nodeDefinition.getDisplayName());
+ this.modified = true; // by default, a new object is considered modified
+ if ( parent != null ) {
+ parent.addChild(this,nodeDefinition,-1); // this call may not be efficient if 'exists' is false
+ this.setExists(true);
+ } else {
+ this.ensureNameIsValid();
+ this.setExists(true); // this must be a root entity that should be made existent
+ }
this.allowedActions = allowedActions;
this.descendantActions = StandardAuthorizationActions.NONE_VALUE;
this.actions = StandardAuthorizationActions.NONE;
@@ -82,7 +132,7 @@
this.isHidden = false;
this.isPhysical = nodeIsPhysical;
this.hashCode = nodeDefinition.getName().hashCode();
- // BasicTreeNode is set to modified when created! Unset it.
+ // PermissionDataNodeImpl is set to modified when created! Unset it.
this.setModified(false, false);
}
@@ -440,56 +490,6 @@
}
/**
- * Returns true if the specified object is semantically equal to this instance.
- * Note: this method is consistent with <code>compareTo()</code>.
- * @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;
- }
-
- // Check if object can be compared to this one
- // (this includes checking for null ) ...
- boolean areEqual = false;
- if ( obj instanceof PermissionDataNodeImpl ) {
- PermissionDataNodeImpl that = (PermissionDataNodeImpl) obj;
- // Must always have resourceNames
- areEqual = getType().getName().equals( that.getResourceName() );
- }
-
- return areEqual;
- }
- /**
- * Compares this object to another. If the specified object is not an instance of
- * the <code>PermissionDataNodeImpl</code> class, then this method throws a
- * ClassCastException (as instances are comparable only to instances of the same
- * class).
- * Note: this method <i>is</i> consistent with <code>equals()</code>, meaning
- * that <code>(compare(x, y)==0) == (x.equals(y))</code>.
- * <p>
- * @param obj the object that this instance is to be compared to; may not be null.
- * @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 ClassCastException if the specified object's type prevents it
- * from being compared to this instance.
- */
- public int compareTo(Object obj) {
- PermissionDataNodeImpl that = (PermissionDataNodeImpl) obj; // May throw ClassCastException
- if(obj == null){
- Assertion.isNotNull(obj,SecurityPlugin.Util.getString(AdminMessages.ADMIN_0039));
- }
-
- if ( obj == this ) {
- return 0;
- }
-
- return compare(this, that);
- }
-
- /**
* Utility method to compare two PermissionDataNodeImpl instances. Returns a negative integer, zero,
* or a positive integer as this object is less than, equal to, or greater than
* the specified object. <p>
@@ -520,13 +520,6 @@
/**
* Return stringafied representation of the object.
*/
- public String toString() {
- return getType().getName() + " " + this.actions; //$NON-NLS-1$
- }
-
- /**
- * Return stringafied representation of the object.
- */
public String printDebug() {
StringBuffer buf = new StringBuffer();
buf.append("\nResource: " + getType().getName()); //$NON-NLS-1$
@@ -735,4 +728,1012 @@
// }
// return true;
// }
+
+ /**
+ * Construct a new instance by specifying the parent that owns this entity,
+ * the name of the instance, the type of the instance and the global UID
+ * for the instance.
+ * <b>Note:</b> this constructor does <i>NOT</i> verify that the name is valid within
+ * the parent's namespace.
+ * @param parent the parent that is considered the owning namespace for this
+ * instance; may be null if the new instance is to be the root
+ * @param name the name for the new entity instance; may be null or zero length
+ * if the node name is to be determined
+ * @param type the reference to the MetaModelEntity that defines the type
+ * of entity; may not be null
+ * @param guid the globally-unique identifier for this instance; may not be null
+ */
+ public PermissionDataNodeImpl(PermissionDataNodeImpl parent, String name, ObjectDefinition defn, ObjectID guid ) {
+// Assertion.isNotNull(name,"The name may not be null");
+ Assertion.isNotNull(defn,"The ObjectDefinition reference may not be null"); //$NON-NLS-1$
+ Assertion.isNotNull(guid,"The ObjectID reference may not be null"); //$NON-NLS-1$
+ this.type = defn;
+ this.globalUID = guid;
+ this.children = new ArrayList(5);
+ this.unmodifiableChildren = Collections.unmodifiableList(this.children);
+ this.properties = new HashMap();
+// this.unmodifiableProperties = Collections.unmodifiableMap(this.properties);
+ this.setNameOfNode(name);
+ this.modified = true; // by default, a new object is considered modified
+
+ if ( parent != null ) {
+ parent.addChild(this,defn,-1); // this call may not be efficient if 'exists' is false
+ this.setExists(true);
+ } else {
+ this.ensureNameIsValid();
+ this.setExists(true); // this must be a root entity that should be made existent
+ }
+ }
+
+ // ########################## PropertiedObject Methods ###################################
+
+ // ########################## TreeNode Methods ###################################
+
+ /**
+ * Get this name of this entity. The name does not contain the namespace,
+ * but is unique within the namespace of the entity.
+ * @return the entity's name; never null or zero-length
+ */
+ public String getName(){
+ return this.name;
+ }
+
+ /**
+ * Get the actual or programmatic name of this property.
+ * @return the property's name (never null)
+ */
+ public String getFullName(){
+ return this.addFullName( new StringBuffer(), DELIMITER ).toString();
+ }
+ /**
+ * Get the actual or programmatic name of this property.
+ * @param delimiter the string delimiter to use between the names of nodes
+ * @return the property's name (never null)
+ */
+ public String getFullName(String delimiter){
+ return this.addFullName( new StringBuffer(), delimiter ).toString();
+ }
+ /**
+ * Helper method to build a string of the full name without having to
+ * construct a new StringBuffer in each node.
+ * <p>
+ * This method is implemented by having the node invoke this method on
+ * its parent (so that the parent can add its full name first), and then
+ * this node adds the delimiter and its name.
+ * @param sb the StringBuffer to which the name of this node should be appended
+ * @return the StringBuffer containing the full name of this node
+ */
+ protected StringBuffer addFullName(StringBuffer sb, String delimiter) {
+ if ( delimiter == null || delimiter.length() == 0 ) {
+ delimiter = DELIMITER;
+ }
+ StringBuffer result = sb;
+ if ( parent != null ) {
+ result = parent.addFullName(result,delimiter);
+ result.append(delimiter);
+ }
+ result.append(this.name);
+ return result;
+ }
+ /**
+ * Get the actual or programmatic name of this property.
+ * @return the property's name (never null)
+ */
+ public String getNamespace() {
+ if ( this.parent == null ) {
+ return ""; //$NON-NLS-1$
+ }
+ return this.parent.getFullName();
+ }
+
+ /**
+ * Get this type for this entity.
+ * @return the entity's type; never null
+ */
+ public ObjectDefinition getType() {
+ return this.type;
+ }
+
+ /**
+ * Return whether this TreeNode represents an existing metadata entity.
+ * <p>
+ * This attribute is set to true any time the object is part of a model,
+ * and it is set to false whenever the object is removed (deleted) from
+ * a model.
+ * @return true the entry exists, or false otherwise.
+ */
+ public boolean exists() {
+ return exists;
+ }
+
+ /**
+ * Ensure that the existance flag on this instance is set to the specified
+ * value. If the values are the same, this method simply returns without
+ * doing anything. However, if the existance value is different that the
+ * desired value, this method sets the existance value on this node and all
+ * of its children (recursively).
+ */
+ public void setExists( boolean value ) {
+ if ( this.exists != value ) {
+ this.exists = value;
+ Iterator iter = this.iterator();
+ while ( iter.hasNext() ) {
+ PermissionDataNodeImpl child = (PermissionDataNodeImpl) iter.next();
+ child.setExists(value);
+ }
+ }
+ }
+
+ /**
+ * Obtain the character that is used to separate names in a path sequence for
+ * the abstract path. This character is completely dependent upon the implementation.
+ * @return the charater used to delimit names in the abstract path.
+ */
+ public char getSeparatorChar() {
+ return DELIMITER_CHAR;
+ }
+
+ /**
+ * Obtain the character (as a String) that is used to separate names in a path sequence for
+ * the abstract path.
+ * @return the string containing the charater used to delimit names in the abstract path; never null
+ */
+ public String getSeparator() {
+ return DELIMITER;
+ }
+
+ /**
+ * 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;
+ }
+
+ // Check if object can be compared to this one
+ // (this includes checking for null ) ...
+ //if ( this.getClass().isInstance(obj) ) {
+ if ( obj instanceof PermissionDataNodeImpl ) {
+ PermissionDataNodeImpl that = (PermissionDataNodeImpl) obj;
+ return ( this.globalUID.equals( that.getGlobalUID() ) );
+ }
+
+ // Otherwise not comparable ...
+ return false;
+ }
+ /**
+ * Compares this object to another. If the specified object is not an instance of
+ * the ModelEntity class, then this method throws a
+ * ClassCastException (as instances are comparable only to instances of the same
+ * class).
+ * Note: this method <i>is</i> consistent with <code>equals()</code>, meaning
+ * that <code>(compare(x, y)==0) == (x.equals(y))</code>.
+ * <p>
+ * @param obj the object that this instance is to be compared to; may not be null.
+ * @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 ClassCastException if the specified object's type prevents it
+ * from being compared to this instance.
+ */
+ public int compareTo(Object obj) {
+ PermissionDataNodeImpl that = (PermissionDataNodeImpl) obj; // May throw ClassCastException
+ Assertion.isNotNull(obj,"Attempt to compare null"); //$NON-NLS-1$
+ if ( obj == this ) {
+ return 0;
+ }
+
+ return this.globalUID.compareTo(that.getGlobalUID());
+ }
+ /**
+ * Returns a string representing the current state of the object.
+ * @return the string representation of this instance.
+ */
+ public String toString(){
+ return this.getName();
+ }
+
+ // ########################## Implementation Methods ###################################
+
+ public ObjectID getGlobalUID(){
+ return globalUID;
+ }
+
+ /**
+ * Use this with extreme care!!!!
+ */
+ protected void setGlobalUID(ObjectID newID){
+ if ( newID != null ) {
+ globalUID = newID;
+ }
+ }
+
+ public Iterator iterator() {
+ return this.unmodifiableChildren.iterator();
+ }
+
+ /**
+ * Return the immediate child of this object that has the specified name.
+ * @param name the name of the child to find; may not be null or zero-length
+ * @param ignoreCase flag specifying true if the names should be compared in
+ * a case-insensitive manner, or false if the names should compare in a
+ * case-sensitive manner.
+ * @return the list of children with the matching name, or null if no child is found.
+ */
+ public List getChildren( String name, boolean ignoreCase ) {
+ Assertion.isNotNull(name,"The name reference may not be null"); //$NON-NLS-1$
+ Assertion.isNotZeroLength(name,"The name reference may not be zero-length"); //$NON-NLS-1$
+ List result = new ArrayList();
+ Iterator iter = this.children.iterator();
+
+ // Break into one of two loops based upon 'ignoreCase'; this is
+ // done like this for runtime efficiency with the knowlege
+ // that there is duplicate code.
+ if ( ignoreCase ) {
+ while ( iter.hasNext() ) {
+ PermissionDataNodeImpl obj = (PermissionDataNodeImpl) iter.next();
+ if ( obj.getName().equalsIgnoreCase(name) ) {
+ result.add(obj);
+ }
+ }
+ } else {
+ while ( iter.hasNext() ) {
+ PermissionDataNodeImpl obj = (PermissionDataNodeImpl) iter.next();
+ if ( obj.getName().equals(name) ) {
+ result.add(obj);
+ }
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Return the immediate child of this object that has the specified name.
+ * @param name the name of the child to find; may not be null or zero-length
+ * @param ignoreCase flag specifying true if the names should be compared in
+ * a case-insensitive manner, or false if the names should compare in a
+ * case-sensitive manner.
+ * @return the child with the matching name, or null if no child is found.
+ */
+ public PermissionDataNodeImpl getChild( String name, ObjectDefinition defn, boolean ignoreCase ) {
+ Assertion.isNotNull(name,"The name reference may not be null"); //$NON-NLS-1$
+ Assertion.isNotZeroLength(name,"The name reference may not be zero-length"); //$NON-NLS-1$
+ Assertion.isNotNull(defn,"The ObjectDefinition reference may not be null"); //$NON-NLS-1$
+ Iterator iter = this.children.iterator();
+
+ // Break into one of two loops based upon 'ignoreCase'; this is
+ // done like this for runtime efficiency with the knowlege
+ // that there is duplicate code.
+ if ( ignoreCase ) {
+ while ( iter.hasNext() ) {
+ PermissionDataNodeImpl obj = (PermissionDataNodeImpl) iter.next();
+ if ( defn.equals(obj.getType()) && obj.getName().equalsIgnoreCase(name) ) {
+ return obj;
+ }
+ }
+ } else {
+ while ( iter.hasNext() ) {
+ PermissionDataNodeImpl obj = (PermissionDataNodeImpl) iter.next();
+ if ( defn.equals(obj.getType()) && obj.getName().equals(name) ) {
+ return obj;
+ }
+ }
+ }
+ return null;
+ }
+
+ public int getIndexOfChild( PermissionDataNodeImpl child ) {
+ PermissionDataNodeImpl nodesParent = assertPermissionDataNodeImpl(child).parent;
+ Assertion.assertTrue(this==nodesParent,"The referenced child is not contained in this entity"); //$NON-NLS-1$
+ Iterator iter = this.children.iterator();
+ int index = 0;
+ while ( iter.hasNext() ) {
+ if ( iter.next() == child ) {
+ return index;
+ }
+ ++index;
+ }
+ throw new AssertionError(CommonPlugin.Util.getString(ErrorMessageKeys.TREE_ERR_0022));
+ }
+
+ /**
+ * Return the ordered list of children.
+ */
+ public List getChildren() {
+ return this.unmodifiableChildren;
+ }
+
+ /**
+ * Return true if this node is allowed to have any children.
+ */
+// public boolean getAllowsChildren() {
+// return CHILD_RULES.getAllowsChildren(this.getType());
+// }
+
+ /**
+ * Return true if this node currently does have any children.
+ */
+ public boolean hasChildren() {
+ return ( this.unmodifiableChildren.size() != 0 );
+ }
+
+ public int getChildCount() {
+ return this.unmodifiableChildren.size();
+ }
+
+ public boolean containsChildWithName( String name ) {
+ Assertion.isNotNull(name,"The name reference may not be null"); //$NON-NLS-1$
+ if ( name.length() == 0 ) {
+ return false;
+ }
+ Iterator iter = this.iterator();
+ while ( iter.hasNext() ) {
+ PermissionDataNodeImpl child = (PermissionDataNodeImpl) iter.next();
+ if ( child.getName().equals(name) ) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Set the name of this node.
+ * <b>Note:</b> this method does <i>NOT</i> verify that the child's name is valid within this
+ * namespace
+ */
+ public void setName(String newName) {
+ this.setNameOfNode(newName);
+ this.ensureNameIsValid();
+ }
+
+ protected void setNameOfNode(String newName) {
+ this.name = newName;
+ PropertyDefinition nameDefn = this.getNamePropertyDefinition();
+ if ( nameDefn != null ) {
+ this.setPropertyValue(nameDefn,newName);
+ }
+ }
+
+ protected PermissionDataNodeImpl assertPermissionDataNodeImpl( PermissionDataNodeImpl obj ) {
+ Assertion.isNotNull(obj,"The TreeNode reference may not be null"); //$NON-NLS-1$
+ Assertion.assertTrue(obj instanceof PermissionDataNodeImpl,"The referenced object is not an PermissionDataNodeImpl"); //$NON-NLS-1$
+ return (PermissionDataNodeImpl) obj;
+ }
+
+ /**
+ * Get the model entity which which is the parent of this entity.
+ * @return the parent model entity, which may be null if no parent exists.
+ */
+ public PermissionDataNodeImpl getParent() {
+ return this.parent;
+ }
+
+ /**
+ * Determine whether this handle is the parent of the specified handle.
+ * The result of this method is equivalent to calling the following,
+ * although this method uses a much more efficient algorithm that
+ * does not rely upon string comparisons:
+ * <p>
+ * <code>return this.getFullName().equals( node.getNamespace() )</code>
+ * </p>
+ * @return true if this handle is the namespace of the specified node
+ */
+ public boolean isParentOf(PermissionDataNodeImpl node) {
+ PermissionDataNodeImpl nodesParent = assertPermissionDataNodeImpl(node).parent;
+ return ( this == nodesParent );
+ }
+
+ /**
+ * Determine whether this handle is an ancestor of the specified handle,
+ * The result of this method is equivalent to calling the following,
+ * although this method uses a much more efficient algorithm that
+ * does not rely upon string comparisons:
+ * <p>
+ * <code>return node.getNamespace().startsWith( this.getFullName() )</code>
+ * </p>
+ * @return true if this handle is an ancestor of the specified node
+ */
+ public boolean isAncestorOf(PermissionDataNodeImpl node) {
+ PermissionDataNodeImpl ancestor = assertPermissionDataNodeImpl(node).parent;
+ while( ancestor != null ) {
+ if ( this == ancestor ) {
+ return true;
+ }
+ ancestor = assertPermissionDataNodeImpl(ancestor).parent;
+ }
+ return false;
+ }
+
+ /**
+ * Return whether this node has undergone changes. The time from which changes are
+ * maintained is left to the implementation.
+ * @return true if this TreeNode has changes, or false otherwise.
+ */
+ public boolean isModified() {
+ return this.modified;
+ }
+
+ /**
+ * Set the modified state of the TreeNode node.<br></br>Default behavior is to
+ * set as modified the whole subtree starting with this node.
+ * @param marked the marked state of the node.
+ */
+ public void setModified(boolean modified) {
+ this.setModified(modified, true);
+ }
+
+ /**
+ * Set the modified state of the TreeNode node.
+ * @param modified the marked state of the node.
+ * @param recursive true if the whole subtree starting from this node should
+ * be set as modified, or false if only this node is to be set as modified.
+ */
+ public synchronized void setModified(boolean modified, boolean recursive) {
+ this.modified = modified;
+ if ( recursive ) {
+ Iterator iter = this.children.iterator();
+ while ( iter.hasNext() ) {
+ PermissionDataNodeImpl child = (PermissionDataNodeImpl) iter.next();
+ child.setModified(modified, true);
+ }
+ }
+ }
+
+ /**
+ * Return the marked state of the specified node.
+ * @return the marked state of the node.
+ */
+ public boolean isMarked() {
+ return this.marked;
+ }
+
+ /**
+ * Set the marked state of the TreeNode node.<br></br>Default behavior is to
+ * mark the whole subtree from this node.
+ * @param marked the marked state of the node.
+ */
+ public void setMarked(boolean marked) {
+ this.setMarked(marked, true);
+ }
+
+ /**
+ * Set the marked state of the TreeNode node.
+ * @param marked the marked state of the node.
+ * @param recursive mark the whole subtree starting from this node.
+ */
+ public synchronized void setMarked(boolean marked, boolean recursive) {
+ this.marked = marked;
+ if ( recursive ) {
+ Iterator iter = this.children.iterator();
+ while ( iter.hasNext() ) {
+ PermissionDataNodeImpl child = (PermissionDataNodeImpl) iter.next();
+ child.setMarked(marked, true);
+ }
+ }
+ }
+
+ /**
+ * Return the set of marked nodes for this view.
+ * @param the unmodifiable set of marked nodes; never null
+ */
+ protected synchronized void addMarkedNodesToSet( Set result ) {
+ if ( this.isMarked() ) {
+ result.add(this);
+ }
+
+ PermissionDataNodeImpl child = null;
+ Iterator iter = this.children.iterator();
+ while ( iter.hasNext() ) {
+ child = (PermissionDataNodeImpl) iter.next();
+ child.addMarkedNodesToSet( result );
+ }
+ }
+
+ /**
+ * Go through the tree and find out the leaf nodes beneath this object.
+ * @return true if there are nodes below this node that are marked
+ */
+ public synchronized void findLeafNodes( Set leafNodes ) {
+ if ( this.getChildCount() == 0 ) {
+ leafNodes.add(this);
+ return;
+ }
+
+ // Otherwise, call this same method on all children ...
+ PermissionDataNodeImpl child = null;
+ Iterator iter = this.children.iterator();
+ while ( iter.hasNext() ) {
+ child = (PermissionDataNodeImpl) iter.next();
+ child.findLeafNodes( leafNodes );
+ }
+ }
+
+ /**
+ * Go through the tree and find out the top-level objects that are not marked
+ * and that do not have marked nodes beneath them, and find the leaf-level marked
+ * objects.
+ * @return true if there are nodes below this node that are marked
+ */
+ public synchronized boolean findMarkedAndUnmarkedNodes( Set unmarkedNodes, Set markedLeafNodes ) {
+ // If this node is marked, go no further ...
+ if ( this.isMarked() ) {
+ this.findLeafNodes(markedLeafNodes);
+ return true;
+ }
+ unmarkedNodes.add(this);
+
+ // Otherwise, call this same method on all children ...
+ boolean childHasMarkedNodes = false;
+ PermissionDataNodeImpl child = null;
+ Iterator iter = this.children.iterator();
+ while ( iter.hasNext() ) {
+ child = (PermissionDataNodeImpl) iter.next();
+ if ( child.findMarkedAndUnmarkedNodes( unmarkedNodes, markedLeafNodes ) ) {
+ childHasMarkedNodes = true;
+ }
+ }
+
+ if ( childHasMarkedNodes ) {
+ unmarkedNodes.remove(this);
+ }
+ return childHasMarkedNodes;
+ }
+
+ /**
+ * Go through the tree and find out the top-level objects that are not marked
+ * and that do not have marked nodes beneath them, and find the leaf-level marked
+ * objects.
+ * @return true if there are nodes below this node that are marked
+ */
+ public synchronized void findTopLevelMarkedNodes( Set markedTopLevelNodes ) {
+ // If this node is marked, go no further ...
+ if ( this.isMarked() ) {
+ markedTopLevelNodes.add(this);
+ }
+
+ // Otherwise, call this same method on all children ...
+ PermissionDataNodeImpl child = null;
+ Iterator iter = this.children.iterator();
+ while ( iter.hasNext() ) {
+ child = (PermissionDataNodeImpl) iter.next();
+ child.findTopLevelMarkedNodes(markedTopLevelNodes);
+ }
+ }
+
+ public Collection getDecendant( String pathWithName, String delimiter, boolean ignoreCase ) {
+ if ( delimiter == null || delimiter.length() == 0 ) {
+ delimiter = DELIMITER;
+ }
+ Set parents = new HashSet();
+ Set decendents = new HashSet();
+ parents.add(this);
+ PermissionDataNodeImpl parent = this;
+ StringTokenizer tokenizer = new StringTokenizer(pathWithName,delimiter);
+ while ( tokenizer.hasMoreTokens() ) {
+ String name = tokenizer.nextToken();
+ decendents.clear();
+ Iterator iter = parents.iterator();
+ while ( iter.hasNext() ) {
+ parent = (PermissionDataNodeImpl) iter.next();
+ decendents.addAll( parent.getChildren( name, ignoreCase ) );
+ }
+ parents.clear();
+ parents.addAll(decendents);
+ }
+ return decendents;
+ }
+
+ public Collection getDecendant( String pathWithName, boolean ignoreCase ) {
+ return getDecendant(pathWithName,DELIMITER,ignoreCase);
+ }
+
+ /**
+ * Remove from this node the specified child, null the parent reference
+ * of the node, and mark the node as non-existant.
+ * @param child the child entity
+ */
+ public synchronized void remove( PermissionDataNodeImpl child ) {
+ Assertion.assertTrue(child!=this,"The specified node may not be removed from itself"); //$NON-NLS-1$
+ Assertion.isNotNull(child,"Unable to remove a null child reference"); //$NON-NLS-1$
+ boolean found = this.children.remove(child);
+ Assertion.assertTrue(found,"The specified child was not found within this node"); //$NON-NLS-1$
+ child.parent = null;
+ child.setExists(false);
+ }
+
+ /**
+ * Remove from this node the child specified by the index, null the parent reference
+ * of the node, and mark the node as non-existant.
+ * @param index the index of the child to be removed
+ * @throws IndexOutOfBoundsException if the index is not within the range
+ * <code>0 <= newIndex < this.getChildCount()</code>
+ */
+ public synchronized void removeAll() {
+ Iterator iter = this.children.iterator();
+ PermissionDataNodeImpl child = null;
+ while ( iter.hasNext() ) {
+ child = (PermissionDataNodeImpl) iter.next();
+ child.parent = null;
+ child.setExists(false);
+ iter.remove();
+ }
+ }
+
+ /**
+ * Remove from this node the child specified by the index, null the parent reference
+ * of the node, and mark the node as non-existant.
+ * @param index the index of the child to be removed
+ * @throws IndexOutOfBoundsException if the index is not within the range
+ * <code>0 <= newIndex < this.getChildCount()</code>
+ */
+ public synchronized void remove(int index ) {
+ PermissionDataNodeImpl child = (PermissionDataNodeImpl) this.children.remove(index);
+ child.parent = null;
+ child.setExists(false);
+ }
+
+ /**
+ * Move the child to a new index under the same parent.
+ * @param child the child entity
+ * @param newIndex the location
+ * @throws IndexOutOfBoundsException if the index is not within the range
+ * <code>0 <= newIndex < this.getChildCount()</code>
+ */
+ public synchronized void moveChild( PermissionDataNodeImpl child, int newIndex ) {
+ //this.remove(child); // this marks it as non-existant, instead to ...
+ Assertion.assertTrue(child!=this,"The specified node may not be removed from itself"); //$NON-NLS-1$
+ Assertion.isNotNull(child,"Unable to remove a null child reference"); //$NON-NLS-1$
+ int currentIndex = this.children.indexOf(child);
+ if ( currentIndex == newIndex ) {
+ return;
+ }
+ boolean found = this.children.remove(child);
+ Assertion.assertTrue(found,"The specified child was not found within this node"); //$NON-NLS-1$
+ int correctIndex = newIndex;
+ if ( currentIndex < newIndex ) {
+ // Change the location, because they computed the newIndex based upon the
+ // list WITH the child, and we just removed the child (essentially decrementing
+ // their index
+
+ --correctIndex;
+ }
+ this.children.add(correctIndex,child);
+ }
+
+ /**
+ * Insert the node as a child of this node. If the child already has a parent,
+ * this method removes the child from that parent.
+ * <b>Note:</b> this method does <i>NOT</i> verify that the child's name is valid within this
+ * namespace
+ * @param child the child entity
+ * @param newIndex the location
+ * @throws IndexOutOfBoundsException if the index is not within the range
+ * <code>0 <= newIndex <= this.getChildCount()</code>
+ */
+ public synchronized void insert( PermissionDataNodeImpl child, int index ) {
+ Assertion.isNotNull(child,"The child reference may not be null"); //$NON-NLS-1$
+ Assertion.assertTrue(child != this,"The specified node may not be added to itself"); //$NON-NLS-1$
+ Assertion.assertTrue(child.getParent() != this,"The specified node is already a child of this entity"); //$NON-NLS-1$
+
+ this.children.add(index,child); // ensures index is valid, so do this first
+ if ( child.parent != null ) {
+ child.parent.children.remove(child); // doesn't mark node as non-existant
+ }
+ child.parent = this; // remove from parent
+ child.setExists(true); // ensure that child is marked as exists
+
+ // Check if this node already contains a child that has the same
+ // name and type as the new child; if there is an existing child,
+ // come up with the next valid name ...
+ this.ensureNameIsValid();
+ }
+
+ /**
+ * Insert the node as a child of this node, and place it at the end of this
+ * node's list of children. If the child already has a parent,
+ * this method removes the child from that parent.
+ * <p>
+ * <b>Note:</b> this method does <i>NOT</i> verify that the child's name is valid within this
+ * namespace
+ * @param child the child entity
+ */
+ public synchronized void add( PermissionDataNodeImpl child ) {
+ Assertion.isNotNull(child,"The child reference may not be null"); //$NON-NLS-1$
+ Assertion.assertTrue(child != this,"The specified node may not be added to itself"); //$NON-NLS-1$
+ Assertion.assertTrue(child.getParent() != this,"The specified node is already a child of this entity"); //$NON-NLS-1$
+ addChild(child,child.getType(),-1); // add at end
+ }
+
+ /**
+ * Insert the node as a child of this node, and place it at the end of this
+ * node's list of children. If the child already has a parent,
+ * this method removes the child from that parent.
+ * <p>
+ * <b>Note:</b> this method does <i>NOT</i> verify that the child's name is valid within this
+ * namespace
+ * @param child the child entity
+ */
+ public synchronized void add( PermissionDataNodeImpl child, int index ) {
+ Assertion.isNotNull(child,"The child reference may not be null"); //$NON-NLS-1$
+ Assertion.assertTrue(child != this,"The specified node may not be added to itself"); //$NON-NLS-1$
+ Assertion.assertTrue(child.getParent() != this,"The specified node is already a child of this entity"); //$NON-NLS-1$
+ addChild(child,child.getType(),index);
+ }
+
+ protected synchronized void addChild( PermissionDataNodeImpl child, ObjectDefinition childType, int index ) {
+ // Check if this node can add the new child to its list of children
+ if ( this.addChildIsValid(child) ) {
+ if ( index == -1 ) {
+ this.children.add(child); // Add at the end
+ } else {
+ this.children.add(index,child); // Add at index, may throw IndexOutOfBoundsException
+ }
+ if ( child.parent != null ) {
+ child.parent.children.remove(child); // doesn't mark node as non-existant
+ }
+ child.parent = this; // remove from parent
+ child.setExists(true); // ensure that child is marked as exists
+
+ // Check if this node already contains a child that has the same
+ // name and type as the new child; if there is an existing child,
+ // come up with the next valid name ...
+ child.ensureNameIsValid();
+ }
+ }
+
+ public Object getPropertyValue(PropertyDefinition propertyDefn) {
+ Object result = resolveTypeFromString(this.properties.get(propertyDefn),propertyDefn);
+ if ( result == null && propertyDefn.hasDefaultValue() ) {
+ result = propertyDefn.getDefaultValue();
+ }
+ if ( result == null ) {
+ return result;
+ }
+
+ // This is a check to verify that the types correspond to types and that we
+ // are no longer using Collection to hold multi-valued properties
+ if ( result instanceof Collection && propertyDefn.getPropertyType() != PropertyType.LIST ) {
+ throw new AssertionError("The property value is a Collection but the PropertyType is a " + propertyDefn.getPropertyType().getDisplayName() ); //$NON-NLS-1$
+ }
+ if ( result instanceof Set && propertyDefn.getPropertyType() != PropertyType.SET ) {
+ throw new AssertionError("The property value is a Set but the PropertyType is a " + propertyDefn.getPropertyType().getDisplayName() ); //$NON-NLS-1$
+ }
+
+ return result;
+ }
+
+ public Object setPropertyValue(PropertyDefinition propertyDefn,Object value) {
+ Object previous = this.properties.put(propertyDefn,convertTypeToString(value,propertyDefn));
+ // Check if the value has changed. If the old and new value are both null
+ // we assume the property was not modified. If old or new value is not null
+ // and does not satisify the .equals check then the value is modified and the
+ // node is marked accordingly
+ if ( (previous != null && !previous.equals(value)) || (value != null && !value.equals(previous)) ) {
+ this.setModified(true,false);
+ }
+// if ( previous != value ) {
+// this.setModified(true,false);
+// }
+ return previous;
+ }
+
+ /**
+ * hook to allow some PropertyDefinition values to be converted from String values
+ * before they are sent to clients of this Editor. Subclasses may override
+ * this method to convert custom types.
+ */
+ protected Object resolveTypeFromString(Object value, PropertyDefinition def) {
+ Object result = value;
+ if ( PropertyType.BOOLEAN.equals(def.getPropertyType()) ) {
+ if ( value instanceof String ) {
+ if ( Boolean.TRUE.toString().equalsIgnoreCase((String) value) ) {
+ result = Boolean.TRUE;
+ } else {
+ result = Boolean.FALSE;
+ }
+ }
+ }
+ //TODO: handle other types
+ return result;
+ }
+
+ /**
+ * hook to allow some PropertyDefinition values to be converted non-string values
+ * into Strings before they are set on the PropertiedObject. Subclasses may override
+ * this method to convert custom types.
+ */
+ protected Object convertTypeToString(Object value, PropertyDefinition def) {
+ Object result = value;
+ if ( PropertyType.BOOLEAN.equals(def.getPropertyType()) ) {
+ if ( value instanceof Boolean ) {
+ result = value.toString();
+ }
+ }
+ //TODO: handle other types
+ return result;
+ }
+
+ public Object removePropertyValue(PropertyDefinition propertyDefn) {
+ return this.properties.remove(propertyDefn);
+ }
+
+ public Map getProperties() {
+ return this.properties;
+ }
+
+ public void print( PrintStream stream ) {
+ Assertion.isNotNull(stream,"The stream reference may not be null"); //$NON-NLS-1$
+ printInfo(stream);
+ PermissionDataNodeImpl child = null;
+ Iterator iter = this.iterator();
+ while ( iter.hasNext() ) {
+ child = (PermissionDataNodeImpl) iter.next();
+ //child.print(stream);
+ child.printInfo(stream);
+ }
+ }
+
+ protected String getEntityForm() {
+ return "PermissionDataNodeImpl"; //$NON-NLS-1$
+ }
+
+ protected void printInfo( PrintStream stream ) {
+ // Stream will never be null
+ stream.println(" \"" + this.getFullName() + "\" <" + this.getEntityForm() + "> (Type=" + this.getType() + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ }
+
+ protected PermissionDataNodeImpl find( ObjectID globalUID ) {
+ Assertion.isNotNull(globalUID,"The ObjectID reference may not be null"); //$NON-NLS-1$
+ if ( this.globalUID.equals(globalUID) ) {
+ return this;
+ }
+
+ // Go through the children and see if they contain the object ...
+ PermissionDataNodeImpl result = null;
+ PermissionDataNodeImpl child = null;
+ Iterator iter = this.iterator();
+ while ( iter.hasNext() ) {
+ child = (PermissionDataNodeImpl) iter.next();
+ result = child.find(globalUID);
+ if ( result != null ) {
+ break;
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * This method is used to determine the property definitions for this object.
+ * By default, this method returns an empty list.
+ */
+ protected List getPropertyDefinitions() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * This method is used to determine which, if any, of the property definitions for this object
+ * are used to access the name.
+ * By default, this method returns null, meaning there is no name property definition.
+ */
+ protected PropertyDefinition getNamePropertyDefinition() {
+ return null;
+ }
+
+ /**
+ * This method is used to determine which, if any, of the property definitions for this object
+ * are used to access the description.
+ * By default, this method returns null, meaning there is no description property definition.
+ */
+ protected PropertyDefinition getDescriptionPropertyDefinition() {
+ return null;
+ }
+
+ /**
+ * This method is used to determine whether two child nodes under a single parent
+ * are allowed to have the same name. By default, this method returns <code>true</code>.
+ */
+ protected boolean areDuplicateChildNamesAllowed() {
+ return true;
+ }
+
+ /**
+ * This method is used to determine the default name for a node when that node has no name.
+ * By default, this method returns the name of the node's type.
+ */
+ protected String getDefaultName() {
+ return this.type.getName();
+ }
+
+ protected boolean isValidNewName(String newName) {
+ if ( newName == null || newName.length() == 0 ) {
+ return false;
+ }
+ if ( newName.equals(this.name) ) {
+ return true;
+ }
+ if ( this.parent != null ) {
+ if ( this.areDuplicateChildNamesAllowed() ) {
+ return true;
+ }
+ if ( this.parent.containsChildWithName(newName) ) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * This method is called prior to adding the specified child to this
+ * TreeNode allowing any subclass to provide specific behavior if necessary.
+ * This implementation returns true by default.
+ */
+ protected boolean addChildIsValid( PermissionDataNodeImpl child ) {
+ return true;
+ }
+
+ /**
+ * Set the name of the new node (before its been added as a sibling to the nodes
+ * in <code>siblings</code>
+ */
+ protected void ensureNameIsValid() {
+ if ( this.name.length() == 0 ) {
+ this.setNameOfNode( this.getDefaultName() );
+ }
+ if ( areDuplicateChildNamesAllowed() ) {
+ return; // nothing to rename !!!
+ }
+ if ( this.parent == null ) {
+ return;
+ }
+ List siblings = this.parent.getChildren();
+ if ( siblings.size() == 1 ) {
+ return;
+ }
+
+ // Determine if there is a conflict ...
+ boolean rename = false;
+ Iterator iter = siblings.iterator();
+ PermissionDataNodeImpl sibling = null;
+ while ( iter.hasNext() ) {
+ sibling = (PermissionDataNodeImpl) iter.next();
+ if ( sibling != this && sibling.getName().equals(this.name) ) {
+ rename = true;
+ break;
+ }
+ }
+
+ if ( !rename ) {
+//System.out.println("setValidName(" + newNode.getFullName() + ") is NOT renaming");
+ return;
+ }
+
+//System.out.println("setValidName(" + newNode.getFullName() + ") IS renaming");
+ String newName = null;
+ int suffix = 1;
+ while ( newName == null ) {
+ String potentialName = this.name + suffix;
+ iter = siblings.iterator();
+ while ( iter.hasNext() ) {
+ sibling = (PermissionDataNodeImpl) iter.next();
+//System.out.println("setValidName(" + newNode.getFullName() + ") : comparing " + potentialName + " to " + sibling.getName() );
+ if ( sibling != this && sibling.getName().equals(potentialName) ) {
+ potentialName = null;
+//System.out.println("setValidName(" + newNode.getFullName() + ") : breaking " );
+ break;
+ }
+ }
+ if ( potentialName != null ) {
+//System.out.println("setValidName(" + newNode.getFullName() + ") : new name = " + potentialName );
+ newName = potentialName;
+ }
+ ++suffix;
+ }
+ this.setNameOfNode(newName);
+ }
+
}
Modified: trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/MetadataFactory.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/MetadataFactory.java 2009-11-30 15:24:24 UTC (rev 1605)
+++ trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/MetadataFactory.java 2009-11-30 17:12:55 UTC (rev 1606)
@@ -53,8 +53,6 @@
this.importProperties = importProperties;
schema = new Schema();
schema.setName(modelName);
- schema.setPhysical(true);
- schema.setPrimaryMetamodelUri("http://www.metamatrix.com/metamodels/Relational"); //$NON-NLS-1$
setUUID(schema);
store.addSchema(schema);
}
Modified: trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Schema.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Schema.java 2009-11-30 15:24:24 UTC (rev 1605)
+++ trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Schema.java 2009-11-30 17:12:55 UTC (rev 1606)
@@ -29,7 +29,7 @@
private boolean physical = true;
private boolean isVisible = true;
- private String primaryMetamodelUri;
+ private String primaryMetamodelUri = "http://www.metamatrix.com/metamodels/Relational"; //$NON-NLS-1$
private Map<String, Table> tables = new LinkedHashMap<String, Table>();
private Map<String, ProcedureRecordImpl> procedures = new LinkedHashMap<String, ProcedureRecordImpl>();
Modified: trunk/engine/src/main/java/com/metamatrix/dqp/service/AuthorizationService.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/dqp/service/AuthorizationService.java 2009-11-30 15:24:24 UTC (rev 1605)
+++ trunk/engine/src/main/java/com/metamatrix/dqp/service/AuthorizationService.java 2009-11-30 17:12:55 UTC (rev 1606)
@@ -31,7 +31,6 @@
import com.metamatrix.api.exception.security.AuthorizationException;
import com.metamatrix.api.exception.security.AuthorizationMgmtException;
import com.metamatrix.common.application.ApplicationService;
-import com.metamatrix.core.CoreConstants;
import com.metamatrix.platform.security.api.AuthorizationPolicy;
import com.metamatrix.platform.security.api.AuthorizationRealm;
import com.metamatrix.platform.security.api.MetaMatrixPrincipalName;
@@ -55,8 +54,6 @@
public static final int CONTEXT_DELETE = 3;
public static final int CONTEXT_PROCEDURE = 4;
- public static final String DEFAULT_WSDL_USERNAME = CoreConstants.DEFAULT_ANON_USERNAME;
-
public static final String ENTITELEMENTS_ENABLED = "auth.check_entitlements"; //$NON-NLS-1$
public static final String ADMIN_ROLES_FILE = "auth.adminRolesFile"; //$NON-NLS-1$
Modified: trunk/engine/src/main/java/com/metamatrix/platform/security/api/service/MembershipServiceInterface.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/platform/security/api/service/MembershipServiceInterface.java 2009-11-30 15:24:24 UTC (rev 1605)
+++ trunk/engine/src/main/java/com/metamatrix/platform/security/api/service/MembershipServiceInterface.java 2009-11-30 17:12:55 UTC (rev 1606)
@@ -56,7 +56,6 @@
public static final String DOMAIN_NAME = "domainName"; //$NON-NLS-1$
public static final String DEFAULT_ADMIN_USERNAME = "admin"; //$NON-NLS-1$
- public static final String DEFAULT_WSDL_USERNAME = CoreConstants.DEFAULT_ANON_USERNAME;
public static final String ADMIN_PASSWORD = "membership.superUserPassword"; //$NON-NLS-1$
public static final String ADMIN_USERNAME = "membership.superUser"; //$NON-NLS-1$
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/CachedRequestWorkItem.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/CachedRequestWorkItem.java 2009-11-30 15:24:24 UTC (rev 1605)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/CachedRequestWorkItem.java 2009-11-30 17:12:55 UTC (rev 1606)
@@ -51,7 +51,7 @@
@Override
protected void processNew() throws MetaMatrixComponentException, MetaMatrixProcessingException {
request.initMetadata();
- request.validateEntitlement(originalCommand);
+ request.validateAccess(originalCommand);
this.request = null;
}
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/MetaDataProcessor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/MetaDataProcessor.java 2009-11-30 15:24:24 UTC (rev 1605)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/MetaDataProcessor.java 2009-11-30 17:12:55 UTC (rev 1606)
@@ -107,9 +107,7 @@
this.vdbName = workContext.getVdbName();
this.vdbVersion = workContext.getVdbVersion();
- QueryMetadataInterface md = metadataService.lookupMetadata(vdbName, vdbVersion);
- // Defect 15029 - Use the QueryMetadataWrapper to hide models with private visibility when resolving the command.
- this.metadata = new QueryMetadataWrapper(md, vdbName, vdbVersion, vdbService);
+ this.metadata = metadataService.lookupMetadata(vdbName, vdbVersion);
// If multi-source, use the multi-source wrapper as well
Collection multiModels = vdbService.getMultiSourceModels(vdbName, vdbVersion);
Deleted: trunk/engine/src/main/java/org/teiid/dqp/internal/process/QueryMetadataWrapper.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/QueryMetadataWrapper.java 2009-11-30 15:24:24 UTC (rev 1605)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/QueryMetadataWrapper.java 2009-11-30 17:12:55 UTC (rev 1606)
@@ -1,88 +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 org.teiid.dqp.internal.process;
-
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Iterator;
-
-import com.metamatrix.api.exception.MetaMatrixComponentException;
-import com.metamatrix.api.exception.query.QueryMetadataException;
-import com.metamatrix.common.vdb.api.ModelInfo;
-import com.metamatrix.dqp.service.VDBService;
-import com.metamatrix.query.metadata.QueryMetadataInterface;
-import com.metamatrix.query.metadata.BasicQueryMetadataWrapper;
-
-/**
- * This classs is a proxy to QueryMetadataInterface. It knows VDBService
- * and VNB name.
- */
-public class QueryMetadataWrapper extends BasicQueryMetadataWrapper{
- private String vdbName;
- private String vdbVersion;
- private VDBService vdbService;
-
- public QueryMetadataWrapper(QueryMetadataInterface actualMetadata, String vdbName, String vdbVersion, VDBService vdbService){
- super(actualMetadata);
- this.vdbName = vdbName;
- this.vdbService = vdbService;
- this.vdbVersion = vdbVersion;
- }
-
- protected QueryMetadataInterface getActualMetadata() {
- return this.actualMetadata;
- }
- protected String getVdbName() {
- return this.vdbName;
- }
- protected VDBService getVdbService() {
- return this.vdbService;
- }
- protected String getVdbVersion() {
- return this.vdbVersion;
- }
-
- /**
- * @see com.metamatrix.query.metadata.QueryMetadataInterface#getGroupsForPartialName(java.lang.String)
- */
- public Collection getGroupsForPartialName(String partialGroupName) throws MetaMatrixComponentException, QueryMetadataException {
- Collection result = actualMetadata.getGroupsForPartialName(partialGroupName);
- if(result == null || result.isEmpty()){
- return result;
- }
- Collection filteredResult = new HashSet();
- Iterator iter = result.iterator();
- while(iter.hasNext()){
- String groupName = (String)iter.next();
- Object groupID = actualMetadata.getGroupID(groupName);
- Object modelID = actualMetadata.getModelID(groupID);
- String modelName = actualMetadata.getFullName(modelID);
- int visibility = vdbService.getModelVisibility(vdbName, vdbVersion, modelName);
- if(visibility == ModelInfo.PUBLIC){
- filteredResult.add(groupName);
- }
- }
- return filteredResult;
- }
-
-}
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java 2009-11-30 15:24:24 UTC (rev 1605)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java 2009-11-30 17:12:55 UTC (rev 1606)
@@ -37,7 +37,6 @@
import org.teiid.dqp.internal.process.multisource.MultiSourceMetadataWrapper;
import org.teiid.dqp.internal.process.multisource.MultiSourcePlanToProcessConverter;
import org.teiid.dqp.internal.process.validator.AuthorizationValidationVisitor;
-import org.teiid.dqp.internal.process.validator.ModelVisibilityValidationVisitor;
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
@@ -211,9 +210,6 @@
this.metadata = new TempMetadataAdapter(metadata, new TempMetadataStore());
- //wrap metadata in the wrapper that knows VDBService
- this.metadata = new QueryMetadataWrapper(this.metadata, this.vdbName, this.vdbVersion, this.vdbService);
-
// Check for multi-source models and further wrap the metadata interface
List multiSourceModelList = vdbService.getMultiSourceModels(this.vdbName, this.vdbVersion);
if(multiSourceModelList != null && multiSourceModelList.size() > 0) {
@@ -302,18 +298,12 @@
this.userCommand = (Command)command.clone();
}
- private void validateQuery(Command command, boolean validateVisibility)
+ private void validateQuery(Command command)
throws QueryValidatorException, MetaMatrixComponentException {
// Create generic sql validation visitor
AbstractValidationVisitor visitor = new ValidationVisitor();
validateWithVisitor(visitor, metadata, command, false);
-
- if (validateVisibility) {
- // Create model visibility validation visitor
- visitor = new ModelVisibilityValidationVisitor(this.vdbService, this.vdbName, this.vdbVersion);
- validateWithVisitor(visitor, metadata, command, true);
- }
}
private Command parseCommand() throws QueryParserException {
@@ -452,7 +442,7 @@
createCommandContext();
- validateQuery(command, true);
+ validateQuery(command);
command = QueryRewriter.rewrite(command, null, metadata, context);
@@ -573,7 +563,7 @@
Command processingCommand = generatePlan();
- validateEntitlement(userCommand);
+ validateAccess(userCommand);
setSchemasForXMLPlan(userCommand, metadata);
@@ -594,10 +584,10 @@
referenceCheck(references);
- validateQuery(newCommand, isRootXQuery);
+ validateQuery(newCommand);
if (isRootXQuery) {
- validateEntitlement(newCommand);
+ validateAccess(newCommand);
}
CommandContext copy = (CommandContext) commandContext.clone();
@@ -610,28 +600,13 @@
return new QueryProcessor(plan, copy, bufferManager, processorDataManager);
}
- protected void validateEntitlement(Command command)
+ protected void validateAccess(Command command)
throws QueryValidatorException, MetaMatrixComponentException {
// Validate the query (may only want to validate entitlement)
- AuthorizationService authSvc = (AuthorizationService) this.env
- .findService(DQPServiceNames.AUTHORIZATION_SERVICE);
- if (authSvc != null) {
- // See if entitlement checking is turned on
- if (authSvc.checkingEntitlements()) {
- AuthorizationValidationVisitor visitor = new AuthorizationValidationVisitor(
- this.workContext.getConnectionID(), authSvc);
- validateWithVisitor(visitor, this.metadata, command, true);
- } else if (workContext.getUserName().equals(
- AuthorizationService.DEFAULT_WSDL_USERNAME)) {
- if (command.getType() == Command.TYPE_STORED_PROCEDURE &&
- AuthorizationValidationVisitor.GET_UPDATED_CHARACTER_VDB_RESOURCE.contains(((StoredProcedure) command).getProcedureName())) {
- // do nothing... this is valid
- } else {
- // Throw an exception since the WSDL user is trying to do something other than access the VDB resources
- final String message = DQPPlugin.Util.getString("Request.wsdl_user_not_authorized"); //$NON-NLS-1$
- throw new QueryValidatorException(message);
- }
- }
- }
+ AuthorizationService authSvc = (AuthorizationService) this.env.findService(DQPServiceNames.AUTHORIZATION_SERVICE);
+
+ // See if entitlement checking is turned on
+ AuthorizationValidationVisitor visitor = new AuthorizationValidationVisitor(this.workContext.getConnectionID(), authSvc, this.vdbService, this.vdbName, this.vdbVersion);
+ validateWithVisitor(visitor, this.metadata, command, true);
}
}
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/validator/AuthorizationValidationVisitor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/validator/AuthorizationValidationVisitor.java 2009-11-30 15:24:24 UTC (rev 1605)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/validator/AuthorizationValidationVisitor.java 2009-11-30 17:12:55 UTC (rev 1606)
@@ -30,15 +30,16 @@
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import org.teiid.dqp.internal.process.multisource.MultiSourceElement;
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
import com.metamatrix.api.exception.query.QueryMetadataException;
+import com.metamatrix.common.vdb.api.ModelInfo;
import com.metamatrix.dqp.DQPPlugin;
import com.metamatrix.dqp.service.AuthorizationService;
+import com.metamatrix.dqp.service.VDBService;
import com.metamatrix.query.function.FunctionLibrary;
import com.metamatrix.query.metadata.TempMetadataID;
import com.metamatrix.query.resolver.util.ResolverUtil;
@@ -58,66 +59,82 @@
public class AuthorizationValidationVisitor extends AbstractValidationVisitor {
- /**
- * This virtual procedure must be accessible to all users in order to read the WSDL
- * for web services.
- */
- public final static String GET_UPDATED_CHARACTER_VDB_RESOURCE = "System.getUpdatedCharacterVDBResource"; //$NON-NLS-1$
-
- /**
- * Set of procedures which must be available to all users.
- */
- private static Set globallyAccessibleProcedures = new HashSet();
-
private String connectionID;
private AuthorizationService authInterface;
-
-
- static {
- globallyAccessibleProcedures.add(GET_UPDATED_CHARACTER_VDB_RESOURCE);
- }
-
-
+ private VDBService vdbService;
+ private String vdbName;
+ private String vdbVersion;
+
public AuthorizationValidationVisitor(
String connectionID,
- AuthorizationService authInterface) {
- super();
-
+ AuthorizationService authInterface,
+ VDBService vdbService,
+ String vdbName,
+ String vdbVersion) {
this.connectionID = connectionID;
this.authInterface = authInterface;
+ this.vdbService = vdbService;
+ this.vdbName = vdbName;
+ this.vdbVersion = vdbVersion;
}
// ############### Visitor methods for language objects ##################
+
+ @Override
+ public void visit(GroupSymbol obj) {
+ try {
+ Object modelID = getMetadata().getModelID(obj.getMetadataID());
+ this.validateModelVisibility(modelID, obj);
+ } catch(QueryMetadataException e) {
+ handleException(e, obj);
+ } catch(MetaMatrixComponentException e) {
+ handleException(e, obj);
+ }
+ }
public void visit(Delete obj) {
- validateEntitlements(obj);
+ if (this.authInterface != null && this.authInterface.checkingEntitlements()) {
+ validateEntitlements(obj);
+ }
}
public void visit(Insert obj) {
- validateEntitlements(obj);
+ if (this.authInterface != null && this.authInterface.checkingEntitlements()) {
+ validateEntitlements(obj);
+ }
}
public void visit(Query obj) {
- validateEntitlements(obj);
+ if (this.authInterface != null && this.authInterface.checkingEntitlements()) {
+ validateEntitlements(obj);
+ }
}
public void visit(Update obj) {
- validateEntitlements(obj);
+ if (this.authInterface != null && this.authInterface.checkingEntitlements()) {
+ validateEntitlements(obj);
+ }
}
public void visit(StoredProcedure obj) {
- validateEntitlements(obj);
+ this.validateModelVisibility(obj.getModelID(), obj.getGroup());
+ if (this.authInterface != null && this.authInterface.checkingEntitlements()) {
+ validateEntitlements(obj);
+ }
}
public void visit(Function obj) {
if (FunctionLibrary.LOOKUP.equalsIgnoreCase(obj.getName())) {
try {
- List<Symbol> symbols = new LinkedList<Symbol>();
ResolverUtil.ResolvedLookup lookup = ResolverUtil.resolveLookup(obj, this.getMetadata());
- symbols.add(lookup.getGroup());
- symbols.add(lookup.getKeyElement());
- symbols.add(lookup.getReturnElement());
- validateEntitlements(symbols, AuthorizationService.ACTION_READ, AuthorizationService.CONTEXT_QUERY);
+ validateModelVisibility(getMetadata().getModelID(lookup.getGroup().getMetadataID()), lookup.getGroup());
+ if (this.authInterface != null && this.authInterface.checkingEntitlements()) {
+ List<Symbol> symbols = new LinkedList<Symbol>();
+ symbols.add(lookup.getGroup());
+ symbols.add(lookup.getKeyElement());
+ symbols.add(lookup.getReturnElement());
+ validateEntitlements(symbols, AuthorizationService.ACTION_READ, AuthorizationService.CONTEXT_QUERY);
+ }
} catch (MetaMatrixComponentException e) {
handleException(e, obj);
} catch (MetaMatrixProcessingException e) {
@@ -207,31 +224,10 @@
validateEntitlements(entitledObjects, AuthorizationService.ACTION_READ, AuthorizationService.CONTEXT_QUERY);
}
-
/**
- * Add a procedure to the list of globally
- * @param name
- * @since 4.2
- */
- public static void addGloballyAccessibleProcedure(String name) {
- globallyAccessibleProcedures.add(name);
- }
-
- public static void removeGloballyAccessibleProcedure(String name) {
- globallyAccessibleProcedures.remove(name);
- }
-
-
- /**
* Validate query entitlements
*/
protected void validateEntitlements(StoredProcedure obj) {
- //Skip entitlement checking for any globally available procedures.
- if (globallyAccessibleProcedures.contains(obj.getProcedureName())) {
- return;
- }
-
-
List symbols = new ArrayList(1);
symbols.add(obj.getGroup());
validateEntitlements(symbols, AuthorizationService.ACTION_READ, AuthorizationService.CONTEXT_PROCEDURE);
@@ -308,4 +304,19 @@
}
+ protected void validateModelVisibility(Object modelID, GroupSymbol group) {
+ if(modelID instanceof TempMetadataID){
+ return;
+ }
+ try {
+ String modelName = getMetadata().getFullName(modelID);
+ int visibility = this.vdbService.getModelVisibility(this.vdbName, this.vdbVersion, modelName);
+ if(visibility != ModelInfo.PUBLIC) {
+ handleValidationError(DQPPlugin.Util.getString("ERR.018.005.0088", getMetadata().getFullName(group.getMetadataID()))); //$NON-NLS-1$
+ }
+ } catch (MetaMatrixComponentException e) {
+ handleException(e, group);
+ }
+ }
+
}
Deleted: trunk/engine/src/main/java/org/teiid/dqp/internal/process/validator/ModelVisibilityValidationVisitor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/validator/ModelVisibilityValidationVisitor.java 2009-11-30 15:24:24 UTC (rev 1605)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/validator/ModelVisibilityValidationVisitor.java 2009-11-30 17:12:55 UTC (rev 1606)
@@ -1,138 +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 org.teiid.dqp.internal.process.validator;
-
-import java.util.Collection;
-import java.util.Iterator;
-
-import com.metamatrix.api.exception.MetaMatrixComponentException;
-import com.metamatrix.api.exception.query.QueryMetadataException;
-import com.metamatrix.api.exception.query.QueryResolverException;
-import com.metamatrix.common.vdb.api.ModelInfo;
-import com.metamatrix.dqp.DQPPlugin;
-import com.metamatrix.dqp.service.VDBService;
-import com.metamatrix.query.function.FunctionLibrary;
-import com.metamatrix.query.metadata.TempMetadataID;
-import com.metamatrix.query.resolver.util.ResolverUtil;
-import com.metamatrix.query.sql.lang.Command;
-import com.metamatrix.query.sql.lang.Delete;
-import com.metamatrix.query.sql.lang.Insert;
-import com.metamatrix.query.sql.lang.Query;
-import com.metamatrix.query.sql.lang.StoredProcedure;
-import com.metamatrix.query.sql.lang.Update;
-import com.metamatrix.query.sql.symbol.Function;
-import com.metamatrix.query.sql.symbol.GroupSymbol;
-import com.metamatrix.query.sql.visitor.GroupCollectorVisitor;
-import com.metamatrix.query.validator.AbstractValidationVisitor;
-
-/**
- */
-public class ModelVisibilityValidationVisitor extends AbstractValidationVisitor {
-
- private VDBService vdbService;
- private String vdbName;
- private String vdbVersion;
-
- /**
- *
- */
- public ModelVisibilityValidationVisitor(VDBService vdbService, String vdbName, String vdbVersion ) {
- super();
-
- this.vdbService = vdbService;
- this.vdbName = vdbName;
- this.vdbVersion = vdbVersion;
- }
-
- // ############### Visitor methods for language objects ##################
-
- public void visit(Delete obj) {
- validateModelVisibility(obj);
- }
-
- public void visit(Insert obj) {
- validateModelVisibility(obj);
- }
-
- public void visit(Query obj) {
- validateModelVisibility(obj);
- }
-
- public void visit(Update obj) {
- validateModelVisibility(obj);
- }
-
- public void visit(StoredProcedure obj) {
- validateModelVisibility(obj);
- }
-
- public void visit(Function obj) {
- if (FunctionLibrary.LOOKUP.equalsIgnoreCase(obj.getName())) {
- try {
- ResolverUtil.ResolvedLookup resolvedLookup = ResolverUtil.resolveLookup(obj, getMetadata());
- validateModelVisibility(getMetadata().getModelID(resolvedLookup.getGroup().getMetadataID()), resolvedLookup.getGroup());
- } catch (QueryResolverException e) {
- handleException(e, obj);
- } catch (MetaMatrixComponentException e) {
- handleException(e, obj);
- }
- }
- }
-
- // ######################### Validation methods #########################
-
- protected void validateModelVisibility(Command obj) {
- // first get list of groups from command
- Collection groups = GroupCollectorVisitor.getGroups(obj, true);
-
- try {
- // collect models used by this command
- Iterator groupIter = groups.iterator();
- while(groupIter.hasNext()) {
- GroupSymbol group = (GroupSymbol) groupIter.next();
- Object modelID = null;
- if(obj instanceof StoredProcedure){
- modelID = ((StoredProcedure)obj).getModelID();
- }else{
- modelID = getMetadata().getModelID(group.getMetadataID());
- }
- if(modelID instanceof TempMetadataID){
- return;
- }
- validateModelVisibility(modelID, group);
- }
- } catch(QueryMetadataException e) {
- handleException(e, obj);
- } catch(MetaMatrixComponentException e) {
- handleException(e, obj);
- }
- }
-
- protected void validateModelVisibility(Object modelID, GroupSymbol group) throws QueryMetadataException, MetaMatrixComponentException {
- String modelName = getMetadata().getFullName(modelID);
- int visibility = this.vdbService.getModelVisibility(this.vdbName, this.vdbVersion, modelName);
- if(visibility != ModelInfo.PUBLIC) {
- handleValidationError(DQPPlugin.Util.getString("ERR.018.005.0088", getMetadata().getFullName(group.getMetadataID()))); //$NON-NLS-1$
- }
- }
-}
Modified: trunk/engine/src/main/java/org/teiid/metadata/CompositeMetadataStore.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/metadata/CompositeMetadataStore.java 2009-11-30 15:24:24 UTC (rev 1605)
+++ trunk/engine/src/main/java/org/teiid/metadata/CompositeMetadataStore.java 2009-11-30 17:12:55 UTC (rev 1606)
@@ -37,7 +37,6 @@
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.query.QueryMetadataException;
import com.metamatrix.metadata.runtime.api.MetadataSource;
-import com.metamatrix.query.QueryPlugin;
/**
* Aggregates the metadata from multiple stores.
@@ -83,44 +82,42 @@
* @param partialGroupName
* @return
*/
- public Collection<String> getGroupsForPartialName(String partialGroupName) {
- List<String> result = new LinkedList<String>();
+ public Collection<Table> getGroupsForPartialName(String partialGroupName) {
+ List<Table> result = new LinkedList<Table>();
for (Schema schema : getSchemas().values()) {
for (Table t : schema.getTables().values()) {
String fullName = t.getFullName();
if (fullName.regionMatches(true, fullName.length() - partialGroupName.length(), partialGroupName, 0, partialGroupName.length())) {
- result.add(fullName);
+ result.add(t);
}
}
}
return result;
}
- public ProcedureRecordImpl getStoredProcedure(String name)
+ public Collection<ProcedureRecordImpl> getStoredProcedure(String name)
throws MetaMatrixComponentException, QueryMetadataException {
+ List<ProcedureRecordImpl> result = new LinkedList<ProcedureRecordImpl>();
int index = name.indexOf(TransformationMetadata.DELIMITER_STRING);
if (index > -1) {
String schema = name.substring(0, index);
- ProcedureRecordImpl result = getSchema(schema).getProcedures().get(name.substring(index + 1));
- if (result != null) {
+ ProcedureRecordImpl proc = getSchema(schema).getProcedures().get(name.substring(index + 1));
+ if (proc != null) {
+ result.add(proc);
return result;
}
}
- ProcedureRecordImpl result = null;
//assume it's a partial name
name = TransformationMetadata.DELIMITER_STRING + name;
for (Schema schema : getSchemas().values()) {
for (ProcedureRecordImpl p : schema.getProcedures().values()) {
String fullName = p.getFullName();
if (fullName.regionMatches(true, fullName.length() - name.length(), name, 0, name.length())) {
- if (result != null) {
- throw new QueryMetadataException(QueryPlugin.Util.getString("ambiguous_procedure", name.substring(1))); //$NON-NLS-1$
- }
- result = p;
+ result.add(p);
}
}
}
- if (result == null) {
+ if (result.isEmpty()) {
throw new QueryMetadataException(name+TransformationMetadata.NOT_EXISTS_MESSAGE);
}
return result;
Modified: trunk/engine/src/main/java/org/teiid/metadata/TransformationMetadata.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/metadata/TransformationMetadata.java 2009-11-30 15:24:24 UTC (rev 1605)
+++ trunk/engine/src/main/java/org/teiid/metadata/TransformationMetadata.java 2009-11-30 17:12:55 UTC (rev 1606)
@@ -26,7 +26,6 @@
import java.io.File;
import java.io.InputStream;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
@@ -53,11 +52,14 @@
import com.metamatrix.api.exception.query.QueryMetadataException;
import com.metamatrix.common.properties.UnmodifiableProperties;
import com.metamatrix.common.types.DataTypeManager;
+import com.metamatrix.common.vdb.api.ModelInfo;
import com.metamatrix.core.util.ArgCheck;
import com.metamatrix.core.util.LRUCache;
import com.metamatrix.core.util.StringUtil;
import com.metamatrix.dqp.DQPPlugin;
+import com.metamatrix.dqp.service.VDBService;
import com.metamatrix.metadata.runtime.api.MetadataSourceUtil;
+import com.metamatrix.query.QueryPlugin;
import com.metamatrix.query.mapping.relational.QueryNode;
import com.metamatrix.query.mapping.xml.MappingDocument;
import com.metamatrix.query.mapping.xml.MappingLoader;
@@ -83,20 +85,28 @@
private static UnmodifiableProperties EMPTY_PROPS = new UnmodifiableProperties(new Properties());
private final CompositeMetadataStore store;
+ private String vdbVersion;
+ private VDBService vdbService;
/*
* TODO: move caching to jboss cache structure
*/
private final Map<String, Object> metadataCache = Collections.synchronizedMap(new LRUCache<String, Object>(500));
- private final Map<String, String> partialNameToFullNameCache = Collections.synchronizedMap(new LRUCache<String, String>(1000));
- private final Map<String, StoredProcedureInfo> procedureCache = Collections.synchronizedMap(new LRUCache<String, StoredProcedureInfo>(200));
+ private final Map<String, Collection<Table>> partialNameToFullNameCache = Collections.synchronizedMap(new LRUCache<String, Collection<Table>>(1000));
+ private final Map<String, Collection<StoredProcedureInfo>> procedureCache = Collections.synchronizedMap(new LRUCache<String, Collection<StoredProcedureInfo>>(200));
/**
* TransformationMetadata constructor
* @param context Object containing the info needed to lookup metadta.
*/
public TransformationMetadata(final CompositeMetadataStore store) {
+ this(store, null, null);
+ }
+
+ public TransformationMetadata(final CompositeMetadataStore store, VDBService service, String vdbVersion) {
ArgCheck.isNotNull(store);
this.store = store;
+ this.vdbService = service;
+ this.vdbVersion = vdbVersion;
}
//==================================================================================
@@ -124,20 +134,27 @@
throws MetaMatrixComponentException, QueryMetadataException {
ArgCheck.isNotEmpty(partialGroupName);
- String groupName = this.partialNameToFullNameCache.get(partialGroupName);
+ Collection<Table> matches = this.partialNameToFullNameCache.get(partialGroupName);
- if (groupName != null) {
- return Arrays.asList(groupName);
+ if (matches == null) {
+ String partialName = DELIMITER_CHAR + partialGroupName.toLowerCase();
+
+ matches = getMetadataStore().getGroupsForPartialName(partialName);
+
+ this.partialNameToFullNameCache.put(partialGroupName, matches);
}
- String partialName = DELIMITER_CHAR + partialGroupName.toLowerCase();
-
- Collection result = getMetadataStore().getGroupsForPartialName(partialName);
-
- if (result.size() == 1) {
- this.partialNameToFullNameCache.put(partialGroupName, (String)result.iterator().next());
- }
- return result;
+ if (matches.isEmpty()) {
+ return Collections.emptyList();
+ }
+
+ Collection<String> filteredResult = new ArrayList<String>(matches.size());
+ for (Table table : matches) {
+ if (vdbService == null || vdbService.getModelVisibility(getVirtualDatabaseName(), vdbVersion, table.getParent().getName()) == ModelInfo.PUBLIC) {
+ filteredResult.add(table.getFullName());
+ }
+ }
+ return filteredResult;
}
/* (non-Javadoc)
@@ -244,64 +261,80 @@
throws MetaMatrixComponentException, QueryMetadataException {
ArgCheck.isNotEmpty(fullyQualifiedProcedureName);
String lowerGroupName = fullyQualifiedProcedureName.toLowerCase();
- StoredProcedureInfo procInfo = this.procedureCache.get(lowerGroupName);
+ Collection<StoredProcedureInfo> results = this.procedureCache.get(lowerGroupName);
- if (procInfo != null) {
- return procInfo;
- }
-
- ProcedureRecordImpl procRecord = getMetadataStore().getStoredProcedure(lowerGroupName);
+ if (results == null) {
+ Collection<ProcedureRecordImpl> procRecords = getMetadataStore().getStoredProcedure(lowerGroupName);
+ results = new ArrayList<StoredProcedureInfo>(procRecords.size());
+ for (ProcedureRecordImpl procRecord : procRecords) {
+ String procedureFullName = procRecord.getFullName();
- String procedureFullName = procRecord.getFullName();
+ // create the storedProcedure info object that would hold procedure's metadata
+ StoredProcedureInfo procInfo = new StoredProcedureInfo();
+ procInfo.setProcedureCallableName(procedureFullName);
+ procInfo.setProcedureID(procRecord);
- // create the storedProcedure info object that would hold procedure's metadata
- procInfo = new StoredProcedureInfo();
- procInfo.setProcedureCallableName(procedureFullName);
- procInfo.setProcedureID(procRecord);
+ // modelID for the procedure
+ procInfo.setModelID(procRecord.getSchema());
- // modelID for the procedure
- procInfo.setModelID(procRecord.getSchema());
+ // get the parameter metadata info
+ for (ProcedureParameter paramRecord : procRecord.getParameters()) {
+ String runtimeType = paramRecord.getRuntimeType();
+ int direction = this.convertParamRecordTypeToStoredProcedureType(paramRecord.getType());
+ // create a parameter and add it to the procedure object
+ SPParameter spParam = new SPParameter(paramRecord.getPosition(), direction, paramRecord.getName());
+ spParam.setMetadataID(paramRecord);
+ spParam.setClassType(DataTypeManager.getDataTypeClass(runtimeType));
+ procInfo.addParameter(spParam);
+ }
- // get the parameter metadata info
- for (ProcedureParameter paramRecord : procRecord.getParameters()) {
- String runtimeType = paramRecord.getRuntimeType();
- int direction = this.convertParamRecordTypeToStoredProcedureType(paramRecord.getType());
- // create a parameter and add it to the procedure object
- SPParameter spParam = new SPParameter(paramRecord.getPosition(), direction, paramRecord.getName());
- spParam.setMetadataID(paramRecord);
- spParam.setClassType(DataTypeManager.getDataTypeClass(runtimeType));
- procInfo.addParameter(spParam);
- }
+ // if the procedure returns a resultSet, obtain resultSet metadata
+ if(procRecord.getResultSet() != null) {
+ ColumnSet<ProcedureRecordImpl> resultRecord = procRecord.getResultSet();
+ // resultSet is the last parameter in the procedure
+ int lastParamIndex = procInfo.getParameters().size() + 1;
+ SPParameter param = new SPParameter(lastParamIndex, SPParameter.RESULT_SET, resultRecord.getName());
+ param.setClassType(java.sql.ResultSet.class);
+ param.setMetadataID(resultRecord);
- // if the procedure returns a resultSet, obtain resultSet metadata
- if(procRecord.getResultSet() != null) {
- ColumnSet<ProcedureRecordImpl> resultRecord = procRecord.getResultSet();
- // resultSet is the last parameter in the procedure
- int lastParamIndex = procInfo.getParameters().size() + 1;
- SPParameter param = new SPParameter(lastParamIndex, SPParameter.RESULT_SET, resultRecord.getName());
- param.setClassType(java.sql.ResultSet.class);
- param.setMetadataID(resultRecord);
+ for (Column columnRecord : resultRecord.getColumns()) {
+ String colType = columnRecord.getRuntimeType();
+ param.addResultSetColumn(columnRecord.getFullName(), DataTypeManager.getDataTypeClass(colType), columnRecord);
+ }
- for (Column columnRecord : resultRecord.getColumns()) {
- String colType = columnRecord.getRuntimeType();
- param.addResultSetColumn(columnRecord.getFullName(), DataTypeManager.getDataTypeClass(colType), columnRecord);
- }
+ procInfo.addParameter(param);
+ }
- procInfo.addParameter(param);
+ // if this is a virtual procedure get the procedure plan
+ if(procRecord.isVirtual()) {
+ QueryNode queryNode = new QueryNode(procedureFullName, procRecord.getQueryPlan());
+ procInfo.setQueryPlan(queryNode);
+ }
+
+ //subtract 1, to match up with the server
+ procInfo.setUpdateCount(procRecord.getUpdateCount() -1);
+ results.add(procInfo);
+ }
+ this.procedureCache.put(lowerGroupName, results);
}
-
- // if this is a virtual procedure get the procedure plan
- if(procRecord.isVirtual()) {
- QueryNode queryNode = new QueryNode(procedureFullName, procRecord.getQueryPlan());
- procInfo.setQueryPlan(queryNode);
- }
- //subtract 1, to match up with the server
- procInfo.setUpdateCount(procRecord.getUpdateCount() -1);
-
- this.procedureCache.put(lowerGroupName, procInfo);
+ StoredProcedureInfo result = null;
+
+ for (StoredProcedureInfo storedProcedureInfo : results) {
+ Schema schema = (Schema)storedProcedureInfo.getModelID();
+ if(vdbService == null || vdbService.getModelVisibility(getVirtualDatabaseName(), vdbVersion, schema.getName()) == ModelInfo.PUBLIC){
+ if (result != null) {
+ throw new QueryMetadataException(QueryPlugin.Util.getString("ambiguous_procedure", fullyQualifiedProcedureName)); //$NON-NLS-1$
+ }
+ result = storedProcedureInfo;
+ }
+ }
+
+ if (result == null) {
+ throw new QueryMetadataException(fullyQualifiedProcedureName+NOT_EXISTS_MESSAGE);
+ }
- return procInfo;
+ return result;
}
/**
Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java 2009-11-30 15:24:24 UTC (rev 1605)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java 2009-11-30 17:12:55 UTC (rev 1606)
@@ -226,11 +226,6 @@
helpTestVisibilityFails(xquery);
}
- @Test public void testResolvingVisibility() throws Exception {
- String sql = "SELECT * FROM SmallA"; //$NON-NLS-1$
- helpExecute(sql, "a"); //$NON-NLS-1$
- }
-
///////////////////////////Helper method///////////////////////////////////
private ResultsMessage helpExecute(String sql, String userName) throws Exception {
return helpExecute(sql, userName, 1, false);
Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestMetaDataProcessor.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestMetaDataProcessor.java 2009-11-30 15:24:24 UTC (rev 1605)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestMetaDataProcessor.java 2009-11-30 17:12:55 UTC (rev 1606)
@@ -126,19 +126,6 @@
assertEquals(0, metadata.length);
}
- public void testDefect15029() throws Exception {
- String sql = "SELECT * FROM g1"; //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.examplePrivatePhysicalModel();
-
- MetadataResult response = helpTestQuery(metadata, sql);
-
- Map[] md = response.getColumnMetadata();
- assertNotNull(md);
- assertEquals(1, md.length);
- assertEquals("e1", md[0].get(ResultsMetadataConstants.ELEMENT_NAME)); //$NON-NLS-1$
- assertEquals("vm1.g1", md[0].get(ResultsMetadataConstants.GROUP_NAME)); //$NON-NLS-1$
- }
-
private MetadataResult helpTestQuery(QueryMetadataInterface metadata, String sql) throws Exception {
FakeVDBService vdbService = new FakeVDBService();
vdbService.addModel("MyVDB", "1", "pm1", ModelInfo.PRIVATE, false); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestRequest.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestRequest.java 2009-11-30 15:24:24 UTC (rev 1605)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestRequest.java 2009-11-30 17:12:55 UTC (rev 1606)
@@ -123,7 +123,7 @@
request.initialize(message, environment, null, null, null, false, null, workContext, 101024);
request.initMetadata();
- request.validateEntitlement(command);
+ request.validateAccess(command);
}
Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/validator/TestAuthorizationValidationVisitor.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/validator/TestAuthorizationValidationVisitor.java 2009-11-30 15:24:24 UTC (rev 1605)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/validator/TestAuthorizationValidationVisitor.java 2009-11-30 17:12:55 UTC (rev 1606)
@@ -27,6 +27,8 @@
import java.util.Iterator;
import java.util.Set;
+import org.mockito.Mockito;
+import org.teiid.dqp.internal.process.Request;
import org.teiid.dqp.internal.process.validator.AuthorizationValidationVisitor;
import junit.framework.TestCase;
@@ -34,8 +36,12 @@
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.query.QueryParserException;
import com.metamatrix.api.exception.query.QueryResolverException;
+import com.metamatrix.api.exception.query.QueryValidatorException;
+import com.metamatrix.common.vdb.api.ModelInfo;
import com.metamatrix.dqp.service.AuthorizationService;
import com.metamatrix.dqp.service.FakeAuthorizationService;
+import com.metamatrix.dqp.service.FakeVDBService;
+import com.metamatrix.dqp.service.VDBService;
import com.metamatrix.query.metadata.QueryMetadataInterface;
import com.metamatrix.query.parser.QueryParser;
import com.metamatrix.query.resolver.QueryResolver;
@@ -119,7 +125,7 @@
Command command = parser.parseCommand(sql);
QueryResolver.resolveCommand(command, metadata);
- AuthorizationValidationVisitor visitor = new AuthorizationValidationVisitor(CONN_ID, svc);
+ AuthorizationValidationVisitor visitor = new AuthorizationValidationVisitor(CONN_ID, svc, Mockito.mock(VDBService.class), "foo", "1"); //$NON-NLS-1$ //$NON-NLS-2$
ValidatorReport report = Validator.validate(command, metadata, visitor, true);
if(report.hasItems()) {
ValidatorFailure firstFailure = (ValidatorFailure) report.getItems().iterator().next();
@@ -215,14 +221,6 @@
helpTest(exampleAuthSvc2(), "SELECT e1, e2, e3, e4 INTO pm3.g2 FROM pm2.g1", FakeMetadataFactory.example1Cached(), new String[] {"pm3.g2.e1", "pm3.g2.e2"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- public void testProcGloballyAccessible() throws Exception {
- AuthorizationValidationVisitor.addGloballyAccessibleProcedure("pm1.sq2"); //$NON-NLS-1$
- helpTest(exampleAuthSvc1(), "EXEC pm1.sq2('xyz')", FakeMetadataFactory.example1Cached(), new String[] {}); //$NON-NLS-1$
-
- AuthorizationValidationVisitor.removeGloballyAccessibleProcedure("pm1.sq2"); //$NON-NLS-1$
- helpTest(exampleAuthSvc1(), "EXEC pm1.sq2('xyz')", FakeMetadataFactory.example1Cached(), new String[] {"pm1.sq2"}); //$NON-NLS-1$//$NON-NLS-2$
- }
-
public void testTempTableSelectInto() throws Exception {
helpTest(exampleAuthSvc1(), "SELECT e1 INTO #temp FROM pm1.g1", FakeMetadataFactory.example1Cached(), new String[] {}); //$NON-NLS-1$
}
@@ -242,4 +240,31 @@
public void testXMLInAccessible() throws Exception {
helpTest(exampleAuthSvc1(), "select * from xmltest.doc1", FakeMetadataFactory.example1Cached(), new String[] {"xmltest.doc1"}); //$NON-NLS-1$ //$NON-NLS-2$
}
+
+ private void helpTestLookupVisibility(boolean visible) throws QueryParserException, QueryValidatorException, MetaMatrixComponentException {
+ FakeVDBService vdbService = new FakeVDBService();
+ String vdbName = "foo"; //$NON-NLS-1$
+ String vdbVersion = "1"; //$NON-NLS-1$
+ String modelName = "pm1"; //$NON-NLS-1$
+ vdbService.addModel(vdbName, vdbVersion, modelName, visible?ModelInfo.PUBLIC:ModelInfo.PRIVATE, false);
+ AuthorizationValidationVisitor mvvv = new AuthorizationValidationVisitor(CONN_ID, Mockito.mock(AuthorizationService.class), vdbService, vdbName, vdbVersion);
+
+ String sql = "select lookup('pm1.g1', 'e1', 'e2', 1)"; //$NON-NLS-1$
+ Command command = QueryParser.getQueryParser().parseCommand(sql);
+ Request.validateWithVisitor(mvvv, FakeMetadataFactory.example1Cached(), command, true);
+ }
+
+ public void testLookupVisibility() throws Exception {
+ helpTestLookupVisibility(true);
+ }
+
+ public void testLookupVisibilityFails() throws Exception {
+ try {
+ helpTestLookupVisibility(false);
+ fail("expected exception"); //$NON-NLS-1$
+ } catch (QueryValidatorException e) {
+ assertEquals("Group does not exist: pm1.g1", e.getMessage()); //$NON-NLS-1$
+ }
+ }
+
}
Deleted: trunk/engine/src/test/java/org/teiid/dqp/internal/process/validator/TestModelVisibilityValidationVisitor.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/validator/TestModelVisibilityValidationVisitor.java 2009-11-30 15:24:24 UTC (rev 1605)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/validator/TestModelVisibilityValidationVisitor.java 2009-11-30 17:12:55 UTC (rev 1606)
@@ -1,67 +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 org.teiid.dqp.internal.process.validator;
-
-import org.teiid.dqp.internal.process.Request;
-import org.teiid.dqp.internal.process.validator.ModelVisibilityValidationVisitor;
-
-import junit.framework.TestCase;
-
-import com.metamatrix.api.exception.MetaMatrixComponentException;
-import com.metamatrix.api.exception.query.QueryParserException;
-import com.metamatrix.api.exception.query.QueryValidatorException;
-import com.metamatrix.common.vdb.api.ModelInfo;
-import com.metamatrix.dqp.service.FakeVDBService;
-import com.metamatrix.query.parser.QueryParser;
-import com.metamatrix.query.sql.lang.Command;
-import com.metamatrix.query.unittest.FakeMetadataFactory;
-
-public class TestModelVisibilityValidationVisitor extends TestCase {
-
- private void helpTestLookupVisibility(boolean visible) throws QueryParserException, QueryValidatorException, MetaMatrixComponentException {
- FakeVDBService vdbService = new FakeVDBService();
- String vdbName = "foo"; //$NON-NLS-1$
- String vdbVersion = "1"; //$NON-NLS-1$
- String modelName = "pm1"; //$NON-NLS-1$
- vdbService.addModel(vdbName, vdbVersion, modelName, visible?ModelInfo.PUBLIC:ModelInfo.PRIVATE, false);
- ModelVisibilityValidationVisitor mvvv = new ModelVisibilityValidationVisitor(vdbService, vdbName, vdbVersion);
-
- String sql = "select lookup('pm1.g1', 'e1', 'e2', 1)"; //$NON-NLS-1$
- Command command = QueryParser.getQueryParser().parseCommand(sql);
- Request.validateWithVisitor(mvvv, FakeMetadataFactory.example1Cached(), command, true);
- }
-
- public void testLookupVisibility() throws Exception {
- helpTestLookupVisibility(true);
- }
-
- public void testLookupVisibilityFails() throws Exception {
- try {
- helpTestLookupVisibility(false);
- fail("expected exception"); //$NON-NLS-1$
- } catch (QueryValidatorException e) {
- assertEquals("Group does not exist: pm1.g1", e.getMessage()); //$NON-NLS-1$
- }
- }
-
-}
Deleted: trunk/engine/src/test/java/org/teiid/metadata/TestCompositeMetadataStore.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/metadata/TestCompositeMetadataStore.java 2009-11-30 15:24:24 UTC (rev 1605)
+++ trunk/engine/src/test/java/org/teiid/metadata/TestCompositeMetadataStore.java 2009-11-30 17:12:55 UTC (rev 1606)
@@ -1,59 +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 org.teiid.metadata;
-
-import static org.junit.Assert.*;
-
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-
-import org.junit.Test;
-import org.mockito.Mockito;
-import org.teiid.connector.metadata.runtime.Datatype;
-import org.teiid.connector.metadata.runtime.MetadataFactory;
-
-import com.metamatrix.api.exception.query.QueryMetadataException;
-import com.metamatrix.common.types.DataTypeManager;
-import com.metamatrix.metadata.runtime.api.MetadataSource;
-
-public class TestCompositeMetadataStore {
-
- @Test public void testAmbiguousProc() throws Exception {
- Map<String, Datatype> datatypes = new HashMap<String, Datatype>();
- datatypes.put(DataTypeManager.DefaultDataTypes.STRING, new Datatype());
- MetadataFactory mf = new MetadataFactory("x", datatypes, new Properties()); //$NON-NLS-1$
- mf.addProcedure("y"); //$NON-NLS-1$
- MetadataFactory mf1 = new MetadataFactory("x1", datatypes, new Properties()); //$NON-NLS-1$
- mf1.addProcedure("y"); //$NON-NLS-1$
- CompositeMetadataStore cms = new CompositeMetadataStore(Arrays.asList(mf.getMetadataStore(), mf1.getMetadataStore()), Mockito.mock(MetadataSource.class));
- try {
- cms.getStoredProcedure("y"); //$NON-NLS-1$
- fail("expected exception"); //$NON-NLS-1$
- } catch (QueryMetadataException e) {
- assertEquals("Procedure 'y' is ambiguous, use the fully qualified name instead", e.getMessage()); //$NON-NLS-1$
- }
- }
-
-}
Copied: trunk/engine/src/test/java/org/teiid/metadata/TestTransformationMetadata.java (from rev 1603, trunk/engine/src/test/java/org/teiid/metadata/TestCompositeMetadataStore.java)
===================================================================
--- trunk/engine/src/test/java/org/teiid/metadata/TestTransformationMetadata.java (rev 0)
+++ trunk/engine/src/test/java/org/teiid/metadata/TestTransformationMetadata.java 2009-11-30 17:12:55 UTC (rev 1606)
@@ -0,0 +1,86 @@
+/*
+ * 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 org.teiid.metadata;
+
+import static org.junit.Assert.*;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.teiid.connector.metadata.runtime.Datatype;
+import org.teiid.connector.metadata.runtime.MetadataFactory;
+
+import com.metamatrix.api.exception.query.QueryMetadataException;
+import com.metamatrix.common.types.DataTypeManager;
+import com.metamatrix.common.vdb.api.ModelInfo;
+import com.metamatrix.dqp.service.VDBService;
+import com.metamatrix.metadata.runtime.api.MetadataSource;
+
+public class TestTransformationMetadata {
+
+ @Test public void testAmbiguousProc() throws Exception {
+ Map<String, Datatype> datatypes = new HashMap<String, Datatype>();
+ datatypes.put(DataTypeManager.DefaultDataTypes.STRING, new Datatype());
+ MetadataFactory mf = new MetadataFactory("x", datatypes, new Properties()); //$NON-NLS-1$
+ mf.addProcedure("y"); //$NON-NLS-1$
+ MetadataFactory mf1 = new MetadataFactory("x1", datatypes, new Properties()); //$NON-NLS-1$
+ mf1.addProcedure("y"); //$NON-NLS-1$
+ CompositeMetadataStore cms = new CompositeMetadataStore(Arrays.asList(mf.getMetadataStore(), mf1.getMetadataStore()), Mockito.mock(MetadataSource.class));
+ TransformationMetadata tm = new TransformationMetadata(cms);
+ try {
+ tm.getStoredProcedureInfoForProcedure("y"); //$NON-NLS-1$
+ fail("expected exception"); //$NON-NLS-1$
+ } catch (QueryMetadataException e) {
+ assertEquals("Procedure 'y' is ambiguous, use the fully qualified name instead", e.getMessage()); //$NON-NLS-1$
+ }
+ }
+
+ @Test public void testAmbiguousTableWithPrivateModel() throws Exception {
+ Map<String, Datatype> datatypes = new HashMap<String, Datatype>();
+ datatypes.put(DataTypeManager.DefaultDataTypes.STRING, new Datatype());
+ MetadataFactory mf = new MetadataFactory("x", datatypes, new Properties()); //$NON-NLS-1$
+ mf.addTable("y"); //$NON-NLS-1$
+ MetadataFactory mf1 = new MetadataFactory("x1", datatypes, new Properties()); //$NON-NLS-1$
+ mf1.addTable("y"); //$NON-NLS-1$
+ MetadataSource ms = Mockito.mock(MetadataSource.class);
+ Mockito.stub(ms.getName()).toReturn("foo"); //$NON-NLS-1$
+ CompositeMetadataStore cms = new CompositeMetadataStore(Arrays.asList(mf.getMetadataStore(), mf1.getMetadataStore()), ms);
+ TransformationMetadata tm = new TransformationMetadata(cms);
+ Collection result = tm.getGroupsForPartialName("y"); //$NON-NLS-1$
+ assertEquals(2, result.size());
+
+ VDBService vdbService = Mockito.mock(VDBService.class);
+ Mockito.stub(vdbService.getModelVisibility("foo", "1", "x1")).toReturn((int)ModelInfo.PRIVATE); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Mockito.stub(vdbService.getModelVisibility("foo", "1", "x")).toReturn((int)ModelInfo.PUBLIC); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ tm = new TransformationMetadata(cms, vdbService, "1"); //$NON-NLS-1$
+ result = tm.getGroupsForPartialName("y"); //$NON-NLS-1$
+ assertEquals(1, result.size());
+
+ }
+
+}
Property changes on: trunk/engine/src/test/java/org/teiid/metadata/TestTransformationMetadata.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/runtime/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedVDBService.java
===================================================================
--- trunk/runtime/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedVDBService.java 2009-11-30 15:24:24 UTC (rev 1605)
+++ trunk/runtime/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedVDBService.java 2009-11-30 17:12:55 UTC (rev 1606)
@@ -24,7 +24,6 @@
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
@@ -38,7 +37,6 @@
import com.metamatrix.common.application.exception.ApplicationLifecycleException;
import com.metamatrix.common.config.api.ConnectorBinding;
import com.metamatrix.common.vdb.api.ModelInfo;
-import com.metamatrix.common.vdb.api.SystemVdbUtility;
import com.metamatrix.common.vdb.api.VDBArchive;
import com.metamatrix.common.vdb.api.VDBDefn;
import com.metamatrix.core.util.StringUtil;
@@ -99,18 +97,6 @@
return vdb;
}
- private ModelInfo getModel(VDBDefn vdb, String modelName) {
- Collection c = vdb.getModels();
- Iterator it = c.iterator();
- while (it.hasNext()) {
- ModelInfo model = (ModelInfo)it.next();
- if (model.getName().equals(modelName)) {
- return model;
- }
- }
- return null;
- }
-
/**
* This should changed to connectorBindingNames.
* @see com.metamatrix.dqp.service.VDBService#getConnectorBindings(java.lang.String, java.lang.String, java.lang.String)
@@ -153,14 +139,14 @@
throws MetaMatrixComponentException {
// If this is any of the Public System Models, like JDBC,ODBC system models
- if(SystemVdbUtility.isSystemModelWithSystemTableType(modelName)){
+ if(VDBArchive.isSystemModelWithSystemTableType(modelName)){
return ModelInfo.PUBLIC;
}
VDBArchive vdb = getVDB(vdbName, vdbVersion);
VDBDefn def = vdb.getConfigurationDef();
- ModelInfo model = getModel(def, modelName);
+ ModelInfo model = def.getModel(modelName);
if(model != null) {
return model.getVisibility();
}
@@ -179,14 +165,14 @@
String modelName = StringUtil.getFirstToken(StringUtil.getLastToken(pathInVDB, "/"), "."); //$NON-NLS-1$ //$NON-NLS-2$
// If this is any of the Public System Models, like JDBC,ODBC system models
- if(SystemVdbUtility.isSystemModelWithSystemTableType(modelName)){
+ if(VDBArchive.isSystemModelWithSystemTableType(modelName)){
return ModelInfo.PUBLIC;
}
VDBArchive vdb = getVDB(vdbName, vdbVersion);
VDBDefn def = vdb.getConfigurationDef();
- ModelInfo model = getModel(def, modelName);
+ ModelInfo model = def.getModel(modelName);
if(model != null) {
return model.getVisibility();
}
Modified: trunk/runtime/src/main/java/com/metamatrix/platform/security/membership/service/MembershipServiceImpl.java
===================================================================
--- trunk/runtime/src/main/java/com/metamatrix/platform/security/membership/service/MembershipServiceImpl.java 2009-11-30 15:24:24 UTC (rev 1605)
+++ trunk/runtime/src/main/java/com/metamatrix/platform/security/membership/service/MembershipServiceImpl.java 2009-11-30 17:12:55 UTC (rev 1606)
@@ -58,6 +58,7 @@
import com.metamatrix.common.util.PropertiesUtils;
import com.metamatrix.common.util.crypto.CryptoException;
import com.metamatrix.common.util.crypto.CryptoUtil;
+import com.metamatrix.core.CoreConstants;
import com.metamatrix.core.util.StringUtil;
import com.metamatrix.dqp.embedded.DQPEmbeddedPlugin;
import com.metamatrix.dqp.embedded.DQPEmbeddedProperties;
@@ -334,7 +335,7 @@
return new FailedAuthenticationToken();
}
- if (isWsdlUser(username)) {
+ if (isAnonUser(username)) {
// No need to check credentials. There is no password for the wsdl user.
return new SuccessfulAuthenticationToken(trustedPayload, username);
}
@@ -493,7 +494,7 @@
return new BasicMetaMatrixPrincipal(name, MetaMatrixPrincipal.TYPE_ADMIN,Collections.EMPTY_SET);
}
- if (isWsdlUser(name)) {
+ if (isAnonUser(name)) {
return new BasicMetaMatrixPrincipal(name, MetaMatrixPrincipal.TYPE_USER,Collections.EMPTY_SET);
}
}
@@ -645,8 +646,8 @@
return adminUsername.equalsIgnoreCase(username);
}
- public boolean isWsdlUser(String username) {
- return DEFAULT_WSDL_USERNAME.equalsIgnoreCase(username);
+ public boolean isAnonUser(String username) {
+ return CoreConstants.DEFAULT_ANON_USERNAME.equalsIgnoreCase(username);
}
/**
15 years, 1 month
teiid SVN: r1605 - trunk/console/src/main/java/org/teiid/rhq/plugin.
by teiid-commits@lists.jboss.org
Author: tejones
Date: 2009-11-30 10:24:24 -0500 (Mon, 30 Nov 2009)
New Revision: 1605
Modified:
trunk/console/src/main/java/org/teiid/rhq/plugin/PlatformDiscoveryComponent.java
Log:
TEIID-807: Added discovery of runtime engine
Modified: trunk/console/src/main/java/org/teiid/rhq/plugin/PlatformDiscoveryComponent.java
===================================================================
--- trunk/console/src/main/java/org/teiid/rhq/plugin/PlatformDiscoveryComponent.java 2009-11-29 14:39:39 UTC (rev 1604)
+++ trunk/console/src/main/java/org/teiid/rhq/plugin/PlatformDiscoveryComponent.java 2009-11-30 15:24:24 UTC (rev 1605)
@@ -21,103 +21,156 @@
*/
package org.teiid.rhq.plugin;
+import java.io.File;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.Map;
import java.util.Set;
+import javax.naming.InitialContext;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.jboss.deployers.spi.management.ManagementView;
+import org.jboss.deployers.spi.management.deploy.DeploymentManager;
+import org.jboss.managed.api.ComponentType;
+import org.jboss.managed.api.ManagedComponent;
+import org.jboss.profileservice.spi.Profile;
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.ProfileService;
+import org.mc4j.ems.connection.EmsConnection;
+import org.mc4j.ems.connection.bean.EmsBean;
+import org.mc4j.ems.connection.bean.attribute.EmsAttribute;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails;
import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
import org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent;
import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
-import org.teiid.rhq.admin.utils.SingletonConnectionManager;
-import org.teiid.rhq.comm.Component;
-import org.teiid.rhq.comm.ConnectionConstants;
+import org.rhq.plugins.jmx.JMXDiscoveryComponent;
-
/**
* This is the parent node for a MetaMatrix system
*/
public class PlatformDiscoveryComponent implements ResourceDiscoveryComponent {
- private static SingletonConnectionManager connMgr = SingletonConnectionManager.getInstance();
+
private static final Log LOG = LogFactory
.getLog(PlatformDiscoveryComponent.class);
-
-
- Map environmentMap = new HashMap();
- /**
+ private final Log log = LogFactory.getLog(this.getClass());
+
+ /**
* Review the javadoc for both {@link ResourceDiscoveryComponent} and
* {@link ResourceDiscoveryContext} to learn what you need to do in this
* method.
*
* @see ResourceDiscoveryComponent#discoverResources(ResourceDiscoveryContext)
*/
- public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext discoveryContext) throws InvalidPluginConfigurationException,
- Exception {
- try {
-
- String name = discoveryContext.getResourceType().getName();
- String desc = discoveryContext.getResourceType().getDescription();
- String version = ConnectionConstants.VERSION;
-
- LOG.info("Discovering " + desc); //$NON-NLS-1$
-
-
- // now perform your own discovery mechanism, if you have one. For each
- // resource discovered, you need to
- // create a details object that describe the resource that you
- // discovered.
- HashSet<DiscoveredResourceDetails> set = new HashSet<DiscoveredResourceDetails>();
+ public Set<DiscoveredResourceDetails> discoverResources(
+ ResourceDiscoveryContext discoveryContext)
+ throws InvalidPluginConfigurationException, Exception {
- Set<String> systemkeys = null ;
+ Set<DiscoveredResourceDetails> discoveredResources = new HashSet<DiscoveredResourceDetails>();
- try {
- systemkeys = connMgr.getInstallationSystemKeys();
- } catch (Exception e) {
- systemkeys = new HashSet(1);
- systemkeys.add("NotDefined");
+ InitialContext ic = new InitialContext();
+ ProfileService ps = (ProfileService) ic.lookup("ProfileService");
- // TODO
- // - when the serverList cannot be obtained
-
- // DO NOT throw exception, still want to create the
- // resource, but it will show not active / available
- }
+ ManagementView vm = ps.getViewManager();
+ vm.load();
+ ComponentType type = new ComponentType("ConnectionFactory", "NoTx");
+ ManagedComponent mc = vm.getComponent("teiid-runtime-engine",
+ type);
+ /*
+ * Currently this uses a hardcoded remote address for access to the
+ * MBean server This needs to be switched to check if we e.g. run inside
+ * a JBossAS to which we have a connection already that we can reuse.
+ */
+ Configuration c = new Configuration(); // TODO get from
+ // defaultPluginConfig
+ String managerName = mc.getName();
+ c.put(new PropertySimple("objectName", managerName));
+ /**
+ *
+ * A discovered resource must have a unique key, that must stay the same
+ * when the resource is discovered the next time
+ */
+ DiscoveredResourceDetails detail = new DiscoveredResourceDetails(
+ discoveryContext.getResourceType(), // ResourceType
+ managerName, // Resource Key
+ "Data Service Runtime Engine", // Resource Name
+ null, // Version TODO can we get that from discovery ?
+ "The JBoss Enterprise Data Service Engine", // Description
+ c, // Plugin Config
+ null // Process info from a process scan
+ );
- Iterator<String> serverIter = systemkeys.iterator();
- int hostCount = -1;
- while (serverIter.hasNext()) {
- hostCount++;
- String systemKey = serverIter.next();
-
- DiscoveredResourceDetails resource = new DiscoveredResourceDetails(discoveryContext.getResourceType(),
- systemKey, name,
- version, desc, null, null);
-
- Configuration configuration = resource.getPluginConfiguration();
- configuration.put(new PropertySimple(Component.NAME, name));
- configuration.put(new PropertySimple(Component.IDENTIFIER, name));
- configuration.put(new PropertySimple(Component.SYSTEM_KEY, systemKey));
-
-
- set.add(resource);
+ // Add to return values
+ discoveredResources.add(detail);
+ log.info("Discovered Teiid instance: " + managerName);
+ return discoveredResources;
- }
-
- return set;
- } catch (InvalidPluginConfigurationException ipe) {
- throw ipe;
- } catch (Throwable t) {
- throw new InvalidPluginConfigurationException(t);
- }
-
- }
+ // String name = discoveryContext.getResourceType().getName();
+ // String desc = discoveryContext.getResourceType().getDescription();
+ // String version = ConnectionConstants.VERSION;
+ //
+ // LOG.info("Discovering " + desc); //$NON-NLS-1$
+ //
+ //
+ // // now perform your own discovery mechanism, if you have one. For
+ // each
+ // // resource discovered, you need to
+ // // create a details object that describe the resource that you
+ // // discovered.
+ // HashSet<DiscoveredResourceDetails> set = new
+ // HashSet<DiscoveredResourceDetails>();
+ //
+ // Set<String> systemkeys = null ;
+ //
+ // try {
+ // systemkeys = connMgr.getInstallationSystemKeys();
+ // } catch (Exception e) {
+ // systemkeys = new HashSet(1);
+ // systemkeys.add("NotDefined");
+ //
+ // // TODO
+ // // - when the serverList cannot be obtained
+ //
+ // // DO NOT throw exception, still want to create the
+ // // resource, but it will show not active / available
+ // }
+ //
+ //
+ //
+ // Iterator<String> serverIter = systemkeys.iterator();
+ // int hostCount = -1;
+ // while (serverIter.hasNext()) {
+ // hostCount++;
+ // String systemKey = serverIter.next();
+ //
+ // DiscoveredResourceDetails resource = new
+ // DiscoveredResourceDetails(discoveryContext.getResourceType(),
+ // systemKey, name,
+ // version, desc, null, null);
+ //
+ // Configuration configuration = resource.getPluginConfiguration();
+ // configuration.put(new PropertySimple(Component.NAME, name));
+ // configuration.put(new PropertySimple(Component.IDENTIFIER, name));
+ // configuration.put(new PropertySimple(Component.SYSTEM_KEY,
+ // systemKey));
+ //
+ //
+ // set.add(resource);
+ //
+ // }
+ //
+ // return set;
+ // } catch (InvalidPluginConfigurationException ipe) {
+ // throw ipe;
+ // } catch (Throwable t) {
+ // throw new InvalidPluginConfigurationException(t);
+ // }
+ //
+ }
}
\ No newline at end of file
15 years, 1 month
teiid SVN: r1604 - in trunk: common-internal/src/main/java/com/metamatrix/platform and 1 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2009-11-29 09:39:39 -0500 (Sun, 29 Nov 2009)
New Revision: 1604
Removed:
trunk/common-internal/src/main/java/com/metamatrix/platform/vm/
Modified:
trunk/documentation/reference/src/main/docbook/en-US/content/grammar.xml
trunk/pom.xml
Log:
TEIID-251 TEIID-873 added support for order by expressions and removing parsing restrictions that limited quoted identifiers.
Modified: trunk/documentation/reference/src/main/docbook/en-US/content/grammar.xml
===================================================================
--- trunk/documentation/reference/src/main/docbook/en-US/content/grammar.xml 2009-11-25 21:45:09 UTC (rev 1603)
+++ trunk/documentation/reference/src/main/docbook/en-US/content/grammar.xml 2009-11-29 14:39:39 UTC (rev 1604)
@@ -1,423 +1,773 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE appendix PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
<appendix id="grammar">
-<title>BNF Grammar</title>
-<sect1 id="terminals">
-<title>Terminals</title>
-<para>
-<informaltable>
-<tgroup cols="1">
-<tbody>
- <!-- Token -->
- <row>
- <entry>
-<DEFAULT> SKIP : {" "| "\t"| "\n"| "\r"} </entry>
- </row>
- <!-- Token -->
- <row>
- <entry>
-<DEFAULT> MORE : {"/*" : IN_MULTI_LINE_COMMENT} </entry>
- </row>
- <!-- Token -->
- <row>
- <entry>
-<IN_MULTI_LINE_COMMENT> SPECIAL : {<MULTI_LINE_COMMENT: "*/"> : DEFAULT} </entry>
- </row>
- <!-- Token -->
- <row>
- <entry>
-<IN_MULTI_LINE_COMMENT> MORE : {<~[]>} </entry>
- </row>
- <!-- Token -->
- <row>
- <entry>
-<DEFAULT> TOKEN : {<STRING: "string">| <BOOLEAN: "boolean">| <BYTE: "byte">| <SHORT: "short">| <CHAR: "char">| <INTEGER: "integer">| <LONG: "long">| <BIGINTEGER: "biginteger">| <FLOAT: "float">| <DOUBLE: "double">| <BIGDECIMAL: "bigdecimal">| <DATE: "date">| <TIME: "time">| <TIMESTAMP: "timestamp">| <OBJECT: "object">| <BLOB: "blob">| <CLOB: "clob">| <XML: "xml">} </entry>
- </row>
- <!-- Token -->
- <row>
- <entry>
-<DEFAULT> TOKEN : {<CAST: "cast">| <CONVERT: "convert">| <TIMESTAMPADD: "timestampadd">| <TIMESTAMPDIFF: "timestampdiff">| <COUNT: "count">| <SUM: "sum">| <AVG: "avg">| <MIN: "min">| <MAX: "max">} </entry>
- </row>
- <!-- Token -->
- <row>
- <entry>
-<DEFAULT> TOKEN : {<ALL: "all">| <AND: "and">| <ANY: "any">| <AS: "as">| <ASC: "asc">| <BEGIN: "begin">| <BETWEEN: "between">| <BREAK: "break">| <BY: "by">| <CASE: "case">| <CONTINUE: "continue">| <CREATE: "create">| <CRITERIA: "criteria">| <CROSS: "cross">| <DEBUG: "debug">| <DECLARE: "declare">| <DELETE: "delete">| <DESC: "desc">| <DISTINCT: "distinct">| <DROP: "drop">| <ELSE: "else">| <END: "end">| <ERROR: "error">| <ESCAPE: "escape">| <EXCEPT: "except">| <EXEC: "exec">| <EXECUTE: "execute">| <EXISTS: "exists">| <FALSE: "false">| <FN: "fn">| <FOR: "for">| <FROM: "from">| <FULL: "full">| <GROUP: "group">| <HAS: "has">| <HAVING: "having">| <IF: "if">| <IN: "in">| <INNER: "inner">| <INSERT: "insert">| <INTERSECT: "intersect">|!
<INTO: "into">| <IS: "is">| <JOIN: "join">| <LEFT: "left">| <LIKE: "like">| <LIMIT: "limit">| <LOCAL: "local">| <LOOP: "loop">| <MAKEDEP: "makedep">| <MAKENOTDEP: "makenotdep">| <NOCACHE: "nocache">| <NOT: "not">| <NULL: "null">| <ON: "on">| <OJ: "oj">| <OPTION: "option">| <OR: "or">| <ORDER: "order">| <OUTER: "outer">| <PLANONLY: "planonly">| <PROCEDURE: "procedure">| <RIGHT: "right">| <SELECT: "select">| <SET: "set">| <SHOWPLAN: "showplan">| <SOME: "some">| <TABLE: "table">| <TEMPORARY: "temporary">| <THEN: "then">| <TRANSLATE: "translate">| <TRUE: "true">| <UNION: "union">| <UNKNOWN: "unknown">| <UPDATE: "update">| <USING: "using">| <VALUES: "values">| <VIRTUAL: "virtual">| <WHEN: "when">| <WHERE: "where">| <WITH: "with">| <WHILE: !
"while">} </entry>
- </row>
- <!-- Token -->
- <row>
- <entry>
-<DEFAULT> TOKEN : {<SQL_TSI_FRAC_SECOND: "SQL_TSI_FRAC_SECOND">| <SQL_TSI_SECOND: "SQL_TSI_SECOND">| <SQL_TSI_MINUTE: "SQL_TSI_MINUTE">| <SQL_TSI_HOUR: "SQL_TSI_HOUR">| <SQL_TSI_DAY: "SQL_TSI_DAY">| <SQL_TSI_WEEK: "SQL_TSI_WEEK">| <SQL_TSI_MONTH: "SQL_TSI_MONTH">| <SQL_TSI_QUARTER: "SQL_TSI_QUARTER">| <SQL_TSI_YEAR: "SQL_TSI_YEAR">} </entry>
- </row>
- <!-- Token -->
- <row>
- <entry>
-<DEFAULT> TOKEN : {<ALL_IN_GROUP: (<GROUP_PART> | <MMUUID_PART>) <PERIOD> <STAR>>| <VARIABLE: <ID> | <MMUUID>>| <#ID: <GROUP_PART> ((<PERIOD> | <SLASH>) (<QUOTED_ID> | <MMUUID_PART>))?>| <#ELEMENT: <GROUP_PART> (<PERIOD> | <SLASH>) <QUOTED_ID>>| <#GROUP_PART: ("#")? (<QUOTED_ID> (<PERIOD> | <SLASH>))? <QUOTED_ID>>| <#QUOTED_ID: <DOTTED_ID> | "\"" <DOTTED_ID> "\"">| <#DOTTED_ID: <ID_PART> ((<PERIOD> | <SLASH>) <ID_PART>)*>| <#ID_PART: ("@")? <LETTER> (<ID_CHAR>)*>| <#ID_CHAR: <LETTER> | "_" | <DIGIT>>| <#MMUUID: <MMUUID_PART> (<PERIOD> <MMUUID_PART>)?>| <#MMUUID_PART: "mmuuid:" (<MMUUID_CHAR>)*>| <#MMUUID_CHAR: ["a"-"f"] | ["0"-"9"] | "-">| <DATETYPE: "{" "d">| <TIMETYPE: "{" "t">| <TIMEST!
AMPTYPE: "{" "ts">| <BOOLEANTYPE: "{" "b">| <INTEGERVAL: (<MINUS>)? (<DIGIT>)+>| <FLOATVAL: (<MINUS>)? (<DIGIT>)* <PERIOD> (<DIGIT>)+ (["e","E"] (["+","-"])? (<DIGIT>)+)?>| <STRINGVAL: ("N")? (<STRINGA> | <STRINGB>)>| <#STRINGA: "\'" (~["\'"])* ("\'\'" (~["\'"])*)* "\'">| <#STRINGB: "\"" (~["\""])* ("\"\"" (~["\""])*)* "\"">| <#LETTER: ["a"-"z","A"-"Z"] | ["\u0153"-"\ufffd"]>| <#DIGIT: ["0"-"9"]>| <#COLON: ":">} </entry>
- </row>
- <!-- Token -->
- <row>
- <entry>
-<DEFAULT> TOKEN : {<COMMA: ",">| <PERIOD: ".">| <LPAREN: "(">| <RPAREN: ")">| <LBRACE: "{">| <RBRACE: "}">| <EQ: "=">| <NE: "<>">| <NE2: "!=">| <LT: "<">| <LE: "<=">| <GT: ">">| <GE: ">=">| <STAR: "*">| <SLASH: "/">| <PLUS: "+">| <MINUS: "-">| <QMARK: "?">| <DOLLAR: "$">| <SEMICOLON: ";">| <CONCAT_OP: "||">} </entry>
- </row>
-</tbody>
-</tgroup>
-</informaltable>
-</para>
-</sect1>
-<sect1 id="non-terminals">
-<title>Non-Terminals</title>
-<para>
-<informaltable>
-<tgroup cols="2">
-<colspec align="right" colwidth="1*"/>
-<colspec align="left" colwidth="2*"/>
-<tbody>
-<row>
-<entry valign="top"><anchor id="prod1"/>command ::= </entry>
-<entry valign="top">( ( <link linkend="prod2">createUpdateProcedure</link> ) | <link linkend="prod3">userCommand</link> | <link linkend="prod4">callableStatement</link> ) ( <SEMICOLON> )? <EOF></entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod3"/>userCommand ::= </entry>
-<entry valign="top">( <link linkend="prod5">queryExpression</link> | <link linkend="prod6">storedProcedure</link> | <link linkend="prod7">insert</link> | <link linkend="prod8">update</link> | <link linkend="prod9">delete</link> | <link linkend="prod10">dropTable</link> | <link linkend="prod11">createTempTable</link> )</entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod10"/>dropTable ::= </entry>
-<entry valign="top"><DROP> <TABLE> <VARIABLE></entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod11"/>createTempTable ::= </entry>
-<entry valign="top"><CREATE> <LOCAL> <TEMPORARY> <TABLE> <VARIABLE> <LPAREN> <link linkend="prod12">createElementsWithTypes</link> <RPAREN></entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod13"/>errorStatement ::= </entry>
-<entry valign="top"><ERROR> <link linkend="prod14">expression</link></entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod15"/>statement ::= </entry>
-<entry valign="top">( <link linkend="prod16">ifStatement</link> | <link linkend="prod17">loopStatement</link> | <link linkend="prod18">whileStatement</link> | <link linkend="prod19">delimitedStatement</link> )</entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod19"/>delimitedStatement ::= </entry>
-<entry valign="top">( <link linkend="prod20">sqlStatement</link> | <link linkend="prod13">errorStatement</link> | <link linkend="prod21">assignStatement</link> | <link linkend="prod22">declareStatement</link> | <link linkend="prod23">continueStatement</link> | <link linkend="prod24">breakStatement</link> ) <SEMICOLON></entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod25"/>block ::= </entry>
-<entry valign="top">( <link linkend="prod15">statement</link> | ( <BEGIN> ( <link linkend="prod15">statement</link> )* <END> ) )</entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod24"/>breakStatement ::= </entry>
-<entry valign="top"><BREAK></entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod23"/>continueStatement ::= </entry>
-<entry valign="top"><CONTINUE></entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod18"/>whileStatement ::= </entry>
-<entry valign="top"><WHILE> <LPAREN> <link linkend="prod26">criteria</link> <RPAREN> <link linkend="prod25">block</link></entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod17"/>loopStatement ::= </entry>
-<entry valign="top"><LOOP> <ON> <LPAREN> <link linkend="prod5">queryExpression</link> <RPAREN> <AS> <VARIABLE> <link linkend="prod25">block</link></entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod16"/>ifStatement ::= </entry>
-<entry valign="top"><IF> <LPAREN> <link linkend="prod26">criteria</link> <RPAREN> <link linkend="prod25">block</link> ( <ELSE> <link linkend="prod25">block</link> )?</entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod27"/>criteriaSelector ::= </entry>
-<entry valign="top">( ( <EQ> | <NE> | <NE2> | <LE> | <GE> | <LT> | <GT> | <IN> | <LIKE> | ( <IS> <NULL> ) | <BETWEEN> ) )? <CRITERIA> ( <ON> <LPAREN> <VARIABLE> ( <COMMA> <VARIABLE> )* <RPAREN> )?</entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod28"/>hasCriteria ::= </entry>
-<entry valign="top"><HAS> <link linkend="prod27">criteriaSelector</link></entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod22"/>declareStatement ::= </entry>
-<entry valign="top"><DECLARE> <link linkend="prod29">dataType</link> <VARIABLE> ( <EQ> <link linkend="prod30">assignStatementOperand</link> )?</entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod21"/>assignStatement ::= </entry>
-<entry valign="top"><VARIABLE> <EQ> <link linkend="prod30">assignStatementOperand</link></entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod30"/>assignStatementOperand ::= </entry>
-<entry valign="top">( ( <link linkend="prod7">insert</link> ) | <link linkend="prod8">update</link> | <link linkend="prod9">delete</link> | <link linkend="prod6">storedProcedure</link> | ( <link linkend="prod14">expression</link> ) | <link linkend="prod5">queryExpression</link> )</entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod20"/>sqlStatement ::= </entry>
-<entry valign="top">( ( <link linkend="prod31">dynamicCommand</link> ) | <link linkend="prod3">userCommand</link> )</entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod32"/>translateCriteria ::= </entry>
-<entry valign="top"><TRANSLATE> <link linkend="prod27">criteriaSelector</link> ( <WITH> <LPAREN> <VARIABLE> <EQ> <link linkend="prod14">expression</link> ( <COMMA> <VARIABLE> <EQ> <link linkend="prod14">expression</link> )* <RPAREN> )?</entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod2"/>createUpdateProcedure ::= </entry>
-<entry valign="top"><CREATE> ( <VIRTUAL> )? ( <UPDATE> )? <PROCEDURE> <link linkend="prod25">block</link></entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod31"/>dynamicCommand ::= </entry>
-<entry valign="top">( <EXECUTE> | <EXEC> ) <STRING> <link linkend="prod14">expression</link> ( <AS> <link linkend="prod12">createElementsWithTypes</link> ( <INTO> <VARIABLE> )? )? ( <USING> <link linkend="prod33">setClauseList</link> )? ( <UPDATE> ( ( <INTEGERVAL> ) | ( <STAR> ) ) )?</entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod33"/>setClauseList ::= </entry>
-<entry valign="top"><VARIABLE> <EQ> ( <COMMA> <VARIABLE> <EQ> )*</entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod12"/>createElementsWithTypes ::= </entry>
-<entry valign="top"><VARIABLE> <link linkend="prod29">dataType</link> ( <COMMA> <VARIABLE> <link linkend="prod29">dataType</link> )*</entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod4"/>callableStatement ::= </entry>
-<entry valign="top"><LBRACE> ( <QMARK> <EQ> )? <VARIABLE> <VARIABLE> ( <LPAREN> ( <link linkend="prod34">executeUnnamedParams</link> ) <RPAREN> )? <RBRACE> ( <link linkend="prod35">option</link> )?</entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod6"/>storedProcedure ::= </entry>
-<entry valign="top">( ( <EXEC> | <EXECUTE> ) <VARIABLE> <LPAREN> ( <link linkend="prod36">executeNamedParams</link> | <link linkend="prod34">executeUnnamedParams</link> ) <RPAREN> ) ( <link linkend="prod35">option</link> )?</entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod34"/>executeUnnamedParams ::= </entry>
-<entry valign="top">( <link linkend="prod14">expression</link> ( <COMMA> <link linkend="prod14">expression</link> )* )?</entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod36"/>executeNamedParams ::= </entry>
-<entry valign="top">( <link linkend="prod37">paramName</link> <EQ> <link linkend="prod14">expression</link> ( <COMMA> <link linkend="prod37">paramName</link> <EQ> <link linkend="prod14">expression</link> )* )</entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod37"/>paramName ::= </entry>
-<entry valign="top"><VARIABLE></entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod7"/>insert ::= </entry>
-<entry valign="top"><INSERT> <INTO> <VARIABLE> ( <LPAREN> <VARIABLE> ( <COMMA> <VARIABLE> )* <RPAREN> )? ( ( <VALUES> <link linkend="prod38">rowValues</link> ) | ( <link linkend="prod5">queryExpression</link> ) ) ( <link linkend="prod35">option</link> )?</entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod38"/>rowValues ::= </entry>
-<entry valign="top"><LPAREN> <link linkend="prod14">expression</link> ( <COMMA> <link linkend="prod14">expression</link> )* <RPAREN></entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod8"/>update ::= </entry>
-<entry valign="top"><UPDATE> <VARIABLE> <SET> <link linkend="prod33">setClauseList</link> ( <link linkend="prod39">where</link> )? ( <link linkend="prod35">option</link> )?</entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod9"/>delete ::= </entry>
-<entry valign="top"><DELETE> <FROM> <VARIABLE> ( <link linkend="prod39">where</link> )? ( <link linkend="prod35">option</link> )?</entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod5"/>queryExpression ::= </entry>
-<entry valign="top"><link linkend="prod40">queryExpressionBody</link></entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod40"/>queryExpressionBody ::= </entry>
-<entry valign="top"><link linkend="prod41">queryTerm</link> ( ( <UNION> | <EXCEPT> ) ( <ALL> | <DISTINCT> )? <link linkend="prod41">queryTerm</link> )* ( <link linkend="prod42">orderby</link> )? ( <link linkend="prod43">limit</link> )? ( <link linkend="prod35">option</link> )?</entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod41"/>queryTerm ::= </entry>
-<entry valign="top"><link linkend="prod44">queryPrimary</link> ( <INTERSECT> ( <ALL> | <DISTINCT> )? <link linkend="prod44">queryPrimary</link> )*</entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod44"/>queryPrimary ::= </entry>
-<entry valign="top">( <link linkend="prod45">query</link> | ( <LPAREN> <link linkend="prod40">queryExpressionBody</link> <RPAREN> ) )</entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod45"/>query ::= </entry>
-<entry valign="top"><link linkend="prod46">select</link> ( <link linkend="prod47">into</link> )? ( <link linkend="prod48">from</link> ( <link linkend="prod39">where</link> )? ( <link linkend="prod49">groupBy</link> )? ( <link linkend="prod50">having</link> )? )?</entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod47"/>into ::= </entry>
-<entry valign="top"><INTO> ( <VARIABLE> )</entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod46"/>select ::= </entry>
-<entry valign="top"><SELECT> ( <ALL> | ( <DISTINCT> ) )? ( <STAR> | ( <link linkend="prod51">selectSymbol</link> ( <COMMA> <link linkend="prod51">selectSymbol</link> )* ) )</entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod51"/>selectSymbol ::= </entry>
-<entry valign="top">( ( <ALL_IN_GROUP> ) | ( <link linkend="prod14">expression</link> ) ( ( <AS> )? ( <VARIABLE> | <STRINGVAL> ) )? )</entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod52"/>aggregateSymbol ::= </entry>
-<entry valign="top">( ( <COUNT> <LPAREN> <STAR> <RPAREN> ) | ( ( <COUNT> | <SUM> | <AVG> | <MIN> | <MAX> ) <LPAREN> ( <DISTINCT> )? <link linkend="prod14">expression</link> <RPAREN> ) )</entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod48"/>from ::= </entry>
-<entry valign="top"><FROM> ( <link linkend="prod53">tableReference</link> ( <COMMA> <link linkend="prod53">tableReference</link> )* )</entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod53"/>tableReference ::= </entry>
-<entry valign="top">( ( <LBRACE> <OJ> <link linkend="prod54">tableReferenceUnescaped</link> <RBRACE> ) | <link linkend="prod54">tableReferenceUnescaped</link> )</entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod54"/>tableReferenceUnescaped ::= </entry>
-<entry valign="top">( <link linkend="prod55">joinedTable</link> | <link linkend="prod56">tablePrimary</link> )</entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod55"/>joinedTable ::= </entry>
-<entry valign="top"><link linkend="prod56">tablePrimary</link> ( ( <link linkend="prod57">crossJoin</link> | <link linkend="prod58">qualifiedJoin</link> ) )+</entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod57"/>crossJoin ::= </entry>
-<entry valign="top">( ( <CROSS> | <UNION> ) <JOIN> <link linkend="prod56">tablePrimary</link> )</entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod58"/>qualifiedJoin ::= </entry>
-<entry valign="top">( ( ( <RIGHT> ( <OUTER> )? ) | ( <LEFT> ( <OUTER> )? ) | ( <FULL> ( <OUTER> )? ) | <INNER> )? <JOIN> <link linkend="prod53">tableReference</link> <ON> <link linkend="prod26">criteria</link> )</entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod56"/>tablePrimary ::= </entry>
-<entry valign="top">( <link linkend="prod59">unaryFromClause</link> | <link linkend="prod60">subqueryFromClause</link> | ( <LPAREN> <link linkend="prod55">joinedTable</link> <RPAREN> ) ) ( ( <MAKEDEP> ) | ( <MAKENOTDEP> ) )?</entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod60"/>subqueryFromClause ::= </entry>
-<entry valign="top"><LPAREN> ( <link linkend="prod5">queryExpression</link> | <link linkend="prod6">storedProcedure</link> ) <RPAREN> ( <AS> )? <VARIABLE></entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod59"/>unaryFromClause ::= </entry>
-<entry valign="top">( <VARIABLE> ( ( <AS> )? <VARIABLE> )? )</entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod39"/>where ::= </entry>
-<entry valign="top"><WHERE> <link linkend="prod26">criteria</link></entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod26"/>criteria ::= </entry>
-<entry valign="top"><link linkend="prod61">compoundCritOr</link></entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod61"/>compoundCritOr ::= </entry>
-<entry valign="top"><link linkend="prod62">compoundCritAnd</link> ( <OR> <link linkend="prod62">compoundCritAnd</link> )*</entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod62"/>compoundCritAnd ::= </entry>
-<entry valign="top"><link linkend="prod63">notCrit</link> ( <AND> <link linkend="prod63">notCrit</link> )*</entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod63"/>notCrit ::= </entry>
-<entry valign="top">( <NOT> )? <link linkend="prod64">primary</link></entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod64"/>primary ::= </entry>
-<entry valign="top">( <link linkend="prod65">predicate</link> | ( <LPAREN> <link linkend="prod26">criteria</link> <RPAREN> ) )</entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod65"/>predicate ::= </entry>
-<entry valign="top">( <link linkend="prod66">subqueryCompareCriteria</link> | <link linkend="prod67">compareCrit</link> | <link linkend="prod68">matchCrit</link> | <link linkend="prod69">betweenCrit</link> | <link linkend="prod70">setCrit</link> | <link linkend="prod71">existsCriteria</link> | <link linkend="prod28">hasCriteria</link> | <link linkend="prod32">translateCriteria</link> | <link linkend="prod72">isNullCrit</link> )</entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod67"/>compareCrit ::= </entry>
-<entry valign="top"><link linkend="prod14">expression</link> ( <EQ> | <NE> | <NE2> | <LT> | <LE> | <GT> | <GE> ) <link linkend="prod14">expression</link></entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod73"/>subquery ::= </entry>
-<entry valign="top"><LPAREN> ( <link linkend="prod5">queryExpression</link> | <link linkend="prod6">storedProcedure</link> ) <RPAREN></entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod66"/>subqueryCompareCriteria ::= </entry>
-<entry valign="top"><link linkend="prod14">expression</link> ( <EQ> | <NE> | <NE2> | <LT> | <LE> | <GT> | <GE> ) ( <ANY> | <SOME> | <ALL> ) <link linkend="prod73">subquery</link></entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod68"/>matchCrit ::= </entry>
-<entry valign="top">( <link linkend="prod14">expression</link> ( <NOT> )? <LIKE> <link linkend="prod14">expression</link> ( <link linkend="prod74">escapeChar</link> | ( <LBRACE> <link linkend="prod74">escapeChar</link> <RBRACE> ) )? )</entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod74"/>escapeChar ::= </entry>
-<entry valign="top"><ESCAPE> <STRINGVAL></entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod69"/>betweenCrit ::= </entry>
-<entry valign="top"><link linkend="prod14">expression</link> ( <NOT> )? <BETWEEN> <link linkend="prod14">expression</link> <AND> <link linkend="prod14">expression</link></entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod72"/>isNullCrit ::= </entry>
-<entry valign="top"><link linkend="prod14">expression</link> <IS> ( <NOT> )? <NULL></entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod70"/>setCrit ::= </entry>
-<entry valign="top"><link linkend="prod14">expression</link> ( <NOT> )? <IN> ( ( <link linkend="prod73">subquery</link> ) | ( <LPAREN> <link linkend="prod14">expression</link> ( <COMMA> <link linkend="prod14">expression</link> )* <RPAREN> ) )</entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod71"/>existsCriteria ::= </entry>
-<entry valign="top"><EXISTS> <link linkend="prod73">subquery</link></entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod49"/>groupBy ::= </entry>
-<entry valign="top"><GROUP> <BY> ( <link linkend="prod75">groupByItem</link> ( <COMMA> <link linkend="prod75">groupByItem</link> )* )</entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod75"/>groupByItem ::= </entry>
-<entry valign="top"><link linkend="prod14">expression</link></entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod50"/>having ::= </entry>
-<entry valign="top"><HAVING> <link linkend="prod26">criteria</link></entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod42"/>orderby ::= </entry>
-<entry valign="top"><ORDER> <BY> ( <VARIABLE> | <STRINGVAL> | <INTEGERVAL> ) ( <ASC> | <DESC> )? ( <COMMA> ( <VARIABLE> | <STRINGVAL> | <INTEGERVAL> ) ( <ASC> | <DESC> )? )*</entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod43"/>limit ::= </entry>
-<entry valign="top"><LIMIT> ( <INTEGERVAL> | <QMARK> ) ( <COMMA> ( <INTEGERVAL> | <QMARK> ) )?</entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod35"/>option ::= </entry>
-<entry valign="top"><OPTION> ( <SHOWPLAN> | <PLANONLY> | <DEBUG> | <MAKEDEP> <VARIABLE> ( <COMMA> <VARIABLE> )* | <MAKENOTDEP> <VARIABLE> ( <COMMA> <VARIABLE> )* | <NOCACHE> ( <VARIABLE> ( <COMMA> <VARIABLE> )* )? )*</entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod14"/>expression ::= </entry>
-<entry valign="top"><link linkend="prod76">concatExpression</link></entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod76"/>concatExpression ::= </entry>
-<entry valign="top">( <link linkend="prod77">plusExpression</link> ( <CONCAT_OP> <link linkend="prod77">plusExpression</link> )* )</entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod77"/>plusExpression ::= </entry>
-<entry valign="top">( <link linkend="prod78">timesExpression</link> ( <link linkend="prod79">plusOperator</link> <link linkend="prod78">timesExpression</link> )* )</entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod79"/>plusOperator ::= </entry>
-<entry valign="top">( <PLUS> | <MINUS> )</entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod78"/>timesExpression ::= </entry>
-<entry valign="top">( <link linkend="prod80">basicExpression</link> ( <link linkend="prod81">timesOperator</link> <link linkend="prod80">basicExpression</link> )* )</entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod81"/>timesOperator ::= </entry>
-<entry valign="top">( <STAR> | <SLASH> )</entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod80"/>basicExpression ::= </entry>
-<entry valign="top">( <QMARK> | <link linkend="prod82">literal</link> | ( <LBRACE> <FN> <link linkend="prod83">function</link> <RBRACE> ) | ( <link linkend="prod52">aggregateSymbol</link> ) | ( <link linkend="prod83">function</link> ) | ( <VARIABLE> ) | ( <LPAREN> <link linkend="prod14">expression</link> <RPAREN> ) | <link linkend="prod73">subquery</link> | <link linkend="prod84">caseExpression</link> | <link linkend="prod85">searchedCaseExpression</link> )</entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod84"/>caseExpression ::= </entry>
-<entry valign="top"><CASE> <link linkend="prod14">expression</link> ( <WHEN> <link linkend="prod14">expression</link> <THEN> <link linkend="prod14">expression</link> )+ ( <ELSE> <link linkend="prod14">expression</link> )? <END></entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod85"/>searchedCaseExpression ::= </entry>
-<entry valign="top"><CASE> ( <WHEN> <link linkend="prod26">criteria</link> <THEN> <link linkend="prod14">expression</link> )+ ( <ELSE> <link linkend="prod14">expression</link> )? <END></entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod83"/>function ::= </entry>
-<entry valign="top">( ( <CONVERT> <LPAREN> <link linkend="prod14">expression</link> <COMMA> <link linkend="prod29">dataType</link> <RPAREN> ) | ( <CAST> <LPAREN> <link linkend="prod14">expression</link> <AS> <link linkend="prod29">dataType</link> <RPAREN> ) | ( ( <TIMESTAMPADD> | <TIMESTAMPDIFF> ) <LPAREN> <link linkend="prod86">intervalType</link> <COMMA> <link linkend="prod14">expression</link> <COMMA> <link linkend="prod14">expression</link> <RPAREN> ) | ( ( <LEFT> | <RIGHT> | <CHAR> ) <LPAREN> ( <link linkend="prod14">expression</link> ( <COMMA> <link linkend="prod14">expression</link> )* )? <RPAREN> ) | ( ( <INSERT> ) <LPAREN> ( <link linkend="prod14">expression</link> ( <COMMA> <link linkend="prod14">expression</link> )* )? <RPAREN> ) | ( ( <TRANSLATE> ) <LPAREN> ( <link linkend="prod14">expression</link> ( <COM!
MA> <link linkend="prod14">expression</link> )* )? <RPAREN> ) | ( <VARIABLE> <LPAREN> ( <link linkend="prod14">expression</link> ( <COMMA> <link linkend="prod14">expression</link> )* )? <RPAREN> ) )</entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod29"/>dataType ::= </entry>
-<entry valign="top">( <STRING> | <BOOLEAN> | <BYTE> | <SHORT> | <CHAR> | <INTEGER> | <LONG> | <BIGINTEGER> | <FLOAT> | <DOUBLE> | <BIGDECIMAL> | <DATE> | <TIME> | <TIMESTAMP> | <OBJECT> | <BLOB> | <CLOB> | <XML> )</entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod86"/>intervalType ::= </entry>
-<entry valign="top">( <SQL_TSI_FRAC_SECOND> | <SQL_TSI_SECOND> | <SQL_TSI_MINUTE> | <SQL_TSI_HOUR> | <SQL_TSI_DAY> | <SQL_TSI_WEEK> | <SQL_TSI_MONTH> | <SQL_TSI_QUARTER> | <SQL_TSI_YEAR> )</entry>
-</row>
-<row>
-<entry valign="top"><anchor id="prod82"/>literal ::= </entry>
-<entry valign="top">( <STRINGVAL> | <INTEGERVAL> | <FLOATVAL> | <FALSE> | <TRUE> | <UNKNOWN> | <NULL> | ( <BOOLEANTYPE> <STRINGVAL> <RBRACE> ) | ( <TIMESTAMPTYPE> <STRINGVAL> <RBRACE> ) | ( <DATETYPE> <STRINGVAL> <RBRACE> ) | ( <TIMETYPE> <STRINGVAL> <RBRACE> ) )</entry>
-</row>
-</tbody>
-</tgroup>
-</informaltable>
-</para>
-</sect1>
+ <title>BNF for SQL Grammar</title>
+ <sect1 remap="h2">
+ <title>TOKENS</title>
+ <informaltable frame="none">
+ <tgroup cols="1">
+ <colspec colname="c1" colwidth="100*"/>
+ <!-- Token -->
+ <tbody>
+ <row>
+ <entry><para>
+<DEFAULT> SKIP : {
+" "
+| "\t"
+| "\n"
+| "\r"
+}
+
+ </para></entry>
+ </row>
+ <!-- Token -->
+ <row>
+ <entry><para>
+<DEFAULT> MORE : {
+"/*" : IN_MULTI_LINE_COMMENT
+}
+
+ </para></entry>
+ </row>
+ <!-- Token -->
+ <row>
+ <entry><para>
+<IN_MULTI_LINE_COMMENT> SPECIAL : {
+<MULTI_LINE_COMMENT: "*/"> : DEFAULT
+}
+
+ </para></entry>
+ </row>
+ <!-- Token -->
+ <row>
+ <entry><para>
+<IN_MULTI_LINE_COMMENT> MORE : {
+<~[]>
+}
+
+ </para></entry>
+ </row>
+ <!-- Token -->
+ <row>
+ <entry><para>
+<DEFAULT> TOKEN : {
+<STRING: "string">
+| <BOOLEAN: "boolean">
+| <BYTE: "byte">
+| <SHORT: "short">
+| <CHAR: "char">
+| <INTEGER: "integer">
+| <LONG: "long">
+| <BIGINTEGER: "biginteger">
+| <FLOAT: "float">
+| <DOUBLE: "double">
+| <BIGDECIMAL: "bigdecimal">
+| <DATE: "date">
+| <TIME: "time">
+| <TIMESTAMP: "timestamp">
+| <OBJECT: "object">
+| <BLOB: "blob">
+| <CLOB: "clob">
+| <XML: "xml">
+}
+
+ </para></entry>
+ </row>
+ <!-- Token -->
+ <row>
+ <entry><para>
+<DEFAULT> TOKEN : {
+<CAST: "cast">
+| <CONVERT: "convert">
+| <TIMESTAMPADD: "timestampadd">
+| <TIMESTAMPDIFF: "timestampdiff">
+| <COUNT: "count">
+| <SUM: "sum">
+| <AVG: "avg">
+| <MIN: "min">
+| <MAX: "max">
+}
+
+ </para></entry>
+ </row>
+ <!-- Token -->
+ <row>
+ <entry><para>
+<DEFAULT> TOKEN : {
+<ALL: "all">
+| <AND: "and">
+| <ANY: "any">
+| <AS: "as">
+| <ASC: "asc">
+| <BEGIN: "begin">
+| <BETWEEN: "between">
+| <BREAK: "break">
+| <BY: "by">
+| <CASE: "case">
+| <CONTINUE: "continue">
+| <CREATE: "create">
+| <CRITERIA: "criteria">
+| <CROSS: "cross">
+| <DEBUG: "debug">
+| <DECLARE: "declare">
+| <DELETE: "delete">
+| <DESC: "desc">
+| <DISTINCT: "distinct">
+| <DROP: "drop">
+| <ELSE: "else">
+| <END: "end">
+| <ERROR: "error">
+| <ESCAPE: "escape">
+| <EXCEPT: "except">
+| <EXEC: "exec">
+| <EXECUTE: "execute">
+| <EXISTS: "exists">
+| <FALSE: "false">
+| <FN: "fn">
+| <FOR: "for">
+| <FROM: "from">
+| <FULL: "full">
+| <GROUP: "group">
+| <HAS: "has">
+| <HAVING: "having">
+| <IF: "if">
+| <IN: "in">
+| <INNER: "inner">
+| <INSERT: "insert">
+| <INTERSECT: "intersect">
+| <INTO: "into">
+| <IS: "is">
+| <JOIN: "join">
+| <LEFT: "left">
+| <LIKE: "like">
+| <LIMIT: "limit">
+| <LOCAL: "local">
+| <LOOP: "loop">
+| <MAKEDEP: "makedep">
+| <MAKENOTDEP: "makenotdep">
+| <NOCACHE: "nocache">
+| <NOT: "not">
+| <NULL: "null">
+| <ON: "on">
+| <OJ: "oj">
+| <OPTION: "option">
+| <OR: "or">
+| <ORDER: "order">
+| <OUTER: "outer">
+| <PLANONLY: "planonly">
+| <PROCEDURE: "procedure">
+| <RIGHT: "right">
+| <SELECT: "select">
+| <SET: "set">
+| <SHOWPLAN: "showplan">
+| <SOME: "some">
+| <TABLE: "table">
+| <TEMPORARY: "temporary">
+| <THEN: "then">
+| <TRANSLATE: "translate">
+| <TRUE: "true">
+| <UNION: "union">
+| <UNKNOWN: "unknown">
+| <UPDATE: "update">
+| <USING: "using">
+| <VALUES: "values">
+| <VIRTUAL: "virtual">
+| <WHEN: "when">
+| <WHERE: "where">
+| <WITH: "with">
+| <WHILE: "while">
+}
+
+ </para></entry>
+ </row>
+ <!-- Token -->
+ <row>
+ <entry><para>
+<DEFAULT> TOKEN : {
+<SQL_TSI_FRAC_SECOND: "SQL_TSI_FRAC_SECOND">
+| <SQL_TSI_SECOND: "SQL_TSI_SECOND">
+| <SQL_TSI_MINUTE: "SQL_TSI_MINUTE">
+| <SQL_TSI_HOUR: "SQL_TSI_HOUR">
+| <SQL_TSI_DAY: "SQL_TSI_DAY">
+| <SQL_TSI_WEEK: "SQL_TSI_WEEK">
+| <SQL_TSI_MONTH: "SQL_TSI_MONTH">
+| <SQL_TSI_QUARTER: "SQL_TSI_QUARTER">
+| <SQL_TSI_YEAR: "SQL_TSI_YEAR">
+}
+
+ </para></entry>
+ </row>
+ <!-- Token -->
+ <row>
+ <entry><para>
+<DEFAULT> TOKEN : {
+<ALL_IN_GROUP: <ID> <PERIOD> <STAR>>
+| <ID: <QUOTED_ID> (<PERIOD> <QUOTED_ID>)*>
+| <#QUOTED_ID: <ID_PART> | "\"" ("\"\"" | ~["\""])+ "\"">
+| <#ID_PART: ("@" | "#" | <LETTER>) (<LETTER> | "_" | <DIGIT>)*>
+| <DATETYPE: "{" "d">
+| <TIMETYPE: "{" "t">
+| <TIMESTAMPTYPE: "{" "ts">
+| <BOOLEANTYPE: "{" "b">
+| <INTEGERVAL: (<MINUS>)? (<DIGIT>)+>
+| <FLOATVAL: (<MINUS>)? (<DIGIT>)* <PERIOD> (<DIGIT>)+ (["e","E"] (["+","-"])? (<DIGIT>)+)?>
+| <STRINGVAL: ("N")? "\'" ("\'\'" | ~["\'"])* "\'">
+| <#LETTER: ["a"-"z","A"-"Z"] | ["\u0153"-"\ufffd"]>
+| <#DIGIT: ["0"-"9"]>
+}
+
+ </para></entry>
+ </row>
+ <!-- Token -->
+ <row>
+ <entry><para>
+<DEFAULT> TOKEN : {
+<COMMA: ",">
+| <PERIOD: ".">
+| <LPAREN: "(">
+| <RPAREN: ")">
+| <LBRACE: "{">
+| <RBRACE: "}">
+| <EQ: "=">
+| <NE: "<>">
+| <NE2: "!=">
+| <LT: "<">
+| <LE: "<=">
+| <GT: ">">
+| <GE: ">=">
+| <STAR: "*">
+| <SLASH: "/">
+| <PLUS: "+">
+| <MINUS: "-">
+| <QMARK: "?">
+| <DOLLAR: "$">
+| <SEMICOLON: ";">
+| <CONCAT_OP: "||">
+}
+
+ </para></entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
+ </sect1>
+ <sect1 remap="h2">
+ <title>NON-TERMINALS</title>
+ <informaltable frame="none">
+ <tgroup cols="3">
+ <colspec colname="c1" colwidth="33*"/>
+ <colspec colname="c2" colwidth="5*"/>
+ <colspec colname="c3" colwidth="62*"/>
+ <tbody>
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod1" xreflabel="stringVal"/>stringVal</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para>( <STRINGVAL> )</para></entry>
+ </row>
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod2" xreflabel="id"/>id</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para>( <ID> )</para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod3" xreflabel="command"/>command</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para>( ( <link linkend="SQLParser.html-prod4">createUpdateProcedure</link> ) | <link linkend="SQLParser.html-prod5">userCommand</link> | <link linkend="SQLParser.html-prod6">callableStatement</link> ) ( <SEMICOLON> )? <EOF></para></entry>
+ </row>
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod5" xreflabel="userCommand"/>userCommand</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para>( <link linkend="SQLParser.html-prod7">queryExpression</link> | <link linkend="SQLParser.html-prod8">storedProcedure</link> | <link linkend="SQLParser.html-prod9">insert</link> | <link linkend="SQLParser.html-prod10">update</link> | <link linkend="SQLParser.html-prod11">delete</link> | <link linkend="SQLParser.html-prod12">dropTable</link> | <link linkend="SQLParser.html-prod13">createTempTable</link> )</para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod12" xreflabel="dropTable"/>dropTable</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para><DROP> <TABLE> <link linkend="SQLParser.html-prod2">id</link></para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod13" xreflabel="createTempTable"/>createTempTable</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para><CREATE> <LOCAL> <TEMPORARY> <TABLE> <link linkend="SQLParser.html-prod2">id</link> <LPAREN> <link linkend="SQLParser.html-prod14">createElementsWithTypes</link> <RPAREN></para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod15" xreflabel="errorStatement"/>errorStatement</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para><ERROR> <link linkend="SQLParser.html-prod16">expression</link></para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod17" xreflabel="statement"/>statement</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para>( <link linkend="SQLParser.html-prod18">ifStatement</link> | <link linkend="SQLParser.html-prod19">loopStatement</link> | <link linkend="SQLParser.html-prod20">whileStatement</link> | <link linkend="SQLParser.html-prod21">delimitedStatement</link> )</para></entry>
+ </row>
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod21" xreflabel="delimitedStatement"/>delimitedStatement</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para>( <link linkend="SQLParser.html-prod22">sqlStatement</link> | <link linkend="SQLParser.html-prod15">errorStatement</link> | <link linkend="SQLParser.html-prod23">assignStatement</link> | <link linkend="SQLParser.html-prod24">declareStatement</link> | <link linkend="SQLParser.html-prod25">continueStatement</link> | <link linkend="SQLParser.html-prod26">breakStatement</link> ) <SEMICOLON></para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod27" xreflabel="block"/>block</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para>( <link linkend="SQLParser.html-prod17">statement</link> | ( <BEGIN> ( <link linkend="SQLParser.html-prod17">statement</link> )* <END> ) )</para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod26" xreflabel="breakStatement"/>breakStatement</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para><BREAK></para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod25" xreflabel="continueStatement"/>continueStatement</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para><CONTINUE></para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod20" xreflabel="whileStatement"/>whileStatement</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para><WHILE> <LPAREN> <link linkend="SQLParser.html-prod28">criteria</link> <RPAREN> <link linkend="SQLParser.html-prod27">block</link></para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod19" xreflabel="loopStatement"/>loopStatement</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para><LOOP> <ON> <LPAREN> <link linkend="SQLParser.html-prod7">queryExpression</link> <RPAREN> <AS> <link linkend="SQLParser.html-prod2">id</link><link linkend="SQLParser.html-prod27">block</link></para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod18" xreflabel="ifStatement"/>ifStatement</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para><IF> <LPAREN> <link linkend="SQLParser.html-prod28">criteria</link> <RPAREN> <link linkend="SQLParser.html-prod27">block</link> ( <ELSE> <link linkend="SQLParser.html-prod27">block</link> )?</para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod29" xreflabel="criteriaSelector"/>criteriaSelector</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para>( ( <EQ> | <NE> | <NE2> | <LE> | <GE> | <LT> | <GT> | <IN> | <LIKE> | ( <IS> <NULL> ) | <BETWEEN> ) )? <CRITERIA> ( <ON> <LPAREN> <link linkend="SQLParser.html-prod2">id</link> ( <COMMA> <link linkend="SQLParser.html-prod2">id</link> )* <RPAREN> )?</para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod30" xreflabel="hasCriteria"/>hasCriteria</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para><HAS> <link linkend="SQLParser.html-prod29">criteriaSelector</link></para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod24" xreflabel="declareStatement"/>declareStatement</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para><DECLARE> <link linkend="SQLParser.html-prod31">dataType</link><link linkend="SQLParser.html-prod2">id</link> ( <EQ> <link linkend="SQLParser.html-prod32">assignStatementOperand</link> )?</para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod23" xreflabel="assignStatement"/>assignStatement</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para><link linkend="SQLParser.html-prod2">id</link> <EQ> <link linkend="SQLParser.html-prod32">assignStatementOperand</link></para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod32" xreflabel="assignStatementOperand"/>assignStatementOperand</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para>( ( <link linkend="SQLParser.html-prod9">insert</link> ) | <link linkend="SQLParser.html-prod10">update</link> | <link linkend="SQLParser.html-prod11">delete</link> | <link linkend="SQLParser.html-prod8">storedProcedure</link> | ( <link linkend="SQLParser.html-prod16">expression</link> ) | <link linkend="SQLParser.html-prod7">queryExpression</link> )</para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod22" xreflabel="sqlStatement"/>sqlStatement</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para>( ( <link linkend="SQLParser.html-prod33">dynamicCommand</link> ) | <link linkend="SQLParser.html-prod5">userCommand</link> )</para></entry>
+ </row>
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod34" xreflabel="translateCriteria"/>translateCriteria</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para><TRANSLATE> <link linkend="SQLParser.html-prod29">criteriaSelector</link> ( <WITH> <LPAREN> <link linkend="SQLParser.html-prod2">id</link> <EQ> <link linkend="SQLParser.html-prod16">expression</link> ( <COMMA> <link linkend="SQLParser.html-prod2">id</link> <EQ> <link linkend="SQLParser.html-prod16">expression</link> )* <RPAREN> )?</para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod4" xreflabel="createUpdateProcedure"/>createUpdateProcedure</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para><CREATE> ( <VIRTUAL> )? ( <UPDATE> )? <PROCEDURE> <link linkend="SQLParser.html-prod27">block</link></para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod33" xreflabel="dynamicCommand"/>dynamicCommand</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para>( <EXECUTE> | <EXEC> ) <STRING> <link linkend="SQLParser.html-prod16">expression</link> ( <AS> <link linkend="SQLParser.html-prod14">createElementsWithTypes</link> ( <INTO> <link linkend="SQLParser.html-prod2">id</link> )? )? ( <USING> <link linkend="SQLParser.html-prod35">setClauseList</link> )? ( <UPDATE> ( ( <INTEGERVAL> ) | ( <STAR> ) ) )?</para></entry>
+ </row>
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod35" xreflabel="setClauseList"/>setClauseList</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para><link linkend="SQLParser.html-prod2">id</link> <EQ> ( <COMMA> <link linkend="SQLParser.html-prod2">id</link> <EQ> )*</para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod14" xreflabel="createElementsWithTypes"/>createElementsWithTypes</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para><link linkend="SQLParser.html-prod2">id</link><link linkend="SQLParser.html-prod31">dataType</link> ( <COMMA> <link linkend="SQLParser.html-prod2">id</link><link linkend="SQLParser.html-prod31">dataType</link> )*</para></entry>
+ </row>
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod6" xreflabel="callableStatement"/>callableStatement</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para><LBRACE> ( <QMARK> <EQ> )? <ID> <link linkend="SQLParser.html-prod2">id</link> ( <LPAREN> ( <link linkend="SQLParser.html-prod36">executeUnnamedParams</link> ) <RPAREN> )? <RBRACE> ( <link linkend="SQLParser.html-prod37">option</link> )?</para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod8" xreflabel="storedProcedure"/>storedProcedure</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para>( ( <EXEC> | <EXECUTE> ) <link linkend="SQLParser.html-prod2">id</link> <LPAREN> ( <link linkend="SQLParser.html-prod38">executeNamedParams</link> | <link linkend="SQLParser.html-prod36">executeUnnamedParams</link> ) <RPAREN> ) ( <link linkend="SQLParser.html-prod37">option</link> )?</para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod36" xreflabel="executeUnnamedParams"/>executeUnnamedParams</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para>( <link linkend="SQLParser.html-prod16">expression</link> ( <COMMA> <link linkend="SQLParser.html-prod16">expression</link> )* )?</para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod38" xreflabel="executeNamedParams"/>executeNamedParams</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para>( <link linkend="SQLParser.html-prod2">id</link> <EQ> <link linkend="SQLParser.html-prod16">expression</link> ( <COMMA> <link linkend="SQLParser.html-prod2">id</link> <EQ> <link linkend="SQLParser.html-prod16">expression</link> )* )</para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod9" xreflabel="insert"/>insert</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para><INSERT> <INTO> <link linkend="SQLParser.html-prod2">id</link> ( <LPAREN> <link linkend="SQLParser.html-prod2">id</link> ( <COMMA> <link linkend="SQLParser.html-prod2">id</link> )* <RPAREN> )? ( ( <VALUES> <link linkend="SQLParser.html-prod39">rowValues</link> ) | ( <link linkend="SQLParser.html-prod7">queryExpression</link> ) ) ( <link linkend="SQLParser.html-prod37">option</link> )?</para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod39" xreflabel="rowValues"/>rowValues</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para><LPAREN> <link linkend="SQLParser.html-prod16">expression</link> ( <COMMA> <link linkend="SQLParser.html-prod16">expression</link> )* <RPAREN></para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod10" xreflabel="update"/>update</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para><UPDATE> <link linkend="SQLParser.html-prod2">id</link> <SET> <link linkend="SQLParser.html-prod35">setClauseList</link> ( <link linkend="SQLParser.html-prod40">where</link> )? ( <link linkend="SQLParser.html-prod37">option</link> )?</para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod11" xreflabel="delete"/>delete</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para><DELETE> <FROM> <link linkend="SQLParser.html-prod2">id</link> ( <link linkend="SQLParser.html-prod40">where</link> )? ( <link linkend="SQLParser.html-prod37">option</link> )?</para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod7" xreflabel="queryExpression"/>queryExpression</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para><link linkend="SQLParser.html-prod41">queryExpressionBody</link></para></entry>
+ </row>
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod41" xreflabel="queryExpressionBody"/>queryExpressionBody</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para><link linkend="SQLParser.html-prod42">queryTerm</link> ( ( <UNION> | <EXCEPT> ) ( <ALL> | <DISTINCT> )? <link linkend="SQLParser.html-prod42">queryTerm</link> )* ( <link linkend="SQLParser.html-prod43">orderby</link> )? ( <link linkend="SQLParser.html-prod44">limit</link> )? ( <link linkend="SQLParser.html-prod37">option</link> )?</para></entry>
+ </row>
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod42" xreflabel="queryTerm"/>queryTerm</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para><link linkend="SQLParser.html-prod45">queryPrimary</link> ( <INTERSECT> ( <ALL> | <DISTINCT> )? <link linkend="SQLParser.html-prod45">queryPrimary</link> )*</para></entry>
+ </row>
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod45" xreflabel="queryPrimary"/>queryPrimary</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para>( <link linkend="SQLParser.html-prod46">query</link> | ( <LPAREN> <link linkend="SQLParser.html-prod41">queryExpressionBody</link> <RPAREN> ) )</para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod46" xreflabel="query"/>query</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para><link linkend="SQLParser.html-prod47">select</link> ( <link linkend="SQLParser.html-prod48">into</link> )? ( <link linkend="SQLParser.html-prod49">from</link> ( <link linkend="SQLParser.html-prod40">where</link> )? ( <link linkend="SQLParser.html-prod50">groupBy</link> )? ( <link linkend="SQLParser.html-prod51">having</link> )? )?</para></entry>
+ </row>
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod48" xreflabel="into"/>into</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para><INTO> ( <link linkend="SQLParser.html-prod2">id</link> )</para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod47" xreflabel="select"/>select</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para><SELECT> ( <ALL> | ( <DISTINCT> ) )? ( <STAR> | ( <link linkend="SQLParser.html-prod52">selectSymbol</link> ( <COMMA> <link linkend="SQLParser.html-prod52">selectSymbol</link> )* ) )</para></entry>
+ </row>
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod52" xreflabel="selectSymbol"/>selectSymbol</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para>( ( <ALL_IN_GROUP> ) | ( <link linkend="SQLParser.html-prod16">expression</link> ) ( ( <AS> )? ( <link linkend="SQLParser.html-prod2">id</link> ) )? )</para></entry>
+ </row>
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod53" xreflabel="aggregateSymbol"/>aggregateSymbol</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para>( ( <COUNT> <LPAREN> <STAR> <RPAREN> ) | ( ( <COUNT> | <SUM> | <AVG> | <MIN> | <MAX> ) <LPAREN> ( <DISTINCT> )? <link linkend="SQLParser.html-prod16">expression</link> <RPAREN> ) )</para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod49" xreflabel="from"/>from</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para><FROM> ( <link linkend="SQLParser.html-prod54">tableReference</link> ( <COMMA> <link linkend="SQLParser.html-prod54">tableReference</link> )* )</para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod54" xreflabel="tableReference"/>tableReference</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para>( ( <LBRACE> <OJ> <link linkend="SQLParser.html-prod55">tableReferenceUnescaped</link> <RBRACE> ) | <link linkend="SQLParser.html-prod55">tableReferenceUnescaped</link> )</para></entry>
+ </row>
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod55" xreflabel="tableReferenceUnescaped"/>tableReferenceUnescaped</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para>( <link linkend="SQLParser.html-prod56">joinedTable</link> | <link linkend="SQLParser.html-prod57">tablePrimary</link> )</para></entry>
+ </row>
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod56" xreflabel="joinedTable"/>joinedTable</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para><link linkend="SQLParser.html-prod57">tablePrimary</link> ( ( <link linkend="SQLParser.html-prod58">crossJoin</link> | <link linkend="SQLParser.html-prod59">qualifiedJoin</link> ) )+</para></entry>
+ </row>
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod58" xreflabel="crossJoin"/>crossJoin</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para>( ( <CROSS> | <UNION> ) <JOIN> <link linkend="SQLParser.html-prod57">tablePrimary</link> )</para></entry>
+ </row>
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod59" xreflabel="qualifiedJoin"/>qualifiedJoin</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para>( ( ( <RIGHT> ( <OUTER> )? ) | ( <LEFT> ( <OUTER> )? ) | ( <FULL> ( <OUTER> )? ) | <INNER> )? <JOIN> <link linkend="SQLParser.html-prod54">tableReference</link> <ON> <link linkend="SQLParser.html-prod28">criteria</link> )</para></entry>
+ </row>
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod57" xreflabel="tablePrimary"/>tablePrimary</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para>( <link linkend="SQLParser.html-prod60">unaryFromClause</link> | <link linkend="SQLParser.html-prod61">subqueryFromClause</link> | ( <LPAREN> <link linkend="SQLParser.html-prod56">joinedTable</link> <RPAREN> ) ) ( ( <MAKEDEP> ) | ( <MAKENOTDEP> ) )?</para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod61" xreflabel="subqueryFromClause"/>subqueryFromClause</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para><LPAREN> ( <link linkend="SQLParser.html-prod7">queryExpression</link> | <link linkend="SQLParser.html-prod8">storedProcedure</link> ) <RPAREN> ( <AS> )? <link linkend="SQLParser.html-prod2">id</link></para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod60" xreflabel="unaryFromClause"/>unaryFromClause</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para>( <ID> ( ( <AS> )? <link linkend="SQLParser.html-prod2">id</link> )? )</para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod40" xreflabel="where"/>where</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para><WHERE> <link linkend="SQLParser.html-prod28">criteria</link></para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod28" xreflabel="criteria"/>criteria</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para><link linkend="SQLParser.html-prod62">compoundCritOr</link></para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod62" xreflabel="compoundCritOr"/>compoundCritOr</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para><link linkend="SQLParser.html-prod63">compoundCritAnd</link> ( <OR> <link linkend="SQLParser.html-prod63">compoundCritAnd</link> )*</para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod63" xreflabel="compoundCritAnd"/>compoundCritAnd</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para><link linkend="SQLParser.html-prod64">notCrit</link> ( <AND> <link linkend="SQLParser.html-prod64">notCrit</link> )*</para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod64" xreflabel="notCrit"/>notCrit</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para>( <NOT> )? <link linkend="SQLParser.html-prod65">primary</link></para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod65" xreflabel="primary"/>primary</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para>( <link linkend="SQLParser.html-prod66">predicate</link> | ( <LPAREN> <link linkend="SQLParser.html-prod28">criteria</link> <RPAREN> ) )</para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod66" xreflabel="predicate"/>predicate</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para>( <link linkend="SQLParser.html-prod67">subqueryCompareCriteria</link> | <link linkend="SQLParser.html-prod68">compareCrit</link> | <link linkend="SQLParser.html-prod69">matchCrit</link> | <link linkend="SQLParser.html-prod70">betweenCrit</link> | <link linkend="SQLParser.html-prod71">setCrit</link> | <link linkend="SQLParser.html-prod72">existsCriteria</link> | <link linkend="SQLParser.html-prod30">hasCriteria</link> | <link linkend="SQLParser.html-prod34">translateCriteria</link> | <link linkend="SQLParser.html-prod73">isNullCrit</link> )</para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod68" xreflabel="compareCrit"/>compareCrit</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para><link linkend="SQLParser.html-prod16">expression</link> ( <EQ> | <NE> | <NE2> | <LT> | <LE> | <GT> | <GE> ) <link linkend="SQLParser.html-prod16">expression</link></para></entry>
+ </row>
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod74" xreflabel="subquery"/>subquery</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para><LPAREN> ( <link linkend="SQLParser.html-prod7">queryExpression</link> | <link linkend="SQLParser.html-prod8">storedProcedure</link> ) <RPAREN></para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod67" xreflabel="subqueryCompareCriteria"/>subqueryCompareCriteria</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para><link linkend="SQLParser.html-prod16">expression</link> ( <EQ> | <NE> | <NE2> | <LT> | <LE> | <GT> | <GE> ) ( <ANY> | <SOME> | <ALL> ) <link linkend="SQLParser.html-prod74">subquery</link></para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod69" xreflabel="matchCrit"/>matchCrit</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para>( <link linkend="SQLParser.html-prod16">expression</link> ( <NOT> )? <LIKE> <link linkend="SQLParser.html-prod16">expression</link> ( <link linkend="SQLParser.html-prod75">escapeChar</link> | ( <LBRACE> <link linkend="SQLParser.html-prod75">escapeChar</link> <RBRACE> ) )? )</para></entry>
+ </row>
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod75" xreflabel="escapeChar"/>escapeChar</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para><ESCAPE> <link linkend="SQLParser.html-prod1">stringVal</link></para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod70" xreflabel="betweenCrit"/>betweenCrit</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para><link linkend="SQLParser.html-prod16">expression</link> ( <NOT> )? <BETWEEN> <link linkend="SQLParser.html-prod16">expression</link> <AND> <link linkend="SQLParser.html-prod16">expression</link></para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod73" xreflabel="isNullCrit"/>isNullCrit</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para><link linkend="SQLParser.html-prod16">expression</link> <IS> ( <NOT> )? <NULL></para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod71" xreflabel="setCrit"/>setCrit</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para><link linkend="SQLParser.html-prod16">expression</link> ( <NOT> )? <IN> ( ( <link linkend="SQLParser.html-prod74">subquery</link> ) | ( <LPAREN> <link linkend="SQLParser.html-prod16">expression</link> ( <COMMA> <link linkend="SQLParser.html-prod16">expression</link> )* <RPAREN> ) )</para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod72" xreflabel="existsCriteria"/>existsCriteria</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para><EXISTS> <link linkend="SQLParser.html-prod74">subquery</link></para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod50" xreflabel="groupBy"/>groupBy</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para><GROUP> <BY> ( <link linkend="SQLParser.html-prod76">groupByItem</link> ( <COMMA> <link linkend="SQLParser.html-prod76">groupByItem</link> )* )</para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod76" xreflabel="groupByItem"/>groupByItem</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para><link linkend="SQLParser.html-prod16">expression</link></para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod51" xreflabel="having"/>having</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para><HAVING> <link linkend="SQLParser.html-prod28">criteria</link></para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod43" xreflabel="orderby"/>orderby</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para><ORDER> <BY> <link linkend="SQLParser.html-prod77">sortKey</link> ( <ASC> | <DESC> )? ( <COMMA> <link linkend="SQLParser.html-prod77">sortKey</link> ( <ASC> | <DESC> )? )*</para></entry>
+ </row>
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod77" xreflabel="sortKey"/>sortKey</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para><link linkend="SQLParser.html-prod16">expression</link></para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod44" xreflabel="limit"/>limit</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para><LIMIT> ( <INTEGERVAL> | <QMARK> ) ( <COMMA> ( <INTEGERVAL> | <QMARK> ) )?</para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod37" xreflabel="option"/>option</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para><OPTION> ( <SHOWPLAN> | <PLANONLY> | <DEBUG> | <MAKEDEP> <link linkend="SQLParser.html-prod2">id</link> ( <COMMA> <link linkend="SQLParser.html-prod2">id</link> )* | <MAKENOTDEP> <link linkend="SQLParser.html-prod2">id</link> ( <COMMA> <link linkend="SQLParser.html-prod2">id</link> )* | <NOCACHE> ( <link linkend="SQLParser.html-prod2">id</link> ( <COMMA> <link linkend="SQLParser.html-prod2">id</link> )* )? )*</para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod16" xreflabel="expression"/>expression</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para><link linkend="SQLParser.html-prod78">concatExpression</link></para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod78" xreflabel="concatExpression"/>concatExpression</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para>( <link linkend="SQLParser.html-prod79">plusExpression</link> ( <CONCAT_OP> <link linkend="SQLParser.html-prod79">plusExpression</link> )* )</para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod79" xreflabel="plusExpression"/>plusExpression</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para>( <link linkend="SQLParser.html-prod80">timesExpression</link> ( <link linkend="SQLParser.html-prod81">plusOperator</link><link linkend="SQLParser.html-prod80">timesExpression</link> )* )</para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod81" xreflabel="plusOperator"/>plusOperator</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para>( <PLUS> | <MINUS> )</para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod80" xreflabel="timesExpression"/>timesExpression</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para>( <link linkend="SQLParser.html-prod82">basicExpression</link> ( <link linkend="SQLParser.html-prod83">timesOperator</link><link linkend="SQLParser.html-prod82">basicExpression</link> )* )</para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod83" xreflabel="timesOperator"/>timesOperator</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para>( <STAR> | <SLASH> )</para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod82" xreflabel="basicExpression"/>basicExpression</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para>( <QMARK> | <link linkend="SQLParser.html-prod84">literal</link> | ( <LBRACE> <FN> <link linkend="SQLParser.html-prod85">function</link> <RBRACE> ) | ( <link linkend="SQLParser.html-prod53">aggregateSymbol</link> ) | ( <link linkend="SQLParser.html-prod85">function</link> ) | ( <ID> ) | ( <LPAREN> <link linkend="SQLParser.html-prod16">expression</link> <RPAREN> ) | <link linkend="SQLParser.html-prod74">subquery</link> | <link linkend="SQLParser.html-prod86">caseExpression</link> | <link linkend="SQLParser.html-prod87">searchedCaseExpression</link> )</para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod86" xreflabel="caseExpression"/>caseExpression</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para><CASE> <link linkend="SQLParser.html-prod16">expression</link> ( <WHEN> <link linkend="SQLParser.html-prod16">expression</link> <THEN> <link linkend="SQLParser.html-prod16">expression</link> )+ ( <ELSE> <link linkend="SQLParser.html-prod16">expression</link> )? <END></para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod87" xreflabel="searchedCaseExpression"/>searchedCaseExpression</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para><CASE> ( <WHEN> <link linkend="SQLParser.html-prod28">criteria</link> <THEN> <link linkend="SQLParser.html-prod16">expression</link> )+ ( <ELSE> <link linkend="SQLParser.html-prod16">expression</link> )? <END></para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod85" xreflabel="function"/>function</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para>( ( <CONVERT> <LPAREN> <link linkend="SQLParser.html-prod16">expression</link> <COMMA> <link linkend="SQLParser.html-prod31">dataType</link> <RPAREN> ) | ( <CAST> <LPAREN> <link linkend="SQLParser.html-prod16">expression</link> <AS> <link linkend="SQLParser.html-prod31">dataType</link> <RPAREN> ) | ( ( <TIMESTAMPADD> | <TIMESTAMPDIFF> ) <LPAREN> <link linkend="SQLParser.html-prod88">intervalType</link> <COMMA> <link linkend="SQLParser.html-prod16">expression</link> <COMMA> <link linkend="SQLParser.html-prod16">expression</link> <RPAREN> ) | ( ( <LEFT> | <RIGHT> | <CHAR> ) <LPAREN> ( <link linkend="SQLParser.html-prod16">expression</link> ( <COMMA> <link linkend="SQLParser.html-prod16">expression</link> )* )? <RPAREN> ) | ( ( <INSERT> ) <LPAREN> ( <link linkend="SQLParser.html-prod16">expression!
</link> ( <COMMA> <link linkend="SQLParser.html-prod16">expression</link> )* )? <RPAREN> ) | ( ( <TRANSLATE> ) <LPAREN> ( <link linkend="SQLParser.html-prod16">expression</link> ( <COMMA> <link linkend="SQLParser.html-prod16">expression</link> )* )? <RPAREN> ) | ( <link linkend="SQLParser.html-prod2">id</link> <LPAREN> ( <link linkend="SQLParser.html-prod16">expression</link> ( <COMMA> <link linkend="SQLParser.html-prod16">expression</link> )* )? <RPAREN> ) )</para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod31" xreflabel="dataType"/>dataType</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para>( <STRING> | <BOOLEAN> | <BYTE> | <SHORT> | <CHAR> | <INTEGER> | <LONG> | <BIGINTEGER> | <FLOAT> | <DOUBLE> | <BIGDECIMAL> | <DATE> | <TIME> | <TIMESTAMP> | <OBJECT> | <BLOB> | <CLOB> | <XML> )</para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod88" xreflabel="intervalType"/>intervalType</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para>( <SQL_TSI_FRAC_SECOND> | <SQL_TSI_SECOND> | <SQL_TSI_MINUTE> | <SQL_TSI_HOUR> | <SQL_TSI_DAY> | <SQL_TSI_WEEK> | <SQL_TSI_MONTH> | <SQL_TSI_QUARTER> | <SQL_TSI_YEAR> )</para></entry>
+ </row>
+
+ <row>
+ <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod84" xreflabel="literal"/>literal</para></entry>
+ <entry align="center" valign="top"><para>::=</para></entry>
+ <entry align="left" valign="top"><para>( <link linkend="SQLParser.html-prod1">stringVal</link> | <INTEGERVAL> | <FLOATVAL> | <FALSE> | <TRUE> | <UNKNOWN> | <NULL> | ( ( <BOOLEANTYPE> | <TIMESTAMPTYPE> | <DATETYPE> | <TIMETYPE> ) <link linkend="SQLParser.html-prod1">stringVal</link> <RBRACE> ) )</para></entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
+ </sect1>
</appendix>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2009-11-25 21:45:09 UTC (rev 1603)
+++ trunk/pom.xml 2009-11-29 14:39:39 UTC (rev 1604)
@@ -87,9 +87,7 @@
<descriptor>build/assembly/cdk/cdk-dist.xml</descriptor>
<descriptor>build/assembly/adminshell/adminshell-dependencies.xml</descriptor>
<descriptor>build/assembly/adminshell/adminshell-dist.xml</descriptor>
- <!--
<descriptor>documentation/assembly/docs.xml</descriptor>
- -->
</descriptors>
<outputDirectory>target/distribution</outputDirectory>
<workDirectory>target/assembly/work</workDirectory>
15 years, 1 month
teiid SVN: r1603 - in trunk/test-integration/db/src: test/java/org/teiid/test/testcases and 1 other directory.
by teiid-commits@lists.jboss.org
Author: vhalbert(a)redhat.com
Date: 2009-11-25 16:45:09 -0500 (Wed, 25 Nov 2009)
New Revision: 1603
Added:
trunk/test-integration/db/src/main/java/org/teiid/test/framework/transaction/StandaloneGlobalTransaction.java
trunk/test-integration/db/src/test/java/org/teiid/test/testcases/StandaloneGlobalTransactionTests.java
Log:
Teiid 773 - added the standalone global transaction tests, no failures
Added: trunk/test-integration/db/src/main/java/org/teiid/test/framework/transaction/StandaloneGlobalTransaction.java
===================================================================
--- trunk/test-integration/db/src/main/java/org/teiid/test/framework/transaction/StandaloneGlobalTransaction.java (rev 0)
+++ trunk/test-integration/db/src/main/java/org/teiid/test/framework/transaction/StandaloneGlobalTransaction.java 2009-11-25 21:45:09 UTC (rev 1603)
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2000-2007 MetaMatrix, Inc.
+ * All rights reserved.
+ */
+package org.teiid.test.framework.transaction;
+
+import java.util.Random;
+
+import javax.transaction.xa.XAResource;
+
+import org.teiid.test.framework.TransactionContainer;
+import org.teiid.test.framework.TransactionQueryTestCase;
+import org.teiid.test.framework.exception.TransactionRuntimeException;
+
+import com.metamatrix.common.xa.MMXid;
+
+public class StandaloneGlobalTransaction extends TransactionContainer {
+ private static Random RANDOM = new Random();
+ private MMXid xid;
+
+ public StandaloneGlobalTransaction() {
+ super();
+ }
+
+ protected void before(TransactionQueryTestCase test) {
+ try {
+ xid = createXid();
+ XAResource xaResource = this.getConnectionStrategy().getXAConnection().getXAResource();
+ // getXAConnection().getXAResource();
+ xaResource.setTransactionTimeout(120);
+ xaResource.start(xid, XAResource.TMNOFLAGS);
+ } catch (Exception e) {
+ throw new TransactionRuntimeException(e);
+ }
+ }
+
+ public static MMXid createXid() {
+ byte[] gid = new byte[10];
+ byte[] bid = new byte[10];
+ RANDOM.nextBytes(gid);
+ RANDOM.nextBytes(bid);
+ return new MMXid(0, gid, bid);
+ }
+
+ protected void after(TransactionQueryTestCase test) {
+ boolean delistSuccessful = false;
+ boolean commit = false;
+ try {
+ XAResource xaResource = this.getConnectionStrategy().getXAConnection().getXAResource();
+
+ xaResource.end(xid, XAResource.TMSUCCESS);
+
+ if (!test.exceptionExpected() && xaResource.prepare(xid) == XAResource.XA_OK) {
+ commit = true;
+ }
+ delistSuccessful = true;
+ } catch (Exception e) {
+ throw new TransactionRuntimeException(e);
+ } finally {
+ try {
+ if (!delistSuccessful || test.rollbackAllways()|| test.exceptionOccurred()) {
+ this.getConnectionStrategy().getXAConnection().getXAResource().rollback(xid);
+ //getXAConnection().getXAResource().rollback(xid);
+ }
+ else if (commit) {
+ this.getConnectionStrategy().getXAConnection().getXAResource().commit(xid, true);
+ }
+ } catch (Exception e) {
+ throw new TransactionRuntimeException(e);
+ }
+ }
+ }
+}
Property changes on: trunk/test-integration/db/src/main/java/org/teiid/test/framework/transaction/StandaloneGlobalTransaction.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/test-integration/db/src/test/java/org/teiid/test/testcases/StandaloneGlobalTransactionTests.java
===================================================================
--- trunk/test-integration/db/src/test/java/org/teiid/test/testcases/StandaloneGlobalTransactionTests.java (rev 0)
+++ trunk/test-integration/db/src/test/java/org/teiid/test/testcases/StandaloneGlobalTransactionTests.java 2009-11-25 21:45:09 UTC (rev 1603)
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2000-2007 MetaMatrix, Inc.
+ * All rights reserved.
+ */
+package org.teiid.test.testcases;
+
+import org.teiid.test.framework.TransactionContainer;
+import org.teiid.test.framework.transaction.StandaloneGlobalTransaction;
+
+
+/**
+ * This is global transaction test to be used when transaction is external
+ * in places like inside app server
+ */
+public class StandaloneGlobalTransactionTests extends LocalTransactionTests {
+
+ public StandaloneGlobalTransactionTests(String testName) {
+ super(testName);
+ }
+
+ @Override
+ protected TransactionContainer getTransactionContainter() {
+
+ return new StandaloneGlobalTransaction();
+ }
+
+
+}
Property changes on: trunk/test-integration/db/src/test/java/org/teiid/test/testcases/StandaloneGlobalTransactionTests.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
15 years, 1 month
teiid SVN: r1602 - in trunk/test-integration/db/src/main/java/org/teiid/test/framework: connection and 1 other directory.
by teiid-commits@lists.jboss.org
Author: vhalbert(a)redhat.com
Date: 2009-11-25 15:58:42 -0500 (Wed, 25 Nov 2009)
New Revision: 1602
Modified:
trunk/test-integration/db/src/main/java/org/teiid/test/framework/TransactionContainer.java
trunk/test-integration/db/src/main/java/org/teiid/test/framework/connection/ConnectionStrategy.java
Log:
Teiid 773 - cleanup
Modified: trunk/test-integration/db/src/main/java/org/teiid/test/framework/TransactionContainer.java
===================================================================
--- trunk/test-integration/db/src/main/java/org/teiid/test/framework/TransactionContainer.java 2009-11-25 20:58:05 UTC (rev 1601)
+++ trunk/test-integration/db/src/main/java/org/teiid/test/framework/TransactionContainer.java 2009-11-25 20:58:42 UTC (rev 1602)
@@ -124,9 +124,10 @@
if (!test.exceptionExpected()) {
e.printStackTrace();
+ debug("Error: " + e.getMessage());
+ throw new TransactionRuntimeException(e.getMessage());
+
}
- debug("Error: " + e.getMessage());
- throw new TransactionRuntimeException(e.getMessage());
}
if (test.exceptionExpected() && !test.exceptionOccurred()) {
Modified: trunk/test-integration/db/src/main/java/org/teiid/test/framework/connection/ConnectionStrategy.java
===================================================================
--- trunk/test-integration/db/src/main/java/org/teiid/test/framework/connection/ConnectionStrategy.java 2009-11-25 20:58:05 UTC (rev 1601)
+++ trunk/test-integration/db/src/main/java/org/teiid/test/framework/connection/ConnectionStrategy.java 2009-11-25 20:58:42 UTC (rev 1602)
@@ -56,11 +56,7 @@
* @since
*/
public void shutdown() {
-// try {
-// this.dsFactory.cleanup();
-// } catch (Throwable t) {
-//
-// }
+
}
public Connection getAdminConnection() throws QueryTestFailedException{
@@ -150,66 +146,73 @@
try {
- VDB vdb = null;
- Collection<VDB> vdbs = api.getVDBs("*");
- if (vdbs == null) {
- throw new QueryTestFailedException("GetVDBS returned no vdbs available");
-
- } else if (vdbs.size() > 0) {
- String urlString = this.env.getProperty(DriverConnection.DS_URL);
- MMJDBCURL url = new MMJDBCURL(urlString);
- System.out.println("Trying to match VDB : " + url.getVDBName());
+ VDB vdb = null;
+ Collection<VDB> vdbs = api.getVDBs("*");
+ if (vdbs == null || vdbs.isEmpty()) {
+ throw new QueryTestFailedException(
+ "AdminApi.GetVDBS returned no vdbs available");
+ }
+
+ String urlString = this.env.getProperty(DriverConnection.DS_URL);
+ MMJDBCURL url = new MMJDBCURL(urlString);
+ System.out.println("Trying to match VDB : " + url.getVDBName());
+
+ for (Iterator iterator = vdbs.iterator(); iterator.hasNext();) {
+ VDB v = (VDB) iterator.next();
+ if (v.getName().equalsIgnoreCase(url.getVDBName())) {
+ vdb = v;
+ }
+
+ }
+ if (vdbs == null) {
+ throw new QueryTestFailedException(
+ "GetVDBS did not return a vdb that matched "
+ + url.getVDBName());
+ }
- for (Iterator iterator = vdbs.iterator(); iterator
- .hasNext();) {
- VDB v = (VDB) iterator.next();
- if (v.getName().equalsIgnoreCase(url.getVDBName())) {
- vdb = v;
- }
-
- }
- if (vdbs == null) {
- throw new QueryTestFailedException("GetVDBS did not return a vdb that matched " + url.getVDBName());
- }
-
- } else {
- vdb = (VDB) vdbs.iterator().next();
- }
+ Iterator<Model> modelIt = vdb.getModels().iterator();
+ while (modelIt.hasNext()) {
+ Model m = modelIt.next();
- Iterator<Model> modelIt = vdb.getModels().iterator();
- while (modelIt.hasNext() ) {
- Model m = modelIt.next();
-
- if (!m.isPhysical()) continue;
-
- // get the mapping, if defined
- String mappedName = this.env.getProperty(m.getName());
-
- String useName = m.getName();
- if(mappedName != null) {
- useName = mappedName;
- }
+ if (!m.isPhysical())
+ continue;
- org.teiid.test.framework.datasource.DataSource ds = this.dsFactory.getDatasource(useName, m.getName());
-
- if (ds != null) {
+ // get the mapping, if defined
+ String mappedName = this.env.getProperty(m.getName());
- System.out.println("Set up Connector Binding (model:mapping:type): " + m.getName() + ":" + useName + ":" + ds.getConnectorType()); //$NON-NLS-1$
+ String useName = m.getName();
+ if (mappedName != null) {
+ useName = mappedName;
+ }
- AdminOptions ao = new AdminOptions(AdminOptions.OnConflict.OVERWRITE);
- ao.addOption(AdminOptions.BINDINGS_IGNORE_DECRYPT_ERROR);
-
- api.addConnectorBinding(ds.getName(), ds.getConnectorType(), ds.getProperties(), ao);
-
- api.assignBindingToModel(ds.getName(), vdb.getName(), vdb.getVDBVersion(), m.getName());
-
-
- api.startConnectorBinding(ds.getName());
- } else {
- throw new QueryTestFailedException("Error: Unable to create binding to map to model : " + m.getName() + ", the mapped name " + useName + " had no datasource properties defined");
- }
+ org.teiid.test.framework.datasource.DataSource ds = this.dsFactory
+ .getDatasource(useName, m.getName());
- }
+ if (ds != null) {
+
+ System.out
+ .println("Set up Connector Binding (model:mapping:type): " + m.getName() + ":" + useName + ":" + ds.getConnectorType()); //$NON-NLS-1$
+
+ AdminOptions ao = new AdminOptions(
+ AdminOptions.OnConflict.OVERWRITE);
+ ao.addOption(AdminOptions.BINDINGS_IGNORE_DECRYPT_ERROR);
+
+ api.addConnectorBinding(ds.getName(),
+ ds.getConnectorType(), ds.getProperties(), ao);
+
+ api.assignBindingToModel(ds.getName(), vdb.getName(), vdb
+ .getVDBVersion(), m.getName());
+
+ api.startConnectorBinding(ds.getName());
+ } else {
+ throw new QueryTestFailedException(
+ "Error: Unable to create binding to map to model : "
+ + m.getName() + ", the mapped name "
+ + useName
+ + " had no datasource properties defined");
+ }
+
+ }
} catch (QueryTestFailedException qt) {
throw qt;
15 years, 1 month
teiid SVN: r1601 - trunk/test-integration/db/src/test/java/org/teiid/test/testcases.
by teiid-commits@lists.jboss.org
Author: vhalbert(a)redhat.com
Date: 2009-11-25 15:58:05 -0500 (Wed, 25 Nov 2009)
New Revision: 1601
Modified:
trunk/test-integration/db/src/test/java/org/teiid/test/testcases/CommonTransactionTests.java
Log:
Teiid 773 - Test testMultipleSourceMultipleCommands: added check for which db type the assertion was performed on, because Oracle returns a different value than the others
Modified: trunk/test-integration/db/src/test/java/org/teiid/test/testcases/CommonTransactionTests.java
===================================================================
--- trunk/test-integration/db/src/test/java/org/teiid/test/testcases/CommonTransactionTests.java 2009-11-25 20:33:59 UTC (rev 1600)
+++ trunk/test-integration/db/src/test/java/org/teiid/test/testcases/CommonTransactionTests.java 2009-11-25 20:58:05 UTC (rev 1601)
@@ -399,7 +399,11 @@
test.execute("select distinct e2 from g1 where e1 > 100");
// NOTE: if this is an oracle source, it failes because it return varchar2
- test.assertResultsSetEquals(new String[] {"e2[varchar]", "blah"});
+ if (userTxn.getSource("pm1").getMetaData().getDatabaseProductName().toLowerCase().indexOf("oracle") > -1) {
+ test.assertResultsSetEquals(new String[] {"e2[varchar2]", "blah"});
+ } else {
+ test.assertResultsSetEquals(new String[] {"e2[varchar]", "blah"});
+ }
test.closeConnection();
}
15 years, 1 month
teiid SVN: r1600 - trunk/test-integration/db/src/test/java/org/teiid/test/testcases.
by teiid-commits@lists.jboss.org
Author: vhalbert(a)redhat.com
Date: 2009-11-25 15:33:59 -0500 (Wed, 25 Nov 2009)
New Revision: 1600
Modified:
trunk/test-integration/db/src/test/java/org/teiid/test/testcases/CommonTransactionTests.java
Log:
Teiid 773 - Turned off 2 tests for the time being because they are currently hanging, will revisit later
Modified: trunk/test-integration/db/src/test/java/org/teiid/test/testcases/CommonTransactionTests.java
===================================================================
--- trunk/test-integration/db/src/test/java/org/teiid/test/testcases/CommonTransactionTests.java 2009-11-25 20:23:42 UTC (rev 1599)
+++ trunk/test-integration/db/src/test/java/org/teiid/test/testcases/CommonTransactionTests.java 2009-11-25 20:33:59 UTC (rev 1600)
@@ -582,7 +582,7 @@
* Note: This is producing the below error some times; however this is SQL Server issue.
* http://support.microsoft.com/?kbid=834849
*/
- public void testMultipleSourcePartialProcessingUsingMakedep() throws Exception {
+ public void xtestMultipleSourcePartialProcessingUsingMakedep() throws Exception {
AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testMultipleSourcePartialProcessingUsingMakedep") {
public void testCase() throws Exception {
execute("select pm1.g1.e1, pm1.g1.e2 from pm1.g1 LEFT OUTER JOIN pm2.g1 MAKENOTDEP ON pm1.g1.e2 = pm2.g1.e2 where pm2.g1.e1 >= 50 and pm2.g1.e1 < 100");
15 years, 1 month