teiid SVN: r4087 - in trunk/jboss-integration/src/main: resources/org/teiid/jboss and 1 other directory.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2012-05-09 23:02:40 -0400 (Wed, 09 May 2012)
New Revision: 4087
Modified:
trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBDeployer.java
trunk/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties
Log:
TEIID-2021: Removing the hard depolyment time requirement to have translators deployed prior to VDB deployed. In this situation, the system will log a error message to console and as well as VDB errors area. The VDB will be deployed but the VDB service will not be started until the translator is available
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBDeployer.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBDeployer.java 2012-05-09 18:57:43 UTC (rev 4086)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBDeployer.java 2012-05-10 03:02:40 UTC (rev 4087)
@@ -51,6 +51,7 @@
import org.teiid.adminapi.Model;
import org.teiid.adminapi.Translator;
import org.teiid.adminapi.impl.ModelMetaData;
+import org.teiid.adminapi.impl.ModelMetaData.ValidationError;
import org.teiid.adminapi.impl.VDBMetaData;
import org.teiid.adminapi.impl.VDBTranslatorMetaData;
import org.teiid.common.buffer.BufferManager;
@@ -86,7 +87,6 @@
if (!TeiidAttachments.isVDBDeployment(deploymentUnit)) {
return;
}
- final String deploymentName = deploymentUnit.getName();
final VDBMetaData deployment = deploymentUnit.getAttachment(TeiidAttachments.VDB_METADATA);
// check to see if there is old vdb already deployed.
@@ -103,27 +103,24 @@
throw new DeploymentUnitProcessingException(IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50074, deployment));
}
}
-
- // add required connector managers; if they are not already there
- for (Translator t: deployment.getOverrideTranslators()) {
- VDBTranslatorMetaData data = (VDBTranslatorMetaData)t;
-
- String type = data.getType();
- Translator parent = this.translatorRepository.getTranslatorMetaData(type);
- if ( parent == null) {
- throw new DeploymentUnitProcessingException(IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50077, type, deploymentName));
- }
- }
- // make sure the translator defined exists in configuration.
+ // make sure the translator defined exists in configuration; otherwise add as error
for (ModelMetaData model:deployment.getModelMetaDatas().values()) {
if (model.isSource() && !model.getSourceNames().isEmpty()) {
for (String source:model.getSourceNames()) {
+
String translatorName = model.getSourceTranslatorName(source);
- Translator parent = this.translatorRepository.getTranslatorMetaData(translatorName);
- if ( parent == null) {
- throw new DeploymentUnitProcessingException(IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50077, translatorName, deploymentName));
- }
+ if (deployment.isOverideTranslator(translatorName)) {
+ VDBTranslatorMetaData parent = deployment.getTranslator(translatorName);
+ translatorName = parent.getType();
+ }
+
+ Translator translator = this.translatorRepository.getTranslatorMetaData(translatorName);
+ if ( translator == null) {
+ String msg = IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50077, translatorName, deployment.getName(), deployment.getVersion());
+ model.addError(ValidationError.Severity.ERROR.name(), msg);
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, msg);
+ }
}
}
}
@@ -178,19 +175,14 @@
List<String> sourceNames = model.getSourceNames();
for (String sourceName:sourceNames) {
String translatorName = model.getSourceTranslatorName(sourceName);
- if (!deployment.isOverideTranslator(translatorName)) {
- vdbService.addDependency(TeiidServiceNames.translatorServiceName(translatorName));
+ if (deployment.isOverideTranslator(translatorName)) {
+ VDBTranslatorMetaData translator = deployment.getTranslator(translatorName);
+ translatorName = translator.getType();
}
+ vdbService.addDependency(TeiidServiceNames.translatorServiceName(translatorName));
}
}
- //override translators (if any)
- for (Translator t: deployment.getOverrideTranslators()) {
- VDBTranslatorMetaData data = (VDBTranslatorMetaData)t;
- String type = data.getType();
- vdbService.addDependency(TeiidServiceNames.translatorServiceName(type));
- }
-
vdbService.addDependency(TeiidServiceNames.VDB_REPO, VDBRepository.class, vdb.vdbRepositoryInjector);
vdbService.addDependency(TeiidServiceNames.TRANSLATOR_REPO, TranslatorRepository.class, vdb.translatorRepositoryInjector);
vdbService.addDependency(TeiidServiceNames.executorServiceName(this.asyncThreadPoolName), Executor.class, vdb.executorInjector);
Modified: trunk/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties
===================================================================
--- trunk/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties 2012-05-09 18:57:43 UTC (rev 4086)
+++ trunk/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties 2012-05-10 03:02:40 UTC (rev 4087)
@@ -78,7 +78,7 @@
TEIID50074=VDB has validity errors; failed to deploy - {0}
TEIID50075=No "path" information found to load the FUNCTION model {0}; FUNCTION model must have path information.
TEIID50076=For {0}.{1} VDB, recursive delegation {2} found.
-TEIID50077=The parent translator type "{0}" was not found in configuration "{1}"
+TEIID50077=The translator type "{0}" was not found in configuration; VDB {1}.{2} will not be started until translator is available.
wrong_vdb= Wrong VDB name and/or version supplied, or VDB is not active, or not available.
# subsystem description
12 years, 8 months
teiid SVN: r4086 - in branches/7.4.x/jboss-integration/src/main/java/org/teiid/jboss: deployers and 1 other directory.
by teiid-commits@lists.jboss.org
Author: jolee
Date: 2012-05-09 14:57:43 -0400 (Wed, 09 May 2012)
New Revision: 4086
Modified:
branches/7.4.x/jboss-integration/src/main/java/org/teiid/jboss/JBossSecurityHelper.java
branches/7.4.x/jboss-integration/src/main/java/org/teiid/jboss/SecurityActions.java
branches/7.4.x/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
Log:
TEIID-2037: Security context is not propagated correctly between Teiid engine and data sources
Modified: branches/7.4.x/jboss-integration/src/main/java/org/teiid/jboss/JBossSecurityHelper.java
===================================================================
--- branches/7.4.x/jboss-integration/src/main/java/org/teiid/jboss/JBossSecurityHelper.java 2012-05-09 18:40:59 UTC (rev 4085)
+++ branches/7.4.x/jboss-integration/src/main/java/org/teiid/jboss/JBossSecurityHelper.java 2012-05-09 18:57:43 UTC (rev 4086)
@@ -38,7 +38,7 @@
@Override
public boolean assosiateSecurityContext(String securityDomain, Object newContext) {
SecurityContext context = SecurityActions.getSecurityContext();
- if (context == null || (!context.getSecurityDomain().equals(securityDomain) && newContext != null)) {
+ if (newContext != null && (context == null || newContext != context)) {
SecurityActions.setSecurityContext((SecurityContext)newContext);
return true;
}
@@ -47,10 +47,7 @@
@Override
public void clearSecurityContext(String securityDomain) {
- SecurityContext sc = SecurityActions.getSecurityContext();
- if (sc != null && sc.getSecurityDomain().equals(securityDomain)) {
- SecurityActions.clearSecurityContext();
- }
+ SecurityActions.clearSecurityContext();
}
@Override
@@ -64,8 +61,7 @@
@Override
public Object createSecurityContext(String securityDomain, Principal p, Object credentials, Subject subject) {
- SecurityActions.pushSecurityContext(p, credentials, subject, securityDomain);
- return getSecurityContext(securityDomain);
+ return SecurityActions.createSecurityContext(p, credentials, subject, securityDomain);
}
@Override
Modified: branches/7.4.x/jboss-integration/src/main/java/org/teiid/jboss/SecurityActions.java
===================================================================
--- branches/7.4.x/jboss-integration/src/main/java/org/teiid/jboss/SecurityActions.java 2012-05-09 18:40:59 UTC (rev 4085)
+++ branches/7.4.x/jboss-integration/src/main/java/org/teiid/jboss/SecurityActions.java 2012-05-09 18:57:43 UTC (rev 4086)
@@ -68,18 +68,17 @@
});
}
- static void pushSecurityContext(final Principal p, final Object cred, final Subject subject, final String securityDomain)
+ static SecurityContext createSecurityContext(final Principal p, final Object cred, final Subject subject, final String securityDomain)
{
- AccessController.doPrivileged(new PrivilegedAction<Object>() {
- public Object run() {
+ return AccessController.doPrivileged(new PrivilegedAction<SecurityContext>() {
+ public SecurityContext run() {
SecurityContext sc;
try {
sc = SecurityContextFactory.createSecurityContext(p, cred, subject, securityDomain);
} catch (Exception e) {
throw new RuntimeException(e);
}
- setSecurityContext(sc);
- return null;
+ return sc;
}
});
}
Modified: branches/7.4.x/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
===================================================================
--- branches/7.4.x/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2012-05-09 18:40:59 UTC (rev 4085)
+++ branches/7.4.x/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2012-05-09 18:57:43 UTC (rev 4086)
@@ -223,6 +223,7 @@
ClientServiceRegistryImpl jdbcCsr = new ClientServiceRegistryImpl();
jdbcCsr.registerClientService(ILogon.class, logon, LogConstants.CTX_SECURITY);
jdbcCsr.registerClientService(DQP.class, dqpProxy, LogConstants.CTX_DQP);
+ jdbcCsr.setSecurityHelper(getSecurityHelper());
if (this.jdbcSocketConfiguration.getEnabled()) {
this.jdbcSocket = new SocketListener(this.jdbcSocketConfiguration, jdbcCsr, this.dqpCore.getBufferManager(), offset);
@@ -234,6 +235,7 @@
ClientServiceRegistryImpl adminCsr = new ClientServiceRegistryImpl(Type.Admin);
adminCsr.registerClientService(ILogon.class, logon, LogConstants.CTX_SECURITY);
adminCsr.registerClientService(Admin.class, adminProxy, LogConstants.CTX_ADMIN_API);
+ adminCsr.setSecurityHelper(getSecurityHelper());
if (this.adminSocketConfiguration.getEnabled()) {
this.adminSocket = new SocketListener(this.adminSocketConfiguration, adminCsr, this.dqpCore.getBufferManager(), offset);
12 years, 8 months
teiid SVN: r4085 - in branches/7.7.x/common-core/src: test/java/org/teiid/core/types/basic and 1 other directory.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2012-05-09 14:40:59 -0400 (Wed, 09 May 2012)
New Revision: 4085
Modified:
branches/7.7.x/common-core/src/main/java/org/teiid/core/types/basic/StringToDateTransform.java
branches/7.7.x/common-core/src/main/java/org/teiid/core/types/basic/StringToTimestampTransform.java
branches/7.7.x/common-core/src/test/java/org/teiid/core/types/basic/TestTransforms.java
Log:
TEIID-1995 adding back full checks for valid representations
Modified: branches/7.7.x/common-core/src/main/java/org/teiid/core/types/basic/StringToDateTransform.java
===================================================================
--- branches/7.7.x/common-core/src/main/java/org/teiid/core/types/basic/StringToDateTransform.java 2012-05-09 18:40:58 UTC (rev 4084)
+++ branches/7.7.x/common-core/src/main/java/org/teiid/core/types/basic/StringToDateTransform.java 2012-05-09 18:40:59 UTC (rev 4085)
@@ -62,7 +62,7 @@
}
throw new TransformationException(e, "ERR.003.029.0018", CorePlugin.Util.getString("ERR.003.029.0018", value)); //$NON-NLS-1$ //$NON-NLS-2$
}
- if (validate && !result.toString().equals(value)) {
+ if (!result.toString().equals(value)) {
throw new TransformationException(CorePlugin.Util.getString("transform.invalid_string_for_date", value, getTargetType().getSimpleName())); //$NON-NLS-1$
}
return result;
Modified: branches/7.7.x/common-core/src/main/java/org/teiid/core/types/basic/StringToTimestampTransform.java
===================================================================
--- branches/7.7.x/common-core/src/main/java/org/teiid/core/types/basic/StringToTimestampTransform.java 2012-05-09 18:40:58 UTC (rev 4084)
+++ branches/7.7.x/common-core/src/main/java/org/teiid/core/types/basic/StringToTimestampTransform.java 2012-05-09 18:40:59 UTC (rev 4085)
@@ -63,7 +63,7 @@
throw new TransformationException(e, "ERR.003.029.0024", CorePlugin.Util.getString("ERR.003.029.0024", value)); //$NON-NLS-1$ //$NON-NLS-2$
}
//validate everything except for fractional seconds
- if (validate && !((String)value).startsWith(result.toString().substring(0, 19))) {
+ if (!((String)value).startsWith(result.toString().substring(0, 19))) {
throw new TransformationException(CorePlugin.Util.getString("transform.invalid_string_for_date", value, getTargetType().getSimpleName())); //$NON-NLS-1$
}
return result;
Modified: branches/7.7.x/common-core/src/test/java/org/teiid/core/types/basic/TestTransforms.java
===================================================================
--- branches/7.7.x/common-core/src/test/java/org/teiid/core/types/basic/TestTransforms.java 2012-05-09 18:40:58 UTC (rev 4084)
+++ branches/7.7.x/common-core/src/test/java/org/teiid/core/types/basic/TestTransforms.java 2012-05-09 18:40:59 UTC (rev 4085)
@@ -232,6 +232,10 @@
helpTestTransform(" 2005-12-01 11:13:01 ", TimestampUtil.createTimestamp(105, 11, 1, 11, 13, 1, 0)); //$NON-NLS-1$
}
+ @Test public void testStringToTimestampFails() throws Exception {
+ helpTransformException("2005-12-01 11:88:60", Timestamp.class, "The string representation '2005-12-01 11:88:60' of a Timestamp value is not valid."); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
@Test public void testStringToLongWithWS() throws Exception {
helpTestTransform(" 1 ", Long.valueOf(1)); //$NON-NLS-1$
}
12 years, 8 months
teiid SVN: r4084 - in trunk/common-core/src: test/java/org/teiid/core/types/basic and 1 other directory.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2012-05-09 14:40:58 -0400 (Wed, 09 May 2012)
New Revision: 4084
Modified:
trunk/common-core/src/main/java/org/teiid/core/types/basic/StringToDateTransform.java
trunk/common-core/src/main/java/org/teiid/core/types/basic/StringToTimestampTransform.java
trunk/common-core/src/test/java/org/teiid/core/types/basic/TestTransforms.java
Log:
TEIID-1995 adding back full checks for valid representations
Modified: trunk/common-core/src/main/java/org/teiid/core/types/basic/StringToDateTransform.java
===================================================================
--- trunk/common-core/src/main/java/org/teiid/core/types/basic/StringToDateTransform.java 2012-05-09 18:38:36 UTC (rev 4083)
+++ trunk/common-core/src/main/java/org/teiid/core/types/basic/StringToDateTransform.java 2012-05-09 18:40:58 UTC (rev 4084)
@@ -62,7 +62,7 @@
}
throw new TransformationException(CorePlugin.Event.TEIID10061, e, CorePlugin.Util.gs(CorePlugin.Event.TEIID10061, value));
}
- if (validate && !result.toString().equals(value)) {
+ if (!result.toString().equals(value)) {
throw new TransformationException(CorePlugin.Event.TEIID10060, CorePlugin.Util.gs(CorePlugin.Event.TEIID10060, value, getTargetType().getSimpleName()));
}
return result;
@@ -72,7 +72,7 @@
* Type of the incoming value.
* @return Source type
*/
- public Class getSourceType() {
+ public Class<?> getSourceType() {
return String.class;
}
@@ -80,7 +80,7 @@
* Type of the outgoing value.
* @return Target type
*/
- public Class getTargetType() {
+ public Class<?> getTargetType() {
return Date.class;
}
Modified: trunk/common-core/src/main/java/org/teiid/core/types/basic/StringToTimestampTransform.java
===================================================================
--- trunk/common-core/src/main/java/org/teiid/core/types/basic/StringToTimestampTransform.java 2012-05-09 18:38:36 UTC (rev 4083)
+++ trunk/common-core/src/main/java/org/teiid/core/types/basic/StringToTimestampTransform.java 2012-05-09 18:40:58 UTC (rev 4084)
@@ -63,7 +63,7 @@
throw new TransformationException(CorePlugin.Event.TEIID10059, e, CorePlugin.Util.gs(CorePlugin.Event.TEIID10059, value));
}
//validate everything except for fractional seconds
- if (validate && !((String)value).startsWith(result.toString().substring(0, 19))) {
+ if (!((String)value).startsWith(result.toString().substring(0, 19))) {
throw new TransformationException(CorePlugin.Event.TEIID10060, CorePlugin.Util.gs(CorePlugin.Event.TEIID10060, value, getTargetType().getSimpleName()));
}
return result;
@@ -73,7 +73,7 @@
* Type of the incoming value.
* @return Source type
*/
- public Class getSourceType() {
+ public Class<?> getSourceType() {
return String.class;
}
@@ -81,7 +81,7 @@
* Type of the outgoing value.
* @return Target type
*/
- public Class getTargetType() {
+ public Class<?> getTargetType() {
return Timestamp.class;
}
Modified: trunk/common-core/src/test/java/org/teiid/core/types/basic/TestTransforms.java
===================================================================
--- trunk/common-core/src/test/java/org/teiid/core/types/basic/TestTransforms.java 2012-05-09 18:38:36 UTC (rev 4083)
+++ trunk/common-core/src/test/java/org/teiid/core/types/basic/TestTransforms.java 2012-05-09 18:40:58 UTC (rev 4084)
@@ -22,10 +22,7 @@
package org.teiid.core.types.basic;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.Assert.*;
import java.math.BigDecimal;
import java.math.BigInteger;
@@ -37,13 +34,13 @@
import org.teiid.core.types.ClobImpl;
import org.teiid.core.types.ClobType;
import org.teiid.core.types.DataTypeManager;
-import org.teiid.core.types.DataTypeManager.DefaultDataClasses;
-import org.teiid.core.types.DataTypeManager.DefaultDataTypes;
import org.teiid.core.types.SQLXMLImpl;
import org.teiid.core.types.TestDataTypeManager;
import org.teiid.core.types.Transform;
import org.teiid.core.types.TransformationException;
import org.teiid.core.types.XMLType;
+import org.teiid.core.types.DataTypeManager.DefaultDataClasses;
+import org.teiid.core.types.DataTypeManager.DefaultDataTypes;
import org.teiid.query.unittest.TimestampUtil;
@@ -235,6 +232,10 @@
helpTestTransform(" 2005-12-01 11:13:01 ", TimestampUtil.createTimestamp(105, 11, 1, 11, 13, 1, 0)); //$NON-NLS-1$
}
+ @Test public void testStringToTimestampFails() throws Exception {
+ helpTransformException("2005-12-01 11:88:60", Timestamp.class, "Error Code:TEIID10060 Message:TEIID10060 The string representation '2005-12-01 11:88:60' of a Timestamp value is not valid."); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
@Test public void testStringToLongWithWS() throws Exception {
helpTestTransform(" 1 ", Long.valueOf(1)); //$NON-NLS-1$
}
12 years, 8 months
teiid SVN: r4083 - branches/7.7.x/documentation/admin-guide/src/main/docbook/en-US/content.
by teiid-commits@lists.jboss.org
Author: tejones
Date: 2012-05-09 14:38:36 -0400 (Wed, 09 May 2012)
New Revision: 4083
Modified:
branches/7.7.x/documentation/admin-guide/src/main/docbook/en-US/content/admin-console.xml
Log:
TEIID-1996:Updated documentation to reflect the "View query plan" operation
Modified: branches/7.7.x/documentation/admin-guide/src/main/docbook/en-US/content/admin-console.xml
===================================================================
--- branches/7.7.x/documentation/admin-guide/src/main/docbook/en-US/content/admin-console.xml 2012-05-09 15:53:06 UTC (rev 4082)
+++ branches/7.7.x/documentation/admin-guide/src/main/docbook/en-US/content/admin-console.xml 2012-05-09 18:38:36 UTC (rev 4083)
@@ -43,8 +43,8 @@
Translator instances defined for use by this VDB</para>
</listitem>
<listitem>
- <para><emphasis>Data Roles</emphasis>- any
- data roles defined for use by this VDB</para>
+ <para><emphasis>Data Roles</emphasis>- any data roles
+ defined for use by this VDB</para>
</listitem>
</orderedlist>
</listitem>
@@ -133,6 +133,9 @@
<para>View Current Requests</para>
</listitem>
<listitem>
+ <para>View query plan</para>
+ </listitem>
+ <listitem>
<para>Terminate requests</para>
</listitem>
<listitem>
12 years, 8 months
teiid SVN: r4082 - in branches/7.7.x: runtime/src/main/java/org/teiid/services and 1 other directories.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2012-05-09 11:53:06 -0400 (Wed, 09 May 2012)
New Revision: 4082
Modified:
branches/7.7.x/engine/src/main/java/org/teiid/dqp/service/SessionService.java
branches/7.7.x/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java
branches/7.7.x/runtime/src/main/java/org/teiid/transport/LogonImpl.java
Log:
TEIID-2037: Moving dis-assosiation to happen correctly in case of error in LoginImpl
Modified: branches/7.7.x/engine/src/main/java/org/teiid/dqp/service/SessionService.java
===================================================================
--- branches/7.7.x/engine/src/main/java/org/teiid/dqp/service/SessionService.java 2012-05-09 15:34:45 UTC (rev 4081)
+++ branches/7.7.x/engine/src/main/java/org/teiid/dqp/service/SessionService.java 2012-05-09 15:53:06 UTC (rev 4082)
@@ -148,7 +148,7 @@
String getGssSecurityDomain();
- void associateSubjectInContext(String securityDomain, Subject subject);
+ boolean associateSubjectInContext(String securityDomain, Subject subject);
Subject getSubjectInContext(String securityDomain);
Modified: branches/7.7.x/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java
===================================================================
--- branches/7.7.x/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java 2012-05-09 15:34:45 UTC (rev 4081)
+++ branches/7.7.x/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java 2012-05-09 15:53:06 UTC (rev 4082)
@@ -424,13 +424,13 @@
}
@Override
- public void associateSubjectInContext(String securityDomain, Subject subject) {
+ public boolean associateSubjectInContext(String securityDomain, Subject subject) {
Principal principal = null;
for(Principal p:subject.getPrincipals()) {
principal = p;
break;
}
- this.securityHelper.associateSecurityContext(securityDomain, this.securityHelper.createSecurityContext(securityDomain, principal, null, subject));
+ return this.securityHelper.associateSecurityContext(securityDomain, this.securityHelper.createSecurityContext(securityDomain, principal, null, subject));
}
@Override
Modified: branches/7.7.x/runtime/src/main/java/org/teiid/transport/LogonImpl.java
===================================================================
--- branches/7.7.x/runtime/src/main/java/org/teiid/transport/LogonImpl.java 2012-05-09 15:34:45 UTC (rev 4081)
+++ branches/7.7.x/runtime/src/main/java/org/teiid/transport/LogonImpl.java 2012-05-09 15:53:06 UTC (rev 4082)
@@ -159,7 +159,7 @@
String user = connProps.getProperty(TeiidURL.CONNECTION.USER_NAME);
String password = connProps.getProperty(TeiidURL.CONNECTION.PASSWORD);
-
+ boolean assosiated = false;
try {
String securityDomain = service.getGssSecurityDomain();
if (securityDomain == null) {
@@ -175,7 +175,7 @@
}
if (result.context.isEstablished()) {
- service.associateSubjectInContext(securityDomain, subject);
+ assosiated = service.associateSubjectInContext(securityDomain, subject);
}
if (!result.context.isEstablished() || !createSession) {
@@ -187,12 +187,14 @@
LogManager.logDetail(LogConstants.CTX_SECURITY, "Kerberos context established"); //$NON-NLS-1$
//connProps.setProperty(TeiidURL.CONNECTION.PASSTHROUGH_AUTHENTICATION, "true"); //$NON-NLS-1$
- LogonResult loginInResult = logon(connProps, result.serviceTicket);
- service.clearSubjectInContext();
- return loginInResult;
+ return logon(connProps, result.serviceTicket);
} catch (LoginException e) {
throw new LogonException(e, RuntimePlugin.Util.getString("krb5_login_failed")); //$NON-NLS-1$
- }
+ } finally {
+ if (assosiated) {
+ this.service.clearSubjectInContext();
+ }
+ }
}
private String updateDQPContext(SessionMetadata s) {
12 years, 8 months
teiid SVN: r4081 - in trunk: engine/src/main/java/org/teiid/dqp/service and 4 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2012-05-09 11:34:45 -0400 (Wed, 09 May 2012)
New Revision: 4081
Modified:
trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPWorkContext.java
trunk/engine/src/main/java/org/teiid/dqp/service/SessionService.java
trunk/engine/src/main/java/org/teiid/security/SecurityHelper.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/JBossSecurityHelper.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/SecurityActions.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/TransportService.java
trunk/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java
trunk/runtime/src/main/java/org/teiid/transport/LogonImpl.java
Log:
TEIID-2037 applying changes forward.
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPWorkContext.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPWorkContext.java 2012-05-09 15:09:08 UTC (rev 4080)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPWorkContext.java 2012-05-09 15:34:45 UTC (rev 4081)
@@ -241,7 +241,7 @@
runnable.run();
} finally {
if (associated) {
- securityHelper.clearSecurityContext(this.getSecurityDomain());
+ securityHelper.clearSecurityContext();
}
DQPWorkContext.releaseWorkContext();
if (previous != null) {
@@ -254,7 +254,7 @@
DQPWorkContext.setWorkContext(this);
boolean associated = false;
if (securityHelper != null && this.getSubject() != null) {
- associated = securityHelper.associateSecurityContext(this.getSecurityDomain(), this.getSecurityContext());
+ associated = securityHelper.associateSecurityContext(this.getSecurityContext());
}
return associated;
}
Modified: trunk/engine/src/main/java/org/teiid/dqp/service/SessionService.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/service/SessionService.java 2012-05-09 15:09:08 UTC (rev 4080)
+++ trunk/engine/src/main/java/org/teiid/dqp/service/SessionService.java 2012-05-09 15:34:45 UTC (rev 4081)
@@ -148,7 +148,9 @@
String getGssSecurityDomain();
- void associateSubjectInContext(String securityDomain, Subject subject);
+ boolean associateSubjectInContext(String securityDomain, Subject subject);
Subject getSubjectInContext(String securityDomain);
+
+ public void clearSubjectInContext();
}
Modified: trunk/engine/src/main/java/org/teiid/security/SecurityHelper.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/security/SecurityHelper.java 2012-05-09 15:09:08 UTC (rev 4080)
+++ trunk/engine/src/main/java/org/teiid/security/SecurityHelper.java 2012-05-09 15:34:45 UTC (rev 4081)
@@ -28,9 +28,9 @@
public interface SecurityHelper {
- boolean associateSecurityContext(String securityDomain, Object context);
+ boolean associateSecurityContext(Object context);
- void clearSecurityContext(String securityDomain);
+ void clearSecurityContext();
Object getSecurityContext(String securityDomain);
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/JBossSecurityHelper.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/JBossSecurityHelper.java 2012-05-09 15:09:08 UTC (rev 4080)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/JBossSecurityHelper.java 2012-05-09 15:34:45 UTC (rev 4081)
@@ -36,9 +36,9 @@
private static final long serialVersionUID = 3598997061994110254L;
@Override
- public boolean associateSecurityContext(String securityDomain, Object newContext) {
+ public boolean associateSecurityContext(Object newContext) {
SecurityContext context = SecurityActions.getSecurityContext();
- if (context == null || (!context.getSecurityDomain().equals(securityDomain) && newContext != null)) {
+ if (context == null || (newContext != null && newContext != context)) {
SecurityActions.setSecurityContext((SecurityContext)newContext);
return true;
}
@@ -46,11 +46,8 @@
}
@Override
- public void clearSecurityContext(String securityDomain) {
- SecurityContext sc = SecurityActions.getSecurityContext();
- if (sc != null && sc.getSecurityDomain().equals(securityDomain)) {
- SecurityActions.clearSecurityContext();
- }
+ public void clearSecurityContext() {
+ SecurityActions.clearSecurityContext();
}
@Override
@@ -64,8 +61,7 @@
@Override
public Object createSecurityContext(String securityDomain, Principal p, Object credentials, Subject subject) {
- SecurityActions.pushSecurityContext(p, credentials, subject, securityDomain);
- return getSecurityContext(securityDomain);
+ return SecurityActions.createSecurityContext(p, credentials, subject, securityDomain);
}
@Override
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/SecurityActions.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/SecurityActions.java 2012-05-09 15:09:08 UTC (rev 4080)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/SecurityActions.java 2012-05-09 15:34:45 UTC (rev 4081)
@@ -68,18 +68,17 @@
});
}
- static void pushSecurityContext(final Principal p, final Object cred, final Subject subject, final String securityDomain)
+ static SecurityContext createSecurityContext(final Principal p, final Object cred, final Subject subject, final String securityDomain)
{
- AccessController.doPrivileged(new PrivilegedAction<Object>() {
- public Object run() {
+ return AccessController.doPrivileged(new PrivilegedAction<SecurityContext>() {
+ public SecurityContext run() {
SecurityContext sc;
try {
sc = SecurityContextFactory.createSecurityContext(p, cred, subject, securityDomain);
} catch (Exception e) {
throw new RuntimeException(e);
}
- setSecurityContext(sc);
- return null;
+ return sc;
}
});
}
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/TransportService.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/TransportService.java 2012-05-09 15:09:08 UTC (rev 4080)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/TransportService.java 2012-05-09 15:34:45 UTC (rev 4081)
@@ -119,6 +119,7 @@
this.sessionService.setAuthenticationType(getAuthenticationType());
this.sessionService.setGssSecurityDomain(this.krb5Domain);
this.sessionService.start();
+ this.csr.setAuthenticationType(this.sessionService.getAuthenticationType());
// create the necessary services
this.logon = new LogonImpl(this.sessionService, "teiid-cluster"); //$NON-NLS-1$
Modified: trunk/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java 2012-05-09 15:09:08 UTC (rev 4080)
+++ trunk/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java 2012-05-09 15:34:45 UTC (rev 4081)
@@ -388,13 +388,13 @@
}
@Override
- public void associateSubjectInContext(String securityDomain, Subject subject) {
+ public boolean associateSubjectInContext(String securityDomain, Subject subject) {
Principal principal = null;
for(Principal p:subject.getPrincipals()) {
principal = p;
break;
}
- this.securityHelper.associateSecurityContext(securityDomain, this.securityHelper.createSecurityContext(securityDomain, principal, null, subject));
+ return this.securityHelper.associateSecurityContext(this.securityHelper.createSecurityContext(securityDomain, principal, null, subject));
}
@Override
@@ -409,6 +409,11 @@
@Override
public String getGssSecurityDomain(){
return this.gssSecurityDomain;
+ }
+
+ @Override
+ public void clearSubjectInContext() {
+ this.securityHelper.clearSecurityContext();
}
protected Collection<String> getDomainsForUser(List<String> domains, String username) {
Modified: trunk/runtime/src/main/java/org/teiid/transport/LogonImpl.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/transport/LogonImpl.java 2012-05-09 15:09:08 UTC (rev 4080)
+++ trunk/runtime/src/main/java/org/teiid/transport/LogonImpl.java 2012-05-09 15:34:45 UTC (rev 4081)
@@ -158,7 +158,7 @@
String user = connProps.getProperty(TeiidURL.CONNECTION.USER_NAME);
String password = connProps.getProperty(TeiidURL.CONNECTION.PASSWORD);
-
+ boolean associated = false;
try {
String securityDomain = service.getGssSecurityDomain();
if (securityDomain == null) {
@@ -174,7 +174,7 @@
}
if (result.context.isEstablished()) {
- service.associateSubjectInContext(securityDomain, subject);
+ associated = service.associateSubjectInContext(securityDomain, subject);
}
if (!result.context.isEstablished() || !createSession) {
@@ -186,10 +186,15 @@
LogManager.logDetail(LogConstants.CTX_SECURITY, "Kerberos context established"); //$NON-NLS-1$
//connProps.setProperty(TeiidURL.CONNECTION.PASSTHROUGH_AUTHENTICATION, "true"); //$NON-NLS-1$
- return logon(connProps, result.serviceTicket);
+ LogonResult loginInResult = logon(connProps, result.serviceTicket);
+ return loginInResult;
} catch (LoginException e) {
throw new LogonException(RuntimePlugin.Event.TEIID40061, e, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40061));
- }
+ } finally {
+ if (associated) {
+ service.clearSubjectInContext();
+ }
+ }
}
private String updateDQPContext(SessionMetadata s) {
12 years, 8 months
teiid SVN: r4080 - branches/7.7.x/connectors/translator-hive/.settings.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2012-05-09 11:09:08 -0400 (Wed, 09 May 2012)
New Revision: 4080
Modified:
branches/7.7.x/connectors/translator-hive/.settings/
Log:
adding ignores
Property changes on: branches/7.7.x/connectors/translator-hive/.settings
___________________________________________________________________
Modified: svn:ignore
- org.eclipse.jdt.core.prefs
org.maven.ide.eclipse.prefs
+ org.eclipse.jdt.core.prefs
org.maven.ide.eclipse.prefs
org.eclipse.m2e.core.prefs
12 years, 8 months
teiid SVN: r4079 - in branches/7.7.x: jboss-integration/src/main/java/org/teiid/jboss and 3 other directories.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2012-05-09 11:08:03 -0400 (Wed, 09 May 2012)
New Revision: 4079
Modified:
branches/7.7.x/engine/src/main/java/org/teiid/dqp/service/SessionService.java
branches/7.7.x/jboss-integration/src/main/java/org/teiid/jboss/JBossSecurityHelper.java
branches/7.7.x/jboss-integration/src/main/java/org/teiid/jboss/SecurityActions.java
branches/7.7.x/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
branches/7.7.x/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java
branches/7.7.x/runtime/src/main/java/org/teiid/transport/LogonImpl.java
Log:
TEIID-2037: Fixing the propagation of the security context from DQPWorkContext on to the executing thread and clearing it at the end of the thread run.
Modified: branches/7.7.x/engine/src/main/java/org/teiid/dqp/service/SessionService.java
===================================================================
--- branches/7.7.x/engine/src/main/java/org/teiid/dqp/service/SessionService.java 2012-05-09 15:08:01 UTC (rev 4078)
+++ branches/7.7.x/engine/src/main/java/org/teiid/dqp/service/SessionService.java 2012-05-09 15:08:03 UTC (rev 4079)
@@ -151,4 +151,6 @@
void associateSubjectInContext(String securityDomain, Subject subject);
Subject getSubjectInContext(String securityDomain);
+
+ public void clearSubjectInContext();
}
Modified: branches/7.7.x/jboss-integration/src/main/java/org/teiid/jboss/JBossSecurityHelper.java
===================================================================
--- branches/7.7.x/jboss-integration/src/main/java/org/teiid/jboss/JBossSecurityHelper.java 2012-05-09 15:08:01 UTC (rev 4078)
+++ branches/7.7.x/jboss-integration/src/main/java/org/teiid/jboss/JBossSecurityHelper.java 2012-05-09 15:08:03 UTC (rev 4079)
@@ -38,7 +38,7 @@
@Override
public boolean associateSecurityContext(String securityDomain, Object newContext) {
SecurityContext context = SecurityActions.getSecurityContext();
- if (context == null || (!context.getSecurityDomain().equals(securityDomain) && newContext != null)) {
+ if (context == null || (newContext != null && newContext != context)) {
SecurityActions.setSecurityContext((SecurityContext)newContext);
return true;
}
@@ -46,11 +46,8 @@
}
@Override
- public void clearSecurityContext(String securityDomain) {
- SecurityContext sc = SecurityActions.getSecurityContext();
- if (sc != null && sc.getSecurityDomain().equals(securityDomain)) {
- SecurityActions.clearSecurityContext();
- }
+ public void clearSecurityContext(String context) {
+ SecurityActions.clearSecurityContext();
}
@Override
@@ -64,8 +61,7 @@
@Override
public Object createSecurityContext(String securityDomain, Principal p, Object credentials, Subject subject) {
- SecurityActions.pushSecurityContext(p, credentials, subject, securityDomain);
- return getSecurityContext(securityDomain);
+ return SecurityActions.createSecurityContext(p, credentials, subject, securityDomain);
}
@Override
Modified: branches/7.7.x/jboss-integration/src/main/java/org/teiid/jboss/SecurityActions.java
===================================================================
--- branches/7.7.x/jboss-integration/src/main/java/org/teiid/jboss/SecurityActions.java 2012-05-09 15:08:01 UTC (rev 4078)
+++ branches/7.7.x/jboss-integration/src/main/java/org/teiid/jboss/SecurityActions.java 2012-05-09 15:08:03 UTC (rev 4079)
@@ -68,18 +68,17 @@
});
}
- static void pushSecurityContext(final Principal p, final Object cred, final Subject subject, final String securityDomain)
+ static SecurityContext createSecurityContext(final Principal p, final Object cred, final Subject subject, final String securityDomain)
{
- AccessController.doPrivileged(new PrivilegedAction<Object>() {
- public Object run() {
+ return AccessController.doPrivileged(new PrivilegedAction<SecurityContext>() {
+ public SecurityContext run() {
SecurityContext sc;
try {
sc = SecurityContextFactory.createSecurityContext(p, cred, subject, securityDomain);
} catch (Exception e) {
throw new RuntimeException(e);
}
- setSecurityContext(sc);
- return null;
+ return sc;
}
});
}
Modified: branches/7.7.x/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
===================================================================
--- branches/7.7.x/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2012-05-09 15:08:01 UTC (rev 4078)
+++ branches/7.7.x/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2012-05-09 15:08:03 UTC (rev 4079)
@@ -235,6 +235,7 @@
jdbcCsr.setAuthenticationType(this.sessionService.getAuthType());
jdbcCsr.registerClientService(ILogon.class, logon, LogConstants.CTX_SECURITY);
jdbcCsr.registerClientService(DQP.class, dqpProxy, LogConstants.CTX_DQP);
+ jdbcCsr.setSecurityHelper(getSecurityHelper());
if (this.jdbcSocketConfiguration.getEnabled()) {
this.jdbcSocket = new SocketListener(this.jdbcSocketConfiguration, jdbcCsr, this.dqpCore.getBufferManager(), offset);
@@ -247,6 +248,7 @@
adminCsr.setAuthenticationType(this.sessionService.getAuthType());
adminCsr.registerClientService(ILogon.class, logon, LogConstants.CTX_SECURITY);
adminCsr.registerClientService(Admin.class, adminProxy, LogConstants.CTX_ADMIN_API);
+ adminCsr.setSecurityHelper(getSecurityHelper());
if (this.adminSocketConfiguration.getEnabled()) {
this.adminSocket = new SocketListener(this.adminSocketConfiguration, adminCsr, this.dqpCore.getBufferManager(), offset);
Modified: branches/7.7.x/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java
===================================================================
--- branches/7.7.x/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java 2012-05-09 15:08:01 UTC (rev 4078)
+++ branches/7.7.x/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java 2012-05-09 15:08:03 UTC (rev 4079)
@@ -445,5 +445,10 @@
@Override
public String getGssSecurityDomain(){
return this.gssSecurityDomain;
+ }
+
+ @Override
+ public void clearSubjectInContext() {
+ this.securityHelper.clearSecurityContext(null);
}
}
Modified: branches/7.7.x/runtime/src/main/java/org/teiid/transport/LogonImpl.java
===================================================================
--- branches/7.7.x/runtime/src/main/java/org/teiid/transport/LogonImpl.java 2012-05-09 15:08:01 UTC (rev 4078)
+++ branches/7.7.x/runtime/src/main/java/org/teiid/transport/LogonImpl.java 2012-05-09 15:08:03 UTC (rev 4079)
@@ -187,7 +187,9 @@
LogManager.logDetail(LogConstants.CTX_SECURITY, "Kerberos context established"); //$NON-NLS-1$
//connProps.setProperty(TeiidURL.CONNECTION.PASSTHROUGH_AUTHENTICATION, "true"); //$NON-NLS-1$
- return logon(connProps, result.serviceTicket);
+ LogonResult loginInResult = logon(connProps, result.serviceTicket);
+ service.clearSubjectInContext();
+ return loginInResult;
} catch (LoginException e) {
throw new LogonException(e, RuntimePlugin.Util.getString("krb5_login_failed")); //$NON-NLS-1$
}
12 years, 8 months
teiid SVN: r4078 - in branches/7.7.x: engine/src/main/java/org/teiid/dqp/internal/process and 1 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2012-05-09 11:08:01 -0400 (Wed, 09 May 2012)
New Revision: 4078
Modified:
branches/7.7.x/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml
branches/7.7.x/engine/src/main/java/org/teiid/dqp/internal/process/AuthorizationValidator.java
branches/7.7.x/engine/src/main/java/org/teiid/dqp/internal/process/DefaultAuthorizationValidator.java
branches/7.7.x/engine/src/main/java/org/teiid/dqp/internal/process/PreparedStatementRequest.java
branches/7.7.x/engine/src/main/java/org/teiid/dqp/internal/process/Request.java
branches/7.7.x/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java
branches/7.7.x/engine/src/test/java/org/teiid/dqp/internal/process/TestRequest.java
Log:
TEIID-2009 allowing authorizationvalidator command modification
Modified: branches/7.7.x/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml
===================================================================
--- branches/7.7.x/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml 2012-05-09 14:36:12 UTC (rev 4077)
+++ branches/7.7.x/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml 2012-05-09 15:08:01 UTC (rev 4078)
@@ -154,7 +154,7 @@
<bean name="AuthorizationValidator" class="org.teiid.dqp.internal.process.DefaultAuthorizationValidator">
<!-- Turn on authorization checking (default true) -->
<property name="enabled">true</property>
- <!-- The policy decider to use. (default AuthorizationValidator).
+ <!-- The policy decider to use. (default org.teiid.dqp.internal.process.DataRolePolicyDecider).
This instance may be changed to another org.teiid.PolicyDecider if needed.
-->
<property name="policyDecider"><inject bean="PolicyDecider"/></property>
Modified: branches/7.7.x/engine/src/main/java/org/teiid/dqp/internal/process/AuthorizationValidator.java
===================================================================
--- branches/7.7.x/engine/src/main/java/org/teiid/dqp/internal/process/AuthorizationValidator.java 2012-05-09 14:36:12 UTC (rev 4077)
+++ branches/7.7.x/engine/src/main/java/org/teiid/dqp/internal/process/AuthorizationValidator.java 2012-05-09 15:08:01 UTC (rev 4078)
@@ -33,8 +33,34 @@
*/
public interface AuthorizationValidator {
- void validate(Command command, QueryMetadataInterface metadata, CommandContext commandContext) throws QueryValidatorException, TeiidComponentException;
+ enum CommandType {
+ USER,
+ PREPARED,
+ CACHED
+ }
+ /**
+ * Validates the given command. If the command is not a {@link CommandType#USER} command, the command object should not be modified.
+ * Any modification must be fully resolved using the associated {@link QueryMetadataInterface}. Returning true for a
+ * {@link CommandType#PREPARED} or {@link CommandType#CACHED} commands means that the matching prepared plan or cache entry
+ * will not be used.
+ * @param originalSql array of commands will typically contain only a single string, but may have multiple for batched updates.
+ * @param command the parsed and resolved command.
+ * @param metadata
+ * @param commandContext
+ * @param commandType
+ * @return true if the USER command was modified, or if the non-USER command should be modified.
+ * @throws QueryValidatorException
+ * @throws TeiidComponentException
+ */
+ boolean validate(String[] originalSql, Command command, QueryMetadataInterface metadata, CommandContext commandContext, CommandType commandType) throws QueryValidatorException, TeiidComponentException;
+
+ /**
+ *
+ * @param roleName
+ * @param commandContext
+ * @return true if the current user has the given role
+ */
boolean hasRole(String roleName, CommandContext commandContext);
boolean isEnabled();
Modified: branches/7.7.x/engine/src/main/java/org/teiid/dqp/internal/process/DefaultAuthorizationValidator.java
===================================================================
--- branches/7.7.x/engine/src/main/java/org/teiid/dqp/internal/process/DefaultAuthorizationValidator.java 2012-05-09 14:36:12 UTC (rev 4077)
+++ branches/7.7.x/engine/src/main/java/org/teiid/dqp/internal/process/DefaultAuthorizationValidator.java 2012-05-09 15:08:01 UTC (rev 4078)
@@ -41,11 +41,15 @@
}
@Override
- public void validate(Command command, QueryMetadataInterface metadata, CommandContext commandContext) throws QueryValidatorException, TeiidComponentException {
+ public boolean validate(String[] originalSql, Command command,
+ QueryMetadataInterface metadata, CommandContext commandContext,
+ CommandType commandType) throws QueryValidatorException,
+ TeiidComponentException {
if (enabled && policyDecider.validateCommand(commandContext)) {
AuthorizationValidationVisitor visitor = new AuthorizationValidationVisitor(this.policyDecider, commandContext);
Request.validateWithVisitor(visitor, metadata, command);
}
+ return false;
}
@Override
Modified: branches/7.7.x/engine/src/main/java/org/teiid/dqp/internal/process/PreparedStatementRequest.java
===================================================================
--- branches/7.7.x/engine/src/main/java/org/teiid/dqp/internal/process/PreparedStatementRequest.java 2012-05-09 14:36:12 UTC (rev 4077)
+++ branches/7.7.x/engine/src/main/java/org/teiid/dqp/internal/process/PreparedStatementRequest.java 2012-05-09 15:08:01 UTC (rev 4078)
@@ -35,6 +35,7 @@
import org.teiid.core.TeiidComponentException;
import org.teiid.core.TeiidProcessingException;
import org.teiid.core.types.DataTypeManager;
+import org.teiid.dqp.internal.process.AuthorizationValidator.CommandType;
import org.teiid.dqp.internal.process.SessionAwareCache.CacheID;
import org.teiid.logging.LogConstants;
import org.teiid.logging.LogManager;
@@ -131,6 +132,21 @@
String sqlQuery = requestMsg.getCommands()[0];
CacheID id = new CacheID(this.workContext, Request.createParseInfo(this.requestMsg), sqlQuery);
prepPlan = prepPlanCache.get(id);
+
+ if (prepPlan != null) {
+ ProcessorPlan cachedPlan = prepPlan.getPlan();
+ this.userCommand = prepPlan.getCommand();
+ if (validateAccess(requestMsg.getCommands(), userCommand, CommandType.PREPARED)) {
+ LogManager.logDetail(LogConstants.CTX_DQP, requestId, "AuthorizationValidator indicates that the prepared plan for command will not be used"); //$NON-NLS-1$
+ prepPlan = null;
+ } else {
+ LogManager.logTrace(LogConstants.CTX_DQP, new Object[] { "Query exist in cache: ", sqlQuery }); //$NON-NLS-1$
+ processPlan = cachedPlan.clone();
+ //already in cache. obtain the values from cache
+ analysisRecord = prepPlan.getAnalysisRecord();
+ }
+ }
+
if (prepPlan == null) {
//if prepared plan does not exist, create one
prepPlan = new PreparedPlan();
@@ -149,15 +165,7 @@
}
this.prepPlanCache.put(id, determinismLevel, prepPlan, userCommand.getCacheHint() != null?userCommand.getCacheHint().getTtl():null);
- }
- } else {
- ProcessorPlan cachedPlan = prepPlan.getPlan();
- this.userCommand = prepPlan.getCommand();
- validateAccess(userCommand);
- LogManager.logTrace(LogConstants.CTX_DQP, new Object[] { "Query exist in cache: ", sqlQuery }); //$NON-NLS-1$
- processPlan = cachedPlan.clone();
- //already in cache. obtain the values from cache
- analysisRecord = prepPlan.getAnalysisRecord();
+ }
}
if (requestMsg.isBatchedUpdate()) {
Modified: branches/7.7.x/engine/src/main/java/org/teiid/dqp/internal/process/Request.java
===================================================================
--- branches/7.7.x/engine/src/main/java/org/teiid/dqp/internal/process/Request.java 2012-05-09 14:36:12 UTC (rev 4077)
+++ branches/7.7.x/engine/src/main/java/org/teiid/dqp/internal/process/Request.java 2012-05-09 15:08:01 UTC (rev 4078)
@@ -47,6 +47,7 @@
import org.teiid.core.types.DataTypeManager;
import org.teiid.core.util.Assertion;
import org.teiid.dqp.internal.datamgr.ConnectorManagerRepository;
+import org.teiid.dqp.internal.process.AuthorizationValidator.CommandType;
import org.teiid.dqp.internal.process.multisource.MultiSourceCapabilitiesFinder;
import org.teiid.dqp.internal.process.multisource.MultiSourceMetadataWrapper;
import org.teiid.dqp.internal.process.multisource.MultiSourcePlanToProcessConverter;
@@ -289,8 +290,6 @@
//ensure that the user command is distinct from the processing command
//rewrite and planning may alter options, symbols, etc.
QueryResolver.resolveCommand(command, metadata);
-
- this.userCommand = (Command)command.clone();
}
private void validateQuery(Command command)
@@ -391,8 +390,10 @@
resolveCommand(command);
- validateAccess(userCommand);
+ validateAccess(requestMsg.getCommands(), command, CommandType.USER);
+ this.userCommand = (Command) command.clone();
+
Collection<GroupSymbol> groups = GroupCollectorVisitor.getGroups(command, true);
for (GroupSymbol groupSymbol : groups) {
if (groupSymbol.isTempTable()) {
@@ -470,11 +471,14 @@
this.context.setValidateXML(requestMsg.getValidationMode());
}
- protected void validateAccess(Command command) throws QueryValidatorException, TeiidComponentException {
- createCommandContext(command);
+ protected boolean validateAccess(String[] commandStr, Command command, CommandType type) throws QueryValidatorException, TeiidComponentException {
+ if (context == null) {
+ createCommandContext(command);
+ }
if (this.authorizationValidator != null) {
- this.authorizationValidator.validate(command, metadata, context);
+ return this.authorizationValidator.validate(commandStr, command, metadata, context, type);
}
+ return false;
}
public void setExecutor(Executor executor) {
Modified: branches/7.7.x/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java
===================================================================
--- branches/7.7.x/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java 2012-05-09 14:36:12 UTC (rev 4077)
+++ branches/7.7.x/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java 2012-05-09 15:08:01 UTC (rev 4078)
@@ -50,6 +50,7 @@
import org.teiid.core.TeiidProcessingException;
import org.teiid.core.TeiidRuntimeException;
import org.teiid.core.types.DataTypeManager;
+import org.teiid.dqp.internal.process.AuthorizationValidator.CommandType;
import org.teiid.dqp.internal.process.DQPCore.CompletionListener;
import org.teiid.dqp.internal.process.DQPCore.FutureWork;
import org.teiid.dqp.internal.process.DQPWorkContext.Version;
@@ -504,9 +505,11 @@
this.resultsBuffer = cr.getResults();
request.initMetadata();
this.originalCommand = cr.getCommand(requestMsg.getCommandString(), request.metadata, pi);
- request.validateAccess(this.originalCommand);
- this.doneProducingBatches();
- return;
+ if (!request.validateAccess(requestMsg.getCommands(), this.originalCommand, CommandType.CACHED)) {
+ this.doneProducingBatches();
+ return;
+ }
+ LogManager.logDetail(LogConstants.CTX_DQP, requestID, "Cached result command to be modified, will not use the cached results", cacheId); //$NON-NLS-1$
}
} else {
LogManager.logDetail(LogConstants.CTX_DQP, requestID, "Parameters are not serializable - cache cannot be used for", cacheId); //$NON-NLS-1$
Modified: branches/7.7.x/engine/src/test/java/org/teiid/dqp/internal/process/TestRequest.java
===================================================================
--- branches/7.7.x/engine/src/test/java/org/teiid/dqp/internal/process/TestRequest.java 2012-05-09 14:36:12 UTC (rev 4077)
+++ branches/7.7.x/engine/src/test/java/org/teiid/dqp/internal/process/TestRequest.java 2012-05-09 15:08:01 UTC (rev 4078)
@@ -35,6 +35,7 @@
import org.teiid.core.TeiidProcessingException;
import org.teiid.dqp.internal.datamgr.ConnectorManagerRepository;
import org.teiid.dqp.internal.datamgr.FakeTransactionService;
+import org.teiid.dqp.internal.process.AuthorizationValidator.CommandType;
import org.teiid.dqp.service.AutoGenDataService;
import org.teiid.query.metadata.QueryMetadataInterface;
import org.teiid.query.parser.QueryParser;
@@ -89,10 +90,9 @@
drpd.setAllowFunctionCallsByDefault(true);
drav.setPolicyDecider(drpd);
request.setAuthorizationValidator(drav);
- request.validateAccess(command);
+ request.validateAccess(new String[] {QUERY}, command, CommandType.USER);
}
-
/**
* Test Request.processRequest().
* Test processing the same query twice, and make sure that doesn't cause problems.
@@ -166,7 +166,7 @@
DQPWorkContext workContext = RealMetadataFactory.buildWorkContext(metadata, RealMetadataFactory.example1VDB());
message.setStatementType(StatementType.PREPARED);
- message.setParameterValues(new ArrayList());
+ message.setParameterValues(new ArrayList<Object>());
helpProcessMessage(message, cache, workContext);
@@ -174,7 +174,7 @@
//If this doesn't throw an exception, assume it was successful.
message = new RequestMessage(QUERY);
message.setStatementType(StatementType.PREPARED);
- message.setParameterValues(new ArrayList());
+ message.setParameterValues(new ArrayList<Object>());
helpProcessMessage(message, cache, workContext);
}
12 years, 8 months