teiid SVN: r2641 - in branches/7.1.x: build/kits/jboss-container and 7 other directories.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2010-10-11 12:42:47 -0400 (Mon, 11 Oct 2010)
New Revision: 2641
Removed:
branches/7.1.x/client/src/main/java/org/teiid/adminapi/ProcessObject.java
branches/7.1.x/client/src/main/java/org/teiid/adminapi/TeiidAdmin.java
branches/7.1.x/client/src/main/java/org/teiid/net/socket/AdminApiServerDiscovery.java
branches/7.1.x/client/src/test/java/org/teiid/net/socket/TestAdminApiServerDiscovery.java
Modified:
branches/7.1.x/adminshell/src/main/java/org/teiid/adminshell/AdminShell.java
branches/7.1.x/build/kits/jboss-container/teiid-releasenotes.html
branches/7.1.x/client/src/main/java/org/teiid/adminapi/Admin.java
branches/7.1.x/client/src/main/java/org/teiid/adminapi/AdminFactory.java
branches/7.1.x/client/src/main/java/org/teiid/adminapi/impl/DQPManagement.java
branches/7.1.x/client/src/test/java/org/teiid/net/socket/TestSocketServiceRegistry.java
branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
branches/7.1.x/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java
branches/7.1.x/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
Log:
TEIID-1299: Removing the unimplemented methods from the Admin API. Renaming, getWorkManagerStats to getWorkerPoolStats.
Modified: branches/7.1.x/adminshell/src/main/java/org/teiid/adminshell/AdminShell.java
===================================================================
--- branches/7.1.x/adminshell/src/main/java/org/teiid/adminshell/AdminShell.java 2010-10-11 15:02:22 UTC (rev 2640)
+++ branches/7.1.x/adminshell/src/main/java/org/teiid/adminshell/AdminShell.java 2010-10-11 16:42:47 UTC (rev 2641)
@@ -37,7 +37,6 @@
import org.teiid.adminapi.AdminException;
import org.teiid.adminapi.AdminFactory;
import org.teiid.adminapi.CacheStatistics;
-import org.teiid.adminapi.ProcessObject;
import org.teiid.adminapi.PropertyDefinition;
import org.teiid.adminapi.Request;
import org.teiid.adminapi.Session;
@@ -183,13 +182,6 @@
return getAdmin().getTemplatePropertyDefinitions(templateName);
}
- @Doc(text = "Get the ProcessObject instances for the given identifier")
- public static Collection<ProcessObject> getProcesses(
- @Doc(text = "identifier") String processIdentifier)
- throws AdminException {
- return getAdmin().getProcesses(processIdentifier);
- }
-
@Doc(text = "Get all Request instances")
public static Collection<Request> getRequests() throws AdminException {
return getAdmin().getRequests();
@@ -224,11 +216,10 @@
return getAdmin().getVDBs();
}
- @Doc(text = "Get WorkerPoolStatistics for the given WorkManager")
- public static WorkerPoolStatistics getWorkManagerStats(
- @Doc(text = "identifier") String identifier)
+ @Doc(text = "Get thread pool statistics for Teiid")
+ public static WorkerPoolStatistics getWorkerPoolStats()
throws AdminException {
- return getAdmin().getWorkManagerStats(identifier);
+ return getAdmin().getWorkerPoolStats();
}
@Doc(text = "Get cache statistics for given cache type")
@@ -256,14 +247,6 @@
getAdmin().setAnyAuthenticatedForDataRole(vdbName, vdbVersion, dataRole, anyAuthenticated);
}
- @Doc(text = "Set a runtime property")
- public static void setRuntimeProperty(
- @Doc(text = "name") String propertyName,
- @Doc(text = "value") String propertyValue)
- throws AdminException {
- getAdmin().setRuntimeProperty(propertyName, propertyValue);
- }
-
@Doc(text = "Terminate a session and associated requests")
public static void terminateSession(
@Doc(text = "session id") String sessionId) throws AdminException {
Modified: branches/7.1.x/build/kits/jboss-container/teiid-releasenotes.html
===================================================================
--- branches/7.1.x/build/kits/jboss-container/teiid-releasenotes.html 2010-10-11 15:02:22 UTC (rev 2640)
+++ branches/7.1.x/build/kits/jboss-container/teiid-releasenotes.html 2010-10-11 16:42:47 UTC (rev 2641)
@@ -50,6 +50,7 @@
<li>Overwriting an existing VDB will cause old connections to be terminated. Production systems should rely on VDB versioning.
<li>The jdbc:metamatrix JDBC URL prefix is no longer accepted. Use jdbc:teiid instead.
<li>Model visibility no longer restricts access to tables and procedures. Setting visible to false will only hide entries from system tables. Data roles should be used to restrict data access.
+ <li>On Admin API "getWorkManagerStats" methods renamed to "getWorkerPoolStats". Also, "setRuntimeProperty" and "getProcesses" methods are not supported.
</ul>
<h4>from 7.0</h4>
<ul>
Modified: branches/7.1.x/client/src/main/java/org/teiid/adminapi/Admin.java
===================================================================
--- branches/7.1.x/client/src/main/java/org/teiid/adminapi/Admin.java 2010-10-11 15:02:22 UTC (rev 2640)
+++ branches/7.1.x/client/src/main/java/org/teiid/adminapi/Admin.java 2010-10-11 16:42:47 UTC (rev 2641)
@@ -75,13 +75,6 @@
void deleteVDB(String vdbName, int vdbVersion) throws AdminException;
/**
- * Set a process level property.
- * @param propertyName - name of the property
- * @param propertyValue - value of the property
- */
- void setRuntimeProperty(String propertyName, String propertyValue) throws AdminException;
-
- /**
* Get the VDBs that currently deployed in the system
*
* @return Collection of {@link VDB}s. There could be multiple VDBs with the
@@ -116,13 +109,12 @@
Translator getTranslator(String deployedName) throws AdminException;
/**
- * Get the Work Manager stats that correspond to the specified identifier pattern.
+ * Get the Worker Pool statistics in runtime engine.
*
- * @param identifier - an identifier for the queues {@link QueueWorkerPool}.
- * @return Collection of {@link QueueWorkerPool}
+ * @return {@link WorkerPoolStatistics}
* @throws AdminException
*/
- WorkerPoolStatistics getWorkManagerStats(String identifier) throws AdminException;
+ WorkerPoolStatistics getWorkerPoolStats() throws AdminException;
/**
* Get the Caches that correspond to the specified identifier pattern
@@ -169,18 +161,6 @@
*/
Collection<Transaction> getTransactions() throws AdminException;
-
- /**
- * Get the processes that correspond to the specified identifier pattern.
- *
- * @param processIdentifier the unique identifier for for a {@link org.teiid.adminapi.ProcessObject ProcessObject}
- * in the system or "{@link org.teiid.adminapi.AdminObject#WILDCARD WILDCARD}"
- * if all Processes are desired.
- * @return Collection of {@link org.teiid.adminapi.ProcessObject ProcessObject}
- * @throws AdminException if there's a system error.
- */
- Collection<ProcessObject> getProcesses(String processIdentifier) throws AdminException;
-
/**
* Clear the cache or caches specified by the cacheIdentifier.
* @param cacheType Cache Type
Modified: branches/7.1.x/client/src/main/java/org/teiid/adminapi/AdminFactory.java
===================================================================
--- branches/7.1.x/client/src/main/java/org/teiid/adminapi/AdminFactory.java 2010-10-11 15:02:22 UTC (rev 2640)
+++ branches/7.1.x/client/src/main/java/org/teiid/adminapi/AdminFactory.java 2010-10-11 16:42:47 UTC (rev 2641)
@@ -28,9 +28,7 @@
import java.lang.reflect.Proxy;
import java.util.Properties;
-import org.teiid.client.security.LogonException;
import org.teiid.client.util.ExceptionUtil;
-import org.teiid.core.TeiidRuntimeException;
import org.teiid.core.util.PropertiesUtils;
import org.teiid.jdbc.JDBCPlugin;
import org.teiid.net.CommunicationException;
@@ -42,29 +40,26 @@
/**
- * Singleton factory for ServerAdmins.
- * @since 4.3
+ * Singleton factory for class for creating Admin connections to the Teiid
*/
public class AdminFactory {
- private static final int DEFAULT_BOUNCE_WAIT = 2000;
-
private final class AdminProxy implements InvocationHandler {
- private Admin target;
- private ServerConnection registry;
+ private Admin admin;
+ private ServerConnection serverConnection;
private boolean closed;
public AdminProxy(Properties p) throws ConnectionException, CommunicationException {
- this.registry = serverConnectionFactory.getConnection(p);
- this.target = registry.getService(Admin.class);
+ this.serverConnection = serverConnectionFactory.getConnection(p);
+ this.admin = serverConnection.getService(Admin.class);
}
private synchronized Admin getTarget() throws AdminComponentException {
if (closed) {
throw new AdminComponentException(JDBCPlugin.Util.getString("admin_conn_closed")); //$NON-NLS-1$
}
- return target;
+ return admin;
}
@Override
@@ -81,11 +76,7 @@
return method.invoke(getTarget(), args);
} catch (InvocationTargetException e) {
if (ExceptionUtil.getExceptionOfType(e, CommunicationException.class) != null) {
- this.target = null;
- if (method.getName().endsWith("restart")) { //$NON-NLS-1$
- bounceSystem(true);
- return null;
- }
+ this.admin = null;
}
throw e.getTargetException();
}
@@ -96,53 +87,22 @@
return;
}
this.closed = true;
- if (registry != null) {
- registry.close();
+ if (serverConnection != null) {
+ serverConnection.close();
}
- }
-
- public void bounceSystem(boolean waitUntilDone) {
- if (!waitUntilDone) {
- return;
- }
- //we'll wait 2 seconds for the server to come up
- try {
- Thread.sleep(bounceWait);
- } catch (InterruptedException e) {
- throw new TeiidRuntimeException(e);
- }
-
- //we'll wait 30 seconds for the server to come back up
- for (int i = 0; i < 15; i++) {
- try {
- getTarget().getProcesses(AdminObject.WILDCARD);
- return;
- } catch (Exception e) {
- //reestablish a connection and retry
- try {
- Thread.sleep(bounceWait);
- } catch (InterruptedException ex) {
- throw new TeiidRuntimeException(ex);
- }
- }
- }
- }
+ }
}
public static final String DEFAULT_APPLICATION_NAME = "Admin"; //$NON-NLS-1$
- /**Singleton instance*/
- private static AdminFactory instance = new AdminFactory(SocketServerConnectionFactory.getInstance(), DEFAULT_BOUNCE_WAIT);
+ private static AdminFactory instance = new AdminFactory(SocketServerConnectionFactory.getInstance());
private ServerConnectionFactory serverConnectionFactory;
- private int bounceWait;
- AdminFactory(ServerConnectionFactory connFactory, int bounceWait) {
+ AdminFactory(ServerConnectionFactory connFactory) {
this.serverConnectionFactory = connFactory;
- this.bounceWait = bounceWait;
}
- /**Get the singleton instance*/
public static AdminFactory getInstance() {
return instance;
}
@@ -155,11 +115,7 @@
* @param password
* @param serverURL
* @return
- * @throws LogonException
* @throws AdminException
- * @throws CommunicationException
- * @throws LogonException
- * @since 4.3
*/
public Admin createAdmin(String userName,
char[] password,
@@ -174,12 +130,9 @@
* @param userName
* @param password
* @param serverURL
+ * @param applicationName
* @return
- * @throws LogonException
* @throws AdminException
- * @throws CommunicationException
- * @throws LogonException
- * @since 4.3
*/
public Admin createAdmin(String userName,
char[] password,
Deleted: branches/7.1.x/client/src/main/java/org/teiid/adminapi/ProcessObject.java
===================================================================
--- branches/7.1.x/client/src/main/java/org/teiid/adminapi/ProcessObject.java 2010-10-11 15:02:22 UTC (rev 2640)
+++ branches/7.1.x/client/src/main/java/org/teiid/adminapi/ProcessObject.java 2010-10-11 16:42:47 UTC (rev 2641)
@@ -1,140 +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;
-
-import java.net.InetAddress;
-import java.util.Date;
-
-
-/**
- * A Process in the Teiid System
- *
- * <p>The identifier pattern for a Process is <code>"processName"</code>.
- * This Process identifier is considered to be unique across the system.</p>
- * @since 4.3
- */
-public interface ProcessObject extends
- AdminObject {
-
-
- /**
- * Get the Host name
- *
- * @return String host name where the process is running
- * @since 4.3
- */
- public String getHostName();
-
- /**
- * Get the Process name
- *
- * @return String A unique identifier for this Process.
- * @since 4.3
- */
- public String getProcessName();
-
-
- /**
- * Get the port number for this Process
- *
- * @return listener port for this host
- * @since 4.3
- */
- public int getPort();
-
- /**
- * Get the IP address for the Process
- * @return the IP address for the Process
- * @since 4.3
- */
- public InetAddress getInetAddress();
-
- /**
- * Is this process enabled in Configuration
- *
- * @return whether this process is enabled.
- * @since 4.3
- */
- public boolean isEnabled();
-
- /**
- * @return amount of free memory for this Java process.
- */
- public long getFreeMemory();
-
-
- /**
- * @return thread count for this Java process.
- */
- public int getThreadCount();
-
- /**
- * @return total memory allocated for this Java process.
- */
- public long getTotalMemory();
-
-
- /**
- * @return whether this process is running.
- * @since 4.3
- */
- public boolean isRunning();
-
- /**
- * @return Returns the objectsRead.
- * @since 4.3
- */
- public long getObjectsRead();
-
- /**
- * @return Returns the objectsWritten.
- * @since 4.3
- */
- public long getObjectsWritten();
-
-
- /**
- * @return Returns the maxSockets.
- * @since 4.3
- */
- public int getMaxSockets();
-
- /**
- * @return Returns the sockets.
- * @since 4.3
- */
- public int getSockets();
-
- /**
- * @return Returns the startTime.
- * @since 4.3
- */
- public Date getStartTime();
-
-
- /**
- * @return Returns the queueWorkerPool.
- * @since 4.3
- */
- public WorkerPoolStatistics getQueueWorkerPool();
-}
Deleted: branches/7.1.x/client/src/main/java/org/teiid/adminapi/TeiidAdmin.java
===================================================================
--- branches/7.1.x/client/src/main/java/org/teiid/adminapi/TeiidAdmin.java 2010-10-11 15:02:22 UTC (rev 2640)
+++ branches/7.1.x/client/src/main/java/org/teiid/adminapi/TeiidAdmin.java 2010-10-11 16:42:47 UTC (rev 2641)
@@ -1,42 +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;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collection;
-
-
-public abstract class TeiidAdmin implements Admin, Serializable {
-
- @Override
- public Collection<ProcessObject> getProcesses(String processIdentifier) throws AdminException {
- ArrayList<ProcessObject> list = new ArrayList<ProcessObject>();
- //list.add(manager.getProcess());
- return list;
- }
-
- @Override
- public void setRuntimeProperty(String propertyName, String propertyValue) throws AdminException {
- throw new AdminProcessingException("feature coming soon..");
- }
-}
Modified: branches/7.1.x/client/src/main/java/org/teiid/adminapi/impl/DQPManagement.java
===================================================================
--- branches/7.1.x/client/src/main/java/org/teiid/adminapi/impl/DQPManagement.java 2010-10-11 15:02:22 UTC (rev 2640)
+++ branches/7.1.x/client/src/main/java/org/teiid/adminapi/impl/DQPManagement.java 2010-10-11 16:42:47 UTC (rev 2641)
@@ -30,7 +30,7 @@
public interface DQPManagement {
List<RequestMetadata> getRequestsForSession(String sessionId) ;
List<RequestMetadata> getRequests();
- WorkerPoolStatisticsMetadata getWorkManagerStatistics(String identifier);
+ WorkerPoolStatisticsMetadata getWorkerPoolStatistics();
void terminateSession(String terminateeId);
boolean cancelRequest(String sessionId, long requestId) throws AdminException;
Collection<String> getCacheTypes();
Deleted: branches/7.1.x/client/src/main/java/org/teiid/net/socket/AdminApiServerDiscovery.java
===================================================================
--- branches/7.1.x/client/src/main/java/org/teiid/net/socket/AdminApiServerDiscovery.java 2010-10-11 15:02:22 UTC (rev 2640)
+++ branches/7.1.x/client/src/main/java/org/teiid/net/socket/AdminApiServerDiscovery.java 2010-10-11 16:42:47 UTC (rev 2641)
@@ -1,104 +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.net.socket;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
-import org.teiid.adminapi.Admin;
-import org.teiid.adminapi.AdminException;
-import org.teiid.adminapi.ProcessObject;
-import org.teiid.client.security.LogonResult;
-import org.teiid.net.HostInfo;
-import org.teiid.net.TeiidURL;
-
-
-/**
- * Will discover hosts based upon an anon admin api call.
- */
-public class AdminApiServerDiscovery extends UrlServerDiscovery {
-
- /**
- * If the FIREWALL_HOST property is set, then this host name will be used instead of the process
- * names returned by the AdminApi
- */
- public static final String USE_URL_HOST = "AdminApiServerDiscovery.useUrlHost"; //$NON-NLS-1$
-
- public static final int DISCOVERY_TIMEOUT = 120000;
-
- static class ClusterInfo {
- volatile long lastDiscoveryTime;
- volatile List<HostInfo> knownHosts = new ArrayList<HostInfo>();
- }
-
- private static Map<String, ClusterInfo> clusterInfo = Collections.synchronizedMap(new HashMap<String, ClusterInfo>());
-
- private boolean useUrlHost;
-
- @Override
- public void init(TeiidURL url, Properties p) {
- super.init(url, p);
- //TODO: this could be on a per cluster basis
- useUrlHost = Boolean.valueOf(p.getProperty(USE_URL_HOST)).booleanValue();
- }
-
- @Override
- public List<HostInfo> getKnownHosts(LogonResult result,
- SocketServerInstance instance) {
- if (result == null) {
- return super.getKnownHosts(result, instance);
- }
- ClusterInfo info = clusterInfo.get(result.getClusterName());
- if (info == null) {
- info = new ClusterInfo();
- }
- synchronized (info) {
- if (instance != null
- && (info.lastDiscoveryTime < System.currentTimeMillis() - DISCOVERY_TIMEOUT || info.knownHosts.isEmpty())) {
- Admin serverAdmin = instance.getService(Admin.class);
- try {
- Collection<ProcessObject> processes = serverAdmin.getProcesses("*"); //$NON-NLS-1$
- info.knownHosts.clear();
- for (ProcessObject processObject : processes) {
- if (!processObject.isEnabled() || !processObject.isRunning()) {
- continue;
- }
- info.knownHosts.add(new HostInfo(useUrlHost?instance.getHostInfo().getHostName():processObject.getInetAddress().getHostName(), processObject.getPort()));
- }
- info.lastDiscoveryTime = System.currentTimeMillis();
- } catch (AdminException e) {
- //ignore - will get an update on the next successful connection
- }
- }
- if (info.knownHosts.size() == 0) {
- return super.getKnownHosts(result, instance);
- }
- return new ArrayList<HostInfo>(info.knownHosts);
- }
- }
-}
Deleted: branches/7.1.x/client/src/test/java/org/teiid/net/socket/TestAdminApiServerDiscovery.java
===================================================================
--- branches/7.1.x/client/src/test/java/org/teiid/net/socket/TestAdminApiServerDiscovery.java 2010-10-11 15:02:22 UTC (rev 2640)
+++ branches/7.1.x/client/src/test/java/org/teiid/net/socket/TestAdminApiServerDiscovery.java 2010-10-11 16:42:47 UTC (rev 2641)
@@ -1,79 +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.net.socket;
-
-import java.net.InetAddress;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Properties;
-
-import junit.framework.TestCase;
-
-import org.mockito.Mockito;
-import org.teiid.adminapi.Admin;
-import org.teiid.adminapi.ProcessObject;
-import org.teiid.client.security.LogonResult;
-import org.teiid.net.HostInfo;
-import org.teiid.net.TeiidURL;
-
-
-public class TestAdminApiServerDiscovery extends TestCase {
-
- public void testFirewallHost() throws Exception {
- AdminApiServerDiscovery discovery = new AdminApiServerDiscovery();
- Properties p = new Properties();
- p.setProperty(AdminApiServerDiscovery.USE_URL_HOST, Boolean.TRUE.toString());
- TeiidURL mmurl = new TeiidURL("foo", 1, false); //$NON-NLS-1$
- discovery.init(mmurl, p);
- HostInfo knownHost = mmurl.getHostInfo().get(0);
- //we will start off using the url host
- assertEquals(1, discovery.getKnownHosts(null, null).size());
-
- SocketServerInstance instance = Mockito.mock(SocketServerInstance.class);
- Admin serverAdmin = Mockito.mock(Admin.class);
-
- List<ProcessObject> processes = new ArrayList<ProcessObject>();
- ProcessObject p1 = Mockito.mock(ProcessObject.class);
- Mockito.stub(p1.getPort()).toReturn(5);
- processes.add(p1);
- ProcessObject p2 = Mockito.mock(ProcessObject.class);
- Mockito.stub(p2.isEnabled()).toReturn(true);
- Mockito.stub(p2.isRunning()).toReturn(true);
- Mockito.stub(p2.getPort()).toReturn(6);
- Mockito.stub(p2.getInetAddress()).toReturn(InetAddress.getByName("0.0.0.0")); //$NON-NLS-1$
- processes.add(p2);
- Mockito.stub(serverAdmin.getProcesses("*")).toReturn(processes); //$NON-NLS-1$
- Mockito.stub(instance.getService(Admin.class)).toReturn(serverAdmin);
- Mockito.stub(instance.getHostInfo()).toReturn(knownHost);
-
- discovery.connectionSuccessful(knownHost);
- List<HostInfo> knownHosts = discovery.getKnownHosts(new LogonResult(), instance);
-
- assertEquals(1, knownHosts.size());
- HostInfo h = knownHosts.get(0);
- //the returned host should have the url name, but the process port
- assertEquals("foo", h.getHostName()); //$NON-NLS-1$
- assertEquals(6, h.getPortNumber());
- }
-
-}
Modified: branches/7.1.x/client/src/test/java/org/teiid/net/socket/TestSocketServiceRegistry.java
===================================================================
--- branches/7.1.x/client/src/test/java/org/teiid/net/socket/TestSocketServiceRegistry.java 2010-10-11 15:02:22 UTC (rev 2640)
+++ branches/7.1.x/client/src/test/java/org/teiid/net/socket/TestSocketServiceRegistry.java 2010-10-11 16:42:47 UTC (rev 2641)
@@ -29,13 +29,12 @@
import org.teiid.adminapi.Admin;
import org.teiid.adminapi.AdminException;
import org.teiid.client.DQP;
-import org.teiid.client.security.ILogon;
import org.teiid.client.util.ExceptionUtil;
import org.teiid.client.xa.XATransactionException;
import org.teiid.core.TeiidComponentException;
import org.teiid.core.TeiidRuntimeException;
-
+@SuppressWarnings("nls")
public class TestSocketServiceRegistry extends TestCase {
interface Foo{
@@ -53,7 +52,7 @@
public void testAdminExceptionConversion() throws Exception {
- Method m = Admin.class.getMethod("getProcesses", new Class[] {String.class});
+ Method m = Admin.class.getMethod("getCacheStats", new Class[] {String.class});
Throwable t = ExceptionUtil.convertException(m, new TeiidComponentException());
Modified: branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
===================================================================
--- branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2010-10-11 15:02:22 UTC (rev 2640)
+++ branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2010-10-11 16:42:47 UTC (rev 2641)
@@ -472,7 +472,7 @@
return this.requests.get(processorID);
}
- public WorkerPoolStatisticsMetadata getWorkManagerStatistics() {
+ public WorkerPoolStatisticsMetadata getWorkerPoolStatistics() {
return this.processWorkerPool.getStats();
}
Modified: branches/7.1.x/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java
===================================================================
--- branches/7.1.x/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java 2010-10-11 15:02:22 UTC (rev 2640)
+++ branches/7.1.x/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java 2010-10-11 16:42:47 UTC (rev 2641)
@@ -23,6 +23,7 @@
package org.teiid.adminapi.jboss;
import java.io.InputStream;
+import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
@@ -59,7 +60,6 @@
import org.teiid.adminapi.PropertyDefinition;
import org.teiid.adminapi.Request;
import org.teiid.adminapi.Session;
-import org.teiid.adminapi.TeiidAdmin;
import org.teiid.adminapi.Transaction;
import org.teiid.adminapi.Translator;
import org.teiid.adminapi.VDB;
@@ -75,7 +75,7 @@
import org.teiid.adminapi.impl.WorkerPoolStatisticsMetadata;
import org.teiid.jboss.IntegrationPlugin;
-public class Admin extends TeiidAdmin {
+public class Admin implements org.teiid.adminapi.Admin, Serializable {
private static final String CONNECTOR_PREFIX = "connector-"; //$NON-NLS-1$
private static final ProfileKey DEFAULT_PROFILE_KEY = new ProfileKey(ProfileKey.DEFAULT);
private static final long serialVersionUID = 7081309086056911304L;
@@ -355,10 +355,10 @@
}
@Override
- public WorkerPoolStatistics getWorkManagerStats(String identifier) throws AdminException {
+ public WorkerPoolStatistics getWorkerPoolStats() throws AdminException {
try {
ManagedComponent mc = getView().getComponent(DQPNAME, DQPTYPE);
- MetaValue value = ManagedUtil.executeOperation(mc, "getWorkManagerStatistics", SimpleValueSupport.wrap(identifier));//$NON-NLS-1$
+ MetaValue value = ManagedUtil.executeOperation(mc, "getWorkerPoolStatistics");//$NON-NLS-1$
return (WorkerPoolStatistics)MetaValueFactory.getInstance().unwrap(value, WorkerPoolStatisticsMetadata.class);
} catch (Exception e) {
throw new AdminComponentException(e.getMessage(), e);
Modified: branches/7.1.x/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
===================================================================
--- branches/7.1.x/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2010-10-11 15:02:22 UTC (rev 2640)
+++ branches/7.1.x/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2010-10-11 16:42:47 UTC (rev 2641)
@@ -29,7 +29,6 @@
import java.sql.Clob;
import java.sql.SQLException;
import java.sql.SQLXML;
-import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@@ -393,16 +392,9 @@
@Override
- @ManagementOperation(description="Get Runtime workmanager statistics", impact=Impact.ReadOnly,params={@ManagementParameter(name="identifier",description="Use \"runtime\" for engine, or connector name for connector")})
- public WorkerPoolStatisticsMetadata getWorkManagerStatistics(String identifier) {
- if ("runtime".equalsIgnoreCase(identifier)) { //$NON-NLS-1$
- return this.dqpCore.getWorkManagerStatistics();
- }
- /*ConnectorManager cm = this.dqpCore.getConnectorManagerRepository().getConnectorManager(identifier);
- if (cm != null) {
- return cm.getWorkManagerStatistics();
- }*/
- return null;
+ @ManagementOperation(description="Get thread statistics worker pool", impact=Impact.ReadOnly,params={@ManagementParameter(name="identifier",description="Get thread statistics worker pool")})
+ public WorkerPoolStatisticsMetadata getWorkerPoolStatistics(){
+ return this.dqpCore.getWorkerPoolStatistics();
}
@Override
14 years, 2 months
teiid SVN: r2640 - branches/7.1.x/documentation/client-developers-guide/src/main/docbook/en-US/content.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2010-10-11 11:02:22 -0400 (Mon, 11 Oct 2010)
New Revision: 2640
Modified:
branches/7.1.x/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-extensions.xml
branches/7.1.x/documentation/client-developers-guide/src/main/docbook/en-US/content/ssl.xml
Log:
TEIID-1298: Both the links were to external document. Replaced with location details instead of the URL.
Modified: branches/7.1.x/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-extensions.xml
===================================================================
--- branches/7.1.x/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-extensions.xml 2010-10-11 02:02:07 UTC (rev 2639)
+++ branches/7.1.x/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-extensions.xml 2010-10-11 15:02:22 UTC (rev 2640)
@@ -142,7 +142,8 @@
</entry>
<entry>
<para>Determines whether XML documents returned by XML document models will be validated
- against their schema after processing. See the <link linkend="document_validation">document validation</link> section.</para>
+ against their schema after processing. See the Reference Guide's "XML SELECT Command" chapter and
+ "document validation" section.</para>
</entry>
</row>
<row>
Modified: branches/7.1.x/documentation/client-developers-guide/src/main/docbook/en-US/content/ssl.xml
===================================================================
--- branches/7.1.x/documentation/client-developers-guide/src/main/docbook/en-US/content/ssl.xml 2010-10-11 02:02:07 UTC (rev 2639)
+++ branches/7.1.x/documentation/client-developers-guide/src/main/docbook/en-US/content/ssl.xml 2010-10-11 15:02:22 UTC (rev 2640)
@@ -8,7 +8,7 @@
<para>This chapter will shows you various security configurations
that can be used with Teiid in securing your data access. Note that data level
- security (<link linkend="entitlements">data roles</link>) are explained in separate chapter.</para>
+ security called as "data roles" are explained in Reference Guide. This chapter pertains to transport level security.</para>
<section id="default_security">
<title>Default Security</title>
14 years, 2 months
teiid SVN: r2639 - in branches/7.1.x/console/src/main: java/org/teiid/rhq/plugin and 3 other directories.
by teiid-commits@lists.jboss.org
Author: tejones
Date: 2010-10-10 22:02:07 -0400 (Sun, 10 Oct 2010)
New Revision: 2639
Modified:
branches/7.1.x/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java
branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/VDBComponent.java
branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/objects/ExecutedOperationResultImpl.java
branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/util/PluginConstants.java
branches/7.1.x/console/src/main/resources/META-INF/rhq-plugin.xml
Log:
TEIID-982: Added Refresh Materialized Views operation at the VDB level
Modified: branches/7.1.x/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java
===================================================================
--- branches/7.1.x/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java 2010-10-08 02:24:14 UTC (rev 2638)
+++ branches/7.1.x/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java 2010-10-11 02:02:07 UTC (rev 2639)
@@ -327,8 +327,20 @@
connection, formatVdbName(vdbName), Integer
.parseInt(vdbVersion));
getResultsCollectionValue(resultsMetaValue, sqlResultsObject);
- operationResult.setContent(createReportResultListForMatViewQuery(fieldNameList,
- sqlResultsObject.iterator()));
+ operationResult.setContent(createReportResultListForMatViewQuery(
+ fieldNameList, sqlResultsObject.iterator()));
+ } else if (operationName.equals(VDB.Operations.RELOAD_MATVIEW)) {
+ List<String> fieldNameList = operationResult.getFieldNameList();
+ MetaValue resultsMetaValue = reloadMaterializedView(connection,
+ formatVdbName(vdbName), Integer.parseInt(vdbVersion),
+ (String) valueMap.get(Operation.Value.MATVIEW_SCHEMA),
+ (String) valueMap.get(Operation.Value.MATVIEW_TABLE),
+ (Boolean) valueMap.get(Operation.Value.INVALIDATE_MATVIEW));
+ if (resultsMetaValue==null) {
+ operationResult.setContent("failure - see log for details"); //$NON-NLS-1$
+ } else {
+ operationResult.setContent("data successfully refreshed!"); //$NON-NLS-1$
+ }
}
}
@@ -390,7 +402,7 @@
MetaValueFactory.getInstance().create(
Operation.Value.MAT_VIEW_QUERY),
MetaValueFactory.getInstance()
- .create(Long.parseLong("9999999")) };
+ .create(Long.parseLong("9999999")) }; //$NON-NLS-1$
try {
resultsCollection = executeManagedOperation(connection,
@@ -405,6 +417,36 @@
}
+ protected MetaValue reloadMaterializedView(
+ ProfileServiceConnection connection, String vdbName,
+ int vdbVersion, String schema, String table, Boolean invalidate) {
+
+ MetaValue result = null;
+ String matView = schema + "." + table; //$NON-NLS-1$
+ String query = PluginConstants.Operation.Value.MAT_VIEW_REFRESH;
+ query = query.replace("param1", matView); //$NON-NLS-1$
+ query = query.replace("param2", invalidate.toString()); //$NON-NLS-1$
+ MetaValue[] args = new MetaValue[] {
+ MetaValueFactory.getInstance().create(vdbName),
+ MetaValueFactory.getInstance().create(vdbVersion),
+ MetaValueFactory.getInstance().create(query),
+ MetaValueFactory.getInstance()
+ .create(Long.parseLong("9999999")) }; //$NON-NLS-1$
+
+ try {
+ result = executeManagedOperation(connection,
+ getRuntimeEngineDeployer(connection, mc),
+ VDB.Operations.EXECUTE_QUERIES, args);
+ } catch (Exception e) {
+ final String msg = "Exception executing operation: " + VDB.Operations.RELOAD_MATVIEW; //$NON-NLS-1$
+ LOG.error(msg, e);
+
+ }
+
+ return result;
+
+ }
+
protected MetaValue getRequestsForVDB(ProfileServiceConnection connection,
String vdbName, int vdbVersion) {
@@ -504,10 +546,11 @@
} catch (Exception e) {
final String msg = "Exception getting the AdminApi in " + operation; //$NON-NLS-1$
LOG.error(msg, e);
+ throw new RuntimeException(e);
}
}
}
- throw new Exception("No operation found with given name =" + operation); //$NON-NLS-1$
+ throw new Exception("No operation found with given name = " + operation); //$NON-NLS-1$
}
@@ -712,13 +755,27 @@
for (MetaValue value : ((CollectionValueSupport) pValue)
.getElements()) {
if (value.getMetaType().isCollection()) {
- ArrayList<String> row = (ArrayList<String>)MetaValueFactory.getInstance().unwrap(value);
- list.add(row);
+ ArrayList<String> row = (ArrayList<String>) MetaValueFactory
+ .getInstance().unwrap(value);
+ list.add(row);
}
}
}
}
+ private void getResultsCollectionValueForMatViewRefresh(MetaValue pValue,
+ Collection<ArrayList<String>> list) {
+ MetaType metaType = pValue.getMetaType();
+ for (MetaValue value : ((CollectionValueSupport) pValue).getElements()) {
+ if (value.getMetaType().isCollection()) {
+ ArrayList<String> row = (ArrayList<String>) MetaValueFactory
+ .getInstance().unwrap(value);
+ list.add(row);
+ }
+ }
+
+ }
+
public static <T> void getTransactionCollectionValue(MetaValue pValue,
Collection<Transaction> list) {
MetaType metaType = pValue.getMetaType();
@@ -801,21 +858,22 @@
}
return reportResultList;
}
-
- private Collection createReportResultListForMatViewQuery(List fieldNameList,
- Iterator objectIter) {
+
+ private Collection createReportResultListForMatViewQuery(
+ List fieldNameList, Iterator objectIter) {
Collection reportResultList = new ArrayList();
- //Iterate throught rows
+ // Iterate through rows
while (objectIter.hasNext()) {
- ArrayList<String> columnValues = (ArrayList<String>)objectIter.next();
+ ArrayList<String> columnValues = (ArrayList<String>) objectIter
+ .next();
Class cls = null;
try {
Iterator fieldIter = fieldNameList.iterator();
- Map reportValueMap = new HashMap<String, String>();
- //Iterate through columns with a row
- for (String columnValue: columnValues) {
+ Map reportValueMap = new HashMap<String, Object>();
+ // Iterate through columns with a row
+ for (Object columnValue : columnValues) {
String fieldName = (String) fieldIter.next();
reportValueMap.put(fieldName, columnValue);
}
Modified: branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/VDBComponent.java
===================================================================
--- branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/VDBComponent.java 2010-10-08 02:24:14 UTC (rev 2638)
+++ branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/VDBComponent.java 2010-10-11 02:02:07 UTC (rev 2639)
@@ -123,8 +123,14 @@
} else if (name.equals(Platform.Operations.KILL_SESSION)) {
valueMap.put(Operation.Value.SESSION_ID, configuration.getSimple(
Operation.Value.SESSION_ID).getLongValue());
- }
-
+ } else if (name.equals(VDB.Operations.RELOAD_MATVIEW)) {
+ valueMap.put(Operation.Value.MATVIEW_SCHEMA, configuration.getSimple(
+ Operation.Value.MATVIEW_SCHEMA).getStringValue());
+ valueMap.put(Operation.Value.MATVIEW_TABLE, configuration.getSimple(
+ Operation.Value.MATVIEW_TABLE).getStringValue());
+ valueMap.put(Operation.Value.INVALIDATE_MATVIEW, configuration.getSimple(
+ Operation.Value.INVALIDATE_MATVIEW).getBooleanValue());
+ }
}
/*
Modified: branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/objects/ExecutedOperationResultImpl.java
===================================================================
--- branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/objects/ExecutedOperationResultImpl.java 2010-10-08 02:24:14 UTC (rev 2638)
+++ branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/objects/ExecutedOperationResultImpl.java 2010-10-11 02:02:07 UTC (rev 2639)
@@ -134,6 +134,10 @@
.getPropertyDefinitions();
PropertyDefinition listPropDefinition = (PropertyDefinition) propDefs
.get(LISTNAME);
+
+ if (listPropDefinition == null) {
+ continue;
+ }
PropertyDefinition propertyDefinitionMap = ((PropertyDefinitionList) listPropDefinition)
.getMemberDefinition();
Modified: branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/util/PluginConstants.java
===================================================================
--- branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/util/PluginConstants.java 2010-10-08 02:24:14 UTC (rev 2638)
+++ branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/util/PluginConstants.java 2010-10-11 02:02:07 UTC (rev 2639)
@@ -106,6 +106,7 @@
public final static String GET_REQUESTS = "getRequestsUsingVDB"; //$NON-NLS-1$
public final static String GET_SESSIONS = "getSessions"; //$NON-NLS-1$
public final static String GET_MATVIEWS = "getMaterializedViews"; //$NON-NLS-1$
+ public final static String RELOAD_MATVIEW = "reloadMaterializedView"; //$NON-NLS-1$
}
@@ -232,6 +233,7 @@
public final static String STOP_NOW = "stopNow"; //$NON-NLS-1$
public final static String MAT_VIEW_QUERY = "select SchemaName, Name, TargetSchemaName, TargetName, " + //$NON-NLS-1$
"Valid, LoadState, Updated, Cardinality from SYSADMIN.MATVIEWS"; //$NON-NLS-1$
+ public final static String MAT_VIEW_REFRESH = "exec SYSADMIN.refreshMatView('param1','param2');"; //$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$
@@ -247,6 +249,9 @@
public final static String VDB_VERSION = "vdbVersion"; //$NON-NLS-1$
public final static String NAME = "Name"; //$NON-NLS-1$
public final static String VALUE = "Value"; //$NON-NLS-1$
+ public final static String MATVIEW_SCHEMA = "schema"; //$NON-NLS-1$
+ public final static String MATVIEW_TABLE = "table"; //$NON-NLS-1$
+ public final static String INVALIDATE_MATVIEW = "invalidate"; //$NON-NLS-1$
}
Modified: branches/7.1.x/console/src/main/resources/META-INF/rhq-plugin.xml
===================================================================
--- branches/7.1.x/console/src/main/resources/META-INF/rhq-plugin.xml 2010-10-08 02:24:14 UTC (rev 2638)
+++ branches/7.1.x/console/src/main/resources/META-INF/rhq-plugin.xml 2010-10-11 02:02:07 UTC (rev 2639)
@@ -471,6 +471,7 @@
<operation name="getMaterializedViews" displayName="Get Materialized View Info"
description="Get any Materialized Views for this VDB">
+
<results>
<c:list-property name="list" displayName=" Materialized Views"
@@ -490,14 +491,34 @@
<c:simple-property displayName="Current State"
name="loadState" type="string" description="Processing time for the request" />
<c:simple-property displayName="Last Updated"
- name="updated" type="string" description="Last time of data refresh" />
+ name="updated" type="integer" description="Last time of data refresh" />
<c:simple-property displayName="Cardinality"
- name="cardinality" type="string" description="Row count" />
+ name="cardinality" type="integer" description="Row count" />
</c:map-property>
</c:list-property>
</results>
</operation>
+ <operation name="reloadMaterializedView" displayName="Refresh a Materialized View"
+ description="Refresh a given any Materialized View for this VDB">
+ <parameters>
+ <c:simple-property displayName="Materialized View Schema"
+ name="schema" type="string" required="true"
+ description="The schema name of the Materialized View to refresh" />
+ <c:simple-property displayName="Materialized View Table"
+ name="table" type="string" required="true"
+ description="The table name of the Materialized View to refresh" />
+ <c:simple-property displayName="Invalidate Current Materialized View"
+ name="invalidate" type="boolean" required="true"
+ description="If true, will invalidate the current Materialized View" />
+ </parameters>
+
+ <results>
+ <c:simple-property displayName="Result" name="operationResult"
+ type="string" description="Result of refresh" />
+ </results>
+ </operation>
+
<metric displayName="Status" defaultOn="true" dataType="trait"
displayType="summary" category="availability" property="status"
description="The status of this VDB" />
14 years, 2 months
teiid SVN: r2638 - in branches/7.1.x/engine/src: test/java/org/teiid/query/validator and 1 other directory.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-10-07 22:24:14 -0400 (Thu, 07 Oct 2010)
New Revision: 2638
Modified:
branches/7.1.x/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java
branches/7.1.x/engine/src/test/java/org/teiid/query/validator/TestValidator.java
Log:
TEIID-1293 tightening validation related to updates.
Modified: branches/7.1.x/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java
===================================================================
--- branches/7.1.x/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java 2010-10-08 02:23:51 UTC (rev 2637)
+++ branches/7.1.x/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java 2010-10-08 02:24:14 UTC (rev 2638)
@@ -97,6 +97,7 @@
import org.teiid.query.sql.proc.DeclareStatement;
import org.teiid.query.sql.proc.HasCriteria;
import org.teiid.query.sql.proc.IfStatement;
+import org.teiid.query.sql.proc.LoopStatement;
import org.teiid.query.sql.proc.TranslateCriteria;
import org.teiid.query.sql.proc.WhileStatement;
import org.teiid.query.sql.symbol.AggregateSymbol;
@@ -1366,7 +1367,13 @@
validateSubquery(obj);
}
- public void validateSubquery(SubqueryContainer subQuery) {
+ @Override
+ public void visit(LoopStatement obj) {
+ validateSubquery(obj);
+ }
+
+ //TODO: it may be simplier to catch this in the parser
+ private void validateSubquery(SubqueryContainer subQuery) {
if (subQuery.getCommand() instanceof Query && ((Query)subQuery.getCommand()).getInto() != null) {
handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.subquery_insert"), subQuery.getCommand()); //$NON-NLS-1$
}
Modified: branches/7.1.x/engine/src/test/java/org/teiid/query/validator/TestValidator.java
===================================================================
--- branches/7.1.x/engine/src/test/java/org/teiid/query/validator/TestValidator.java 2010-10-08 02:23:51 UTC (rev 2637)
+++ branches/7.1.x/engine/src/test/java/org/teiid/query/validator/TestValidator.java 2010-10-08 02:24:14 UTC (rev 2638)
@@ -345,32 +345,37 @@
try {
ValidatorReport report = Validator.validate(command, metadata);
- // Get invalid objects from report
- Collection actualObjs = new ArrayList();
- report.collectInvalidObjects(actualObjs);
-
- // Compare expected and actual objects
- Set expectedStrings = new HashSet(Arrays.asList(expectedStringArray));
- Set actualStrings = new HashSet();
- Iterator objIter = actualObjs.iterator();
- while(objIter.hasNext()) {
- LanguageObject obj = (LanguageObject) objIter.next();
- actualStrings.add(SQLStringVisitor.getSQLString(obj));
- }
-
- if(expectedStrings.size() == 0 && actualStrings.size() > 0) {
- fail("Expected no failures but got some: " + report.getFailureMessage()); //$NON-NLS-1$
- } else if(actualStrings.size() == 0 && expectedStrings.size() > 0) {
- fail("Expected some failures but got none for sql = " + command); //$NON-NLS-1$
- } else {
- assertEquals("Expected and actual sets of strings are not the same: ", expectedStrings, actualStrings); //$NON-NLS-1$
- }
+ examineReport(command, expectedStringArray, report);
return report;
} catch(TeiidException e) {
throw new TeiidRuntimeException(e);
}
}
+ private static void examineReport(Object command,
+ String[] expectedStringArray, ValidatorReport report) {
+ // Get invalid objects from report
+ Collection actualObjs = new ArrayList();
+ report.collectInvalidObjects(actualObjs);
+
+ // Compare expected and actual objects
+ Set<String> expectedStrings = new HashSet(Arrays.asList(expectedStringArray));
+ Set<String> actualStrings = new HashSet<String>();
+ Iterator objIter = actualObjs.iterator();
+ while(objIter.hasNext()) {
+ LanguageObject obj = (LanguageObject) objIter.next();
+ actualStrings.add(SQLStringVisitor.getSQLString(obj));
+ }
+
+ if(expectedStrings.size() == 0 && actualStrings.size() > 0) {
+ fail("Expected no failures but got some: " + report.getFailureMessage()); //$NON-NLS-1$
+ } else if(actualStrings.size() == 0 && expectedStrings.size() > 0) {
+ fail("Expected some failures but got none for sql = " + command); //$NON-NLS-1$
+ } else {
+ assertEquals("Expected and actual sets of strings are not the same: ", expectedStrings, actualStrings); //$NON-NLS-1$
+ }
+ }
+
private void helpValidateProcedure(String procedure, String userUpdateStr, String procedureType) {
QueryMetadataInterface metadata = FakeMetadataFactory.exampleUpdateProc(procedureType, procedure);
@@ -2045,4 +2050,17 @@
@Test public void testInvalidIntoSubquery3() {
helpValidate("SELECT e2 FROM pm1.g2 WHERE e2 in (SELECT e1, e2 INTO #x FROM pm1.g1 WHERE e2 = '3')", new String[] {"SELECT e1, e2 INTO #x FROM pm1.g1 WHERE e2 = '3'"}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
}
+
+ @Test public void testInvalidIntoSubquery4() throws Exception {
+ StringBuffer procedure = new StringBuffer("CREATE VIRTUAL PROCEDURE\n") //$NON-NLS-1$
+ .append("BEGIN\n") //$NON-NLS-1$
+ .append("loop on (SELECT e1, e2 INTO #x FROM pm1.g1 WHERE e2 = '3') as x\n") //$NON-NLS-1$
+ .append("BEGIN\nSELECT 1;\nEND\nSELECT 1\n;END\n"); //$NON-NLS-1$
+
+ QueryMetadataInterface metadata = FakeMetadataFactory.example1Cached();
+
+ // Validate
+ ValidatorReport report = helpValidateInModeler("pm1.vsp36", procedure.toString(), metadata); //$NON-NLS-1$
+ examineReport(procedure, new String[] {"SELECT e1, e2 INTO #x FROM pm1.g1 WHERE e2 = '3'"}, report);
+ }
}
14 years, 2 months
teiid SVN: r2637 - branches/7.1.x/engine/src/main/resources/org/teiid/query.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-10-07 22:23:51 -0400 (Thu, 07 Oct 2010)
New Revision: 2637
Modified:
branches/7.1.x/engine/src/main/resources/org/teiid/query/i18n.properties
Log:
TEIID-1297 updating message file
Modified: branches/7.1.x/engine/src/main/resources/org/teiid/query/i18n.properties
===================================================================
--- branches/7.1.x/engine/src/main/resources/org/teiid/query/i18n.properties 2010-10-07 22:34:28 UTC (rev 2636)
+++ branches/7.1.x/engine/src/main/resources/org/teiid/query/i18n.properties 2010-10-08 02:23:51 UTC (rev 2637)
@@ -824,6 +824,8 @@
# services (003)
Request.Invalid_character_in_query=Bind variables (represented as "?") were found but are allowed only in prepared or callable statements.
+Request.no_result_set=The query does not return an update count.
+Request.result_set=The query does not return a result set.
ProcessWorker.wrongdata=Wrong type of data found or no data found; expecting streamable object from the buffer manager.
ProcessWorker.LobError=An error occurred during streaming of Lob Chunks to Client.
14 years, 2 months
teiid SVN: r2636 - in branches/7.1.x/console/src/main: java/org/teiid/rhq/plugin and 2 other directories.
by teiid-commits@lists.jboss.org
Author: tejones
Date: 2010-10-07 18:34:28 -0400 (Thu, 07 Oct 2010)
New Revision: 2636
Modified:
branches/7.1.x/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java
branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/VDBComponent.java
branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/util/PluginConstants.java
branches/7.1.x/console/src/main/resources/META-INF/rhq-plugin.xml
Log:
TEIID-982: Added Get Materialized Views operation at the VDB level
Modified: branches/7.1.x/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java
===================================================================
--- branches/7.1.x/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java 2010-10-07 18:42:05 UTC (rev 2635)
+++ branches/7.1.x/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java 2010-10-07 22:34:28 UTC (rev 2636)
@@ -64,9 +64,11 @@
public class DQPManagementView implements PluginConstants {
private static ManagedComponent mc = null;
- private static final Log LOG = LogFactory.getLog(PluginConstants.DEFAULT_LOGGER_CATEGORY);
- private static final MetaValueFactory metaValueFactory = MetaValueFactory.getInstance();
-
+ private static final Log LOG = LogFactory
+ .getLog(PluginConstants.DEFAULT_LOGGER_CATEGORY);
+ private static final MetaValueFactory metaValueFactory = MetaValueFactory
+ .getInstance();
+
private static final String VDB_EXT = ".vdb";
public DQPManagementView() {
@@ -75,52 +77,67 @@
/*
* Metric methods
*/
- public Object getMetric(ProfileServiceConnection connection, String componentType, String identifier, String metric, Map<String, Object> valueMap) {
+ public Object getMetric(ProfileServiceConnection connection,
+ String componentType, String identifier, String metric,
+ Map<String, Object> valueMap) {
Object resultObject = new Object();
if (componentType.equals(PluginConstants.ComponentType.Platform.NAME)) {
- resultObject = getPlatformMetric(connection, componentType, metric, valueMap);
+ resultObject = getPlatformMetric(connection, componentType, metric,
+ valueMap);
} else if (componentType.equals(PluginConstants.ComponentType.VDB.NAME)) {
- resultObject = getVdbMetric(connection, componentType, identifier,metric, valueMap);
+ resultObject = getVdbMetric(connection, componentType, identifier,
+ metric, valueMap);
}
return resultObject;
}
- private Object getPlatformMetric(ProfileServiceConnection connection, String componentType, String metric,
- Map<String, Object> valueMap) {
+ private Object getPlatformMetric(ProfileServiceConnection connection,
+ String componentType, String metric, Map<String, Object> valueMap) {
Object resultObject = new Object();
- if (metric .equals(PluginConstants.ComponentType.Platform.Metrics.QUERY_COUNT)) {
+ if (metric
+ .equals(PluginConstants.ComponentType.Platform.Metrics.QUERY_COUNT)) {
resultObject = new Double(getQueryCount(connection).doubleValue());
- } else if (metric .equals(PluginConstants.ComponentType.Platform.Metrics.SESSION_COUNT)) {
+ } else if (metric
+ .equals(PluginConstants.ComponentType.Platform.Metrics.SESSION_COUNT)) {
resultObject = new Double(getSessionCount(connection).doubleValue());
- } else if (metric .equals(PluginConstants.ComponentType.Platform.Metrics.LONG_RUNNING_QUERIES)) {
- Collection<Request> longRunningQueries = new ArrayList<Request>();
- getRequestCollectionValue(getLongRunningQueries(connection), longRunningQueries);
- resultObject = new Double(longRunningQueries.size());
- } else if (metric.equals(PluginConstants.ComponentType.Platform.Metrics.BUFFER_USAGE)) {
+ } else if (metric
+ .equals(PluginConstants.ComponentType.Platform.Metrics.LONG_RUNNING_QUERIES)) {
+ Collection<Request> longRunningQueries = new ArrayList<Request>();
+ getRequestCollectionValue(getLongRunningQueries(connection),
+ longRunningQueries);
+ resultObject = new Double(longRunningQueries.size());
+ } else if (metric
+ .equals(PluginConstants.ComponentType.Platform.Metrics.BUFFER_USAGE)) {
try {
- resultObject = ProfileServiceUtil.doubleValue(getUsedBufferSpace(connection));
+ resultObject = ProfileServiceUtil
+ .doubleValue(getUsedBufferSpace(connection));
} catch (Exception e) {
final String msg = "Exception executing operation: " + Platform.Operations.GET_BUFFER_USAGE; //$NON-NLS-1$
LOG.error(msg, e);
}
- } else if (metric.startsWith(Admin.Cache.PREPARED_PLAN_CACHE.toString()+".") //$NON-NLS-1$
- || metric.startsWith(Admin.Cache.QUERY_SERVICE_RESULT_SET_CACHE.toString()+".")) { //$NON-NLS-1$
+ } else if (metric.startsWith(Admin.Cache.PREPARED_PLAN_CACHE.toString()
+ + ".") //$NON-NLS-1$
+ || metric.startsWith(Admin.Cache.QUERY_SERVICE_RESULT_SET_CACHE
+ .toString()
+ + ".")) { //$NON-NLS-1$
return getCacheProperty(connection, metric);
}
return resultObject;
}
-
- private Object getCacheProperty(ProfileServiceConnection connection, String metric) {
+
+ private Object getCacheProperty(ProfileServiceConnection connection,
+ String metric) {
int dotIndex = metric.indexOf('.');
String cacheType = metric.substring(0, dotIndex);
- String property = metric.substring(dotIndex+1);
- CompositeValueSupport mv = (CompositeValueSupport)getCacheStats(connection, cacheType);
- MetaValue v = mv.get(property);
- return ((SimpleValue)v).getValue();
+ String property = metric.substring(dotIndex + 1);
+ CompositeValueSupport mv = (CompositeValueSupport) getCacheStats(
+ connection, cacheType);
+ MetaValue v = mv.get(property);
+ return ((SimpleValue) v).getValue();
}
private Object getVdbMetric(ProfileServiceConnection connection,
@@ -129,19 +146,27 @@
Object resultObject = new Object();
- if (metric .equals(PluginConstants.ComponentType.VDB.Metrics.ERROR_COUNT)) {
+ if (metric
+ .equals(PluginConstants.ComponentType.VDB.Metrics.ERROR_COUNT)) {
// TODO remove version parameter after AdminAPI is changed
- resultObject = getErrorCount(connection, (String) valueMap.get(VDB.NAME));
- } else if (metric.equals(PluginConstants.ComponentType.VDB.Metrics.STATUS)) {
+ resultObject = getErrorCount(connection, (String) valueMap
+ .get(VDB.NAME));
+ } else if (metric
+ .equals(PluginConstants.ComponentType.VDB.Metrics.STATUS)) {
// TODO remove version parameter after AdminAPI is changed
- resultObject = getVDBStatus(connection, (String) valueMap.get(VDB.NAME));
- } else if (metric.equals(PluginConstants.ComponentType.VDB.Metrics.QUERY_COUNT)) {
+ resultObject = getVDBStatus(connection, (String) valueMap
+ .get(VDB.NAME));
+ } else if (metric
+ .equals(PluginConstants.ComponentType.VDB.Metrics.QUERY_COUNT)) {
resultObject = new Double(getQueryCount(connection).doubleValue());
- } else if (metric.equals(PluginConstants.ComponentType.VDB.Metrics.SESSION_COUNT)) {
+ } else if (metric
+ .equals(PluginConstants.ComponentType.VDB.Metrics.SESSION_COUNT)) {
resultObject = new Double(getSessionCount(connection).doubleValue());
- } else if (metric.equals(PluginConstants.ComponentType.VDB.Metrics.LONG_RUNNING_QUERIES)) {
+ } else if (metric
+ .equals(PluginConstants.ComponentType.VDB.Metrics.LONG_RUNNING_QUERIES)) {
Collection<Request> longRunningQueries = new ArrayList<Request>();
- getRequestCollectionValue(getLongRunningQueries(connection), longRunningQueries);
+ getRequestCollectionValue(getLongRunningQueries(connection),
+ longRunningQueries);
resultObject = new Double(longRunningQueries.size());
}
return resultObject;
@@ -151,12 +176,17 @@
* Operation methods
*/
- public void executeOperation(ProfileServiceConnection connection, ExecutedResult operationResult, final Map<String, Object> valueMap) {
+ public void executeOperation(ProfileServiceConnection connection,
+ ExecutedResult operationResult, final Map<String, Object> valueMap) {
- if (operationResult.getComponentType().equals(PluginConstants.ComponentType.Platform.NAME)) {
- executePlatformOperation(connection, operationResult, operationResult.getOperationName(), valueMap);
- } else if (operationResult.getComponentType().equals( PluginConstants.ComponentType.VDB.NAME)) {
- executeVdbOperation(connection, operationResult, operationResult .getOperationName(), valueMap);
+ if (operationResult.getComponentType().equals(
+ PluginConstants.ComponentType.Platform.NAME)) {
+ executePlatformOperation(connection, operationResult,
+ operationResult.getOperationName(), valueMap);
+ } else if (operationResult.getComponentType().equals(
+ PluginConstants.ComponentType.VDB.NAME)) {
+ executeVdbOperation(connection, operationResult, operationResult
+ .getOperationName(), valueMap);
}
}
@@ -199,8 +229,9 @@
MetaValue[] args = new MetaValue[] { metaValueFactory
.create(sessionID) };
try {
- executeManagedOperation(connection, getRuntimeEngineDeployer(connection, mc),
- Platform.Operations.KILL_TRANSACTION, args);
+ executeManagedOperation(connection, getRuntimeEngineDeployer(
+ connection, mc), Platform.Operations.KILL_TRANSACTION,
+ args);
} catch (Exception e) {
final String msg = "Exception executing operation: " + Platform.Operations.KILL_TRANSACTION; //$NON-NLS-1$
LOG.error(msg, e);
@@ -210,8 +241,8 @@
MetaValue[] args = new MetaValue[] { metaValueFactory
.create(sessionID) };
try {
- executeManagedOperation(connection, getRuntimeEngineDeployer(connection, mc),
- Platform.Operations.KILL_SESSION, args);
+ executeManagedOperation(connection, getRuntimeEngineDeployer(
+ connection, mc), Platform.Operations.KILL_SESSION, args);
} catch (Exception e) {
final String msg = "Exception executing operation: " + Platform.Operations.KILL_SESSION; //$NON-NLS-1$
LOG.error(msg, e);
@@ -223,31 +254,35 @@
metaValueFactory.create(requestID),
metaValueFactory.create(sessionID) };
try {
- executeManagedOperation(connection, getRuntimeEngineDeployer(connection, mc),
- Platform.Operations.KILL_REQUEST, args);
+ executeManagedOperation(connection, getRuntimeEngineDeployer(
+ connection, mc), Platform.Operations.KILL_REQUEST, args);
} catch (Exception e) {
final String msg = "Exception executing operation: " + Platform.Operations.KILL_REQUEST; //$NON-NLS-1$
LOG.error(msg, e);
}
} else if (operationName.equals(Platform.Operations.DEPLOY_VDB_BY_URL)) {
String vdbUrl = (String) valueMap.get(Operation.Value.VDB_URL);
- String deployName = (String) valueMap.get(Operation.Value.VDB_DEPLOY_NAME);
+ String deployName = (String) valueMap
+ .get(Operation.Value.VDB_DEPLOY_NAME);
Object vdbVersion = valueMap.get(Operation.Value.VDB_VERSION);
- //strip off vdb extension if user added it
- if (deployName.endsWith(VDB_EXT)){
- deployName = deployName.substring(0, deployName.lastIndexOf(VDB_EXT));
+ // strip off vdb extension if user added it
+ if (deployName.endsWith(VDB_EXT)) {
+ deployName = deployName.substring(0, deployName
+ .lastIndexOf(VDB_EXT));
}
- if (vdbVersion!=null){
- deployName = deployName + "." + ((Integer)vdbVersion).toString() + VDB_EXT; //$NON-NLS-1$
+ if (vdbVersion != null) {
+ deployName = deployName
+ + "." + ((Integer) vdbVersion).toString() + VDB_EXT; //$NON-NLS-1$
}
- //add vdb extension if there was no version
- if (!deployName.endsWith(VDB_EXT)){
- deployName = deployName + VDB_EXT;
+ // add vdb extension if there was no version
+ if (!deployName.endsWith(VDB_EXT)) {
+ deployName = deployName + VDB_EXT;
}
-
+
try {
URL url = new URL(vdbUrl);
- DeploymentUtils.deployArchive(deployName, connection.getDeploymentManager(), url, false);
+ DeploymentUtils.deployArchive(deployName, connection
+ .getDeploymentManager(), url, false);
} catch (Exception e) {
final String msg = "Exception executing operation: " + Platform.Operations.DEPLOY_VDB_BY_URL; //$NON-NLS-1$
LOG.error(msg, e);
@@ -259,6 +294,7 @@
private void executeVdbOperation(ProfileServiceConnection connection,
ExecutedResult operationResult, final String operationName,
final Map<String, Object> valueMap) {
+ Collection<ArrayList<String>> sqlResultsObject = new ArrayList<ArrayList<String>>();
Collection<Request> resultObject = new ArrayList<Request>();
Collection<Session> activeSessionsCollection = new ArrayList<Session>();
String vdbName = (String) valueMap
@@ -285,6 +321,14 @@
getRequestCollectionValue(requestMetaValue, resultObject);
operationResult.setContent(createReportResultList(fieldNameList,
resultObject.iterator()));
+ } else if (operationName.equals(VDB.Operations.GET_MATVIEWS)) {
+ List<String> fieldNameList = operationResult.getFieldNameList();
+ MetaValue resultsMetaValue = executeMaterializedViewQuery(
+ connection, formatVdbName(vdbName), Integer
+ .parseInt(vdbVersion));
+ getResultsCollectionValue(resultsMetaValue, sqlResultsObject);
+ operationResult.setContent(createReportResultListForMatViewQuery(fieldNameList,
+ sqlResultsObject.iterator()));
}
}
@@ -293,6 +337,11 @@
* Helper methods
*/
+ private String formatVdbName(String vdbName) {
+
+ return vdbName.substring(0, vdbName.indexOf(".")); //$NON-NLS-1$
+ }
+
public MetaValue getProperties(ProfileServiceConnection connection,
final String component) {
@@ -300,7 +349,8 @@
MetaValue args = null;
try {
- propertyValue = executeManagedOperation(connection, getRuntimeEngineDeployer(connection, mc),
+ propertyValue = executeManagedOperation(connection,
+ getRuntimeEngineDeployer(connection, mc),
PluginConstants.Operation.GET_PROPERTIES, args);
} catch (Exception e) {
final String msg = "Exception executing operation: " + Platform.Operations.GET_PROPERTIES; //$NON-NLS-1$
@@ -317,9 +367,10 @@
MetaValue args = null;
try {
- requestsCollection = executeManagedOperation(connection, getRuntimeEngineDeployer(connection, mc),
+ requestsCollection = executeManagedOperation(connection,
+ getRuntimeEngineDeployer(connection, mc),
- PluginConstants.Operation.GET_REQUESTS, args);
+ PluginConstants.Operation.GET_REQUESTS, args);
} catch (Exception e) {
final String msg = "Exception executing operation: " + Platform.Operations.GET_REQUESTS; //$NON-NLS-1$
LOG.error(msg, e);
@@ -329,6 +380,31 @@
}
+ protected MetaValue executeMaterializedViewQuery(
+ ProfileServiceConnection connection, String vdbName, int vdbVersion) {
+
+ MetaValue resultsCollection = null;
+ MetaValue[] args = new MetaValue[] {
+ MetaValueFactory.getInstance().create(vdbName),
+ MetaValueFactory.getInstance().create(vdbVersion),
+ MetaValueFactory.getInstance().create(
+ Operation.Value.MAT_VIEW_QUERY),
+ MetaValueFactory.getInstance()
+ .create(Long.parseLong("9999999")) };
+
+ try {
+ resultsCollection = executeManagedOperation(connection,
+ getRuntimeEngineDeployer(connection, mc),
+ VDB.Operations.EXECUTE_QUERIES, args);
+ } catch (Exception e) {
+ final String msg = "Exception executing operation: " + VDB.Operations.EXECUTE_QUERIES; //$NON-NLS-1$
+ LOG.error(msg, e);
+ }
+
+ return resultsCollection;
+
+ }
+
protected MetaValue getRequestsForVDB(ProfileServiceConnection connection,
String vdbName, int vdbVersion) {
@@ -338,7 +414,8 @@
MetaValueFactory.getInstance().create(vdbVersion) };
try {
- requestsCollection = executeManagedOperation(connection, getRuntimeEngineDeployer(connection, mc),
+ requestsCollection = executeManagedOperation(connection,
+ getRuntimeEngineDeployer(connection, mc),
PluginConstants.ComponentType.VDB.Operations.GET_REQUESTS,
args);
} catch (Exception e) {
@@ -356,7 +433,8 @@
MetaValue args = null;
try {
- transactionsCollection = executeManagedOperation(connection, getRuntimeEngineDeployer(connection, mc),
+ transactionsCollection = executeManagedOperation(connection,
+ getRuntimeEngineDeployer(connection, mc),
Platform.Operations.GET_TRANSACTIONS, args);
} catch (Exception e) {
final String msg = "Exception executing operation: " + Platform.Operations.GET_TRANSACTIONS; //$NON-NLS-1$
@@ -373,7 +451,8 @@
MetaValue args = null;
try {
- sessionCollection = executeManagedOperation(connection, getRuntimeEngineDeployer(connection, mc),
+ sessionCollection = executeManagedOperation(connection,
+ getRuntimeEngineDeployer(connection, mc),
PluginConstants.Operation.GET_SESSIONS, args);
} catch (Exception e) {
final String msg = "Exception executing operation: " + Platform.Operations.GET_SESSIONS; //$NON-NLS-1$
@@ -401,7 +480,7 @@
final String msg = "Exception in getVDBStatus(): " + e.getMessage(); //$NON-NLS-1$
LOG.error(msg, e);
}
-
+
if (mcVdb == null) {
return Status.INACTIVE.toString();
}
@@ -432,7 +511,6 @@
}
-
/**
* @param mc
* @return
@@ -468,7 +546,7 @@
}
return mc;
}
-
+
public static MetaValue getManagedProperty(
ProfileServiceConnection connection, ManagedComponent mc,
String property) throws Exception {
@@ -481,10 +559,10 @@
LOG.error(msg, e);
}
- if (managedProperty!=null){
- return managedProperty.getValue();
+ if (managedProperty != null) {
+ return managedProperty.getValue();
}
-
+
throw new Exception("No property found with given name =" + property); //$NON-NLS-1$
}
@@ -560,13 +638,18 @@
}
return count;
}
-
- protected MetaValue getCacheStats(ProfileServiceConnection connection, String type) {
+
+ protected MetaValue getCacheStats(ProfileServiceConnection connection,
+ String type) {
try {
- return executeManagedOperation(connection, getRuntimeEngineDeployer(connection, mc),
- Platform.Operations.GET_CACHE_STATS, SimpleValueSupport.wrap(type));
+ return executeManagedOperation(connection,
+ getRuntimeEngineDeployer(connection, mc),
+ Platform.Operations.GET_CACHE_STATS, SimpleValueSupport
+ .wrap(type));
} catch (Exception e) {
- LOG.error("Exception executing operation: " + Platform.Operations.GET_CACHE_STATS, e); //$NON-NLS-1$
+ LOG
+ .error(
+ "Exception executing operation: " + Platform.Operations.GET_CACHE_STATS, e); //$NON-NLS-1$
}
return null;
}
@@ -578,7 +661,8 @@
MetaValue args = null;
try {
- requestsCollection = executeManagedOperation(connection, getRuntimeEngineDeployer(connection, mc),
+ requestsCollection = executeManagedOperation(connection,
+ getRuntimeEngineDeployer(connection, mc),
Platform.Operations.GET_LONGRUNNINGQUERIES, args);
} catch (Exception e) {
final String msg = "Exception executing operation: " + Platform.Operations.GET_LONGRUNNINGQUERIES; //$NON-NLS-1$
@@ -588,14 +672,13 @@
return requestsCollection;
}
- protected MetaValue getUsedBufferSpace(
- ProfileServiceConnection connection) {
+ protected MetaValue getUsedBufferSpace(ProfileServiceConnection connection) {
MetaValue usedBufferSpace = null;
try {
- usedBufferSpace = getManagedProperty(connection, getBufferService(connection, mc),
- Platform.Operations.GET_BUFFER_USAGE);
+ usedBufferSpace = getManagedProperty(connection, getBufferService(
+ connection, mc), Platform.Operations.GET_BUFFER_USAGE);
} catch (Exception e) {
final String msg = "Exception executing operation: " + Platform.Operations.GET_BUFFER_USAGE; //$NON-NLS-1$
LOG.error(msg, e);
@@ -603,32 +686,52 @@
return usedBufferSpace;
}
-
- private void getRequestCollectionValue(MetaValue pValue,Collection<Request> list) {
+
+ private void getRequestCollectionValue(MetaValue pValue,
+ Collection<Request> list) {
MetaType metaType = pValue.getMetaType();
if (metaType.isCollection()) {
- for (MetaValue value : ((CollectionValueSupport) pValue).getElements()) {
+ for (MetaValue value : ((CollectionValueSupport) pValue)
+ .getElements()) {
if (value.getMetaType().isComposite()) {
RequestMetadataMapper rmm = new RequestMetadataMapper();
RequestMetadata request = rmm.unwrapMetaValue(value);
list.add(request);
} else {
- throw new IllegalStateException(pValue + " is not a Composite type"); //$NON-NLS-1$
+ throw new IllegalStateException(pValue
+ + " is not a Composite type"); //$NON-NLS-1$
}
}
}
}
+ private void getResultsCollectionValue(MetaValue pValue,
+ Collection<ArrayList<String>> list) {
+ MetaType metaType = pValue.getMetaType();
+ if (metaType.isCollection()) {
+ for (MetaValue value : ((CollectionValueSupport) pValue)
+ .getElements()) {
+ if (value.getMetaType().isCollection()) {
+ ArrayList<String> row = (ArrayList<String>)MetaValueFactory.getInstance().unwrap(value);
+ list.add(row);
+ }
+ }
+ }
+ }
+
public static <T> void getTransactionCollectionValue(MetaValue pValue,
Collection<Transaction> list) {
MetaType metaType = pValue.getMetaType();
if (metaType.isCollection()) {
- for (MetaValue value : ((CollectionValueSupport) pValue).getElements()) {
+ for (MetaValue value : ((CollectionValueSupport) pValue)
+ .getElements()) {
if (value.getMetaType().isComposite()) {
- Transaction transaction = (Transaction) MetaValueFactory.getInstance().unwrap(value);
+ Transaction transaction = (Transaction) MetaValueFactory
+ .getInstance().unwrap(value);
list.add(transaction);
} else {
- throw new IllegalStateException(pValue + " is not a Composite type"); //$NON-NLS-1$
+ throw new IllegalStateException(pValue
+ + " is not a Composite type"); //$NON-NLS-1$
}
}
}
@@ -638,12 +741,15 @@
Collection<Session> list) {
MetaType metaType = pValue.getMetaType();
if (metaType.isCollection()) {
- for (MetaValue value : ((CollectionValueSupport) pValue).getElements()) {
+ for (MetaValue value : ((CollectionValueSupport) pValue)
+ .getElements()) {
if (value.getMetaType().isComposite()) {
- Session Session = (Session) MetaValueFactory.getInstance().unwrap(value);
+ Session Session = (Session) MetaValueFactory.getInstance()
+ .unwrap(value);
list.add(Session);
} else {
- throw new IllegalStateException(pValue + " is not a Composite type"); //$NON-NLS-1$
+ throw new IllegalStateException(pValue
+ + " is not a Composite type"); //$NON-NLS-1$
}
}
}
@@ -653,14 +759,17 @@
Collection<Session> list, String vdbName) {
MetaType metaType = pValue.getMetaType();
if (metaType.isCollection()) {
- for (MetaValue value : ((CollectionValueSupport) pValue).getElements()) {
+ for (MetaValue value : ((CollectionValueSupport) pValue)
+ .getElements()) {
if (value.getMetaType().isComposite()) {
- Session session = (Session) MetaValueFactory.getInstance().unwrap(value);
+ Session session = (Session) MetaValueFactory.getInstance()
+ .unwrap(value);
if (session.getVDBName().equals(vdbName)) {
list.add(session);
}
} else {
- throw new IllegalStateException(pValue + " is not a Composite type"); //$NON-NLS-1$
+ throw new IllegalStateException(pValue
+ + " is not a Composite type"); //$NON-NLS-1$
}
}
}
@@ -692,5 +801,30 @@
}
return reportResultList;
}
+
+ private Collection createReportResultListForMatViewQuery(List fieldNameList,
+ Iterator objectIter) {
+ Collection reportResultList = new ArrayList();
+ //Iterate throught rows
+ while (objectIter.hasNext()) {
+ ArrayList<String> columnValues = (ArrayList<String>)objectIter.next();
+
+ Class cls = null;
+ try {
+ Iterator fieldIter = fieldNameList.iterator();
+ Map reportValueMap = new HashMap<String, String>();
+ //Iterate through columns with a row
+ for (String columnValue: columnValues) {
+ String fieldName = (String) fieldIter.next();
+ reportValueMap.put(fieldName, columnValue);
+ }
+ reportResultList.add(reportValueMap);
+ } catch (Throwable e) {
+ System.err.println(e);
+ }
+ }
+ return reportResultList;
+ }
+
}
Modified: branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/VDBComponent.java
===================================================================
--- branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/VDBComponent.java 2010-10-07 18:42:05 UTC (rev 2635)
+++ branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/VDBComponent.java 2010-10-07 22:34:28 UTC (rev 2636)
@@ -82,7 +82,8 @@
*
*/
public class VDBComponent extends Facet {
- private final Log LOG = LogFactory.getLog(PluginConstants.DEFAULT_LOGGER_CATEGORY);
+ private final Log LOG = LogFactory
+ .getLog(PluginConstants.DEFAULT_LOGGER_CATEGORY);
/*
* (non-Javadoc)
@@ -122,7 +123,7 @@
} else if (name.equals(Platform.Operations.KILL_SESSION)) {
valueMap.put(Operation.Value.SESSION_ID, configuration.getSimple(
Operation.Value.SESSION_ID).getLongValue());
- }
+ }
}
@@ -134,9 +135,10 @@
@Override
public AvailabilityType getAvailability() {
// TODO Remove vdb version after no longer viable in Teiid
- String version = this.resourceConfiguration.getSimpleValue(
- "version", null);
- String status = DQPManagementView.getVDBStatus(getConnection(), this.name);
+ String version = this.resourceConfiguration.getSimpleValue("version",
+ null);
+ String status = DQPManagementView.getVDBStatus(getConnection(),
+ this.name);
if (status.equals("ACTIVE")) {
return AvailabilityType.UP;
}
@@ -165,8 +167,9 @@
String name = request.getName();
LOG.debug("Measurement name = " + name); //$NON-NLS-1$
- Object metricReturnObject = view.getMetric(getConnection(), getComponentType(), this
- .getComponentIdentifier(), name, valueMap);
+ Object metricReturnObject = view.getMetric(getConnection(),
+ getComponentType(), this.getComponentIdentifier(), name,
+ valueMap);
try {
if (request.getName().equals(
@@ -200,10 +203,11 @@
.getName()
.equals(
PluginConstants.ComponentType.VDB.Metrics.STATUS)) {
- if (((String) metricReturnObject).equals("ACTIVE")) {
+ if (((String) metricReturnObject)
+ .equals("ACTIVE")) {
report.addData(new MeasurementDataTrait(
request, "UP"));
- }else{
+ } else {
report.addData(new MeasurementDataTrait(
request, "DOWN"));
}
@@ -350,7 +354,7 @@
ManagedComponent mcVdb = null;
try {
- mcVdb = ProfileServiceUtil.getManagedComponent( getConnection(),
+ mcVdb = ProfileServiceUtil.getManagedComponent(getConnection(),
new org.jboss.managed.api.ComponentType(
PluginConstants.ComponentType.VDB.TYPE,
PluginConstants.ComponentType.VDB.SUBTYPE),
@@ -371,8 +375,8 @@
"description", String.class);
String vdbStatus = ProfileServiceUtil.getSimpleValue(mcVdb, "status",
String.class);
- String connectionType = ProfileServiceUtil.getSimpleValue(mcVdb, "connectionType",
- String.class);
+ String connectionType = ProfileServiceUtil.getSimpleValue(mcVdb,
+ "connectionType", String.class);
String vdbURL = ProfileServiceUtil.getSimpleValue(mcVdb, "url",
String.class);
@@ -614,7 +618,8 @@
new PropertySimple("type", translatorType),
new PropertySimple("propertyName", propertyName),
new PropertySimple("propertyValue", propertyValue));
- // Only want translator name and value to show up for the first row,
+ // Only want translator name and value to show up for the
+ // first row,
// so we will blank them out here.
translatorName = "";
translatorType = "";
@@ -655,10 +660,10 @@
@Override
public ProfileServiceConnection getConnection() {
- return ((PlatformComponent)this.resourceContext.getParentResourceComponent()).getConnection();
+ return ((PlatformComponent) this.resourceContext
+ .getParentResourceComponent()).getConnection();
}
-
@Override
public EmsConnection getEmsConnection() {
// TODO Auto-generated method stub
Modified: branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/util/PluginConstants.java
===================================================================
--- branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/util/PluginConstants.java 2010-10-07 18:42:05 UTC (rev 2635)
+++ branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/util/PluginConstants.java 2010-10-07 22:34:28 UTC (rev 2636)
@@ -97,13 +97,15 @@
public static interface Operations {
- public final static String GET_QUERIES = "listQueries"; //$NON-NLS-1$
+ public final static String GET_QUERIES = "listQueries"; //$NON-NLS-1$
+ public final static String EXECUTE_QUERIES = "executeQuery"; //$NON-NLS-1$
public final static String GET_LONGRUNNINGQUERIES = "getLongRunningRequests"; //$NON-NLS-1$
public final static String KILL_REQUEST = "cancelRequest"; //$NON-NLS-1$
public final static String KILL_SESSION = "terminateSession"; //$NON-NLS-1$
public final static String GET_PROPERTIES = "getProperties"; //$NON-NLS-1$
public final static String GET_REQUESTS = "getRequestsUsingVDB"; //$NON-NLS-1$
public final static String GET_SESSIONS = "getSessions"; //$NON-NLS-1$
+ public final static String GET_MATVIEWS = "getMaterializedViews"; //$NON-NLS-1$
}
@@ -227,7 +229,9 @@
* @since 1.0
*/
public static interface Value {
- public final static String STOP_NOW = "stopNow"; //$NON-NLS-1$
+ public final static String STOP_NOW = "stopNow"; //$NON-NLS-1$
+ public final static String MAT_VIEW_QUERY = "select SchemaName, Name, TargetSchemaName, TargetName, " + //$NON-NLS-1$
+ "Valid, LoadState, Updated, Cardinality from SYSADMIN.MATVIEWS"; //$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$
Modified: branches/7.1.x/console/src/main/resources/META-INF/rhq-plugin.xml
===================================================================
--- branches/7.1.x/console/src/main/resources/META-INF/rhq-plugin.xml 2010-10-07 18:42:05 UTC (rev 2635)
+++ branches/7.1.x/console/src/main/resources/META-INF/rhq-plugin.xml 2010-10-07 22:34:28 UTC (rev 2636)
@@ -469,6 +469,35 @@
</results>
</operation>
+ <operation name="getMaterializedViews" displayName="Get Materialized View Info"
+ description="Get any Materialized Views for this VDB">
+ <results>
+
+ <c:list-property name="list" displayName=" Materialized Views"
+ description="Get information related to Materialized Views, if any, for this VDB"
+ required="false">
+ <c:map-property name="map">
+ <c:simple-property displayName="Schema Name"
+ name="schemaName" type="string" description="Name of the schema that is materialized" />
+ <c:simple-property displayName="Name" name="name"
+ type="string" description="Name of the materialized table" />
+ <c:simple-property displayName="Target Schema Name"
+ name="targetSchemaName" type="string" description="Name of the materialized schema" />
+ <c:simple-property displayName="Target Name"
+ name="targetName" type="string" description="Name of target table" />
+ <c:simple-property displayName="Created Time"
+ name="valid" type="string" description="Indicates if data in table is valid for use" />
+ <c:simple-property displayName="Current State"
+ name="loadState" type="string" description="Processing time for the request" />
+ <c:simple-property displayName="Last Updated"
+ name="updated" type="string" description="Last time of data refresh" />
+ <c:simple-property displayName="Cardinality"
+ name="cardinality" type="string" description="Row count" />
+ </c:map-property>
+ </c:list-property>
+ </results>
+ </operation>
+
<metric displayName="Status" defaultOn="true" dataType="trait"
displayType="summary" category="availability" property="status"
description="The status of this VDB" />
@@ -611,9 +640,8 @@
description="Indicates if the role is mapped to any authenticated user"
readOnly="false" required="false" />
<c:simple-property name="description"
- displayName="Description" type="string"
- description="Description of this data role"
- readOnly="true" required="false" />
+ displayName="Description" type="string" description="Description of this data role"
+ readOnly="true" required="false" />
<c:list-property name="mappedRoleNameList"
readOnly="false" required="false" displayName="Mapped Role Names"
description="Mapped role names for this data role">
@@ -633,9 +661,11 @@
createDeletePolicy="both" creationDataType="configuration">
<resource-configuration>
- <c:simple-property name="name" displayName="Name" description="Name of the translator" readOnly="true" required="false" />
- <c:simple-property name="description" displayName="Description" description="Description the translator" readOnly="true" required="false" />
-
+ <c:simple-property name="name" displayName="Name"
+ description="Name of the translator" readOnly="true" required="false" />
+ <c:simple-property name="description" displayName="Description"
+ description="Description the translator" readOnly="true" required="false" />
+
<c:list-property name="translatorList" readOnly="true"
required="false" displayName="Properties" description="Translator properties">
<c:map-property name="properties" readOnly="true">
14 years, 2 months
teiid SVN: r2635 - branches/7.1.x/engine/src/main/resources/org/teiid/query.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-10-07 14:42:05 -0400 (Thu, 07 Oct 2010)
New Revision: 2635
Modified:
branches/7.1.x/engine/src/main/resources/org/teiid/query/i18n.properties
Log:
TEIID-1293 TEIID-1294 tightening validation related to updates.
Modified: branches/7.1.x/engine/src/main/resources/org/teiid/query/i18n.properties
===================================================================
--- branches/7.1.x/engine/src/main/resources/org/teiid/query/i18n.properties 2010-10-07 18:36:29 UTC (rev 2634)
+++ branches/7.1.x/engine/src/main/resources/org/teiid/query/i18n.properties 2010-10-07 18:42:05 UTC (rev 2635)
@@ -694,6 +694,7 @@
ValidationVisitor.context_required=The XQuery requires a context item, but none exists in the PASSING clause.
ValidationVisitor.xmlserialize_type=XMLSERIALIZE expects a STRING, CLOB, or BLOB value.
ValidationVisitor.invalid_encoding=Encoding {0} is not valid.
+ValidationVisitor.subquery_insert=SELECT INTO should not be used in a subquery.
UpdateProcedureResolver.only_variables=Element symbol "{0}" cannot be assigned a value. Only declared VARIABLES can be assigned values.
MappingLoader.unknown_node_type=Unknown Node Type "{0}" being loaded by the XML mapping document.
MappingLoader.invalid_criteria_node=Invalid criteria node found; A criteria node must have criteria specified or it must be a default node.
14 years, 2 months
teiid SVN: r2634 - in branches/7.1.x: engine/src/main/java/org/teiid/dqp/internal/process and 4 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-10-07 14:36:29 -0400 (Thu, 07 Oct 2010)
New Revision: 2634
Modified:
branches/7.1.x/build/kits/jboss-container/teiid-releasenotes.html
branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/Request.java
branches/7.1.x/engine/src/main/java/org/teiid/query/resolver/command/UpdateProcedureResolver.java
branches/7.1.x/engine/src/main/java/org/teiid/query/sql/lang/Command.java
branches/7.1.x/engine/src/main/java/org/teiid/query/sql/lang/DynamicCommand.java
branches/7.1.x/engine/src/main/java/org/teiid/query/sql/lang/Query.java
branches/7.1.x/engine/src/main/java/org/teiid/query/sql/lang/QueryCommand.java
branches/7.1.x/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java
branches/7.1.x/engine/src/test/java/org/teiid/query/validator/TestValidator.java
Log:
TEIID-1293 TEIID-1294 tightening validation related to updates.
Modified: branches/7.1.x/build/kits/jboss-container/teiid-releasenotes.html
===================================================================
--- branches/7.1.x/build/kits/jboss-container/teiid-releasenotes.html 2010-10-07 18:24:52 UTC (rev 2633)
+++ branches/7.1.x/build/kits/jboss-container/teiid-releasenotes.html 2010-10-07 18:36:29 UTC (rev 2634)
@@ -43,6 +43,8 @@
</ul>
<h4>from 7.1</h4>
<ul>
+ <li>Subqueries are no longer allowed to be SELECT INTO.
+ <li>INSERT/UPDATE/DELETE cannot be used to create implicit return cursors in non-update virtual procedures. You can instead use "integer_var = UPDATE ...; SELECT integer_var;".
<li>The SYSADMIN schema was created to hold procedures and tables that should not be generally accessible. SYS and pg_catalog are now always accessible - permissions do not apply to these schemas. The SYS.getBinaryVDBResource, SYS.getCharacterVDBResource, and SYS.getVDBResourcePaths have been replaced with the
SYSADMIN.VDBResources table. The Matviews table and the refreshMatView/refreshMatViewRow procedures were also moved into SYSADMIN.
<li>Overwriting an existing VDB will cause old connections to be terminated. Production systems should rely on VDB versioning.
Modified: branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/Request.java
===================================================================
--- branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/Request.java 2010-10-07 18:24:52 UTC (rev 2633)
+++ branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/Request.java 2010-10-07 18:36:29 UTC (rev 2634)
@@ -78,9 +78,7 @@
import org.teiid.query.sql.lang.BatchedUpdateCommand;
import org.teiid.query.sql.lang.Command;
import org.teiid.query.sql.lang.Limit;
-import org.teiid.query.sql.lang.Query;
import org.teiid.query.sql.lang.QueryCommand;
-import org.teiid.query.sql.lang.SetQuery;
import org.teiid.query.sql.lang.StoredProcedure;
import org.teiid.query.sql.symbol.Constant;
import org.teiid.query.sql.symbol.GroupSymbol;
@@ -203,20 +201,8 @@
}
protected void createCommandContext() throws QueryValidatorException {
- boolean returnsResultSet = false;
- this.returnsUpdateCount = true;
- if(userCommand instanceof Query) {
- Query query = (Query)userCommand;
- returnsResultSet = query.getInto() == null;
- returnsUpdateCount = !returnsResultSet;
- } else if (userCommand instanceof SetQuery) {
- returnsResultSet = true;
- returnsUpdateCount = false;
- } else if (userCommand instanceof StoredProcedure) {
- returnsUpdateCount = false;
- StoredProcedure proc = (StoredProcedure)userCommand;
- returnsResultSet = proc.returnsResultSet();
- }
+ boolean returnsResultSet = userCommand.returnsResultSet();
+ this.returnsUpdateCount = !(userCommand instanceof StoredProcedure) && !returnsResultSet;
if ((this.requestMsg.getResultsMode() == ResultsMode.UPDATECOUNT && !returnsUpdateCount)
|| (this.requestMsg.getResultsMode() == ResultsMode.RESULTSET && !returnsResultSet)) {
throw new QueryValidatorException(QueryPlugin.Util.getString(this.requestMsg.getResultsMode()==ResultsMode.RESULTSET?"Request.no_result_set":"Request.result_set")); //$NON-NLS-1$ //$NON-NLS-2$
Modified: branches/7.1.x/engine/src/main/java/org/teiid/query/resolver/command/UpdateProcedureResolver.java
===================================================================
--- branches/7.1.x/engine/src/main/java/org/teiid/query/resolver/command/UpdateProcedureResolver.java 2010-10-07 18:24:52 UTC (rev 2633)
+++ branches/7.1.x/engine/src/main/java/org/teiid/query/resolver/command/UpdateProcedureResolver.java 2010-10-07 18:36:29 UTC (rev 2634)
@@ -231,9 +231,12 @@
dynamicCommand.setAsColumns(Collections.EMPTY_LIST);
}
}
- //this could be the last select statement, set the projected symbol
- //on the virtual procedure command
- command.setResultsCommand(subCommand);
+
+ if (subCommand.returnsResultSet()) {
+ //this could be the last select statement, set the projected symbol
+ //on the virtual procedure command
+ command.setResultsCommand(subCommand);
+ }
}
break;
Modified: branches/7.1.x/engine/src/main/java/org/teiid/query/sql/lang/Command.java
===================================================================
--- branches/7.1.x/engine/src/main/java/org/teiid/query/sql/lang/Command.java 2010-10-07 18:24:52 UTC (rev 2633)
+++ branches/7.1.x/engine/src/main/java/org/teiid/query/sql/lang/Command.java 2010-10-07 18:36:29 UTC (rev 2634)
@@ -340,4 +340,8 @@
return EquivalenceUtil.areEqual(this.cacheHint, cmd.cacheHint) &&
EquivalenceUtil.areEqual(this.option, cmd.option);
}
+
+ public boolean returnsResultSet() {
+ return false;
+ }
}
Modified: branches/7.1.x/engine/src/main/java/org/teiid/query/sql/lang/DynamicCommand.java
===================================================================
--- branches/7.1.x/engine/src/main/java/org/teiid/query/sql/lang/DynamicCommand.java 2010-10-07 18:24:52 UTC (rev 2633)
+++ branches/7.1.x/engine/src/main/java/org/teiid/query/sql/lang/DynamicCommand.java 2010-10-07 18:36:29 UTC (rev 2634)
@@ -255,5 +255,10 @@
public void setAsClauseSet(boolean asClauseSet) {
this.asClauseSet = asClauseSet;
}
+
+ @Override
+ public boolean returnsResultSet() {
+ return intoGroup == null;
+ }
}
Modified: branches/7.1.x/engine/src/main/java/org/teiid/query/sql/lang/Query.java
===================================================================
--- branches/7.1.x/engine/src/main/java/org/teiid/query/sql/lang/Query.java 2010-10-07 18:24:52 UTC (rev 2633)
+++ branches/7.1.x/engine/src/main/java/org/teiid/query/sql/lang/Query.java 2010-10-07 18:36:29 UTC (rev 2634)
@@ -441,4 +441,9 @@
public Query getProjectedQuery() {
return this;
}
+
+ @Override
+ public boolean returnsResultSet() {
+ return into == null;
+ }
} // END CLASS
Modified: branches/7.1.x/engine/src/main/java/org/teiid/query/sql/lang/QueryCommand.java
===================================================================
--- branches/7.1.x/engine/src/main/java/org/teiid/query/sql/lang/QueryCommand.java 2010-10-07 18:24:52 UTC (rev 2633)
+++ branches/7.1.x/engine/src/main/java/org/teiid/query/sql/lang/QueryCommand.java 2010-10-07 18:36:29 UTC (rev 2634)
@@ -62,4 +62,9 @@
}
public abstract Query getProjectedQuery();
+
+ @Override
+ public boolean returnsResultSet() {
+ return true;
+ }
}
Modified: branches/7.1.x/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java
===================================================================
--- branches/7.1.x/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java 2010-10-07 18:24:52 UTC (rev 2633)
+++ branches/7.1.x/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java 2010-10-07 18:36:29 UTC (rev 2634)
@@ -63,6 +63,7 @@
import org.teiid.query.sql.lang.DependentSetCriteria;
import org.teiid.query.sql.lang.Drop;
import org.teiid.query.sql.lang.DynamicCommand;
+import org.teiid.query.sql.lang.ExistsCriteria;
import org.teiid.query.sql.lang.GroupBy;
import org.teiid.query.sql.lang.Insert;
import org.teiid.query.sql.lang.Into;
@@ -81,6 +82,8 @@
import org.teiid.query.sql.lang.SetCriteria;
import org.teiid.query.sql.lang.SetQuery;
import org.teiid.query.sql.lang.SubqueryCompareCriteria;
+import org.teiid.query.sql.lang.SubqueryContainer;
+import org.teiid.query.sql.lang.SubqueryFromClause;
import org.teiid.query.sql.lang.SubquerySetCriteria;
import org.teiid.query.sql.lang.TextTable;
import org.teiid.query.sql.lang.Update;
@@ -266,6 +269,7 @@
}
public void visit(SubquerySetCriteria obj) {
+ validateSubquery(obj);
if (isNonComparable(obj.getExpression())) {
handleValidationError(QueryPlugin.Util.getString("ERR.015.012.0027", obj),obj); //$NON-NLS-1$
}
@@ -376,6 +380,7 @@
@Override
public void visit(ScalarSubquery obj) {
+ validateSubquery(obj);
Collection<SingleElementSymbol> projSymbols = obj.getCommand().getProjectedSymbols();
//Scalar subquery should have one projected symbol (query with one expression
@@ -1021,6 +1026,7 @@
* @since 4.3
*/
public void visit(SubqueryCompareCriteria obj) {
+ validateSubquery(obj);
if (isNonComparable(obj.getLeftExpression())) {
handleValidationError(QueryPlugin.Util.getString("ERR.015.012.0027", obj),obj); //$NON-NLS-1$
}
@@ -1349,5 +1355,21 @@
handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.xmlserialize_type"), obj); //$NON-NLS-1$
}
}
-
+
+ @Override
+ public void visit(ExistsCriteria obj) {
+ validateSubquery(obj);
+ }
+
+ @Override
+ public void visit(SubqueryFromClause obj) {
+ validateSubquery(obj);
+ }
+
+ public void validateSubquery(SubqueryContainer subQuery) {
+ if (subQuery.getCommand() instanceof Query && ((Query)subQuery.getCommand()).getInto() != null) {
+ handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.subquery_insert"), subQuery.getCommand()); //$NON-NLS-1$
+ }
+ }
+
}
Modified: branches/7.1.x/engine/src/test/java/org/teiid/query/validator/TestValidator.java
===================================================================
--- branches/7.1.x/engine/src/test/java/org/teiid/query/validator/TestValidator.java 2010-10-07 18:24:52 UTC (rev 2633)
+++ branches/7.1.x/engine/src/test/java/org/teiid/query/validator/TestValidator.java 2010-10-07 18:36:29 UTC (rev 2634)
@@ -2029,5 +2029,20 @@
@Test public void testValidateScalarSubqueryTooManyColumns() {
helpValidate("SELECT e2, (SELECT e1, e2 FROM pm1.g1 WHERE e2 = '3') FROM pm1.g2", new String[] {"SELECT e1, e2 FROM pm1.g1 WHERE e2 = '3'"}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
}
+
+ @Test public void testInvalidIntoSubquery() {
+ helpValidate("SELECT e2, (SELECT e1, e2 INTO #x FROM pm1.g1 WHERE e2 = '3') FROM pm1.g2", new String[] {"SELECT e1, e2 INTO #x FROM pm1.g1 WHERE e2 = '3'"}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ @Test public void testInvalidIntoSubquery1() {
+ helpValidate("SELECT e2 FROM pm1.g2 WHERE EXISTS (SELECT e1, e2 INTO #x FROM pm1.g1 WHERE e2 = '3')", new String[] {"SELECT e1, e2 INTO #x FROM pm1.g1 WHERE e2 = '3'"}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ @Test public void testInvalidIntoSubquery2() {
+ helpValidate("SELECT * FROM (SELECT e1, e2 INTO #x FROM pm1.g1 WHERE e2 = '3') x", new String[] {"SELECT e1, e2 INTO #x FROM pm1.g1 WHERE e2 = '3'"}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ @Test public void testInvalidIntoSubquery3() {
+ helpValidate("SELECT e2 FROM pm1.g2 WHERE e2 in (SELECT e1, e2 INTO #x FROM pm1.g1 WHERE e2 = '3')", new String[] {"SELECT e1, e2 INTO #x FROM pm1.g1 WHERE e2 = '3'"}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
+ }
}
14 years, 2 months
teiid SVN: r2633 - branches/7.1.x/jboss-integration/src/main/java/org/teiid/jboss/deployers.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2010-10-07 14:24:52 -0400 (Thu, 07 Oct 2010)
New Revision: 2633
Modified:
branches/7.1.x/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
Log:
TEIID-982: fixing the code so that it will work with null values in the result set.
Modified: branches/7.1.x/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
===================================================================
--- branches/7.1.x/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2010-10-07 18:18:59 UTC (rev 2632)
+++ branches/7.1.x/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2010-10-07 18:24:52 UTC (rev 2633)
@@ -107,7 +107,6 @@
@ManagementObject(name="RuntimeEngineDeployer", isRuntime=true, componentType=@ManagementComponent(type="teiid",subtype="dqp"), properties=ManagementProperties.EXPLICIT)
public class RuntimeEngineDeployer extends DQPConfiguration implements DQPManagement, Serializable , ClientServiceRegistry {
private static final long serialVersionUID = -4676205340262775388L;
- private static SimpleDateFormat SDF = new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss.SSSZ"); //$NON-NLS-1$
private transient SocketConfiguration jdbcSocketConfiguration;
private transient SocketConfiguration adminSocketConfiguration;
@@ -576,9 +575,6 @@
if (col instanceof Number || col instanceof String || col instanceof Character) {
newRow.add(col);
}
- else if (col instanceof Date){
- newRow.add(SDF.format((Date)col));
- }
else if (col instanceof Blob) {
newRow.add("blob"); //$NON-NLS-1$
}
14 years, 2 months
teiid SVN: r2632 - branches/7.1.x/jboss-integration/src/main/java/org/teiid/jboss/deployers.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2010-10-07 14:18:59 -0400 (Thu, 07 Oct 2010)
New Revision: 2632
Modified:
branches/7.1.x/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
Log:
TEIID-982: fixing the code so that it will work with null values in the result set.
Modified: branches/7.1.x/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
===================================================================
--- branches/7.1.x/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2010-10-06 17:07:08 UTC (rev 2631)
+++ branches/7.1.x/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2010-10-07 18:18:59 UTC (rev 2632)
@@ -25,6 +25,11 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
+import java.sql.Blob;
+import java.sql.Clob;
+import java.sql.SQLException;
+import java.sql.SQLXML;
+import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@@ -102,7 +107,8 @@
@ManagementObject(name="RuntimeEngineDeployer", isRuntime=true, componentType=@ManagementComponent(type="teiid",subtype="dqp"), properties=ManagementProperties.EXPLICIT)
public class RuntimeEngineDeployer extends DQPConfiguration implements DQPManagement, Serializable , ClientServiceRegistry {
private static final long serialVersionUID = -4676205340262775388L;
-
+ private static SimpleDateFormat SDF = new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss.SSSZ"); //$NON-NLS-1$
+
private transient SocketConfiguration jdbcSocketConfiguration;
private transient SocketConfiguration adminSocketConfiguration;
private transient SocketConfiguration odbcSocketConfiguration;
@@ -524,13 +530,13 @@
}
else {
results.addAll(new ArrayList(Arrays.asList(rm.getColumnNames())));
- results.addAll(Arrays.asList(rm.getResults()));
+ results.addAll(Arrays.asList(fixResults(rm.getResults())));
while (rm.getFinalRow() == -1 || rm.getLastRow() < rm.getFinalRow()) {
long elapsed = System.currentTimeMillis() - start;
message = dqpCore.processCursorRequest(requestID, rm.getLastRow()+1, 1024);
rm = message.get(timoutInMilli-elapsed, TimeUnit.MILLISECONDS);
- results.addAll(Arrays.asList(rm.getResults()));
+ results.addAll(Arrays.asList(fixResults(rm.getResults())));
}
}
@@ -549,4 +555,47 @@
}
}
}
+
+ /**
+ * Managed Object framework has bug that does not currently allow
+ * sending a NULL in the Collection Value, so sending literal string "null".
+ * If you send them as Array Value, the MO is packaged as composite object and would like
+ * all the elements in array to be same type which is not the case with results.
+ */
+ List[] fixResults(List[] rows) throws SQLException {
+ List[] newResults = new List[rows.length];
+
+ for(int i = 0; i < rows.length; i++) {
+ List row = rows[i];
+ ArrayList newRow = new ArrayList();
+ for (Object col:row) {
+ if (col == null) {
+ newRow.add("null"); //$NON-NLS-1$
+ }
+ else {
+ if (col instanceof Number || col instanceof String || col instanceof Character) {
+ newRow.add(col);
+ }
+ else if (col instanceof Date){
+ newRow.add(SDF.format((Date)col));
+ }
+ else if (col instanceof Blob) {
+ newRow.add("blob"); //$NON-NLS-1$
+ }
+ else if (col instanceof Clob) {
+ newRow.add("clob"); //$NON-NLS-1$
+ }
+ else if (col instanceof SQLXML) {
+ SQLXML xml = (SQLXML)col;
+ newRow.add(xml.getString());
+ }
+ else {
+ newRow.add(col.toString());
+ }
+ }
+ }
+ newResults[i] = newRow;
+ }
+ return newResults;
+ }
}
14 years, 2 months