Author: shawkins
Date: 2010-03-09 13:11:28 -0500 (Tue, 09 Mar 2010)
New Revision: 1949
Added:
trunk/connector-api/src/main/java/org/teiid/logging/
trunk/connector-api/src/main/java/org/teiid/logging/api/
trunk/connector-api/src/main/java/org/teiid/logging/api/AuditMessage.java
trunk/connector-api/src/main/java/org/teiid/logging/api/CommandLogMessage.java
trunk/documentation/server-extensions-guide/src/main/docbook/en-US/content/logging.xml
Removed:
trunk/documentation/server-extensions-guide/src/main/docbook/en-US/content/command-logging.xml
trunk/engine/src/main/java/com/metamatrix/common/application/
trunk/engine/src/main/java/com/metamatrix/dqp/service/AuditMessage.java
trunk/engine/src/main/java/com/metamatrix/dqp/service/CommandLogMessage.java
trunk/engine/src/main/java/com/metamatrix/dqp/service/ConnectorBindingLifeCycleListener.java
trunk/engine/src/main/java/com/metamatrix/dqp/service/ConnectorStatus.java
trunk/engine/src/main/java/com/metamatrix/dqp/service/VDBLifeCycleListener.java
trunk/engine/src/main/java/com/metamatrix/platform/security/api/
trunk/engine/src/main/java/com/metamatrix/server/serverapi/
trunk/engine/src/main/java/com/metamatrix/server/util/
Modified:
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/AbstractMetadataRecord.java
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/BaseColumn.java
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Column.java
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/ColumnSet.java
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Datatype.java
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/ForeignKey.java
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/KeyRecord.java
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Procedure.java
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/ProcedureParameter.java
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Schema.java
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Table.java
trunk/documentation/connector-developer-guide/src/main/docbook/en-US/content/introduction.xml
trunk/documentation/server-extensions-guide/pom.xml
trunk/documentation/server-extensions-guide/src/main/docbook/en-US/server_extensions_guide.xml
trunk/engine/src/main/java/com/metamatrix/dqp/service/AuthorizationService.java
trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorManager.java
trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorWorkItem.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/validator/AuthorizationValidationVisitor.java
trunk/engine/src/test/java/com/metamatrix/dqp/service/FakeAuthorizationService.java
trunk/engine/src/test/java/org/teiid/dqp/internal/process/validator/TestAuthorizationValidationVisitor.java
trunk/runtime/src/main/java/org/teiid/services/AuthorizationServiceImpl.java
Log:
TEIID-667 TEIID-668 updating command and audit log classes/docs
Modified:
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/AbstractMetadataRecord.java
===================================================================
---
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/AbstractMetadataRecord.java 2010-03-09
17:19:00 UTC (rev 1948)
+++
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/AbstractMetadataRecord.java 2010-03-09
18:11:28 UTC (rev 1949)
@@ -35,6 +35,8 @@
*/
public abstract class AbstractMetadataRecord implements Serializable {
+ private static final long serialVersionUID = 564092984812414058L;
+
public final static char NAME_DELIM_CHAR = '.';
private static AtomicLong UUID_SEQUENCE = new AtomicLong();
Modified:
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/BaseColumn.java
===================================================================
---
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/BaseColumn.java 2010-03-09
17:19:00 UTC (rev 1948)
+++
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/BaseColumn.java 2010-03-09
18:11:28 UTC (rev 1949)
@@ -26,6 +26,8 @@
public abstract class BaseColumn extends AbstractMetadataRecord {
+ private static final long serialVersionUID = 6382258617714856616L;
+
public enum NullType {
No_Nulls {
@Override
Modified:
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Column.java
===================================================================
---
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Column.java 2010-03-09
17:19:00 UTC (rev 1948)
+++
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Column.java 2010-03-09
18:11:28 UTC (rev 1949)
@@ -28,6 +28,8 @@
*/
public class Column extends BaseColumn implements Comparable<Column> {
+ private static final long serialVersionUID = -1310120788764453726L;
+
public enum SearchType {
Unsearchable,
Like_Only {
Modified:
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/ColumnSet.java
===================================================================
---
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/ColumnSet.java 2010-03-09
17:19:00 UTC (rev 1948)
+++
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/ColumnSet.java 2010-03-09
18:11:28 UTC (rev 1949)
@@ -27,7 +27,9 @@
public class ColumnSet<T extends AbstractMetadataRecord> extends
AbstractMetadataRecord {
- private List<Column> columns;
+ private static final long serialVersionUID = -1185104601468519829L;
+
+ private List<Column> columns;
private T parent;
public List<Column> getColumns() {
Modified:
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Datatype.java
===================================================================
---
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Datatype.java 2010-03-09
17:19:00 UTC (rev 1948)
+++
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Datatype.java 2010-03-09
18:11:28 UTC (rev 1949)
@@ -25,13 +25,10 @@
import org.teiid.connector.metadata.runtime.BaseColumn.NullType;
import org.teiid.connector.metadata.runtime.Column.SearchType;
-
-
-/**
- * ColumnRecordImpl
- */
public class Datatype extends AbstractMetadataRecord {
+ private static final long serialVersionUID = -7839335802224393230L;
+
public enum Type {
Basic,
UserDefined,
Modified:
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/ForeignKey.java
===================================================================
---
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/ForeignKey.java 2010-03-09
17:19:00 UTC (rev 1948)
+++
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/ForeignKey.java 2010-03-09
18:11:28 UTC (rev 1949)
@@ -27,7 +27,9 @@
*/
public class ForeignKey extends KeyRecord {
- private String uniqueKeyID;
+ private static final long serialVersionUID = -8835750783230001311L;
+
+ private String uniqueKeyID;
private KeyRecord primaryKey;
public ForeignKey() {
Modified:
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/KeyRecord.java
===================================================================
---
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/KeyRecord.java 2010-03-09
17:19:00 UTC (rev 1948)
+++
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/KeyRecord.java 2010-03-09
18:11:28 UTC (rev 1949)
@@ -24,6 +24,8 @@
public class KeyRecord extends ColumnSet<Table> {
+ private static final long serialVersionUID = -3526999525526556933L;
+
public enum Type {
Primary,
Foreign,
Modified:
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Procedure.java
===================================================================
---
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Procedure.java 2010-03-09
17:19:00 UTC (rev 1948)
+++
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Procedure.java 2010-03-09
18:11:28 UTC (rev 1949)
@@ -31,6 +31,8 @@
*/
public class Procedure extends AbstractMetadataRecord {
+ private static final long serialVersionUID = 7714869437683360834L;
+
public enum Type {
Function,
UDF,
Modified:
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/ProcedureParameter.java
===================================================================
---
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/ProcedureParameter.java 2010-03-09
17:19:00 UTC (rev 1948)
+++
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/ProcedureParameter.java 2010-03-09
18:11:28 UTC (rev 1949)
@@ -27,6 +27,8 @@
*/
public class ProcedureParameter extends BaseColumn {
+ private static final long serialVersionUID = 3484281155208939073L;
+
public enum Type {
Unknown,
In,
Modified:
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Schema.java
===================================================================
---
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Schema.java 2010-03-09
17:19:00 UTC (rev 1948)
+++
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Schema.java 2010-03-09
18:11:28 UTC (rev 1949)
@@ -27,7 +27,9 @@
public class Schema extends AbstractMetadataRecord {
- private boolean physical = true;
+ private static final long serialVersionUID = -5113742472848113008L;
+
+ private boolean physical = true;
private boolean isVisible = true;
private String primaryMetamodelUri =
"http://www.metamatrix.com/metamodels/Relational"; //$NON-NLS-1$
Modified:
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Table.java
===================================================================
---
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Table.java 2010-03-09
17:19:00 UTC (rev 1948)
+++
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Table.java 2010-03-09
18:11:28 UTC (rev 1949)
@@ -26,11 +26,10 @@
import java.util.LinkedList;
import java.util.List;
-/**
- * TableRecordImpl
- */
public class Table extends ColumnSet<Schema> {
+ private static final long serialVersionUID = 4891356771125218672L;
+
public enum Type {
Table,
View,
Copied: trunk/connector-api/src/main/java/org/teiid/logging/api/AuditMessage.java (from
rev 1941, trunk/engine/src/main/java/com/metamatrix/dqp/service/AuditMessage.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/logging/api/AuditMessage.java
(rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/logging/api/AuditMessage.java 2010-03-09
18:11:28 UTC (rev 1949)
@@ -0,0 +1,72 @@
+/*
+ * 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.logging.api;
+
+import java.util.Arrays;
+
+/**
+ * Log format for auditing.
+ */
+public class AuditMessage {
+ private String context;
+ private String activity;
+ private String principal;
+ private Object[] resources;
+
+ public AuditMessage(String context, String activity, String principal, String[]
resources ) {
+ this.context = context;
+ this.activity = activity;
+ this.principal = principal;
+ this.resources = resources;
+ }
+
+ public String getContext() {
+ return this.context;
+ }
+
+ public String getActivity() {
+ return this.activity;
+ }
+
+ public String getPrincipal() {
+ return this.principal;
+ }
+
+ public Object[] getResources() {
+ return this.resources;
+ }
+
+ public String toString() {
+ StringBuffer msg = new StringBuffer();
+ msg.append(" ["); //$NON-NLS-1$
+ msg.append( getPrincipal() );
+ msg.append("] <"); //$NON-NLS-1$
+ msg.append( getContext() );
+ msg.append('.');
+ msg.append( getActivity() );
+ msg.append("> "); //$NON-NLS-1$
+ msg.append( Arrays.toString(resources) );
+ return msg.toString();
+ }
+
+}
Copied: trunk/connector-api/src/main/java/org/teiid/logging/api/CommandLogMessage.java
(from rev 1941,
trunk/engine/src/main/java/com/metamatrix/dqp/service/CommandLogMessage.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/logging/api/CommandLogMessage.java
(rev 0)
+++
trunk/connector-api/src/main/java/org/teiid/logging/api/CommandLogMessage.java 2010-03-09
18:11:28 UTC (rev 1949)
@@ -0,0 +1,215 @@
+/*
+ * 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.logging.api;
+
+import java.text.DateFormat;
+import java.util.Date;
+
+import org.teiid.connector.api.ExecutionContext;
+
+/**
+ * Log Message for source and user command events.
+ */
+public class CommandLogMessage {
+
+ public enum Event {
+ NEW,
+ END,
+ CANCEL,
+ ERROR
+ }
+
+ private boolean source;
+ private Event event;
+ private long timestamp;
+
+ // Transaction info
+ private String transactionID;
+
+ // Session info
+ private String sessionID;
+ private String applicationName;
+ private String principal;
+ private String vdbName;
+ private int vdbVersion;
+
+ // RequestInfo
+ private String requestID;
+ private Long sourceCommandID;
+ private String sql;
+ private Integer rowCount;
+ private String modelName;
+ private String connectorBindingName;
+ private ExecutionContext executionContext;
+
+ public CommandLogMessage(long timestamp,
+ String requestID,
+ String transactionID,
+ String sessionID,
+ String applicationName,
+ String principal,
+ String vdbName,
+ int vdbVersion,
+ String sql) {
+ // userCommandStart
+ this(timestamp, requestID, transactionID, sessionID, principal, vdbName, vdbVersion,
null, Event.NEW);
+ this.applicationName = applicationName;
+ this.sql = sql;
+ }
+ public CommandLogMessage(long timestamp,
+ String requestID,
+ String transactionID,
+ String sessionID,
+ String principal,
+ String vdbName,
+ int vdbVersion,
+ Integer finalRowCount,
+ Event event) {
+ // userCommandEnd
+ this.event = event;
+ this.timestamp = timestamp;
+ this.requestID = requestID;
+ this.transactionID = transactionID;
+ this.sessionID = sessionID;
+ this.principal = principal;
+ this.vdbName = vdbName;
+ this.vdbVersion = vdbVersion;
+ this.rowCount = finalRowCount;
+ }
+ public CommandLogMessage(long timestamp,
+ String requestID,
+ long sourceCommandID,
+ String transactionID,
+ String modelName,
+ String connectorBindingName,
+ String sessionID,
+ String principal,
+ String sql,
+ ExecutionContext context) {
+ // dataSourceCommandStart
+ this(timestamp, requestID, sourceCommandID, transactionID, modelName,
connectorBindingName, sessionID, principal, null, Event.NEW, context);
+ this.sql = sql;
+ }
+ public CommandLogMessage(long timestamp,
+ String requestID,
+ long sourceCommandID,
+ String transactionID,
+ String modelName,
+ String connectorBindingName,
+ String sessionID,
+ String principal,
+ Integer finalRowCount,
+ Event event,
+ ExecutionContext context) {
+ // dataSourceCommandEnd
+ this.source = true;
+ this.event = event;
+ this.timestamp = timestamp;
+ this.requestID = requestID;
+ this.sourceCommandID = sourceCommandID;
+ this.transactionID = transactionID;
+ this.modelName = modelName;
+ this.connectorBindingName = connectorBindingName;
+ this.sessionID = sessionID;
+ this.principal = principal;
+ this.rowCount = finalRowCount;
+ this.executionContext = context;
+ }
+
+ public String toString() {
+ if (!source && event == Event.NEW) {
+ return "\tSTART USER COMMAND:\tstartTime=" + getTimestampString(new
Date(timestamp)) + "\trequestID=" + requestID + "\ttxID=" +
transactionID + "\tsessionID=" + sessionID + "\tapplicationName=" +
applicationName + "\tprincipal=" + principal + "\tvdbName=" + vdbName
+ "\tvdbVersion=" + vdbVersion + "\tsql=" + sql; //$NON-NLS-1$
//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$//$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
//$NON-NLS-8$ //$NON-NLS-9$
+ }
+ if (!source) {
+ return "\t"+ event +" USER COMMAND:\tendTime=" +
getTimestampString(new Date(timestamp)) + "\trequestID=" + requestID +
"\ttxID=" + transactionID + "\tsessionID=" + sessionID +
"\tprincipal=" + principal + "\tvdbName=" + vdbName +
"\tvdbVersion=" + vdbVersion + "\tfinalRowCount=" + rowCount;
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$//$NON-NLS-5$ //$NON-NLS-6$
//$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$
+ }
+ if (event == Event.NEW) {
+ return "\tSTART DATA SRC COMMAND:\tstartTime=" + getTimestampString(new
Date(timestamp)) + "\trequestID=" + requestID + "\tsourceCommandID="+
sourceCommandID + "\ttxID=" + transactionID + "\tmodelName="+
modelName + "\tconnectorBindingName=" + connectorBindingName +
"\tsessionID=" + sessionID + "\tprincipal=" + principal +
"\tsql=" + sql; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
//$NON-NLS-4$//$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$
+ }
+ return "\t"+ event +" SRC COMMAND:\tendTime=" +
getTimestampString(new Date(timestamp)) + "\trequestID=" + requestID +
"\tsourceCommandID="+ sourceCommandID + "\ttxID=" + transactionID +
"\tmodelName="+ modelName + "\tconnectorBindingName=" +
connectorBindingName + "\tsessionID=" + sessionID + "\tprincipal=" +
principal + "\tfinalRowCount=" + rowCount; //$NON-NLS-1$ //$NON-NLS-2$
//$NON-NLS-3$ //$NON-NLS-4$//$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$
//$NON-NLS-9$ //$NON-NLS-10$
+ }
+
+ private String getTimestampString(Date date) {
+ return DateFormat.getDateInstance().format(date);
+ }
+ public long getTimestamp() {
+ return timestamp;
+ }
+ public String getTransactionID() {
+ return transactionID;
+ }
+ public String getSessionID() {
+ return sessionID;
+ }
+ public String getApplicationName() {
+ return applicationName;
+ }
+ public String getPrincipal() {
+ return principal;
+ }
+ public String getVdbName() {
+ return vdbName;
+ }
+ public int getVdbVersion() {
+ return vdbVersion;
+ }
+ public String getRequestID() {
+ return requestID;
+ }
+ public Long getSourceCommandID() {
+ return sourceCommandID;
+ }
+ /**
+ * Returns the command. Only valid for {@link Event#NEW}
+ * @return
+ */
+ public String getSql() {
+ return sql;
+ }
+ /**
+ * Returns the command. Only valid for {@link Event#END}
+ * @return
+ */
+ public Integer getRowCount() {
+ return rowCount;
+ }
+ public String getModelName() {
+ return modelName;
+ }
+ public String getConnectorBindingName() {
+ return connectorBindingName;
+ }
+ public Event getStatus() {
+ return event;
+ }
+ public boolean isSource() {
+ return source;
+ }
+ /**
+ * Only available for source commands
+ * @return
+ */
+ public ExecutionContext getExecutionContext() {
+ return executionContext;
+ }
+}
Modified:
trunk/documentation/connector-developer-guide/src/main/docbook/en-US/content/introduction.xml
===================================================================
---
trunk/documentation/connector-developer-guide/src/main/docbook/en-US/content/introduction.xml 2010-03-09
17:19:00 UTC (rev 1948)
+++
trunk/documentation/connector-developer-guide/src/main/docbook/en-US/content/introduction.xml 2010-03-09
18:11:28 UTC (rev 1949)
@@ -1,8 +1,8 @@
<chapter id="introduction">
<title>Connectors in Teiid</title>
- <para>In Teiid a connector handles all communications with individual enterprise
information sources, which can include
- databases, data feeds, flat files, or any other entity you have
modeled.</para>
- <para>In Teiid, a connector is used to:</para>
+ <para>A connector handles all communications with individual enterprise
information sources, which can include
+ databases, data feeds, flat files, etc.</para>
+ <para>A connector is used to:</para>
<itemizedlist>
<listitem>
<para>Translate a Teiid-specific command into a native command.</para>
@@ -11,7 +11,7 @@
<para>Execute the command.</para>
</listitem>
<listitem>
- <para>Return batches of results to Teiid.</para>
+ <para>Return batches of results.</para>
</listitem>
</itemizedlist>
<para>Teiid is responsible for reassembling the results from one or more
connectors into an
@@ -24,7 +24,7 @@
</para>
<sect1>
<title>Do You Need a New Connector?</title>
- <para>Teiid can provide several connectors for common enterprise information
system types. If
+ <para>Teiid provides several connectors for common enterprise information
system types. If
you can use one of these enterprise information systems, you do not need to develop
a custom one.
</para>
<para>Teiid offers the following connectors:</para>
@@ -33,7 +33,7 @@
<para>
<emphasis>JDBC:</emphasis>
Connects to many relational databases. The JDBC Connector is validated against
the following database
- systems: Oracle, Microsoft SQL Server, IBM DB2, MySQL, Postgres, Derby, and
Sybase. In addition, the JDBC Connector can
+ systems: Oracle, Microsoft SQL Server, IBM DB2, MySQL, Postgres, Derby, Sybase,
H2, and HSQL. In addition, the JDBC Connector can
often be used with other 3rd-party drivers and provides a wide range of
extensibility options to
specialize behavior against those drivers.
</para>
@@ -82,14 +82,11 @@
<para>Expectation for incoming queries/metadata</para>
</listitem>
<listitem>
- <para>The SQL and processing constructs supported by information
system.</para>
+ <para>The processing constructs, or capabilities, supported by
information system.</para>
</listitem>
<listitem>
<para>Required properties for the connector, such as URL, user name,
etc.</para>
</listitem>
- <listitem>
- <para>The CDK development kit (jars and tools).</para>
- </listitem>
</itemizedlist>
</listitem>
<listitem>
Modified: trunk/documentation/server-extensions-guide/pom.xml
===================================================================
--- trunk/documentation/server-extensions-guide/pom.xml 2010-03-09 17:19:00 UTC (rev
1948)
+++ trunk/documentation/server-extensions-guide/pom.xml 2010-03-09 18:11:28 UTC (rev
1949)
@@ -45,7 +45,7 @@
<format>
<formatName>pdf</formatName>
<stylesheetResource>classpath:/xslt/org/jboss/pdf.xsl</stylesheetResource>
- <finalName>membership_domain_guide.pdf</finalName>
+ <finalName>server_extensions_guide.pdf</finalName>
</format>
<!-- <format>
<formatName>html_single</formatName>
Deleted:
trunk/documentation/server-extensions-guide/src/main/docbook/en-US/content/command-logging.xml
===================================================================
---
trunk/documentation/server-extensions-guide/src/main/docbook/en-US/content/command-logging.xml 2010-03-09
17:19:00 UTC (rev 1948)
+++
trunk/documentation/server-extensions-guide/src/main/docbook/en-US/content/command-logging.xml 2010-03-09
18:11:28 UTC (rev 1949)
@@ -1,48 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
-<chapter id="Command_logging">
- <title>Command Logging</title>
- <para>Commaand logger lets the user capture the commands that are being executed
in the Teiid System
- at the user level as well the at the data source level. The user commands are
commands that have been submitted
- to the system and data source commands are those that are being executed by the
connectors</para>
- <para>Users have the ability to capture command logging information in a log
file, saved to a user-specified
- location. If a custom command logger is in use, command logging information will no
longer be logged to the
- repository tables. Users and administrators must choose between the default logging
to the Teiid
- Repository and custom command logging.</para>
- <sect1>
- <title>Command Logging API</title>
- <para>
- Command Logging is defined by interface com.metamatrix.dqp.spi.CommandLoggerSPI
- administrators and users can write their own Java implementation of this interface
and plug it into
- Teiid by supplying the fully-qualified classname as the value of the
- metamatrix.server.commandLoggerClassname system property.
- </para>
- <para>Users must also add the implementation class file to the classpath of the
Teiid System. This
- can be done by creating a jar file, adding it to the /lib/patches directory
section, and doing a full stop
- and restart of the server.</para>
- <para>A user’s CommandLogger implementation may require its own property names
and values. Add these
- name/value pairs as a semicolon-delimited list after the command logger classname
property in the Teiid
- Console. For example, a user might need to place a value such as this into the
Console system property:
- </para>
- <programlisting><![CDATA[
-com.myCode.MyClass;metamatrix.transaction.log.storeMMCMD=true;metamatrix.transaction.log.storeSRCCMD=true;myCustomProperty1=MyValue1;
- ]]></programlisting>
- <para>The first part of this string tells Teiid what class it needs to load and
instantiate. The other
- two parts of the string (delimited by semicolons), are a couple of name/value pairs
that will be passed to
- the newly-instantiated Command Logger.</para>
- <para>The system properties "metamatrix.transaction.log.storeMMCMD"
and
- "metamatrix.transaction.log.storeSRCCMD" control whether to send the
custom logger user level command and
- source level commands respectively.</para>
- <note>
- <para>Teiid has provided a sample implementation of the SPI that logs to a
file. Supply the
- following text for the "metamatrix.server.commandLoggerClassname"
property in the Console to enable it</para>
- <programlisting><![CDATA[
-
com.metamatrix.dqp.spi.basic.FileCommandLogger;dqp.commandLogger.fileName=commandLogFile.txt
- ]]></programlisting>
- <para>This means that an instance of the class FileCommandLogger will be used
by the new Tracking Service
- implementation. The FileCommandLogger is expecting a filename property called
dqp.commandLogger.fileName to
- be passed to it, and the value of that property is
commandLogFile.txt.</para>
- </note>
- </sect1>
-
-</chapter>
\ No newline at end of file
Copied:
trunk/documentation/server-extensions-guide/src/main/docbook/en-US/content/logging.xml
(from rev 1941,
trunk/documentation/server-extensions-guide/src/main/docbook/en-US/content/command-logging.xml)
===================================================================
---
trunk/documentation/server-extensions-guide/src/main/docbook/en-US/content/logging.xml
(rev 0)
+++
trunk/documentation/server-extensions-guide/src/main/docbook/en-US/content/logging.xml 2010-03-09
18:11:28 UTC (rev 1949)
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % CustomDTD SYSTEM "../../../../../../docbook/custom.dtd">
+%CustomDTD;
+]>
+<chapter id="logging">
+ <title>Logging</title>
+ <sect1 id="general_logging">
+ <title>General Logging</title>
+ <para>
+ The Teiid system provides a wealth of information via logging. To
+ control logging level, contexts, and log locations, you should be
+ familiar with
+ <ulink
url="http://logging.apache.org/log4j/">log4j</ulink>
+ and the container's jboss-log4j.xml configuration file. All the logs
+ produced by Teiid are prefixed by org.teiid. This makes it extremely
+ easy to control of of Teiid logging from a single context.
+ </para>
+ <sect2>
+ <title>Command Logging API</title>
+ <para>
+ If the default log4j logging mechanisms are not sufficient for your
+ logging needs you may need a appender - see
+ <ulink
url="http://logging.apache.org/log4j/1.2/apidocs/index.html">... log4j
javadocs</ulink>
+ . Note that log4j already provides quite a few appenders including
+ JMS, RDBMS, and SMTP.
+ </para>
+ <para>If you develop a custom logging solution, the implementation
+ jar should be placed in the lib directory of the server profile
+ Teiid is installed in.
+ </para>
+ </sect2>
+ </sect1>
+ <sect1>
+ <title>Command Logging</title>
+ <para>Command logging captures executing commands in the
+ Teiid System.
+ Both user commands (that have been submitted
+ to Teiid)
+ and data source
+ commands (that are being executed by the
+ connectors)
+ are tracked
+ through command logging.</para>
+ <para>To enable command logging to the default log location, simply
+ enable the DETAIL level of logging for the org.teiid.COMMAND_LOG
+ context.</para>
+ <para>To enable command logging to an alternative file location,
+ configure a separate file appender for the DETAIL logging of the
+ org.teiid.COMMAND_LOG context. An example of this is already in
+ the log4j.xml distributed with Teiid.</para>
+ <sect2>
+ <title>Command Logging API</title>
+ <para>
+ If the default log4j logging mechanisms are not sufficient for
+ your
+ command logging needs, you may need a custom log4j appender.
+ The
+ custom appender will have access to log4j LoggingEvents to the
+ COMMAND_LOG context, which have a
+ message that is an instance of
+ org.teiid.logging.api.CommandLogMessage (defined in the
teiid-connector-api-&versionNumber;.jar).
+ </para>
+ <para>
+ See
+ <link linkend="general_logging">General Logging</link>
+ for more information on utilizing log4j.
+ </para>
+ </sect2>
+ </sect1>
+ <sect1>
+ <title>Audit Logging</title>
+ <para>Audit logging captures important security events. This includes
+ the enforcement of permissions, authentication success/failures, etc.
+ </para>
+ <para>To enable audit logging to the default log location, simply
+ enable the DETAIL level of logging for the org.teiid.AUDIT_LOG
+ context.</para>
+ <para>To enable audit logging to an alternative file location,
+ configure a separate file appender for the DETAIL logging of the
+ org.teiid.AUDIT_LOG context. An example of this is already in
+ the
+ log4j.xml distributed with Teiid.</para>
+ <sect2>
+ <title>Audit Logging API</title>
+ <para>
+ If the default log4j logging mechanisms are not sufficient for
+ your
+ audit logging needs, you may need a custom log4j appender.
+ The
+ custom appender will have access to log4j LoggingEvents to the
+ AUDIT_LOG context, which have a
+ message that is an instance of
+ org.teiid.logging.api.AuditMessage (defined in the
teiid-connector-api-&versionNumber;.jar). AuditMessages include
+ information about user, the action, and the target(s) of the action.
+ </para>
+ <para>
+ See
+ <link linkend="general_logging">General Logging</link>
+ for more information on utilizing log4j.
+ </para>
+ </sect2>
+ </sect1>
+</chapter>
\ No newline at end of file
Modified:
trunk/documentation/server-extensions-guide/src/main/docbook/en-US/server_extensions_guide.xml
===================================================================
---
trunk/documentation/server-extensions-guide/src/main/docbook/en-US/server_extensions_guide.xml 2010-03-09
17:19:00 UTC (rev 1948)
+++
trunk/documentation/server-extensions-guide/src/main/docbook/en-US/server_extensions_guide.xml 2010-03-09
18:11:28 UTC (rev 1949)
@@ -46,10 +46,10 @@
<toc/>
<xi:include href="content/introduction.xml"
xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="content/logging.xml"
xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="content/security.xml"
xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="content/custom-membership.xml"
xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="content/appendix-a.xml"
xmlns:xi="http://www.w3.org/2001/XInclude" />
- <xi:include href="content/command-logging.xml"
xmlns:xi="http://www.w3.org/2001/XInclude" />
</book>
Deleted: trunk/engine/src/main/java/com/metamatrix/dqp/service/AuditMessage.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/dqp/service/AuditMessage.java 2010-03-09
17:19:00 UTC (rev 1948)
+++ trunk/engine/src/main/java/com/metamatrix/dqp/service/AuditMessage.java 2010-03-09
18:11:28 UTC (rev 1949)
@@ -1,123 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.dqp.service;
-
-
-public class AuditMessage {
- private static final String RESOURCE_DELIMITER = ", "; //$NON-NLS-1$
-
- private String context;
- private String activity;
- private String principal;
- private Object[] resources;
-
- public AuditMessage(String context, String activity, String principal, Object[]
resources ) {
- this.context = context;
- this.activity = activity;
- this.principal = principal;
- this.resources = resources;
- }
-
- public String getContext() {
- return this.context;
- }
-
- public String getActivity() {
- return this.activity;
- }
-
- public String getPrincipal() {
- return this.principal;
- }
-
- public Object[] getResources() {
- return this.resources;
- }
-
- public String getText() {
- StringBuffer text = new StringBuffer();
- if(resources != null && resources.length > 0 ) {
- Object resource = resources[0];
- if ( resource != null ) {
- text.append(resource.toString());
- }
- for(int i=1; i<resources.length; ++i) {
- text.append(RESOURCE_DELIMITER);
- resource = resources[i];
- if ( resource != null ) {
- text.append(resource.toString());
- }
- }
- }
- return text.toString();
- }
-
- public String getText( String delimiter ) {
- StringBuffer text = new StringBuffer();
- if ( delimiter != null ) {
- if(resources != null && resources.length > 0 ) {
- Object resource = resources[0];
- if ( resource != null ) {
- text.append(resource.toString());
- }
- for(int i=1; i<resources.length; ++i) {
- text.append(delimiter);
- resource = resources[i];
- if ( resource != null ) {
- text.append(resource.toString());
- }
- }
- }
- } else {
- if(resources != null && resources.length > 0 ) {
- Object resource = resources[0];
- if ( resource != null ) {
- text.append(resource.toString());
- }
- for(int i=1; i<resources.length; ++i) {
- text.append(RESOURCE_DELIMITER);
- resource = resources[i];
- if ( resource != null ) {
- text.append(resource.toString());
- }
- }
- }
- }
- return text.toString();
- }
-
- public String toString() {
- StringBuffer msg = new StringBuffer();
- msg.append(" ["); //$NON-NLS-1$
- msg.append( getPrincipal() );
- msg.append("] <"); //$NON-NLS-1$
- msg.append( getContext() );
- msg.append('.');
- msg.append( getActivity() );
- msg.append("> "); //$NON-NLS-1$
- msg.append( getText() );
-
- return msg.toString();
- }
-
-}
Modified: trunk/engine/src/main/java/com/metamatrix/dqp/service/AuthorizationService.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/dqp/service/AuthorizationService.java 2010-03-09
17:19:00 UTC (rev 1948)
+++
trunk/engine/src/main/java/com/metamatrix/dqp/service/AuthorizationService.java 2010-03-09
18:11:28 UTC (rev 1949)
@@ -43,11 +43,13 @@
public static final int ACTION_UPDATE = 2;
public static final int ACTION_DELETE = 3;
- public static final int CONTEXT_QUERY = 0;
- public static final int CONTEXT_INSERT = 1;
- public static final int CONTEXT_UPDATE = 2;
- public static final int CONTEXT_DELETE = 3;
- public static final int CONTEXT_PROCEDURE = 4;
+ public enum Context {
+ QUERY,
+ INSERT,
+ UPDATE,
+ DELETE,
+ STORED_PROCEDURE;
+ }
public static final String ENTITELEMENTS_ENABLED =
"auth.check_entitlements"; //$NON-NLS-1$
public static final String ADMIN_ROLES_FILE = "auth.adminRolesFile";
//$NON-NLS-1$
@@ -61,7 +63,7 @@
* @return Collection Subset of resources
* @throws MetaMatrixComponentException If an error occurs in the service while
checking resources
*/
- Collection getInaccessibleResources(int action, Collection resources, int context)
throws MetaMatrixComponentException;
+ Collection getInaccessibleResources(int action, Collection resources, Context
context) throws MetaMatrixComponentException;
/**
* Determine whether entitlements checking is enabled on the server.
Deleted: trunk/engine/src/main/java/com/metamatrix/dqp/service/CommandLogMessage.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/dqp/service/CommandLogMessage.java 2010-03-09
17:19:00 UTC (rev 1948)
+++
trunk/engine/src/main/java/com/metamatrix/dqp/service/CommandLogMessage.java 2010-03-09
18:11:28 UTC (rev 1949)
@@ -1,190 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.dqp.service;
-
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import org.teiid.connector.api.ExecutionContext;
-
-
-
-public class CommandLogMessage {
-
- static final int USER_COMMAND_START = 0;
- static final int USER_COMMAND_END = 1;
- static final int DATASOURCE_COMMAND_START = 2;
- static final int DATASOURCE_COMMAND_END = 3;
-
- public static final short CMD_POINT_BEGIN = 1;
- public static final short CMD_POINT_END = 2;
-
- public static final short CMD_STATUS_NEW = 1;
- public static final short CMD_STATUS_END = 2;
- public static final short CMD_STATUS_CANCEL = 3;
- public static final short CMD_STATUS_ERROR = 4;
-
- private static final String TIMESTAMP_FORMAT = "yyyy.MM.dd HH:mm:ss.SSS";
//$NON-NLS-1$
- private static DateFormat TIMESTAMP_FORMATTER = new
SimpleDateFormat(TIMESTAMP_FORMAT);
-
- int type;
- long timestamp;
-
- // Transaction info
- String transactionID;
- String subTransactionID;
- boolean isCommit;
-
- // Session info
- String sessionID;
- String applicationName;
- String principal;
- String vdbName;
- int vdbVersion;
-
- // RequestInfo
- String requestID;
- long sourceCommandID;
- String sql;
- int rowCount;
- String modelName;
- String connectorBindingName;
- boolean isCancelled;
- boolean errorOccurred;
- ExecutionContext executionContext;
-
-
- public CommandLogMessage(long timestamp,
- String requestID,
- String transactionID,
- String sessionID,
- String applicationName,
- String principal,
- String vdbName,
- int vdbVersion,
- String sql) {
- // userCommandStart
- this.type = USER_COMMAND_START;
- this.timestamp = timestamp;
- this.requestID = requestID;
- this.transactionID = transactionID;
- this.sessionID = sessionID;
- this.applicationName = applicationName;
- this.principal = principal;
- this.vdbName = vdbName;
- this.vdbVersion = vdbVersion;
- this.sql = sql;
- }
- public CommandLogMessage(long timestamp,
- String requestID,
- String transactionID,
- String sessionID,
- String principal,
- String vdbName,
- int vdbVersion,
- int finalRowCount,
- boolean isCancelled,
- boolean errorOccurred) {
- // userCommandEnd
- this.type = USER_COMMAND_END;
- this.timestamp = timestamp;
- this.requestID = requestID;
- this.transactionID = transactionID;
- this.sessionID = sessionID;
- this.principal = principal;
- this.vdbName = vdbName;
- this.vdbVersion = vdbVersion;
- this.rowCount = finalRowCount;
- this.isCancelled = isCancelled;
- this.errorOccurred = errorOccurred;
- }
- public CommandLogMessage(long timestamp,
- String requestID,
- long sourceCommandID,
- String subTransactionID,
- String modelName,
- String connectorBindingName,
- String sessionID,
- String principal,
- String sql,
- ExecutionContext context) {
- // dataSourceCommandStart
- this.type = DATASOURCE_COMMAND_START;
- this.timestamp = timestamp;
- this.requestID = requestID;
- this.sourceCommandID = sourceCommandID;
- this.subTransactionID = subTransactionID;
- this.modelName = modelName;
- this.connectorBindingName = connectorBindingName;
- this.sessionID = sessionID;
- this.principal = principal;
- this.sql = sql;
- this.executionContext = context;
- }
- public CommandLogMessage(long timestamp,
- String requestID,
- long sourceCommandID,
- String subTransactionID,
- String modelName,
- String connectorBindingName,
- String sessionID,
- String principal,
- int finalRowCount,
- boolean isCancelled,
- boolean errorOccurred,
- ExecutionContext context) {
- // dataSourceCommandEnd
- this.type = DATASOURCE_COMMAND_END;
- this.timestamp = timestamp;
- this.requestID = requestID;
- this.sourceCommandID = sourceCommandID;
- this.subTransactionID = subTransactionID;
- this.modelName = modelName;
- this.connectorBindingName = connectorBindingName;
- this.sessionID = sessionID;
- this.principal = principal;
- this.rowCount = finalRowCount;
- this.isCancelled = isCancelled;
- this.errorOccurred = errorOccurred;
- this.executionContext = context;
- }
-
- public String toString() {
- switch (this.type) {
- case USER_COMMAND_START:
- return getTimestampString(new Date()) + "\tSTART USER
COMMAND:\tstartTime=" + getTimestampString(new Date(timestamp)) +
"\trequestID=" + requestID + "\ttxID=" + transactionID +
"\tsessionID=" + sessionID + "\tapplicationName=" + applicationName +
"\tprincipal=" + principal + "\tvdbName=" + vdbName +
"\tvdbVersion=" + vdbVersion + "\tsql=" + sql; //$NON-NLS-1$
//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$//$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
//$NON-NLS-8$ //$NON-NLS-9$
- case USER_COMMAND_END:
- return getTimestampString(new Date()) + "\tEND USER COMMAND:\tendTime="
+ getTimestampString(new Date(timestamp)) + "\trequestID=" + requestID +
"\ttxID=" + transactionID + "\tsessionID=" + sessionID +
"\tprincipal=" + principal + "\tvdbName=" + vdbName +
"\tvdbVersion=" + vdbVersion + "\tfinalRowCount=" + rowCount +
"\tisCancelled=" + isCancelled + "\terrorOccurred=" + errorOccurred;
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$//$NON-NLS-5$ //$NON-NLS-6$
//$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$
- case DATASOURCE_COMMAND_START:
- return getTimestampString(new Date()) + "\tSTART DATA SRC
COMMAND:\tstartTime=" + getTimestampString(new Date(timestamp)) +
"\trequestID=" + requestID + "\tsourceCommandID="+ sourceCommandID +
"\tsubTxID=" + subTransactionID + "\tmodelName="+ modelName +
"\tconnectorBindingName=" + connectorBindingName + "\tsessionID=" +
sessionID + "\tprincipal=" + principal + "\tsql=" + sql;
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$//$NON-NLS-5$ //$NON-NLS-6$
//$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$
- case DATASOURCE_COMMAND_END:
- return getTimestampString(new Date()) + "\tEND DATA SRC
COMMAND:\tendTime=" + getTimestampString(new Date(timestamp)) +
"\trequestID=" + requestID + "\tsourceCommandID="+ sourceCommandID +
"\tsubTxID=" + subTransactionID + "\tmodelName="+ modelName +
"\tconnectorBindingName=" + connectorBindingName + "\tsessionID=" +
sessionID + "\tprincipal=" + principal + "\tfinalRowCount=" + rowCount
+ "\tisCancelled=" + isCancelled + "\terrorOccurred=" + errorOccurred;
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$//$NON-NLS-5$ //$NON-NLS-6$
//$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$
- }
- return null;
- }
-
- private String getTimestampString(Date date) {
- return TIMESTAMP_FORMATTER.format(date);
- }
-}
Deleted:
trunk/engine/src/main/java/com/metamatrix/dqp/service/ConnectorBindingLifeCycleListener.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/dqp/service/ConnectorBindingLifeCycleListener.java 2010-03-09
17:19:00 UTC (rev 1948)
+++
trunk/engine/src/main/java/com/metamatrix/dqp/service/ConnectorBindingLifeCycleListener.java 2010-03-09
18:11:28 UTC (rev 1949)
@@ -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 com.metamatrix.dqp.service;
-
-
-/**
- * A listerner object for listening the connector bindings adding deleting
- */
-public interface ConnectorBindingLifeCycleListener {
-
- /**
- * Connector Binding Loaded
- * @param bindingName
- */
- public void loaded(String bindingName);
-
- /**
- * Connector Binding Un-Loaded
- * @param bindingName
- */
- public void unloaded(String bindingName);
-}
Deleted: trunk/engine/src/main/java/com/metamatrix/dqp/service/ConnectorStatus.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/dqp/service/ConnectorStatus.java 2010-03-09
17:19:00 UTC (rev 1948)
+++ trunk/engine/src/main/java/com/metamatrix/dqp/service/ConnectorStatus.java 2010-03-09
18:11:28 UTC (rev 1949)
@@ -1,26 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package com.metamatrix.dqp.service;
-
-public enum ConnectorStatus {
- NOT_INITIALIZED, INIT_FAILED, OPEN, DATA_SOURCE_UNAVAILABLE, CLOSED, UNABLE_TO_CHECK;
-}
Deleted: trunk/engine/src/main/java/com/metamatrix/dqp/service/VDBLifeCycleListener.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/dqp/service/VDBLifeCycleListener.java 2010-03-09
17:19:00 UTC (rev 1948)
+++
trunk/engine/src/main/java/com/metamatrix/dqp/service/VDBLifeCycleListener.java 2010-03-09
18:11:28 UTC (rev 1949)
@@ -1,45 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.dqp.service;
-
-
-/**
- * A listener object for listening for the life cycle events for the VDB
- * @since 4.3
- */
-public interface VDBLifeCycleListener {
-
- /**
- * A new VDB is loaded/added to the system
- * @param vdbName - name of the VDB
- * @param vdbVersion - version of the VDB
- */
- public void loaded(String vdbName, String vdbVersion);
-
- /**
- * VDB is unloaded/deleted from the system
- * @param vdbName - name of the VDB
- * @param vdbVersion - version of the VDB
- */
- public void unloaded(String vdbName, String vdbVersion);
-}
Modified:
trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorManager.java
===================================================================
---
trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorManager.java 2010-03-09
17:19:00 UTC (rev 1948)
+++
trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorManager.java 2010-03-09
18:11:28 UTC (rev 1949)
@@ -54,6 +54,8 @@
import org.teiid.connector.metadata.runtime.MetadataStore;
import org.teiid.dqp.internal.cache.DQPContextCache;
import org.teiid.dqp.internal.datamgr.CapabilitiesConverter;
+import org.teiid.logging.api.CommandLogMessage;
+import org.teiid.logging.api.CommandLogMessage.Event;
import org.teiid.security.SecurityHelper;
import com.metamatrix.common.comm.api.ResultsReceiver;
@@ -66,8 +68,6 @@
import com.metamatrix.dqp.message.AtomicRequestMessage;
import com.metamatrix.dqp.message.AtomicResultsMessage;
import com.metamatrix.dqp.service.BufferService;
-import com.metamatrix.dqp.service.CommandLogMessage;
-import com.metamatrix.dqp.service.ConnectorStatus;
import com.metamatrix.dqp.util.LogConstants;
import com.metamatrix.query.optimizer.capabilities.BasicSourceCapabilities;
import com.metamatrix.query.optimizer.capabilities.SourceCapabilities;
@@ -81,6 +81,10 @@
@ManagementObject(isRuntime=true,
componentType=@ManagementComponent(type="teiid",subtype="connectormanager"),
properties=ManagementProperties.EXPLICIT)
public class ConnectorManager {
+ public enum ConnectorStatus {
+ NOT_INITIALIZED, INIT_FAILED, OPEN, DATA_SOURCE_UNAVAILABLE, CLOSED, UNABLE_TO_CHECK;
+ }
+
public static final int DEFAULT_MAX_THREADS = 20;
private String connectorName;
@@ -334,12 +338,12 @@
* Add begin point to transaction monitoring table.
* @param qr Request that contains the MetaMatrix command information in the
transaction.
*/
- void logSRCCommand(AtomicRequestMessage qr, ExecutionContext context, short
cmdStatus, int finalRowCnt) {
+ void logSRCCommand(AtomicRequestMessage qr, ExecutionContext context, Event
cmdStatus, Integer finalRowCnt) {
if (!LogManager.isMessageToBeRecorded(LogConstants.CTX_COMMANDLOGGING,
MessageLevel.INFO)) {
return;
}
String sqlStr = null;
- if(cmdStatus == CommandLogMessage.CMD_STATUS_NEW){
+ if(cmdStatus == Event.NEW){
Command cmd = qr.getCommand();
sqlStr = cmd != null ? cmd.toString() : null;
}
@@ -352,23 +356,14 @@
String modelName = qr.getModelName();
AtomicRequestID id = qr.getAtomicRequestID();
- short cmdPoint = cmdStatus == CommandLogMessage.CMD_STATUS_NEW ?
CommandLogMessage.CMD_POINT_BEGIN : CommandLogMessage.CMD_POINT_END;
String principal = userName == null ? "unknown" : userName;
//$NON-NLS-1$
CommandLogMessage message = null;
- if (cmdPoint == CommandLogMessage.CMD_POINT_BEGIN) {
+ if (cmdStatus == Event.NEW) {
message = new CommandLogMessage(System.currentTimeMillis(),
qr.getRequestID().toString(), id.getNodeID(), transactionID, modelName, connectorName,
qr.getWorkContext().getConnectionID(), principal, sqlStr, context);
}
else {
- boolean isCancelled = false;
- boolean errorOccurred = false;
-
- if (cmdStatus == CommandLogMessage.CMD_STATUS_CANCEL) {
- isCancelled = true;
- } else if (cmdStatus == CommandLogMessage.CMD_STATUS_ERROR) {
- errorOccurred = true;
- }
- message = new CommandLogMessage(System.currentTimeMillis(),
qr.getRequestID().toString(), id.getNodeID(), transactionID, modelName, connectorName,
qr.getWorkContext().getConnectionID(), principal, finalRowCnt, isCancelled, errorOccurred,
context);
+ message = new CommandLogMessage(System.currentTimeMillis(),
qr.getRequestID().toString(), id.getNodeID(), transactionID, modelName, connectorName,
qr.getWorkContext().getConnectionID(), principal, finalRowCnt, cmdStatus, context);
}
LogManager.log(MessageLevel.DETAIL, LogConstants.CTX_COMMANDLOGGING, message);
}
@@ -400,7 +395,7 @@
private void checkStatus() throws ConnectorException {
if (this.state != ConnectorStatus.OPEN) {
- throw new
ConnectorException(DQPPlugin.Util.getString("ConnectorManager.not_in_valid_state",
this.connectorName));
+ throw new
ConnectorException(DQPPlugin.Util.getString("ConnectorManager.not_in_valid_state",
this.connectorName)); //$NON-NLS-1$
}
}
}
Modified:
trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorWorkItem.java
===================================================================
---
trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorWorkItem.java 2010-03-09
17:19:00 UTC (rev 1948)
+++
trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorWorkItem.java 2010-03-09
18:11:28 UTC (rev 1949)
@@ -46,6 +46,8 @@
import org.teiid.dqp.internal.datamgr.metadata.RuntimeMetadataImpl;
import org.teiid.dqp.internal.process.AbstractWorkItem;
import org.teiid.dqp.internal.process.DQPWorkContext;
+import org.teiid.logging.api.CommandLogMessage;
+import org.teiid.logging.api.CommandLogMessage.Event;
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
@@ -59,7 +61,6 @@
import com.metamatrix.dqp.message.AtomicRequestID;
import com.metamatrix.dqp.message.AtomicRequestMessage;
import com.metamatrix.dqp.message.AtomicResultsMessage;
-import com.metamatrix.dqp.service.CommandLogMessage;
import com.metamatrix.dqp.util.LogConstants;
import com.metamatrix.query.metadata.QueryMetadataInterface;
import com.metamatrix.query.metadata.TempMetadataAdapter;
@@ -198,7 +199,7 @@
try {
LogManager.logDetail(LogConstants.CTX_CONNECTOR, new Object[] {this.id,
"Processing CANCEL request"}); //$NON-NLS-1$
asynchCancel();
- this.manager.logSRCCommand(this.requestMsg, this.securityContext,
CommandLogMessage.CMD_STATUS_CANCEL, -1);
+ this.manager.logSRCCommand(this.requestMsg, this.securityContext,
Event.CANCEL, -1);
} catch (ConnectorException e) {
LogManager.logWarning(LogConstants.CTX_CONNECTOR, e,
DQPPlugin.Util.getString("Cancel_request_failed", this.id)); //$NON-NLS-1$
} finally {
@@ -227,7 +228,7 @@
if (t instanceof RuntimeException && t.getCause() != null) {
t = t.getCause();
}
- manager.logSRCCommand(this.requestMsg, this.securityContext,
CommandLogMessage.CMD_STATUS_ERROR, -1);
+ manager.logSRCCommand(this.requestMsg, this.securityContext, Event.ERROR, null);
String msg = DQPPlugin.Util.getString("ConnectorWorker.process_failed",
this.id); //$NON-NLS-1$
if (isCancelled.get()) {
@@ -250,7 +251,7 @@
this.isClosed = true;
LogManager.logDetail(LogConstants.CTX_CONNECTOR, new Object[] {this.id,
"Processing Close :", this.requestMsg.getCommand()}); //$NON-NLS-1$
if (success) {
- manager.logSRCCommand(this.requestMsg, this.securityContext,
CommandLogMessage.CMD_STATUS_END, this.rowCount);
+ manager.logSRCCommand(this.requestMsg, this.securityContext, Event.END,
this.rowCount);
}
try {
if (execution != null) {
@@ -357,7 +358,7 @@
LogManager.logDetail(LogConstants.CTX_CONNECTOR, new Object[]
{this.requestMsg.getAtomicRequestID(), "Obtained execution"}); //$NON-NLS-1$
//Log the Source Command (Must be after obtaining the execution context)
- manager.logSRCCommand(this.requestMsg, this.securityContext,
CommandLogMessage.CMD_STATUS_NEW, -1);
+ manager.logSRCCommand(this.requestMsg, this.securityContext, Event.NEW, null);
}
protected void handleBatch()
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2010-03-09
17:19:00 UTC (rev 1948)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2010-03-09
18:11:28 UTC (rev 1949)
@@ -47,6 +47,8 @@
import org.teiid.adminapi.impl.WorkerPoolStatisticsMetadata;
import org.teiid.dqp.internal.cache.DQPContextCache;
import org.teiid.dqp.internal.datamgr.impl.ConnectorManagerRepository;
+import org.teiid.logging.api.CommandLogMessage;
+import org.teiid.logging.api.CommandLogMessage.Event;
import org.teiid.security.SecurityHelper;
import com.metamatrix.api.exception.MetaMatrixComponentException;
@@ -74,7 +76,6 @@
import com.metamatrix.dqp.message.ResultsMessage;
import com.metamatrix.dqp.service.AuthorizationService;
import com.metamatrix.dqp.service.BufferService;
-import com.metamatrix.dqp.service.CommandLogMessage;
import com.metamatrix.dqp.service.SessionService;
import com.metamatrix.dqp.service.TransactionContext;
import com.metamatrix.dqp.service.TransactionService;
@@ -299,7 +300,7 @@
ResultsFuture<ResultsMessage> resultsFuture = new
ResultsFuture<ResultsMessage>();
RequestWorkItem workItem = new RequestWorkItem(this, requestMsg, request,
resultsFuture.getResultsReceiver(), requestID, workContext);
- logMMCommand(workItem, true, false, 0);
+ logMMCommand(workItem, Event.NEW, null);
addRequest(requestID, workItem, state);
this.addWork(workItem);
@@ -458,7 +459,7 @@
markCancelled = workItem.requestCancel();
}
if (markCancelled) {
- logMMCommand(workItem, false, true, 0);
+ logMMCommand(workItem, Event.CANCEL, null);
} else {
LogManager.logDetail(LogConstants.CTX_DQP,
DQPPlugin.Util.getString("DQPCore.failed_to_cancel")); //$NON-NLS-1$
}
@@ -561,7 +562,7 @@
this.transactionService.terminateTransaction(xid);
}
- void logMMCommand(RequestWorkItem workItem, boolean isBegin, boolean isCancel, int
rowCount) {
+ void logMMCommand(RequestWorkItem workItem, Event status, Integer rowCount) {
if (!LogManager.isMessageToBeRecorded(LogConstants.CTX_COMMANDLOGGING,
MessageLevel.INFO)) {
return;
}
@@ -569,10 +570,6 @@
RequestMessage msg = workItem.requestMsg;
DQPWorkContext workContext = DQPWorkContext.getWorkContext();
RequestID rID = new RequestID(workContext.getConnectionID(),
msg.getExecutionId());
- String command = null;
- if(isBegin && !isCancel){
- command = msg.getCommandString();
- }
String txnID = null;
TransactionContext tc = workItem.getTransactionContext();
if (tc != null && tc.getXid() != null) {
@@ -580,28 +577,11 @@
}
String appName = workContext.getAppName();
// Log to request log
- short point = isBegin?
CommandLogMessage.CMD_POINT_BEGIN:CommandLogMessage.CMD_POINT_END;
- short status = CommandLogMessage.CMD_STATUS_NEW;
- if(!isBegin){
- if(isCancel){
- status = CommandLogMessage.CMD_STATUS_CANCEL;
- }else{
- status = CommandLogMessage.CMD_STATUS_END;
- }
- }
CommandLogMessage message = null;
- if (point == CommandLogMessage.CMD_POINT_BEGIN) {
- message = new CommandLogMessage(System.currentTimeMillis(), rID.toString(),
txnID, workContext.getConnectionID(), appName, workContext.getUserName(),
workContext.getVdbName(), workContext.getVdbVersion(), command);
+ if (status == Event.NEW) {
+ message = new CommandLogMessage(System.currentTimeMillis(), rID.toString(),
txnID, workContext.getConnectionID(), appName, workContext.getUserName(),
workContext.getVdbName(), workContext.getVdbVersion(), msg.getCommandString());
} else {
- boolean isCancelled = false;
- boolean errorOccurred = false;
-
- if (status == CommandLogMessage.CMD_STATUS_CANCEL) {
- isCancelled = true;
- } else if (status == CommandLogMessage.CMD_STATUS_ERROR) {
- errorOccurred = true;
- }
- message = new CommandLogMessage(System.currentTimeMillis(), rID.toString(),
txnID, workContext.getConnectionID(), workContext.getUserName(), workContext.getVdbName(),
workContext.getVdbVersion(), rowCount, isCancelled, errorOccurred);
+ message = new CommandLogMessage(System.currentTimeMillis(), rID.toString(),
txnID, workContext.getConnectionID(), workContext.getUserName(), workContext.getVdbName(),
workContext.getVdbVersion(), rowCount, status);
}
LogManager.log(MessageLevel.DETAIL, LogConstants.CTX_COMMANDLOGGING, message);
}
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java
===================================================================
---
trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java 2010-03-09
17:19:00 UTC (rev 1948)
+++
trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java 2010-03-09
18:11:28 UTC (rev 1949)
@@ -34,6 +34,7 @@
import java.util.concurrent.ConcurrentHashMap;
import org.teiid.dqp.internal.process.SessionAwareCache.CacheID;
+import org.teiid.logging.api.CommandLogMessage.Event;
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MetaMatrixException;
@@ -55,7 +56,6 @@
import com.metamatrix.dqp.message.RequestID;
import com.metamatrix.dqp.message.RequestMessage;
import com.metamatrix.dqp.message.ResultsMessage;
-import com.metamatrix.dqp.service.CommandLogMessage;
import com.metamatrix.dqp.service.TransactionContext;
import com.metamatrix.dqp.service.TransactionService;
import com.metamatrix.dqp.util.LogConstants;
@@ -192,7 +192,7 @@
LogManager.logDetail(LogConstants.CTX_DQP, e, "############# PW EXITING
on", requestID, "- error occurred ###########"); //$NON-NLS-1$
//$NON-NLS-2$
if (!isCanceled()) {
- logCommandError();
+ dqpCore.logMMCommand(this, Event.CANCEL, null);
//Case 5558: Differentiate between system level errors and
//processing errors. Only log system level errors as errors,
//log the processing errors as warnings only
@@ -326,7 +326,7 @@
if (this.processingException != null) {
sendError();
} else {
- dqpCore.logMMCommand(this, false, false, rowcount);
+ dqpCore.logMMCommand(this, Event.END, rowcount);
}
}
@@ -636,18 +636,6 @@
}
}
- /**
- * Log the command to the MM cmd log.
- */
- private void logCommandError() {
- String transactionID = null;
- if (this.transactionContext != null && this.transactionContext.getXid()
!= null) {
- transactionID = this.transactionContext.getXid().toString();
- }
- CommandLogMessage message = new CommandLogMessage(System.currentTimeMillis(),
requestID.toString(), transactionID == null ? null : transactionID,
requestID.getConnectionID(), dqpWorkContext.getUserName(), dqpWorkContext.getVdbName(),
dqpWorkContext.getVdbVersion(), -1, false, true);
- LogManager.log(MessageLevel.INFO, LogConstants.CTX_COMMANDLOGGING, message);
- }
-
boolean isCanceled() {
return isCanceled;
}
Modified:
trunk/engine/src/main/java/org/teiid/dqp/internal/process/validator/AuthorizationValidationVisitor.java
===================================================================
---
trunk/engine/src/main/java/org/teiid/dqp/internal/process/validator/AuthorizationValidationVisitor.java 2010-03-09
17:19:00 UTC (rev 1948)
+++
trunk/engine/src/main/java/org/teiid/dqp/internal/process/validator/AuthorizationValidationVisitor.java 2010-03-09
18:11:28 UTC (rev 1949)
@@ -41,6 +41,7 @@
import com.metamatrix.api.exception.query.QueryMetadataException;
import com.metamatrix.dqp.DQPPlugin;
import com.metamatrix.dqp.service.AuthorizationService;
+import com.metamatrix.dqp.service.AuthorizationService.Context;
import com.metamatrix.query.function.FunctionLibrary;
import com.metamatrix.query.metadata.TempMetadataID;
import com.metamatrix.query.resolver.util.ResolverUtil;
@@ -123,7 +124,7 @@
symbols.add(lookup.getGroup());
symbols.add(lookup.getKeyElement());
symbols.add(lookup.getReturnElement());
- validateEntitlements(symbols, AuthorizationService.ACTION_READ,
AuthorizationService.CONTEXT_QUERY);
+ validateEntitlements(symbols, AuthorizationService.ACTION_READ, Context.QUERY);
}
} catch (MetaMatrixComponentException e) {
handleException(e, obj);
@@ -142,7 +143,7 @@
validateEntitlements(
obj.getVariables(),
AuthorizationService.ACTION_CREATE,
- AuthorizationService.CONTEXT_INSERT);
+ Context.INSERT);
}
/**
@@ -154,12 +155,12 @@
validateEntitlements(
ElementCollectorVisitor.getElements(obj.getCriteria(), true),
AuthorizationService.ACTION_READ,
- AuthorizationService.CONTEXT_UPDATE);
+ Context.UPDATE);
}
// The variables from the changes must be checked for UPDATE entitlement
// validateEntitlements on all the variables used in the update.
- validateEntitlements(obj.getChangeList().getClauseMap().keySet(),
AuthorizationService.ACTION_UPDATE, AuthorizationService.CONTEXT_UPDATE);
+ validateEntitlements(obj.getChangeList().getClauseMap().keySet(),
AuthorizationService.ACTION_UPDATE, Context.UPDATE);
}
/**
@@ -171,13 +172,13 @@
validateEntitlements(
ElementCollectorVisitor.getElements(obj.getCriteria(), true),
AuthorizationService.ACTION_READ,
- AuthorizationService.CONTEXT_DELETE);
+ Context.DELETE);
}
// Check that all elements of group being deleted have delete permission
HashSet deleteVars = new HashSet();
deleteVars.add(obj.getGroup());
- validateEntitlements(deleteVars, AuthorizationService.ACTION_DELETE,
AuthorizationService.CONTEXT_DELETE);
+ validateEntitlements(deleteVars, AuthorizationService.ACTION_DELETE,
Context.DELETE);
}
/**
@@ -198,7 +199,7 @@
}
validateEntitlements(intoElements,
AuthorizationService.ACTION_CREATE,
- AuthorizationService.CONTEXT_INSERT);
+ Context.INSERT);
}
// Validate this query's entitlements
@@ -211,7 +212,7 @@
return;
}
- validateEntitlements(entitledObjects, AuthorizationService.ACTION_READ,
AuthorizationService.CONTEXT_QUERY);
+ validateEntitlements(entitledObjects, AuthorizationService.ACTION_READ,
Context.QUERY);
}
/**
@@ -220,7 +221,7 @@
protected void validateEntitlements(StoredProcedure obj) {
List symbols = new ArrayList(1);
symbols.add(obj.getGroup());
- validateEntitlements(symbols, AuthorizationService.ACTION_READ,
AuthorizationService.CONTEXT_PROCEDURE);
+ validateEntitlements(symbols, AuthorizationService.ACTION_READ,
Context.STORED_PROCEDURE);
}
private String getActionLabel(int actionCode) {
@@ -240,7 +241,7 @@
* @param actionCode The actions to validate for
* @param auditContext The {@link AuthorizationService} to use when resource auditing
is done.
*/
- protected void validateEntitlements(Collection symbols, int actionCode, int
auditContext) {
+ protected void validateEntitlements(Collection symbols, int actionCode, Context
auditContext) {
Map nameToSymbolMap = new HashMap();
Iterator symbolIter = symbols.iterator();
while(symbolIter.hasNext()) {
Modified:
trunk/engine/src/test/java/com/metamatrix/dqp/service/FakeAuthorizationService.java
===================================================================
---
trunk/engine/src/test/java/com/metamatrix/dqp/service/FakeAuthorizationService.java 2010-03-09
17:19:00 UTC (rev 1948)
+++
trunk/engine/src/test/java/com/metamatrix/dqp/service/FakeAuthorizationService.java 2010-03-09
18:11:28 UTC (rev 1949)
@@ -52,12 +52,10 @@
knownResources.add(new Resource(action, resource));
}
- /*
- * @see
com.metamatrix.dqp.service.AuthorizationService#getInaccessibleResources(java.lang.String,
int, java.util.Collection, int)
- */
- public Collection getInaccessibleResources(int action, Collection resources, int
context)
- throws MetaMatrixComponentException {
-
+ @Override
+ public Collection getInaccessibleResources(int action,
+ Collection resources, Context context)
+ throws MetaMatrixComponentException {
List found = new ArrayList();
if (resources.isEmpty()) {
Modified:
trunk/engine/src/test/java/org/teiid/dqp/internal/process/validator/TestAuthorizationValidationVisitor.java
===================================================================
---
trunk/engine/src/test/java/org/teiid/dqp/internal/process/validator/TestAuthorizationValidationVisitor.java 2010-03-09
17:19:00 UTC (rev 1948)
+++
trunk/engine/src/test/java/org/teiid/dqp/internal/process/validator/TestAuthorizationValidationVisitor.java 2010-03-09
18:11:28 UTC (rev 1949)
@@ -108,11 +108,11 @@
FakeAuthorizationService svc = new FakeAuthorizationService(true);
// pm2.g2
- svc.addResource(AuthorizationService.CONTEXT_INSERT, "pm2.g2.e1");
//$NON-NLS-1$
+ svc.addResource(AuthorizationService.ACTION_CREATE, "pm2.g2.e1");
//$NON-NLS-1$
// pm3.g2
- svc.addResource(AuthorizationService.CONTEXT_INSERT, "pm3.g2.e1");
//$NON-NLS-1$
- svc.addResource(AuthorizationService.CONTEXT_INSERT, "pm3.g2.e2");
//$NON-NLS-1$
+ svc.addResource(AuthorizationService.ACTION_CREATE, "pm3.g2.e1");
//$NON-NLS-1$
+ svc.addResource(AuthorizationService.ACTION_CREATE, "pm3.g2.e2");
//$NON-NLS-1$
return svc;
}
Modified: trunk/runtime/src/main/java/org/teiid/services/AuthorizationServiceImpl.java
===================================================================
---
trunk/runtime/src/main/java/org/teiid/services/AuthorizationServiceImpl.java 2010-03-09
17:19:00 UTC (rev 1948)
+++
trunk/runtime/src/main/java/org/teiid/services/AuthorizationServiceImpl.java 2010-03-09
18:11:28 UTC (rev 1949)
@@ -42,6 +42,7 @@
import org.teiid.adminapi.impl.VDBMetaData;
import org.teiid.deployers.VDBRepository;
import org.teiid.dqp.internal.process.DQPWorkContext;
+import org.teiid.logging.api.AuditMessage;
import org.teiid.security.roles.AuthorizationActions;
import org.teiid.security.roles.AuthorizationPermission;
import org.teiid.security.roles.AuthorizationPoliciesHolder;
@@ -60,13 +61,11 @@
import com.metamatrix.core.log.MessageLevel;
import com.metamatrix.core.util.LRUCache;
import com.metamatrix.dqp.embedded.DQPEmbeddedPlugin;
-import com.metamatrix.dqp.service.AuditMessage;
import com.metamatrix.dqp.service.AuthorizationService;
import com.metamatrix.dqp.util.LogConstants;
import com.metamatrix.platform.security.api.MetaMatrixPrincipal;
import com.metamatrix.platform.security.api.MetaMatrixPrincipalName;
import com.metamatrix.platform.security.api.SessionToken;
-import com.metamatrix.server.util.ServerAuditContexts;
import com.metamatrix.vdb.runtime.VDBKey;
/**
@@ -99,12 +98,11 @@
private VDBRepository vdbRepository;
@Override
- public Collection getInaccessibleResources(int action, Collection resources, int
context)
- throws MetaMatrixComponentException {
+ public Collection getInaccessibleResources(int action, Collection resources,
com.metamatrix.dqp.service.AuthorizationService.Context context) throws
MetaMatrixComponentException {
AuthorizationRealm realm = getRealm(DQPWorkContext.getWorkContext());
AuthorizationActions actions = getActions(action);
Collection permissions = createPermissions(realm, resources, actions);
- String auditContext = getAuditContext(context);
+ String auditContext = context.toString();
Collection inaccessableResources = Collections.EMPTY_LIST;
try {
inaccessableResources = getInaccessibleResources(auditContext, permissions);
@@ -141,7 +139,7 @@
LogManager.logDetail(com.metamatrix.common.util.LogConstants.CTX_AUTHORIZATION,
new Object[]{"getInaccessibleResources(", caller, ", ", contextName,
", ", requests, ")"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
//$NON-NLS-4$
- List resources = new ArrayList();
+ List<String> resources = new ArrayList<String>();
if (requests != null && ! requests.isEmpty()) {
Iterator permItr = requests.iterator();
while ( permItr.hasNext() ) {
@@ -150,7 +148,7 @@
}
// Audit - request
- AuditMessage msg = new AuditMessage( contextName,
"getInaccessibleResources-request", caller.getUsername(), resources.toArray());
//$NON-NLS-1$
+ AuditMessage msg = new AuditMessage( contextName,
"getInaccessibleResources-request", caller.getUsername(), resources.toArray(new
String[resources.size()])); //$NON-NLS-1$
LogManager.log(MessageLevel.INFO, LogConstants.CTX_AUDITLOGGING, msg);
if (isEntitled()){
@@ -175,10 +173,10 @@
}
if (results.isEmpty()) {
- msg = new AuditMessage( contextName, "getInaccessibleResources-granted
all", caller.getUsername(), resources.toArray()); //$NON-NLS-1$
+ msg = new AuditMessage( contextName, "getInaccessibleResources-granted
all", caller.getUsername(), resources.toArray(new String[resources.size()]));
//$NON-NLS-1$
LogManager.log(MessageLevel.INFO, LogConstants.CTX_AUDITLOGGING, msg);
} else {
- msg = new AuditMessage( contextName,
"getInaccessibleResources-denied", caller.getUsername(), resources.toArray());
//$NON-NLS-1$
+ msg = new AuditMessage( contextName,
"getInaccessibleResources-denied", caller.getUsername(), resources.toArray(new
String[resources.size()])); //$NON-NLS-1$
LogManager.log(MessageLevel.INFO, LogConstants.CTX_AUDITLOGGING, msg);
}
return results;
@@ -448,17 +446,6 @@
return permissions;
}
- private String getAuditContext(int auditCode) {
- switch(auditCode) {
- case AuthorizationService.CONTEXT_QUERY: return
ServerAuditContexts.CTX_QUERY;
- case AuthorizationService.CONTEXT_INSERT: return
ServerAuditContexts.CTX_INSERT;
- case AuthorizationService.CONTEXT_UPDATE: return
ServerAuditContexts.CTX_UPDATE;
- case AuthorizationService.CONTEXT_DELETE: return
ServerAuditContexts.CTX_DELETE;
- case AuthorizationService.CONTEXT_PROCEDURE: return
ServerAuditContexts.CTX_PROCEDURE;
- default: return ServerAuditContexts.CTX_QUERY;
- }
- }
-
public void setVDBRepository(VDBRepository repo) {
this.vdbRepository = repo;
}