teiid SVN: r1063 - trunk/documentation/reference/src/main/docbook/en-US/content.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2009-06-18 10:02:27 -0400 (Thu, 18 Jun 2009)
New Revision: 1063
Modified:
trunk/documentation/reference/src/main/docbook/en-US/content/scalar_functions.xml
Log:
TEIID-671 updating scalar function reference
Modified: trunk/documentation/reference/src/main/docbook/en-US/content/scalar_functions.xml
===================================================================
--- trunk/documentation/reference/src/main/docbook/en-US/content/scalar_functions.xml 2009-06-17 20:40:10 UTC (rev 1062)
+++ trunk/documentation/reference/src/main/docbook/en-US/content/scalar_functions.xml 2009-06-18 14:02:27 UTC (rev 1063)
@@ -63,7 +63,7 @@
<para>Arc cosine of x</para>
</entry>
<entry>
- <para>x in {double}, return type is double</para>
+ <para>x in {double, bigdecimal}, return type is double</para>
</entry>
</row>
<row>
@@ -74,7 +74,7 @@
<para>Arc sine of x</para>
</entry>
<entry>
- <para>x in {double}, return type is double</para>
+ <para>x in {double, bigdecimal}, return type is double</para>
</entry>
</row>
<row>
@@ -85,7 +85,7 @@
<para>Arc tangent of x</para>
</entry>
<entry>
- <para>x in {double}, return type is double</para>
+ <para>x in {double, bigdecimal}, return type is double</para>
</entry>
</row>
<row>
@@ -96,7 +96,7 @@
<para>Arc tangent of x and y</para>
</entry>
<entry>
- <para>x, y in {double}, return type is double</para>
+ <para>x, y in {double, bigdecimal}, return type is double</para>
</entry>
</row>
<row>
@@ -118,7 +118,7 @@
<para>Cosine of x</para>
</entry>
<entry>
- <para>x in {double}, return type is double</para>
+ <para>x in {double, bigdecimal}, return type is double</para>
</entry>
</row>
<row>
@@ -129,7 +129,7 @@
<para>Cotangent of x</para>
</entry>
<entry>
- <para>x in {double}, return type is double</para>
+ <para>x in {double, bigdecimal}, return type is double</para>
</entry>
</row>
<row>
@@ -140,7 +140,7 @@
<para>Convert x degrees to radians</para>
</entry>
<entry>
- <para>x in {double}, return type is double</para>
+ <para>x in {double, bigdecimal}, return type is double</para>
</entry>
</row>
<row>
@@ -261,7 +261,7 @@
<para>Modulus (remainder of x / y)</para>
</entry>
<entry>
- <para>x in {integer, long, float, double, biginteger}, return
+ <para>x in {integer, long, float, double, biginteger, bigdecimal}, return
type is same as x</para>
</entry>
</row>
@@ -362,7 +362,7 @@
<para>Convert x radians to degrees</para>
</entry>
<entry>
- <para>x in {double}, return type is double</para>
+ <para>x in {double, bigdecimal}, return type is double</para>
</entry>
</row>
<row>
@@ -423,7 +423,7 @@
<para>Sine value of x</para>
</entry>
<entry>
- <para>x in {double}, return type is double</para>
+ <para>x in {double, bigdecimal}, return type is double</para>
</entry>
</row>
<row>
@@ -434,7 +434,7 @@
<para>Square root of x</para>
</entry>
<entry>
- <para>x in {double, float}, return type is double</para>
+ <para>x in {long, double, bigdecimal}, return type is double</para>
</entry>
</row>
<row>
@@ -445,7 +445,7 @@
<para>Tangent of x</para>
</entry>
<entry>
- <para>x in {double}, return type is double</para>
+ <para>x in {double, bigdecimal}, return type is double</para>
</entry>
</row>
<row>
15 years, 8 months
teiid SVN: r1062 - in trunk: build/kit-embedded/deploy and 15 other directories.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2009-06-17 16:40:10 -0400 (Wed, 17 Jun 2009)
New Revision: 1062
Added:
trunk/build/kit-embedded/deploy/jboss-cache-configuration.xml
trunk/embedded/src/main/java/org/
trunk/embedded/src/main/java/org/teiid/
trunk/embedded/src/main/java/org/teiid/configuration/
trunk/embedded/src/main/java/org/teiid/configuration/CommonsLogManagerAdapter.java
trunk/embedded/src/main/resources/commons-logging.properties
Modified:
trunk/build/assembly/embedded/build-configuration.xml
trunk/build/kit-embedded/deploy/log4j.properties
trunk/common-core/src/main/java/com/metamatrix/core/log/JavaLogWriter.java
trunk/common-core/src/main/java/com/metamatrix/core/log/LogListener.java
trunk/common-core/src/main/java/com/metamatrix/core/log/LogMessage.java
trunk/common-internal/src/main/java/com/metamatrix/common/log/LogManager.java
trunk/common-internal/src/test/java/com/metamatrix/common/log/TestLogManager.java
trunk/embedded/pom.xml
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPLogListener.java
trunk/embedded/src/main/java/com/metamatrix/jdbc/EmbeddedGuiceModule.java
trunk/embedded/src/main/java/com/metamatrix/jdbc/LogListernerProvider.java
trunk/embedded/src/main/resources/deploy.properties
trunk/server/src/main/java/com/metamatrix/common/log/DbLogListener.java
trunk/server/src/main/java/com/metamatrix/common/log/DbLogWriter.java
trunk/soap/src/main/java/com/metamatrix/soap/sqlquerywebservice/log/LogUtil.java
trunk/txn-jbossts/src/main/java/com/metamatrix/xa/arjuna/ArjunaTransactionProvider.java
trunk/txn-jbossts/src/main/resources/CommonLogging-properties.xml
trunk/txn-jbossts/src/main/resources/jbossjts-properties.xml
Log:
TEIID-672, TEIID-681
Modified: trunk/build/assembly/embedded/build-configuration.xml
===================================================================
--- trunk/build/assembly/embedded/build-configuration.xml 2009-06-16 21:58:15 UTC (rev 1061)
+++ trunk/build/assembly/embedded/build-configuration.xml 2009-06-17 20:40:10 UTC (rev 1062)
@@ -30,6 +30,7 @@
<loadfile property="connector-types-fragment" srcFile="${extensions.dir}/unzipped/all-cdks.xml"/>
<replace file="${kit.dir}/deploy/configuration.xml" token="${connector-types-fragment-fill-in}" value="${connector-types-fragment}"/>
+ <mkdir dir="${kit.dir}/log"/>
</target>
</project>
\ No newline at end of file
Added: trunk/build/kit-embedded/deploy/jboss-cache-configuration.xml
===================================================================
--- trunk/build/kit-embedded/deploy/jboss-cache-configuration.xml (rev 0)
+++ trunk/build/kit-embedded/deploy/jboss-cache-configuration.xml 2009-06-17 20:40:10 UTC (rev 1062)
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<server>
+ <mbean code="org.jboss.cache.pojo.jmx.CacheJmxWrapper" name="jboss.cache:service=TeiidCache">
+ <attribute name="TransactionManagerLookupClass">org.jboss.cache.transaction.GenericTransactionManagerLookup</attribute>
+ <attribute name="IsolationLevel">READ_COMMITTED</attribute>
+ <attribute name="LockParentForChildInsertRemove">true</attribute>
+
+ <attribute name="CacheMode">LOCAL</attribute>
+ <!-- <attribute name="UseLazyDeserialization">true</attribute> -->
+
+ <!--
+ The max amount of time (in milliseconds) we wait until the
+ initial state (ie. the contents of the cache) are retrieved from
+ existing members in a clustered environment
+ -->
+ <attribute name="StateRetrievalTimeout">20000</attribute>
+
+ <!--
+ Number of milliseconds to wait until all responses for a
+ synchronous call have been received.
+ -->
+ <attribute name="SyncReplTimeout">20000</attribute>
+
+ <!-- Max number of milliseconds to wait for a lock acquisition -->
+ <attribute name="LockAcquisitionTimeout">15000</attribute>
+
+ <!-- Shutdown hook behavior. Valid choices are: DEFAULT, REGISTER and DONT_REGISTER. this element is omitted, DEFAULT is used. -->
+ <attribute name="ShutdownHookBehavior">DEFAULT</attribute>
+
+ <attribute name="FetchInMemoryState">true</attribute>
+
+ <attribute name="CacheLoaderConfig" replace="false">
+ <config>
+
+ <!-- are the cache loaders shared in a cluster? -->
+ <shared>false</shared>
+ <!-- if passivation is true, only the first cache loader is used; the rest are ignored -->
+ <passivation>true</passivation>
+
+ <cacheloader>
+ <class>org.jboss.cache.loader.FileCacheLoader</class>
+ <properties>location=./teiid/cache</properties>
+
+ <!--fetch the persistent state of a cache when joining a cluster-->
+ <fetchPersistentState>true</fetchPersistentState>
+
+ <!-- empties the specified cache loader when cache loader starts up -->
+ <purgeOnStartup>true</purgeOnStartup>
+
+ <!-- cache loader is shared among different cache instances -->
+ <shared>false</shared>
+ </cacheloader>
+ </config>
+ </attribute>
+
+ <attribute name="EvictionPolicyConfig">
+ <config>
+ <attribute name="wakeUpIntervalSeconds">3</attribute>
+ <!-- This defaults to 200000 if not specified -->
+ <attribute name="eventQueueSize">100000</attribute>
+ <!-- Name of the DEFAULT eviction policy class. -->
+ <attribute name="policyClass">org.jboss.cache.eviction.LRUPolicy</attribute>
+ <!-- Cache wide default -->
+ <region name="/_default_">
+ <attribute name="maxNodes">10000</attribute>
+ <attribute name="timeToLiveSeconds">0</attribute>
+ </region>
+ </config>
+ </attribute>
+
+ </mbean>
+</server>
\ No newline at end of file
Property changes on: trunk/build/kit-embedded/deploy/jboss-cache-configuration.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/build/kit-embedded/deploy/log4j.properties
===================================================================
--- trunk/build/kit-embedded/deploy/log4j.properties 2009-06-16 21:58:15 UTC (rev 1061)
+++ trunk/build/kit-embedded/deploy/log4j.properties 2009-06-17 20:40:10 UTC (rev 1062)
@@ -5,13 +5,21 @@
# This is for JGroups
log4j.category.org.jgroups=WARN
-#This one controls for JBoss Cache
+# JBoss transactions
+log4j.category.com.arjuna=WARN
+
+# This one controls for JBoss Cache
log4j.category.org.jboss=WARN
# This one controls Teiid
log4j.category.org.teiid=WARN
+# un-comment for command logging (user, source commands submitted)
+#log4j.category.org.teiid.COMMAND_LOG=INFO
+# un-comment for audit logging
+#log4j.category.org.teiid.AUDIT_LOG=INFO
+
# Appender writes to a file
# Control the maximum log file size, number of backup files
log4j.appender.TEIID=org.apache.log4j.RollingFileAppender
@@ -19,6 +27,6 @@
log4j.appender.TEIID.MaxFileSize=1000KB
log4j.appender.TEIID.MaxBackupIndex=25
-# layout {priority, thread, category, message, newline}
+# layout {date, priority, thread, category, message, newline}
log4j.appender.TEIID.layout=org.apache.log4j.PatternLayout
-log4j.appender.TEIID.layout.ConversionPattern=%p %t %c - %m%n
\ No newline at end of file
+log4j.appender.TEIID.layout.ConversionPattern=%d %p [%t] %c - %m%n
\ No newline at end of file
Modified: trunk/common-core/src/main/java/com/metamatrix/core/log/JavaLogWriter.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/core/log/JavaLogWriter.java 2009-06-16 21:58:15 UTC (rev 1061)
+++ trunk/common-core/src/main/java/com/metamatrix/core/log/JavaLogWriter.java 2009-06-17 20:40:10 UTC (rev 1062)
@@ -30,20 +30,24 @@
*/
public class JavaLogWriter implements LogListener {
- public void logMessage(int level, String context, Object msg) {
+ public void log(int level, String context, Object msg) {
Logger logger = Logger.getLogger("org.teiid." + context); //$NON-NLS-1$
Level javaLevel = convertLevel(level);
if (logger.isLoggable(javaLevel)) {
- if (msg instanceof LogMessage) {
- logger.log(javaLevel, ((LogMessage)msg).getText(), ((LogMessage)msg).getException());
- }
- else {
- logger.log(javaLevel, msg.toString());
- }
+ logger.log(javaLevel, msg.toString());
}
}
+ public void log(int level, String context, Throwable t, Object msg) {
+ Logger logger = Logger.getLogger("org.teiid." + context); //$NON-NLS-1$
+
+ Level javaLevel = convertLevel(level);
+ if (logger.isLoggable(javaLevel)) {
+ logger.log(javaLevel, msg.toString(), t);
+ }
+ }
+
public Level convertLevel(int level) {
switch (level) {
case MessageLevel.CRITICAL:
Modified: trunk/common-core/src/main/java/com/metamatrix/core/log/LogListener.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/core/log/LogListener.java 2009-06-16 21:58:15 UTC (rev 1061)
+++ trunk/common-core/src/main/java/com/metamatrix/core/log/LogListener.java 2009-06-17 20:40:10 UTC (rev 1062)
@@ -27,16 +27,10 @@
* LogListener
*/
public interface LogListener {
+
+ void log(int level, String context, Object msg);
- /**
- * Notifies this listener that given status has been logged.
- * The listener is free to retain or ignore this status.
- * @param status the status being logged
- * @param timestamp the time that the message was logged
- * @param pluginID the identifier of the plugin that submitted the log message
- * @param threadName the name of the thread upon which the message was created
- */
- void logMessage(int level, String context, Object msg);
+ void log(int level, String context, Throwable t, Object msg);
/**
* Shut down this listener, requesting it clean up and release any resources it
Modified: trunk/common-core/src/main/java/com/metamatrix/core/log/LogMessage.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/core/log/LogMessage.java 2009-06-16 21:58:15 UTC (rev 1061)
+++ trunk/common-core/src/main/java/com/metamatrix/core/log/LogMessage.java 2009-06-17 20:40:10 UTC (rev 1062)
@@ -28,18 +28,11 @@
public class LogMessage implements Serializable{
private Object[] msgParts;
- private Throwable exception;
-
- public LogMessage(Throwable e, Object[] msgParts) {
+ public LogMessage(Object[] msgParts) {
this.msgParts = msgParts;
- this.exception = e;
}
- public Throwable getException() {
- return this.exception;
- }
-
public Object[] getMessageParts() {
return this.msgParts;
}
Modified: trunk/common-internal/src/main/java/com/metamatrix/common/log/LogManager.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/log/LogManager.java 2009-06-16 21:58:15 UTC (rev 1061)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/log/LogManager.java 2009-06-17 20:40:10 UTC (rev 1062)
@@ -111,7 +111,7 @@
* not logged if this parameter is null
*/
public static void logCritical(String context, String message) {
- logMessage(MessageLevel.CRITICAL, context, message);
+ logListener.log(MessageLevel.CRITICAL, context, message);
}
/**
@@ -130,7 +130,7 @@
* @param message the log message (may be null)
*/
public static void logCritical(String context, Throwable e, String message) {
- logMessage(MessageLevel.CRITICAL,context,e,message);
+ logListener.log(MessageLevel.CRITICAL,context,e,message);
}
/**
@@ -146,7 +146,7 @@
* not logged if this parameter is null
*/
public static void logError(String context, String message) {
- logMessage(MessageLevel.ERROR, context,message);
+ logListener.log(MessageLevel.ERROR, context,message);
}
/**
@@ -163,7 +163,7 @@
* @param message the log message (may be null)
*/
public static void logError(String context, Throwable e, String message) {
- logMessage(MessageLevel.ERROR,context,e,message);
+ logListener.log(MessageLevel.ERROR,context,e,message);
}
/**
@@ -179,7 +179,7 @@
* not logged if this parameter is null
*/
public static void logWarning(String context, String message) {
- logMessage(MessageLevel.WARNING, context,message);
+ logListener.log(MessageLevel.WARNING, context,message);
}
/**
@@ -196,7 +196,7 @@
* @param message the log message (may be null)
*/
public static void logWarning(String context, Throwable e, String message) {
- logMessage(MessageLevel.WARNING,context,e,message);
+ logListener.log(MessageLevel.WARNING,context,e,message);
}
/**
@@ -213,7 +213,7 @@
* not logged if this parameter is null
*/
public static void logInfo(String context, String message) {
- logMessage(MessageLevel.INFO, context,message);
+ logListener.log(MessageLevel.INFO, context,message);
}
/**
@@ -246,7 +246,7 @@
* @param message the log message (may be null)
*/
public static void logDetail(String context, Throwable e, String message) {
- logMessage(MessageLevel.DETAIL,context,e,message);
+ logListener.log(MessageLevel.DETAIL,context,e,message);
}
/**
@@ -296,7 +296,7 @@
* not logged if this parameter is null
*/
public static void log(int msgLevel, String context, Object message) {
- logListener.logMessage(msgLevel, context, message);
+ logListener.log(msgLevel, context, message);
}
/**
@@ -311,8 +311,8 @@
* @param message the individual parts of the log message; the message is
* not logged if this parameter is null
*/
- public static void log(int msgLevel, String context, Throwable e, String message) {
- logMessage(msgLevel, context, e, message);
+ public static void log(int msgLevel, String context, Throwable e, Object message) {
+ logListener.log(msgLevel, context, e, message);
}
/**
@@ -358,19 +358,16 @@
}
private static void logMessage(int level, String context, Object ... msgParts) {
- logMessage(level, context, null, msgParts);
- }
-
- private static void logMessage(int level, String context, Throwable e, Object ... msgParts) {
if (msgParts == null || msgParts.length == 0 || !isMessageToBeRecorded(context, level)) {
return;
}
-
- LogMessage msg = new LogMessage(e, msgParts);
- logListener.logMessage(level, context, msg);
+ logListener.log(level, context, new LogMessage(msgParts));
}
-
+
+ /**
+ * Create a logging proxy, that logs at entry and exit points of the method calls on the provided interfaces.
+ */
public static Object createLoggingProxy(final String loggingContext,
final Object instance,
final Class[] interfaces,
Modified: trunk/common-internal/src/test/java/com/metamatrix/common/log/TestLogManager.java
===================================================================
--- trunk/common-internal/src/test/java/com/metamatrix/common/log/TestLogManager.java 2009-06-16 21:58:15 UTC (rev 1061)
+++ trunk/common-internal/src/test/java/com/metamatrix/common/log/TestLogManager.java 2009-06-17 20:40:10 UTC (rev 1062)
@@ -114,12 +114,19 @@
/* (non-Javadoc)
* @see com.metamatrix.core.log.LogListener#logMessage(org.eclipse.core.runtime.IStatus, long, java.lang.String, java.lang.String)
*/
- public synchronized void logMessage(int level, String context, Object msg){
- this.messages.add(((LogMessage)msg).getText());
+ public synchronized void log(int level, String context, Object msg){
+ this.messages.add(msg);
if (this.messages.size() == expectedMessages) {
this.notifyAll();
}
}
+
+ public void log(int level, String context, Throwable t, Object msg) {
+ this.messages.add(msg);
+ if (this.messages.size() == expectedMessages) {
+ this.notifyAll();
+ }
+ }
/* (non-Javadoc)
* @see com.metamatrix.core.log.LogListener#shutdown()
Modified: trunk/embedded/pom.xml
===================================================================
--- trunk/embedded/pom.xml 2009-06-16 21:58:15 UTC (rev 1061)
+++ trunk/embedded/pom.xml 2009-06-17 20:40:10 UTC (rev 1062)
@@ -65,5 +65,9 @@
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </dependency>
</dependencies>
</project>
\ No newline at end of file
Modified: trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPLogListener.java
===================================================================
--- trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPLogListener.java 2009-06-16 21:58:15 UTC (rev 1061)
+++ trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPLogListener.java 2009-06-17 20:40:10 UTC (rev 1062)
@@ -36,10 +36,17 @@
this.logger = logger;
}
- public void logMessage(int level, String context, Object msg) {
+ public void log(int level, String context, Object msg) {
+ logger.log(convertLevel(level), System.currentTimeMillis(), context, Thread.currentThread().getName(), msg.toString(), null);
+ }
+
+ public void log(int level, String context, Throwable t, Object msg) {
+ logger.log(convertLevel(level), System.currentTimeMillis(), context, Thread.currentThread().getName(), msg.toString(), t);
+ }
+
+ private int convertLevel(int level) {
+ int logLevel = EmbeddedLogger.INFO;
- int logLevel = EmbeddedLogger.INFO;
-
switch(level) {
case MessageLevel.WARNING:
logLevel = EmbeddedLogger.WARNING;
@@ -60,16 +67,9 @@
default:
logLevel = EmbeddedLogger.INFO;
}
-
- if (msg instanceof LogMessage) {
- LogMessage lm = (LogMessage)msg;
- logger.log(logLevel, System.currentTimeMillis(), context, Thread.currentThread().getName(), lm.getText(), lm.getException());
- }
- else {
- logger.log(logLevel, System.currentTimeMillis(), context, Thread.currentThread().getName(), msg.toString(), null);
- }
- }
-
+ return logLevel;
+ }
+
public void shutdown() {
}
}
Modified: trunk/embedded/src/main/java/com/metamatrix/jdbc/EmbeddedGuiceModule.java
===================================================================
--- trunk/embedded/src/main/java/com/metamatrix/jdbc/EmbeddedGuiceModule.java 2009-06-16 21:58:15 UTC (rev 1061)
+++ trunk/embedded/src/main/java/com/metamatrix/jdbc/EmbeddedGuiceModule.java 2009-06-17 20:40:10 UTC (rev 1062)
@@ -52,19 +52,21 @@
@Override
protected void configure() {
- bind(Cache.class).toProvider(CacheProvider.class).in(Scopes.SINGLETON);
- bind(CacheFactory.class).to(JBossCacheFactory.class).in(Scopes.SINGLETON);
+ bind(LogConfiguration.class).toProvider(LogConfigurationProvider.class).in(Scopes.SINGLETON);
+ bind(LogListener.class).toProvider(LogListernerProvider.class).in(Scopes.SINGLETON);
+
+ bind(URL.class).annotatedWith(Names.named("BootstrapURL")).toInstance(bootstrapURL); //$NON-NLS-1$
bindConstant().annotatedWith(Names.named("HostName")).to("embedded"); //$NON-NLS-1$ //$NON-NLS-2$
bindConstant().annotatedWith(Names.named("ProcessName")).to(props.getProperty(DQPEmbeddedProperties.DQP_IDENTITY)); //$NON-NLS-1$
String workspaceDir = props.getProperty(DQPEmbeddedProperties.DQP_WORKSPACE);
bindConstant().annotatedWith(Names.named("WorkspaceDir")).to(workspaceDir); //$NON-NLS-1$
bind(Properties.class).annotatedWith(Names.named("DQPProperties")).toInstance(this.props); //$NON-NLS-1$
+
+ bind(Cache.class).toProvider(CacheProvider.class).in(Scopes.SINGLETON);
+ bind(CacheFactory.class).to(JBossCacheFactory.class).in(Scopes.SINGLETON);
+
bind(DQPContextCache.class).in(Scopes.SINGLETON);
-
bind(DQPConfigSource.class).to(EmbeddedConfigSource.class);
- bind(URL.class).annotatedWith(Names.named("BootstrapURL")).toInstance(bootstrapURL); //$NON-NLS-1$
- bind(LogConfiguration.class).toProvider(LogConfigurationProvider.class).in(Scopes.SINGLETON);
- bind(LogListener.class).toProvider(LogListernerProvider.class).in(Scopes.SINGLETON);
// this needs to be removed.
binder().requestStaticInjection(LogManager.class);
Modified: trunk/embedded/src/main/java/com/metamatrix/jdbc/LogListernerProvider.java
===================================================================
--- trunk/embedded/src/main/java/com/metamatrix/jdbc/LogListernerProvider.java 2009-06-16 21:58:15 UTC (rev 1061)
+++ trunk/embedded/src/main/java/com/metamatrix/jdbc/LogListernerProvider.java 2009-06-17 20:40:10 UTC (rev 1062)
@@ -86,11 +86,27 @@
static class Log4jListener implements LogListener{
@Override
- public void logMessage(int level, String context, Object msg) {
- Logger log4j = Logger.getLogger("org.teiid."+context); //$NON-NLS-1$
+ public void log(int level, String context, Object msg) {
+ Logger log4j = getLogger(context);
log4j.log(convertLevel(level), msg);
}
+ public void log(int level, String context, Throwable t, Object msg) {
+ Logger log4j = getLogger(context);
+ log4j.log(convertLevel(level), msg, t);
+ }
+
+ private Logger getLogger(String context) {
+ Logger log4j = null;
+ if (context.indexOf('.') == -1) {
+ log4j = Logger.getLogger("org.teiid."+context); //$NON-NLS-1$
+ }
+ else {
+ log4j = Logger.getLogger(context);
+ }
+ return log4j;
+ }
+
@Override
public void shutdown() {
}
Added: trunk/embedded/src/main/java/org/teiid/configuration/CommonsLogManagerAdapter.java
===================================================================
--- trunk/embedded/src/main/java/org/teiid/configuration/CommonsLogManagerAdapter.java (rev 0)
+++ trunk/embedded/src/main/java/org/teiid/configuration/CommonsLogManagerAdapter.java 2009-06-17 20:40:10 UTC (rev 1062)
@@ -0,0 +1,130 @@
+/*
+ * 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.configuration;
+
+import org.apache.commons.logging.Log;
+
+import com.metamatrix.common.log.LogManager;
+import com.metamatrix.core.log.MessageLevel;
+
+/**
+ * This class is bridge for hooking LogManager into systems that use apache commons logging. In the Teiid
+ * JBoss cache/Jboss Transactions use commons logging. This class used in "commons-logging.properties" file.
+ */
+public class CommonsLogManagerAdapter implements Log {
+ String context;
+
+ public CommonsLogManagerAdapter(String context) {
+ this.context = context;
+ }
+
+ @Override
+ public void debug(Object arg0) {
+ LogManager.log(MessageLevel.DETAIL, this.context, arg0);
+ }
+
+ @Override
+ public void debug(Object arg0, Throwable arg1) {
+ LogManager.log(MessageLevel.DETAIL, this.context, arg1, arg0);
+ }
+
+ @Override
+ public void error(Object arg0) {
+ LogManager.log(MessageLevel.ERROR, this.context, arg0);
+ }
+
+ @Override
+ public void error(Object arg0, Throwable arg1) {
+ LogManager.log(MessageLevel.ERROR, this.context, arg1, arg0);
+ }
+
+ @Override
+ public void fatal(Object arg0) {
+ LogManager.log(MessageLevel.CRITICAL, this.context, arg0);
+ }
+
+ @Override
+ public void fatal(Object arg0, Throwable arg1) {
+ LogManager.log(MessageLevel.CRITICAL, this.context, arg1, arg0);
+ }
+
+ @Override
+ public void info(Object arg0) {
+ LogManager.log(MessageLevel.INFO, this.context, arg0);
+ }
+
+ @Override
+ public void info(Object arg0, Throwable arg1) {
+ LogManager.log(MessageLevel.INFO, this.context, arg1, arg0);
+ }
+
+ @Override
+ public void trace(Object arg0) {
+ LogManager.log(MessageLevel.TRACE, this.context, arg0);
+ }
+
+ @Override
+ public void trace(Object arg0, Throwable arg1) {
+ LogManager.log(MessageLevel.TRACE, this.context, arg1, arg0);
+ }
+
+ @Override
+ public void warn(Object arg0) {
+ LogManager.log(MessageLevel.WARNING, this.context, arg0);
+ }
+
+ @Override
+ public void warn(Object arg0, Throwable arg1) {
+ LogManager.log(MessageLevel.WARNING, this.context, arg1, arg0);
+ }
+
+ @Override
+ public boolean isDebugEnabled() {
+ return LogManager.isMessageToBeRecorded(this.context, MessageLevel.DETAIL);
+ }
+
+ @Override
+ public boolean isErrorEnabled() {
+ return LogManager.isMessageToBeRecorded(this.context, MessageLevel.ERROR);
+ }
+
+ @Override
+ public boolean isFatalEnabled() {
+ return LogManager.isMessageToBeRecorded(this.context, MessageLevel.CRITICAL);
+ }
+
+ @Override
+ public boolean isInfoEnabled() {
+ return LogManager.isMessageToBeRecorded(this.context, MessageLevel.INFO);
+ }
+
+ @Override
+ public boolean isTraceEnabled() {
+ return LogManager.isMessageToBeRecorded(this.context, MessageLevel.TRACE);
+ }
+
+ @Override
+ public boolean isWarnEnabled() {
+ return LogManager.isMessageToBeRecorded(this.context, MessageLevel.WARNING);
+ }
+}
Property changes on: trunk/embedded/src/main/java/org/teiid/configuration/CommonsLogManagerAdapter.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/embedded/src/main/resources/commons-logging.properties
===================================================================
--- trunk/embedded/src/main/resources/commons-logging.properties (rev 0)
+++ trunk/embedded/src/main/resources/commons-logging.properties 2009-06-17 20:40:10 UTC (rev 1062)
@@ -0,0 +1,2 @@
+# overrides the logging in jboss cache and jboss transactions integration code
+org.apache.commons.logging.Log=org.teiid.configuration.CommonsLogManagerAdapter
\ No newline at end of file
Property changes on: trunk/embedded/src/main/resources/commons-logging.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/embedded/src/main/resources/deploy.properties
===================================================================
--- trunk/embedded/src/main/resources/deploy.properties 2009-06-16 21:58:15 UTC (rev 1061)
+++ trunk/embedded/src/main/resources/deploy.properties 2009-06-17 20:40:10 UTC (rev 1062)
@@ -1 +1,2 @@
-dqp.workdir=${user.dir}/teiid-work
\ No newline at end of file
+dqp.workdir=${user.dir}/teiid-work
+dqp.logFile=${user.dir}/teiid.log
\ No newline at end of file
Modified: trunk/server/src/main/java/com/metamatrix/common/log/DbLogListener.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/common/log/DbLogListener.java 2009-06-16 21:58:15 UTC (rev 1061)
+++ trunk/server/src/main/java/com/metamatrix/common/log/DbLogListener.java 2009-06-17 20:40:10 UTC (rev 1062)
@@ -49,11 +49,17 @@
this.enabled = enable;
}
- public void logMessage(int level, String context, Object msg) {
+ public void log(int level, String context, Object msg) {
if (enabled) {
- writer.logMessage(level, context, (LogMessage)msg);
+ writer.logMessage(level, context, msg, null);
}
}
+
+ public void log(int level, String context, Throwable t, Object msg) {
+ if (enabled) {
+ writer.logMessage(level, context, msg, t);
+ }
+ }
public void shutdown() {
writer.shutdown();
Modified: trunk/server/src/main/java/com/metamatrix/common/log/DbLogWriter.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/common/log/DbLogWriter.java 2009-06-16 21:58:15 UTC (rev 1061)
+++ trunk/server/src/main/java/com/metamatrix/common/log/DbLogWriter.java 2009-06-17 20:40:10 UTC (rev 1062)
@@ -245,11 +245,11 @@
}
- public synchronized void logMessage(int level, String context,LogMessage msg) {
- write(level, context, msg);
+ public synchronized void logMessage(int level, String context,Object msg, Throwable t) {
+ write(level, context, msg, t);
}
- private void write(int level, String context, LogMessage message) {
+ private void write(int level, String context, Object message, Throwable t) {
// put this in a while to so that as long a
int retrycnt = 0;
if (isLogSuspended && System.currentTimeMillis() > resumeTime) {
@@ -257,7 +257,7 @@
}
while (!isLogSuspended && !shutdown) {
try {
- printMsg(level, context, message);
+ printMsg(level, context, message, t);
return;
} catch (Exception ex) {
@@ -301,7 +301,7 @@
return this.insert;
}
- private void printMsg(int level, String context, LogMessage message) throws SQLException {
+ private void printMsg(int level, String context, Object message, Throwable t) throws SQLException {
if (this.shutdown) {
return;
}
@@ -332,7 +332,7 @@
stmt.setInt(4, level);
// Message text column
- stmt.setString(5, StringUtil.truncString(message.getText(), maxMsgLength));
+ stmt.setString(5, StringUtil.truncString(message.toString(), maxMsgLength));
// Message hostname column
stmt.setString(6, StringUtil.truncString(CurrentConfiguration.getInstance().getConfigurationName(), maxGeneralLength));
@@ -344,8 +344,8 @@
stmt.setString(8, StringUtil.truncString(Thread.currentThread().getName(), maxGeneralLength));
// Exception column
- if(message.getException() != null) {
- String eMsg = message.getException().getMessage();
+ if(t != null) {
+ String eMsg = t.getMessage();
if ( eMsg == null ) {
eMsg = NULL;
} else {
Modified: trunk/soap/src/main/java/com/metamatrix/soap/sqlquerywebservice/log/LogUtil.java
===================================================================
--- trunk/soap/src/main/java/com/metamatrix/soap/sqlquerywebservice/log/LogUtil.java 2009-06-16 21:58:15 UTC (rev 1061)
+++ trunk/soap/src/main/java/com/metamatrix/soap/sqlquerywebservice/log/LogUtil.java 2009-06-17 20:40:10 UTC (rev 1062)
@@ -32,17 +32,13 @@
*/
public class LogUtil {
- // =========================================================================
- // Static Members
- // =========================================================================
private static final LogListener log = new JavaLogWriter();
-
public static void log(int severity, String message) {
- log.logMessage(severity, SOAPPlugin.PLUGIN_ID, new LogMessage(null, new Object[] {message}));
+ log.log(severity, SOAPPlugin.PLUGIN_ID, message);
}
public static void log(int severity, Throwable t, String message) {
- log.logMessage(severity, SOAPPlugin.PLUGIN_ID, new LogMessage( t, new Object[] {message}));
+ log.log(severity, SOAPPlugin.PLUGIN_ID, t, message);
}
}
Modified: trunk/txn-jbossts/src/main/java/com/metamatrix/xa/arjuna/ArjunaTransactionProvider.java
===================================================================
--- trunk/txn-jbossts/src/main/java/com/metamatrix/xa/arjuna/ArjunaTransactionProvider.java 2009-06-16 21:58:15 UTC (rev 1061)
+++ trunk/txn-jbossts/src/main/java/com/metamatrix/xa/arjuna/ArjunaTransactionProvider.java 2009-06-17 20:40:10 UTC (rev 1062)
@@ -94,8 +94,6 @@
String baseDir = props.getProperty(TransactionService.TXN_STORE_DIR, System.getProperty("java.io.tmpdir")); //$NON-NLS-1$
Configuration.setObjectStoreRoot(baseDir + File.separator + "TeiidTxnStore" + File.separator + txnMgrUniqueName); //$NON-NLS-1$
- configureLogging(txnMgrUniqueName, props);
-
// common properties
arjPropertyManager.propertyManager.setProperty(com.arjuna.ats.arjuna.common.Environment.XA_NODE_IDENTIFIER, txnMgrUniqueName);
arjPropertyManager.propertyManager.setProperty("com.arjuna.ats.arjuna.recovery.transactionStatusManagerPort", props.getProperty(TransactionService.TXN_STATUS_PORT, TransactionService.DEFAULT_TXN_STATUS_PORT)) ; //$NON-NLS-1$
@@ -120,36 +118,6 @@
}
}
- private void configureLogging(String uniqueName, Properties props) throws XATransactionException{
- // depending upon the logging type either log to the MM log file or create separate file for
- // transaction logging.
- AppenderSkeleton appender = null;
- if (Boolean.valueOf(props.getProperty(TransactionService.SEPARATE_TXN_LOG, TransactionService.DEFAULT_SEPARATE_TXN_LOG)).booleanValue()){
- RollingFileAppender fileAppender;
- try {
- String baseDir = props.getProperty(TransactionService.TXN_MGR_LOG_DIR);
- File directory = new File(baseDir);
- if (!directory.exists()) {
- directory.mkdirs();
- }
- String filename = baseDir + "/" + uniqueName + ".log"; //$NON-NLS-1$ //$NON-NLS-2$
- fileAppender = new RollingFileAppender(new PatternLayout("%d [%t] %-5p %c - %m%n"), filename, true); //$NON-NLS-1$
- fileAppender.setMaxFileSize(props.getProperty(TransactionService.MAX_FILESIZE_MB, TransactionService.DEFAULT_LOGFILE_SIZE)+"MB"); //$NON-NLS-1$
- fileAppender.setMaxBackupIndex(Integer.parseInt(props.getProperty(TransactionService.MAX_ROLLINGFILES, TransactionService.DEFAULT_MAX_ROLLOVER_FILES)));
- } catch (IOException e) {
- throw new XATransactionException(e);
- }
- appender = fileAppender;
- }
- else {
- appender = new MMLogAppender();
- }
- appender.setThreshold(Level.DEBUG);
-
- Logger root = Logger.getLogger("com.arjuna"); //$NON-NLS-1$
- root.addAppender(appender);
- }
-
/**
* @see org.teiid.dqp.internal.transaction.TransactionProvider#getXATerminator()
*/
@@ -195,43 +163,4 @@
public void removeRecoverySource(String name) {
XAConnectorRecovery.removeConnector(name);
}
-
- static class MMLogAppender extends AppenderSkeleton{
-
- protected void append(LoggingEvent event) {
- int level = MessageLevel.ERROR;
-
- switch(event.getLevel().toInt()) {
- case Level.DEBUG_INT:
- level = MessageLevel.DETAIL;
- break;
- case Level.INFO_INT:
- level = MessageLevel.INFO;
- break;
- case Level.WARN_INT:
- level = MessageLevel.WARNING;
- break;
- case Level.ERROR_INT:
- level = MessageLevel.ERROR;
- break;
- case Level.FATAL_INT:
- level = MessageLevel.CRITICAL;
- break;
- }
-
- if (event.getThrowableInformation() != null) {
- LogManager.log(level, LogCommonConstants.CTX_XA_TXN, event.getThrowableInformation().getThrowable(), event.getRenderedMessage());
- }
- else {
- LogManager.log(level, LogCommonConstants.CTX_XA_TXN, event.getRenderedMessage());
- }
- }
-
- public void close() {
- }
-
- public boolean requiresLayout() {
- return false;
- }
- }
}
Modified: trunk/txn-jbossts/src/main/resources/CommonLogging-properties.xml
===================================================================
--- trunk/txn-jbossts/src/main/resources/CommonLogging-properties.xml 2009-06-16 21:58:15 UTC (rev 1061)
+++ trunk/txn-jbossts/src/main/resources/CommonLogging-properties.xml 2009-06-17 20:40:10 UTC (rev 1062)
@@ -46,7 +46,7 @@
type="System"/>
<property
name="com.arjuna.common.util.logger"
- value="log4j"
+ value="jakarta"
type="System"/>
</properties>
</transaction-service>
Modified: trunk/txn-jbossts/src/main/resources/jbossjts-properties.xml
===================================================================
--- trunk/txn-jbossts/src/main/resources/jbossjts-properties.xml 2009-06-16 21:58:15 UTC (rev 1061)
+++ trunk/txn-jbossts/src/main/resources/jbossjts-properties.xml 2009-06-17 20:40:10 UTC (rev 1062)
@@ -193,7 +193,7 @@
type="System" value="0xffffffff"/>
<property name="com.arjuna.common.util.logging.VisibilityLevel"
type="System" value="0xffffffff"/>
- <property name="com.arjuna.common.util.logger" type="System" value="log4j"/>
+ <property name="com.arjuna.common.util.logger" type="System" value="jakarta"/>
</properties>
<properties depends="arjuna" name="txoj">
<!--
15 years, 9 months
teiid SVN: r1061 - trunk/client-jdbc/src/main/java/com/metamatrix/jdbc.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2009-06-16 17:58:15 -0400 (Tue, 16 Jun 2009)
New Revision: 1061
Modified:
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/EmbeddedDriver.java
Log:
TEIID-672: Adding only when it is not "classpath:" protocol mode.
Modified: trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/EmbeddedDriver.java
===================================================================
--- trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/EmbeddedDriver.java 2009-06-16 18:51:45 UTC (rev 1060)
+++ trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/EmbeddedDriver.java 2009-06-16 21:58:15 UTC (rev 1061)
@@ -356,18 +356,18 @@
if (!EmbeddedDriver.getDefaultConnectionURL().equals(dqpURL.toString())) {
runtimeClasspathList.addAll(libClassPath(dqpURL, libLocation+"patches/", MMURLConnection.REVERSEALPHA)); //$NON-NLS-1$
runtimeClasspathList.addAll(libClassPath(dqpURL, libLocation, MMURLConnection.DATE));
- }
- try {
- String configLocation = props.getProperty(DQPEmbeddedProperties.VDB_DEFINITION, "./deploy/"); //$NON-NLS-1$
- if (!configLocation.endsWith("/")) { //$NON-NLS-1$
- configLocation = configLocation + "/"; //$NON-NLS-1$
- }
- runtimeClasspathList.add(URLHelper.buildURL(dqpURL, configLocation));
- } catch(IOException e) {
- // ignore..
+ try {
+ String configLocation = props.getProperty(DQPEmbeddedProperties.VDB_DEFINITION, "./deploy/"); //$NON-NLS-1$
+ if (!configLocation.endsWith("/")) { //$NON-NLS-1$
+ configLocation = configLocation + "/"; //$NON-NLS-1$
+ }
+ runtimeClasspathList.add(URLHelper.buildURL(dqpURL, configLocation));
+ } catch(IOException e) {
+ // ignore..
+ }
}
-
+
URL[] dqpClassPath = runtimeClasspathList.toArray(new URL[runtimeClasspathList.size()]);
this.classLoader = new PostDelegatingClassLoader(dqpClassPath, this.getClass().getClassLoader(), new MetaMatrixURLStreamHandlerFactory());
15 years, 9 months
teiid SVN: r1060 - trunk/build/kit-embedded/deploy.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2009-06-16 14:51:45 -0400 (Tue, 16 Jun 2009)
New Revision: 1060
Added:
trunk/build/kit-embedded/deploy/log4j.properties
Log:
TEIID-672: adding default "log4j.properties" for the embedded
Added: trunk/build/kit-embedded/deploy/log4j.properties
===================================================================
--- trunk/build/kit-embedded/deploy/log4j.properties (rev 0)
+++ trunk/build/kit-embedded/deploy/log4j.properties 2009-06-16 18:51:45 UTC (rev 1060)
@@ -0,0 +1,24 @@
+#### Log4J configuration for Teiid
+log4j.rootCategory=FATAL, TEIID
+
+# Print only messages of priority ERROR or higher for your category
+# This is for JGroups
+log4j.category.org.jgroups=WARN
+
+#This one controls for JBoss Cache
+log4j.category.org.jboss=WARN
+
+# This one controls Teiid
+log4j.category.org.teiid=WARN
+
+
+# Appender writes to a file
+# Control the maximum log file size, number of backup files
+log4j.appender.TEIID=org.apache.log4j.RollingFileAppender
+log4j.appender.TEIID.File=${dqp.log4jFile}
+log4j.appender.TEIID.MaxFileSize=1000KB
+log4j.appender.TEIID.MaxBackupIndex=25
+
+# layout {priority, thread, category, message, newline}
+log4j.appender.TEIID.layout=org.apache.log4j.PatternLayout
+log4j.appender.TEIID.layout.ConversionPattern=%p %t %c - %m%n
\ No newline at end of file
Property changes on: trunk/build/kit-embedded/deploy/log4j.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
15 years, 9 months
teiid SVN: r1059 - in trunk: client-jdbc/src/main/java/com/metamatrix/jdbc and 1 other directory.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2009-06-16 14:50:47 -0400 (Tue, 16 Jun 2009)
New Revision: 1059
Modified:
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/EmbeddedDriver.java
trunk/client/src/main/java/com/metamatrix/dqp/embedded/DQPEmbeddedProperties.java
Log:
TEIID-672: Added the "deploy" directory to the classpath, so that it will pickup "log4j.properties" or any other configuration.
Modified: trunk/client/src/main/java/com/metamatrix/dqp/embedded/DQPEmbeddedProperties.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/dqp/embedded/DQPEmbeddedProperties.java 2009-06-16 18:49:45 UTC (rev 1058)
+++ trunk/client/src/main/java/com/metamatrix/dqp/embedded/DQPEmbeddedProperties.java 2009-06-16 18:50:47 UTC (rev 1059)
@@ -36,6 +36,7 @@
public static final String COMMON_EXTENSION_CLASPATH = "dqp.extension.CommonClasspath"; //$NON-NLS-1$
public static final String DQP_KEYSTORE = "dqp.keystore"; //$NON-NLS-1$
public static final String DQP_WORKDIR = "dqp.workdir"; //$NON-NLS-1$
+ public static final String DQP_LIBDIR = "dqp.lib"; //$NON-NLS-1$
//derived properties
public static final String DQP_IDENTITY = "dqp.identity"; //$NON-NLS-1$
Modified: trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/EmbeddedDriver.java
===================================================================
--- trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/EmbeddedDriver.java 2009-06-16 18:49:45 UTC (rev 1058)
+++ trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/EmbeddedDriver.java 2009-06-16 18:50:47 UTC (rev 1059)
@@ -347,7 +347,7 @@
// a non-delegating class loader will be created from where all third party dependent jars can be loaded
ArrayList<URL> runtimeClasspathList = new ArrayList<URL>();
- String libLocation = props.getProperty("dqp.lib", "./lib/"); //$NON-NLS-1$ //$NON-NLS-2$
+ String libLocation = props.getProperty(DQPEmbeddedProperties.DQP_LIBDIR, "./lib/"); //$NON-NLS-1$
if (!libLocation.endsWith("/")) { //$NON-NLS-1$
libLocation = libLocation + "/"; //$NON-NLS-1$
}
@@ -358,6 +358,16 @@
runtimeClasspathList.addAll(libClassPath(dqpURL, libLocation, MMURLConnection.DATE));
}
+ try {
+ String configLocation = props.getProperty(DQPEmbeddedProperties.VDB_DEFINITION, "./deploy/"); //$NON-NLS-1$
+ if (!configLocation.endsWith("/")) { //$NON-NLS-1$
+ configLocation = configLocation + "/"; //$NON-NLS-1$
+ }
+ runtimeClasspathList.add(URLHelper.buildURL(dqpURL, configLocation));
+ } catch(IOException e) {
+ // ignore..
+ }
+
URL[] dqpClassPath = runtimeClasspathList.toArray(new URL[runtimeClasspathList.size()]);
this.classLoader = new PostDelegatingClassLoader(dqpClassPath, this.getClass().getClassLoader(), new MetaMatrixURLStreamHandlerFactory());
15 years, 9 months
teiid SVN: r1058 - trunk.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2009-06-16 14:49:45 -0400 (Tue, 16 Jun 2009)
New Revision: 1058
Removed:
trunk/server-installer/
Log:
removing unused server installer module
15 years, 9 months
teiid SVN: r1057 - trunk.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2009-06-16 14:49:42 -0400 (Tue, 16 Jun 2009)
New Revision: 1057
Modified:
trunk/pom.xml
Log:
removing unused server installer module
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2009-06-16 18:05:22 UTC (rev 1056)
+++ trunk/pom.xml 2009-06-16 18:49:42 UTC (rev 1057)
@@ -459,7 +459,6 @@
<module>test-integration</module>
<module>connector-metadata</module>
<module>cache-jbosscache</module>
- <module>server-installer</module>
<module>hibernate-dialect</module>
</modules>
<distributionManagement>
15 years, 9 months
teiid SVN: r1056 - in trunk: common-core/src/main/java/com/metamatrix/internal/core and 12 other directories.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2009-06-16 14:05:22 -0400 (Tue, 16 Jun 2009)
New Revision: 1056
Removed:
trunk/common-core/src/main/java/com/metamatrix/core/log/FileLimitSizeLogWriter.java
trunk/common-core/src/main/java/com/metamatrix/core/log/FileLogWriter.java
trunk/common-core/src/main/java/com/metamatrix/core/log/NullLogger.java
trunk/common-core/src/main/java/com/metamatrix/core/log/SystemLogWriter.java
trunk/common-core/src/main/java/com/metamatrix/internal/core/log/
trunk/server/src/main/java/com/metamatrix/server/ServerLogListernerProvider.java
trunk/soap/src/main/java/com/metamatrix/soap/log/MMSOAPLog.java
Modified:
trunk/common-core/src/main/java/com/metamatrix/core/log/JavaLogWriter.java
trunk/common-core/src/main/java/com/metamatrix/core/log/LogListener.java
trunk/common-core/src/main/java/com/metamatrix/core/log/LogMessage.java
trunk/common-internal/src/main/java/com/metamatrix/common/log/LogManager.java
trunk/common-internal/src/test/java/com/metamatrix/common/log/TestLogManager.java
trunk/connector-sdk/src/main/java/com/metamatrix/core/commandshell/CommandShell.java
trunk/embedded/pom.xml
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPLogListener.java
trunk/embedded/src/main/java/com/metamatrix/jdbc/LogListernerProvider.java
trunk/engine/src/test/java/com/metamatrix/dqp/config/TestDQPLauncher.java
trunk/server/src/main/java/com/metamatrix/common/log/DbLogListener.java
trunk/server/src/main/java/com/metamatrix/common/log/DbLogWriter.java
trunk/server/src/main/java/com/metamatrix/server/FileLogListenerProvider.java
trunk/server/src/main/java/com/metamatrix/server/Main.java
trunk/server/src/main/java/com/metamatrix/server/ServerGuiceModule.java
trunk/soap/src/main/java/com/metamatrix/soap/servlet/MMDiscoverWSDLServlet.java
trunk/soap/src/main/java/com/metamatrix/soap/servlet/MMGetVDBResourceServlet.java
trunk/soap/src/main/java/com/metamatrix/soap/servlet/MMGetWSDLServlet.java
trunk/soap/src/main/java/com/metamatrix/soap/servlet/WSDLURLGenerator.java
trunk/soap/src/main/java/com/metamatrix/soap/sqlquerywebservice/log/LogUtil.java
Log:
TEIID-672: Removed the all the platform logging framework implementation, and supplied the Embedded with Log4J LogListener.
Deleted: trunk/common-core/src/main/java/com/metamatrix/core/log/FileLimitSizeLogWriter.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/core/log/FileLimitSizeLogWriter.java 2009-06-16 17:20:38 UTC (rev 1055)
+++ trunk/common-core/src/main/java/com/metamatrix/core/log/FileLimitSizeLogWriter.java 2009-06-16 18:05:22 UTC (rev 1056)
@@ -1,427 +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.core.log;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.Properties;
-import java.util.concurrent.locks.ReadWriteLock;
-import java.util.concurrent.locks.ReentrantReadWriteLock;
-
-import com.metamatrix.core.CorePlugin;
-import com.metamatrix.core.util.FileUtils;
-import com.metamatrix.internal.core.log.PlatformLimitSizeLogWriter;
-
-/**
- * The FileLogWriter is a {@link LogListener} that writes (appends) to a supplied file.
- *
- */
-public class FileLimitSizeLogWriter implements LogListener {
-
- /**
- * The FILE_SIZE_LIMIT controls the file size limit at which the
- * file will rolled-over (i.e., when it closed and renamed due
- * to size). The default size limit will be 5 Mbs.
- * {@see #FILE_GROUP_NAME}
- */
- public static final String FILE_SIZE_LIMIT = "metamatrix.log.size.limit.kbs"; //$NON-NLS-1$
- /**
- * the FILE_SIZE_MONITOR_TIME interval is in minutes and
- * controls when the monitoring thread will determine if the
- * file has reach the
- * {@see #FILE_SIZE_LIMIT LIMIT} to be swapped out.
- */
- public static final String FILE_SIZE_MONITOR_TIME = "metamatrix.log.size.monitor.mins"; //$NON-NLS-1$
-
- /**
- * The ARCHIVE_PREFIX is a prefixed value to the renamed log file.
- * This is used so that the savelogs.cmd - .sh scripts can
- * find the archived files, zip them up and then delete
- */
- public static final String ARCHIVE_PREFIX = "a_"; //$NON-NLS-1$
-
- // defaults for the file size limit and interval
- private static final long DEFUALT_ROLLOVER_SIZE = 1000; // in kbs in size
- private static final int DEFAULT_WAIT_TIME = 60; // 60 secs or 1 min
-
- // these are the muliplier applied to the parameter values
- // for FILE_SIZE_LIMIT and FILE_SIZE_MONITOR_TIME
- private static final long SIZE_MULTIPLIER = 1000;
- private static final long MIN_MULTIPLIER = 60000;
-
- // the formatted date used in the naming of the
- // swapped out file
- public static final String TIMESTAMP_FORMAT = "yyyy-MM-dd_HH-mm"; //$NON-NLS-1$
-
- static DateFormat DATE_FORMATTER = new SimpleDateFormat(TIMESTAMP_FORMAT);
-
- // monitoring thread
- private FileSizeMonitorThread rollOverThread = null;
- // the primary log file written to
- private File currentLogFile = null;
- private PlatformLimitSizeLogWriter limitwriter = null;
-
-
- private String prefixName = null;
- private String suffixName = null;
- private File parentFile = null;
- private long filecnt = 1;
- private Properties props;
- // List locking
- private ReadWriteLock rwlock = new ReentrantReadWriteLock();
-
-
- public FileLimitSizeLogWriter( final File file ) {
- if (file == null) {
- final String msg = CorePlugin.Util.getString("FileLogWriter.The_File_reference_may_not_be_null"); //$NON-NLS-1$
- throw new IllegalArgumentException(msg);
- }
-
- currentLogFile = file;
- rolloverPreviousLogFile(currentLogFile);
- createPlatformLogWriter(currentLogFile) ;
- init();
- }
-
- // For use in DQP - allows the user to pass a parameter through to reset the System output streams
- public FileLimitSizeLogWriter( final File file, boolean resetSystemStreams) {
- if (file == null) {
- final String msg = CorePlugin.Util.getString("FileLogWriter.The_File_reference_may_not_be_null"); //$NON-NLS-1$
- throw new IllegalArgumentException(msg);
- }
-
- currentLogFile = file;
- rolloverPreviousLogFile(currentLogFile);
- createPlatformLogWriter(currentLogFile, resetSystemStreams) ;
- init();
- }
-
- public FileLimitSizeLogWriter( final File file, Properties properties ) {
- if (file == null) {
- final String msg = CorePlugin.Util.getString("FileLogWriter.The_File_reference_may_not_be_null"); //$NON-NLS-1$
- throw new IllegalArgumentException(msg);
- }
- props = properties;
- currentLogFile = file;
- rolloverPreviousLogFile(currentLogFile);
- createPlatformLogWriter(currentLogFile) ;
- init();
- }
-
- public FileLimitSizeLogWriter( final File file, Properties properties, boolean rollover ) {
- if (file == null) {
- final String msg = CorePlugin.Util.getString("FileLogWriter.The_File_reference_may_not_be_null"); //$NON-NLS-1$
- throw new IllegalArgumentException(msg);
- }
- props = properties;
- currentLogFile = file;
- if (rollover) {
- rolloverPreviousLogFile(currentLogFile);
- }
- createPlatformLogWriter(currentLogFile) ;
- init();
- }
-
- /**
- * initialize the variables used to keep track and
- * assign the next log file name
- *
- */
- private void init() {
-
- parentFile = currentLogFile.getParentFile();
- String name = currentLogFile.getName();
-
- int pos = name.lastIndexOf(PERIOD);
- String first = null;
- String ext = null;
- String period = EMPTY;
- if (pos > 0) {
- ext = name.substring(pos + 1);
- first = name.substring(0, pos);
- period = PERIOD;
- } else {
- first = name;
- ext = EMPTY;
- }
- long fileSizeLimit = DEFUALT_ROLLOVER_SIZE;
- long timeLimit = DEFAULT_WAIT_TIME;
- if (props != null) {
-
- String limit = props.getProperty(FILE_SIZE_LIMIT);
- try {
- if (limit != null) {
- fileSizeLimit = Long.parseLong(limit);
- }
- } catch(Throwable t) {
- fileSizeLimit = DEFUALT_ROLLOVER_SIZE;
- }
-
- String time = props.getProperty(FILE_SIZE_MONITOR_TIME);
- try {
- if (time != null) {
- timeLimit = Long.parseLong(time);
- }
- } catch(Throwable t) {
- timeLimit = DEFAULT_WAIT_TIME;
- }
- }
-
- prefixName = first;
-
- StringBuffer suffix = new StringBuffer(period);
- suffix.append(ext);
- suffixName = suffix.toString();
-
- rollOverThread = new FileSizeMonitorThread(fileSizeLimit, timeLimit, this );
- rollOverThread.start();
-
- }
-
-
- protected File getLogFile() {
- return this.currentLogFile;
- }
-
-
- protected void createPlatformLogWriter(File file) {
- limitwriter = new PlatformLimitSizeLogWriter(file);
- }
-
- protected void createPlatformLogWriter(File file, boolean resetSystemStreams) {
- limitwriter = new PlatformLimitSizeLogWriter(file, resetSystemStreams);
- }
-
- protected PlatformLimitSizeLogWriter getPlatformLogWriter() {
- return this.limitwriter;
- }
-
-
- public void logMessage(LogMessage msg) {
- rwlock.readLock().lock();
- try {
- if (getPlatformLogWriter() != null) {
- getPlatformLogWriter().logMessage(msg);
- }
-
- } finally {
- rwlock.readLock().unlock();
- }
- }
- /**
- * perform the file rollover process
- *
- */
- protected void performRollOver() {
- rwlock.writeLock().lock();
- try {
- File rf = getNextRolloverFile();
- rolloverFile(rf);
-
- } finally {
- rwlock.writeLock().unlock();
- }
-
- }
-
- /**
- * Close the stream to the file.
- */
- public void shutdown() {
- rollOverThread.stopThread();
- if (limitwriter != null) {
- limitwriter.shutdown();
- }
- limitwriter = null;
- }
-
- private static final String PERIOD = "."; //$NON-NLS-1$
- private static final String UNDERSCORE = "_"; //$NON-NLS-1$
- private static final String EMPTY = ""; //$NON-NLS-1$
-
- /**
- * create the name to call the newly created swapped file
- * @return
- */
-
- private File getNextRolloverFile() {
-
-// String mmdd = FileLimitSizeLogWriter.getDate();
-//
-// StringBuffer fileName = new StringBuffer(ARCHIVE_PREFIX);
-// fileName.append(prefixName);
-// fileName.append(mmdd);
-// fileName.append(UNDERSCORE);
-//
-// fileName.append(filecnt);
-// fileName.append(suffixName);
-
- String suffix = String.valueOf(filecnt) + suffixName;
- String archiveName = buildArchiveFileName(prefixName, suffix);
- File f = new File(parentFile, archiveName);
-
- ++filecnt;
- if (f.exists()) {
- return getNextRolloverFile();
- }
-
- return f;
-
- }
-
-
- // This only occurs at the creation of the log file. We check to see if a log file from a
- // previous execution exist and we roll it over.
- private void rolloverPreviousLogFile(File logFile) {
- if (logFile.exists()) {
- String path = logFile.getAbsolutePath();
- String logFileName = logFile.getName();
- path = path.substring(0, path.indexOf(logFileName));
- int index = logFileName.lastIndexOf("."); //$NON-NLS-1$
- String logFile_begin = logFileName.substring(0, index);
- String logFile_end = logFileName.substring(index);
-
- String archiveName = buildArchiveFileName(logFile_begin, logFile_end);
-
- // tmpFile.renameTo(new File(logFile_begin + logFile_date + logFile_end));
- logFile.renameTo(new File(path+archiveName));
- }
- }
-
- protected void rolloverFile(final File rollToFile) {
-
- try {
-
- if (this.getPlatformLogWriter() != null) {
- this.getPlatformLogWriter().shutdown();
- }
-
- FileInputStream fis = null;
- try {
-
- fis = new FileInputStream(currentLogFile);
- FileUtils.write(fis, rollToFile);
- } catch (IOException e) {
- e.printStackTrace();
- } finally {
- fis.close();
- }
-
- boolean deleted = currentLogFile.delete();
- if (!deleted) {
- Exception e = new Exception("File " + currentLogFile + " was not DELETED"); //$NON-NLS-1$ //$NON-NLS-2$
- e.printStackTrace();
- }
- createPlatformLogWriter(this.currentLogFile);
-
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- public static String buildArchiveFileName(String prefix, String suffix) {
- String mmdd = FileLimitSizeLogWriter.getDate();
-
- StringBuffer fileName = new StringBuffer(ARCHIVE_PREFIX);
- fileName.append(prefix);
- fileName.append(mmdd);
- fileName.append(UNDERSCORE);
-
- fileName.append(suffix);
- return fileName.toString();
- }
-
- public synchronized static String getDate( ) {
- try {
- Date d = Calendar.getInstance().getTime();
- return DATE_FORMATTER.format(d);
- } catch (Exception e) {
- return ""; //$NON-NLS-1$
- // If there were problems writing out the date, ignore and
- // continue since that shouldn't stop us from losing the rest
- // of the information
- }
- }
-
-
- class FileSizeMonitorThread extends Thread
- {
- private volatile boolean go = true;
- private FileLimitSizeLogWriter writer;
- private long max;
- private long time;
-
-
-
- public FileSizeMonitorThread(long maxSize, long waitTime, FileLimitSizeLogWriter logwriter )
- {
- super("LogFileSizeMonitor"); //$NON-NLS-1$
- writer = logwriter;
- max = maxSize;
- time = waitTime;
- this.setDaemon(true);
- }
-
- public void run()
- {
- long max_size = max * SIZE_MULTIPLIER;
- long monitor_time = time * MIN_MULTIPLIER;
-
- while (go) {
- try {
- Thread.sleep(monitor_time);
- }catch(Exception e) {
-
- }
- try {
- File f = writer.getLogFile();
- if (f != null && f.exists()) {
- long l = f.length();
- if (l >= (max_size)) {
-// System.out.println("Rollever, size : " + l + " max: " + max);
-
- writer.performRollOver();
- } else {
-// System.out.println("NO Rollever, size not big enough: " + l + " max: " + max);
-
- }
- }
- } catch (Exception e) {
- e.printStackTrace();
- System.out.println(CorePlugin.Util.getString("FileLimitSizeLogWriter.Error_Checking_logwriter_rollover__10") + e.getMessage()); //$NON-NLS-1$
- }
- }
- }
-
- public void stopThread() {
- go = false;
- this.interrupt();
- }
- }
-
-}
Deleted: trunk/common-core/src/main/java/com/metamatrix/core/log/FileLogWriter.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/core/log/FileLogWriter.java 2009-06-16 17:20:38 UTC (rev 1055)
+++ trunk/common-core/src/main/java/com/metamatrix/core/log/FileLogWriter.java 2009-06-16 18:05:22 UTC (rev 1056)
@@ -1,65 +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.core.log;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-
-import com.metamatrix.core.CorePlugin;
-import com.metamatrix.internal.core.log.PlatformLogWriter;
-
-/**
- * The FileLogWriter is a {@link LogListener} that writes (appends) to a supplied file.
- */
-public class FileLogWriter implements LogListener {
-
- private PlatformLogWriter writer;
-
- public FileLogWriter( final File file ) {
- if (file == null) {
- final String msg = CorePlugin.Util.getString("FileLogWriter.The_File_reference_may_not_be_null"); //$NON-NLS-1$
- throw new IllegalArgumentException(msg);
- }
-
- try {
- OutputStream destination = new FileOutputStream(file.getAbsolutePath(), true);
- this.writer = new PlatformLogWriter(destination, destination);
- } catch (IOException e) {
- this.writer = new PlatformLogWriter(System.err, System.err);
- }
- }
-
- public void logMessage(LogMessage msg) {
- this.writer.logMessage(msg);
- }
-
- /**
- * Close the stream to the file.
- */
- public void shutdown() {
- this.writer.shutdown();
- }
-
-}
Modified: trunk/common-core/src/main/java/com/metamatrix/core/log/JavaLogWriter.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/core/log/JavaLogWriter.java 2009-06-16 17:20:38 UTC (rev 1055)
+++ trunk/common-core/src/main/java/com/metamatrix/core/log/JavaLogWriter.java 2009-06-16 18:05:22 UTC (rev 1056)
@@ -30,11 +30,17 @@
*/
public class JavaLogWriter implements LogListener {
- public void logMessage(LogMessage msg) {
- Logger logger = Logger.getLogger("org.teiid." + msg.getContext()); //$NON-NLS-1$
- Level level = convertLevel(msg.getLevel());
- if (logger.isLoggable(level)) {
- logger.log(level, msg.getText(), msg.getException());
+ public void logMessage(int level, String context, Object msg) {
+ Logger logger = Logger.getLogger("org.teiid." + context); //$NON-NLS-1$
+
+ Level javaLevel = convertLevel(level);
+ if (logger.isLoggable(javaLevel)) {
+ if (msg instanceof LogMessage) {
+ logger.log(javaLevel, ((LogMessage)msg).getText(), ((LogMessage)msg).getException());
+ }
+ else {
+ logger.log(javaLevel, msg.toString());
+ }
}
}
Modified: trunk/common-core/src/main/java/com/metamatrix/core/log/LogListener.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/core/log/LogListener.java 2009-06-16 17:20:38 UTC (rev 1055)
+++ trunk/common-core/src/main/java/com/metamatrix/core/log/LogListener.java 2009-06-16 18:05:22 UTC (rev 1056)
@@ -36,7 +36,7 @@
* @param pluginID the identifier of the plugin that submitted the log message
* @param threadName the name of the thread upon which the message was created
*/
- void logMessage(LogMessage msg);
+ void logMessage(int level, String context, Object msg);
/**
* Shut down this listener, requesting it clean up and release any resources it
Modified: trunk/common-core/src/main/java/com/metamatrix/core/log/LogMessage.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/core/log/LogMessage.java 2009-06-16 17:20:38 UTC (rev 1055)
+++ trunk/common-core/src/main/java/com/metamatrix/core/log/LogMessage.java 2009-06-16 18:05:22 UTC (rev 1056)
@@ -27,59 +27,15 @@
public class LogMessage implements Serializable{
- private String context;
- private int level;
private Object[] msgParts;
private Throwable exception;
- private long timestamp;
- private String threadName;
- private int errorCode;
- public LogMessage() {
- }
- public LogMessage(String context, int level, Object[] msgParts ) {
- this.context = context;
- this.level = level;
- this.msgParts = msgParts;
- this.timestamp = System.currentTimeMillis();
- this.threadName = Thread.currentThread().getName();
- }
-
- public LogMessage(String context, int level, Throwable e, Object[] msgParts) {
- this(context, level, msgParts);
+ public LogMessage(Throwable e, Object[] msgParts) {
+ this.msgParts = msgParts;
this.exception = e;
}
-
- public LogMessage(String context, int level, Throwable e, Object[] msgParts, int errorCode) {
- this(context, level, msgParts);
- this.exception = e;
- this.errorCode = errorCode;
- }
-
- public LogMessage(String context, int level, Throwable e, Object[] msgParts, String threadname ) {
- this(context, level, msgParts);
- this.exception = e;
- this.threadName = threadname;
- }
-
- public String getContext() {
- return this.context;
- }
-
- public int getLevel() {
- return this.level;
- }
-
- public String getThreadName() {
- return this.threadName;
- }
-
- public long getTimestamp() {
- return this.timestamp;
- }
-
public Throwable getException() {
return this.exception;
}
@@ -106,11 +62,8 @@
}
return text.toString();
}
-
- /**
- * @return Returns the errorCode.
- */
- public int getErrorCode() {
- return this.errorCode;
- }
+
+ public String toString() {
+ return getText();
+ }
}
Deleted: trunk/common-core/src/main/java/com/metamatrix/core/log/NullLogger.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/core/log/NullLogger.java 2009-06-16 17:20:38 UTC (rev 1055)
+++ trunk/common-core/src/main/java/com/metamatrix/core/log/NullLogger.java 2009-06-16 18:05:22 UTC (rev 1056)
@@ -1,46 +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.core.log;
-
-
-/**
- * Implementation of {@link Logger} that does nothing. An instance of this class is often useful
- * when a reference to a {@link Logger} is always expected to be non-null, but no logging is desired.
- */
-public class NullLogger implements Logger {
-
- /**
- * @see com.metamatrix.core.log.Logger#log(int, java.lang.String)
- */
- public void log(int severity, String message) {
-
- }
-
- /**
- * @see com.metamatrix.core.log.Logger#log(int, java.lang.Throwable, java.lang.String)
- */
- public void log(int severity, Throwable t, String message) {
-
- }
-
-}
Deleted: trunk/common-core/src/main/java/com/metamatrix/core/log/SystemLogWriter.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/core/log/SystemLogWriter.java 2009-06-16 17:20:38 UTC (rev 1055)
+++ trunk/common-core/src/main/java/com/metamatrix/core/log/SystemLogWriter.java 2009-06-16 18:05:22 UTC (rev 1056)
@@ -1,53 +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.core.log;
-
-import com.metamatrix.internal.core.log.PlatformLogWriter;
-
-/**
- * The SystemLogWriter is a {@link LogListener} that writes error log messages to System.err and other log
- * messages to System.out.
- */
-public class SystemLogWriter implements LogListener {
-
- private PlatformLogWriter writer;
-
- public SystemLogWriter() {
- this.writer = new PlatformLogWriter(System.out,System.err);
- }
-
- /* (non-Javadoc)
- * @see com.metamatrix.core.log.LogListener#logMessage(org.eclipse.core.runtime.IStatus, long, java.lang.String, java.lang.String)
- */
- public void logMessage(LogMessage msg) {
- this.writer.logMessage(msg);
- }
-
- /**
- * Close the stream to the file.
- */
- public void shutdown() {
- this.writer.shutdown();
- }
-
-}
Modified: trunk/common-internal/src/main/java/com/metamatrix/common/log/LogManager.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/log/LogManager.java 2009-06-16 17:20:38 UTC (rev 1055)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/log/LogManager.java 2009-06-16 18:05:22 UTC (rev 1056)
@@ -296,7 +296,7 @@
* not logged if this parameter is null
*/
public static void log(int msgLevel, String context, Object message) {
- logMessage(msgLevel, context, message);
+ logListener.logMessage(msgLevel, context, message);
}
/**
@@ -366,8 +366,8 @@
return;
}
- LogMessage msg = new LogMessage( context, level, e, msgParts);
- logListener.logMessage(msg);
+ LogMessage msg = new LogMessage(e, msgParts);
+ logListener.logMessage(level, context, msg);
}
Modified: trunk/common-internal/src/test/java/com/metamatrix/common/log/TestLogManager.java
===================================================================
--- trunk/common-internal/src/test/java/com/metamatrix/common/log/TestLogManager.java 2009-06-16 17:20:38 UTC (rev 1055)
+++ trunk/common-internal/src/test/java/com/metamatrix/common/log/TestLogManager.java 2009-06-16 18:05:22 UTC (rev 1056)
@@ -32,7 +32,6 @@
import com.metamatrix.core.log.LogListener;
import com.metamatrix.core.log.LogMessage;
import com.metamatrix.core.log.MessageLevel;
-import com.metamatrix.internal.core.log.PlatformLog;
/**
* This test case tests the LogManager.
@@ -50,8 +49,6 @@
@Override
protected void setUp() throws Exception {
LogManager.configuration = new BasicLogConfiguration();
- LogManager.logListener = new PlatformLog();
-
}
// =========================================================================
@@ -117,8 +114,8 @@
/* (non-Javadoc)
* @see com.metamatrix.core.log.LogListener#logMessage(org.eclipse.core.runtime.IStatus, long, java.lang.String, java.lang.String)
*/
- public synchronized void logMessage(LogMessage msg){
- this.messages.add(msg.getText());
+ public synchronized void logMessage(int level, String context, Object msg){
+ this.messages.add(((LogMessage)msg).getText());
if (this.messages.size() == expectedMessages) {
this.notifyAll();
}
Modified: trunk/connector-sdk/src/main/java/com/metamatrix/core/commandshell/CommandShell.java
===================================================================
--- trunk/connector-sdk/src/main/java/com/metamatrix/core/commandshell/CommandShell.java 2009-06-16 17:20:38 UTC (rev 1055)
+++ trunk/connector-sdk/src/main/java/com/metamatrix/core/commandshell/CommandShell.java 2009-06-16 18:05:22 UTC (rev 1056)
@@ -23,7 +23,6 @@
package com.metamatrix.core.commandshell;
import java.io.BufferedReader;
-import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.Method;
@@ -34,14 +33,11 @@
import java.util.Set;
import java.util.Stack;
-import com.metamatrix.common.log.LogManager;
import com.metamatrix.core.CorePlugin;
import com.metamatrix.core.MetaMatrixRuntimeException;
-import com.metamatrix.core.log.FileLogWriter;
import com.metamatrix.core.util.FileUtil;
import com.metamatrix.core.util.MetaMatrixExceptionUtil;
import com.metamatrix.core.util.StringUtil;
-import com.metamatrix.internal.core.log.PlatformLog;
/**
* Reads input from standard input and directs commands read to the underlying target object.
@@ -110,9 +106,7 @@
* Start reading commands from standard input.
*/
public void run(String[] args, String logFile) {
- redirectLogging(logFile);
-
writeln(CorePlugin.Util.getString("CommandShell.Started")); //$NON-NLS-1$
write(getCommandPrompt());
if (args.length == 0) {
@@ -137,19 +131,7 @@
writeln(CorePlugin.Util.getString("CommandShell.Finished")); //$NON-NLS-1$
}
-
- private void redirectLogging(String logFile) {
- //add a listener that writes to a file
- File file = new File(logFile);
- FileLogWriter flw = new FileLogWriter(file);
-
- PlatformLog logger = new PlatformLog();
- logger.addListener(flw);
- LogManager.setLogListener(logger);
- }
-
-
-
+
public void writeln(String text) {
if (!silent) {
System.out.println(text);
Modified: trunk/embedded/pom.xml
===================================================================
--- trunk/embedded/pom.xml 2009-06-16 17:20:38 UTC (rev 1055)
+++ trunk/embedded/pom.xml 2009-06-16 18:05:22 UTC (rev 1056)
@@ -61,5 +61,9 @@
<groupId>com.google.code.guice</groupId>
<artifactId>guice</artifactId>
</dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </dependency>
</dependencies>
</project>
\ No newline at end of file
Modified: trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPLogListener.java
===================================================================
--- trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPLogListener.java 2009-06-16 17:20:38 UTC (rev 1055)
+++ trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPLogListener.java 2009-06-16 18:05:22 UTC (rev 1056)
@@ -36,11 +36,11 @@
this.logger = logger;
}
- public void logMessage(LogMessage msg) {
+ public void logMessage(int level, String context, Object msg) {
int logLevel = EmbeddedLogger.INFO;
- switch(msg.getLevel()) {
+ switch(level) {
case MessageLevel.WARNING:
logLevel = EmbeddedLogger.WARNING;
break;
@@ -60,7 +60,14 @@
default:
logLevel = EmbeddedLogger.INFO;
}
- logger.log(logLevel, msg.getTimestamp(), msg.getContext(), msg.getThreadName(), msg.getText(), msg.getException());
+
+ if (msg instanceof LogMessage) {
+ LogMessage lm = (LogMessage)msg;
+ logger.log(logLevel, System.currentTimeMillis(), context, Thread.currentThread().getName(), lm.getText(), lm.getException());
+ }
+ else {
+ logger.log(logLevel, System.currentTimeMillis(), context, Thread.currentThread().getName(), msg.toString(), null);
+ }
}
public void shutdown() {
Modified: trunk/embedded/src/main/java/com/metamatrix/jdbc/LogListernerProvider.java
===================================================================
--- trunk/embedded/src/main/java/com/metamatrix/jdbc/LogListernerProvider.java 2009-06-16 17:20:38 UTC (rev 1055)
+++ trunk/embedded/src/main/java/com/metamatrix/jdbc/LogListernerProvider.java 2009-06-16 18:05:22 UTC (rev 1056)
@@ -22,10 +22,12 @@
package com.metamatrix.jdbc;
-import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
+import org.apache.log4j.Logger;
+import org.apache.log4j.Priority;
+
import com.google.inject.Inject;
import com.google.inject.Provider;
import com.google.inject.Singleton;
@@ -33,11 +35,10 @@
import com.metamatrix.common.application.DQPConfigSource;
import com.metamatrix.common.protocol.URLHelper;
import com.metamatrix.core.MetaMatrixRuntimeException;
-import com.metamatrix.core.log.FileLimitSizeLogWriter;
import com.metamatrix.core.log.JavaLogWriter;
import com.metamatrix.core.log.LogListener;
+import com.metamatrix.core.log.MessageLevel;
import com.metamatrix.dqp.embedded.DQPEmbeddedProperties;
-import com.metamatrix.internal.core.log.PlatformLog;
@Singleton
class LogListernerProvider implements Provider<LogListener> {
@@ -66,10 +67,12 @@
modifiedLogFileName = logFile+"_"+instanceId; //$NON-NLS-1$
}
URL logURL = URLHelper.buildURL(dqpURL, modifiedLogFileName);
- File file = new File(logURL.getPath());
- PlatformLog log = new PlatformLog();
- log.addListener(new FileLimitSizeLogWriter(file, false));
- return log;
+
+ // TODO: The Log4j File appender needs to be created with the above name
+ // since we do not have handle on the Log4J configuration we come back to this issue.
+ // until then just manage on the properties file.
+ System.setProperty("dqp.log4jFile", logURL.getPath()); //$NON-NLS-1$ // hack
+ return new Log4jListener();
}
return new JavaLogWriter();
} catch (MalformedURLException e) {
@@ -77,4 +80,36 @@
}
}
+ /**
+ * Log4J Listener
+ */
+ static class Log4jListener implements LogListener{
+
+ @Override
+ public void logMessage(int level, String context, Object msg) {
+ Logger log4j = Logger.getLogger("org.teiid."+context); //$NON-NLS-1$
+ log4j.log(convertLevel(level), msg);
+ }
+
+ @Override
+ public void shutdown() {
+ }
+
+ public Priority convertLevel(int level) {
+ switch (level) {
+ case MessageLevel.CRITICAL:
+ return Priority.FATAL;
+ case MessageLevel.ERROR:
+ return Priority.ERROR;
+ case MessageLevel.WARNING:
+ return Priority.WARN;
+ case MessageLevel.INFO:
+ return Priority.INFO;
+ case MessageLevel.DETAIL:
+ case MessageLevel.TRACE:
+ return Priority.DEBUG;
+ }
+ return Priority.DEBUG;
+ }
+ }
}
Modified: trunk/engine/src/test/java/com/metamatrix/dqp/config/TestDQPLauncher.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/dqp/config/TestDQPLauncher.java 2009-06-16 17:20:38 UTC (rev 1055)
+++ trunk/engine/src/test/java/com/metamatrix/dqp/config/TestDQPLauncher.java 2009-06-16 18:05:22 UTC (rev 1056)
@@ -23,7 +23,6 @@
package com.metamatrix.dqp.config;
import java.util.HashMap;
-import java.util.List;
import java.util.Properties;
import junit.framework.TestCase;
@@ -33,13 +32,11 @@
import com.metamatrix.common.application.ApplicationService;
import com.metamatrix.common.application.DQPConfigSource;
-import com.metamatrix.core.log.LogListener;
import com.metamatrix.dqp.service.AutoGenDataService;
import com.metamatrix.dqp.service.DQPServiceNames;
import com.metamatrix.dqp.service.FakeAbstractService;
import com.metamatrix.dqp.service.FakeBufferService;
import com.metamatrix.dqp.service.FakeMetadataService;
-import com.metamatrix.internal.core.log.PlatformLog;
/**
*/
@@ -66,12 +63,6 @@
DQPCore dqpCore = new DQPCore();
dqpCore.start(configSource);
- PlatformLog log = new PlatformLog();
- List<LogListener> list = log.getLogListeners();
- for(LogListener l: list) {
- log.removeListener(l);
- }
-
DQPCore dqp = new DQPCore();
dqp.start(configSource);
assertNotNull("DQP should not be null", dqp); //$NON-NLS-1$
Modified: trunk/server/src/main/java/com/metamatrix/common/log/DbLogListener.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/common/log/DbLogListener.java 2009-06-16 17:20:38 UTC (rev 1055)
+++ trunk/server/src/main/java/com/metamatrix/common/log/DbLogListener.java 2009-06-16 18:05:22 UTC (rev 1056)
@@ -49,9 +49,9 @@
this.enabled = enable;
}
- public void logMessage(LogMessage msg) {
+ public void logMessage(int level, String context, Object msg) {
if (enabled) {
- writer.logMessage(msg);
+ writer.logMessage(level, context, (LogMessage)msg);
}
}
Modified: trunk/server/src/main/java/com/metamatrix/common/log/DbLogWriter.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/common/log/DbLogWriter.java 2009-06-16 17:20:38 UTC (rev 1055)
+++ trunk/server/src/main/java/com/metamatrix/common/log/DbLogWriter.java 2009-06-16 18:05:22 UTC (rev 1056)
@@ -245,11 +245,11 @@
}
- public synchronized void logMessage(LogMessage msg) {
- write(msg);
+ public synchronized void logMessage(int level, String context,LogMessage msg) {
+ write(level, context, msg);
}
- private void write(LogMessage message) {
+ private void write(int level, String context, LogMessage message) {
// put this in a while to so that as long a
int retrycnt = 0;
if (isLogSuspended && System.currentTimeMillis() > resumeTime) {
@@ -257,7 +257,7 @@
}
while (!isLogSuspended && !shutdown) {
try {
- printMsg(message);
+ printMsg(level, context, message);
return;
} catch (Exception ex) {
@@ -301,12 +301,12 @@
return this.insert;
}
- private void printMsg(LogMessage message) throws SQLException {
+ private void printMsg(int level, String context, LogMessage message) throws SQLException {
if (this.shutdown) {
return;
}
- long msgTimeStamp = message.getTimestamp();
+ long msgTimeStamp = System.currentTimeMillis();
if (lastSequenceStart != msgTimeStamp) {
lastSequenceStart = msgTimeStamp;
sequenceNumber = 0;
@@ -326,10 +326,10 @@
stmt.setShort(2, sequenceNumber);
// Message context column
- stmt.setString(3, StringUtil.truncString(message.getContext(), maxGeneralLength));
+ stmt.setString(3, StringUtil.truncString(context, maxGeneralLength));
// Message type column
- stmt.setInt(4, message.getLevel());
+ stmt.setInt(4, level);
// Message text column
stmt.setString(5, StringUtil.truncString(message.getText(), maxMsgLength));
@@ -341,7 +341,7 @@
stmt.setString(7, StringUtil.truncString(CurrentConfiguration.getInstance().getProcessName(), maxGeneralLength));
// Message thread name column
- stmt.setString(8, StringUtil.truncString(message.getThreadName(), maxGeneralLength));
+ stmt.setString(8, StringUtil.truncString(Thread.currentThread().getName(), maxGeneralLength));
// Exception column
if(message.getException() != null) {
Modified: trunk/server/src/main/java/com/metamatrix/server/FileLogListenerProvider.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/server/FileLogListenerProvider.java 2009-06-16 17:20:38 UTC (rev 1055)
+++ trunk/server/src/main/java/com/metamatrix/server/FileLogListenerProvider.java 2009-06-16 18:05:22 UTC (rev 1056)
@@ -22,20 +22,11 @@
package com.metamatrix.server;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.PrintStream;
-import java.util.Properties;
-
import com.google.inject.Inject;
import com.google.inject.Provider;
import com.google.inject.name.Named;
-import com.metamatrix.common.config.CurrentConfiguration;
-import com.metamatrix.core.MetaMatrixRuntimeException;
-import com.metamatrix.core.log.FileLimitSizeLogWriter;
+import com.metamatrix.core.log.JavaLogWriter;
import com.metamatrix.core.log.LogListener;
-import com.metamatrix.internal.core.log.PlatformLog;
public class FileLogListenerProvider implements Provider<LogListener> {
@@ -49,45 +40,8 @@
@Override
public LogListener get() {
- final PlatformLog log = new PlatformLog();
- try {
- FileLimitSizeLogWriter flw = buildFileLogger();
- log.addListener(flw);
- } catch (FileNotFoundException e) {
- throw new MetaMatrixRuntimeException(e);
- }
- return log;
+ return new JavaLogWriter();
}
- FileLimitSizeLogWriter buildFileLogger() throws FileNotFoundException {
- File tmpFile = new File(path, logFile);
- tmpFile.getParentFile().mkdirs();
-
- // if log file exists then create a archive
- if (tmpFile.exists()) {
- int index = logFile.lastIndexOf("."); //$NON-NLS-1$
- String archiveName = FileLimitSizeLogWriter.buildArchiveFileName(logFile.substring(0, index), logFile.substring(index));
- tmpFile.renameTo(new File(path, archiveName));
- }
-
- FileOutputStream fos = new FileOutputStream(tmpFile);
- PrintStream ps = new PrintStream(fos);
-
- System.setOut(ps);
- System.setErr(ps);
-
- Properties logProps = new Properties();
- Properties configProps = CurrentConfiguration.getInstance().getProperties();
- if (configProps.containsKey(FileLimitSizeLogWriter.FILE_SIZE_LIMIT)) {
- logProps.setProperty(FileLimitSizeLogWriter.FILE_SIZE_LIMIT,configProps.getProperty(FileLimitSizeLogWriter.FILE_SIZE_LIMIT));
- }
- if (configProps.containsKey(FileLimitSizeLogWriter.FILE_SIZE_MONITOR_TIME)) {
- logProps.setProperty(FileLimitSizeLogWriter.FILE_SIZE_MONITOR_TIME,configProps.getProperty(FileLimitSizeLogWriter.FILE_SIZE_MONITOR_TIME));
- }
-
- FileLimitSizeLogWriter flw = new FileLimitSizeLogWriter(tmpFile,logProps, false);
- return flw;
- }
-
}
Modified: trunk/server/src/main/java/com/metamatrix/server/Main.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/server/Main.java 2009-06-16 17:20:38 UTC (rev 1055)
+++ trunk/server/src/main/java/com/metamatrix/server/Main.java 2009-06-16 18:05:22 UTC (rev 1056)
@@ -26,6 +26,7 @@
import java.io.FilenameFilter;
import java.io.IOException;
import java.util.Arrays;
+import java.util.Date;
import com.google.inject.Guice;
import com.google.inject.Inject;
@@ -36,7 +37,6 @@
import com.metamatrix.common.config.api.exceptions.ConfigurationException;
import com.metamatrix.common.messaging.MessageBus;
import com.metamatrix.common.messaging.MessagingException;
-import com.metamatrix.core.log.FileLimitSizeLogWriter;
import com.metamatrix.core.log.LogListener;
import com.metamatrix.core.util.FileUtils;
import com.metamatrix.core.util.StringUtil;
@@ -151,7 +151,7 @@
String configDir = host.getConfigDirectory();
File f = new File(configDir);
f.mkdirs();
- FilePersistentUtil.writeModel(CONFIG_PREFIX+FileLimitSizeLogWriter.getDate()+".xml", configDir, //$NON-NLS-1$
+ FilePersistentUtil.writeModel(CONFIG_PREFIX+new Date().toString()+".xml", configDir, //$NON-NLS-1$
CurrentConfiguration.getInstance().getConfigurationModel(),
processName);
//remove old instances
Modified: trunk/server/src/main/java/com/metamatrix/server/ServerGuiceModule.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/server/ServerGuiceModule.java 2009-06-16 17:20:38 UTC (rev 1055)
+++ trunk/server/src/main/java/com/metamatrix/server/ServerGuiceModule.java 2009-06-16 18:05:22 UTC (rev 1056)
@@ -98,7 +98,7 @@
// Start the log file
bind(LogConfiguration.class).toProvider(LogConfigurationProvider.class).in(Scopes.SINGLETON);
- bind(LogListener.class).toProvider(ServerLogListernerProvider.class).in(Scopes.SINGLETON);
+ bind(LogListener.class).toProvider(FileLogListenerProvider.class).in(Scopes.SINGLETON);
// this needs to be removed.
binder().requestStaticInjection(LogManager.class);
Deleted: trunk/server/src/main/java/com/metamatrix/server/ServerLogListernerProvider.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/server/ServerLogListernerProvider.java 2009-06-16 17:20:38 UTC (rev 1055)
+++ trunk/server/src/main/java/com/metamatrix/server/ServerLogListernerProvider.java 2009-06-16 18:05:22 UTC (rev 1056)
@@ -1,103 +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.server;
-
-import java.io.FileNotFoundException;
-import java.util.EventObject;
-import java.util.Properties;
-
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
-import com.metamatrix.common.config.CurrentConfiguration;
-import com.metamatrix.common.config.api.Configuration;
-import com.metamatrix.common.config.api.exceptions.ConfigurationException;
-import com.metamatrix.common.log.DbLogListener;
-import com.metamatrix.common.log.LogManager;
-import com.metamatrix.common.messaging.MessageBus;
-import com.metamatrix.common.messaging.MessagingException;
-import com.metamatrix.common.util.LogContextsUtil;
-import com.metamatrix.common.util.PropertiesUtils;
-import com.metamatrix.core.MetaMatrixRuntimeException;
-import com.metamatrix.core.event.EventObjectListener;
-import com.metamatrix.core.log.FileLimitSizeLogWriter;
-import com.metamatrix.core.log.LogListener;
-import com.metamatrix.internal.core.log.PlatformLog;
-import com.metamatrix.platform.config.event.ConfigurationChangeEvent;
-
-@Singleton
-class ServerLogListernerProvider extends FileLogListenerProvider {
- public static final String LOG_DB_ENABLED = "metamatrix.log.jdbcDatabase.enabled"; //$NON-NLS-1$
-
- @Inject
- MessageBus messsgeBus;
-
- @Override
- public LogListener get() {
-
- final PlatformLog log = new PlatformLog();
-
- try {
- FileLimitSizeLogWriter flw = buildFileLogger();
- log.addListener(flw);
-
- } catch (FileNotFoundException e) {
- throw new MetaMatrixRuntimeException(e);
- }
-
- final DbLogListener dbLogger = buildDBLogger();
- log.addListener(dbLogger);
-
- try {
-
- this.messsgeBus.addListener(ConfigurationChangeEvent.class, new EventObjectListener() {
-
- public void processEvent(EventObject obj) {
- if(obj instanceof ConfigurationChangeEvent){
- if(obj instanceof ConfigurationChangeEvent){
- try {
- Configuration currentConfig = CurrentConfiguration.getInstance().getConfiguration();
- Properties props = currentConfig.getProperties();
- boolean enabled = PropertiesUtils.getBooleanProperty(props, LOG_DB_ENABLED, true);
- dbLogger.enableDBLogging(enabled);
- } catch( ConfigurationException ce ) {
- LogManager.logError(LogContextsUtil.CommonConstants.CTX_MESSAGE_BUS, ce, ce.getMessage());
- }
- }
- }
- }
- });
-
- } catch (MessagingException e) {
- throw new MetaMatrixRuntimeException(e);
- }
- return log;
- }
-
- private DbLogListener buildDBLogger() {
- Properties currentProps = CurrentConfiguration.getInstance().getProperties();
- Properties resultsProps = PropertiesUtils.clone(currentProps, null, true, false);
- boolean enabled = PropertiesUtils.getBooleanProperty(resultsProps, LOG_DB_ENABLED, true);
- return new DbLogListener(resultsProps, enabled);
- }
-
-}
Deleted: trunk/soap/src/main/java/com/metamatrix/soap/log/MMSOAPLog.java
===================================================================
--- trunk/soap/src/main/java/com/metamatrix/soap/log/MMSOAPLog.java 2009-06-16 17:20:38 UTC (rev 1055)
+++ trunk/soap/src/main/java/com/metamatrix/soap/log/MMSOAPLog.java 2009-06-16 18:05:22 UTC (rev 1056)
@@ -1,50 +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.soap.log;
-
-import com.metamatrix.core.log.LogMessage;
-import com.metamatrix.core.log.Logger;
-import com.metamatrix.internal.core.log.PlatformLog;
-
-/**
- * MMSOAPLog
- */
-public class MMSOAPLog implements Logger
-{
- private String context;
- private PlatformLog log;
-
- public MMSOAPLog(String context, PlatformLog log) {
- this.context = context;
- this.log = log;
- }
-
- public void log(int severity, String message) {
- log.logMessage(new LogMessage(context, severity, new Object[] {message}));
- }
-
- public void log(int severity, Throwable t, String message) {
- log.logMessage(new LogMessage(context, severity, t, new Object[] {message}));
- }
-
-}
Modified: trunk/soap/src/main/java/com/metamatrix/soap/servlet/MMDiscoverWSDLServlet.java
===================================================================
--- trunk/soap/src/main/java/com/metamatrix/soap/servlet/MMDiscoverWSDLServlet.java 2009-06-16 17:20:38 UTC (rev 1055)
+++ trunk/soap/src/main/java/com/metamatrix/soap/servlet/MMDiscoverWSDLServlet.java 2009-06-16 18:05:22 UTC (rev 1056)
@@ -22,26 +22,21 @@
package com.metamatrix.soap.servlet;
-import java.io.File;
-import java.io.IOException;
-import java.util.List;
-
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.List;
-import org.apache.log4j.Logger;
-
-import com.metamatrix.admin.api.exception.AdminException;
-import com.metamatrix.api.exception.security.LogonException;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import com.metamatrix.admin.api.exception.AdminException;
+import com.metamatrix.api.exception.security.LogonException;
import com.metamatrix.common.util.WSDLServletUtil;
-import com.metamatrix.core.log.FileLogWriter;
-import com.metamatrix.core.log.MessageLevel;
-import com.metamatrix.core.util.StringUtil;
-import com.metamatrix.soap.SOAPPlugin;
-import com.metamatrix.soap.object.MMServerInfo;
-import com.metamatrix.soap.util.WebServiceUtil;
+import com.metamatrix.core.util.StringUtil;
+import com.metamatrix.soap.SOAPPlugin;
+import com.metamatrix.soap.object.MMServerInfo;
+import com.metamatrix.soap.util.WebServiceUtil;
/**
* Servlet to retrieve WSDL from a VDB using servlet context values specified in the web.xml.
Modified: trunk/soap/src/main/java/com/metamatrix/soap/servlet/MMGetVDBResourceServlet.java
===================================================================
--- trunk/soap/src/main/java/com/metamatrix/soap/servlet/MMGetVDBResourceServlet.java 2009-06-16 17:20:38 UTC (rev 1055)
+++ trunk/soap/src/main/java/com/metamatrix/soap/servlet/MMGetVDBResourceServlet.java 2009-06-16 18:05:22 UTC (rev 1056)
@@ -22,7 +22,6 @@
package com.metamatrix.soap.servlet;
-import java.io.File;
import java.io.IOException;
import java.io.Reader;
import java.io.StringWriter;
@@ -50,9 +49,6 @@
import com.metamatrix.common.api.MMURL;
import com.metamatrix.common.util.WSDLServletUtil;
import com.metamatrix.core.CoreConstants;
-import com.metamatrix.core.log.FileLogWriter;
-import com.metamatrix.core.log.LogListener;
-import com.metamatrix.core.log.MessageLevel;
import com.metamatrix.core.util.StringUtil;
import com.metamatrix.soap.SOAPPlugin;
import com.metamatrix.soap.util.ErrorMessageKeys;
Modified: trunk/soap/src/main/java/com/metamatrix/soap/servlet/MMGetWSDLServlet.java
===================================================================
--- trunk/soap/src/main/java/com/metamatrix/soap/servlet/MMGetWSDLServlet.java 2009-06-16 17:20:38 UTC (rev 1055)
+++ trunk/soap/src/main/java/com/metamatrix/soap/servlet/MMGetWSDLServlet.java 2009-06-16 18:05:22 UTC (rev 1056)
@@ -22,25 +22,22 @@
package com.metamatrix.soap.servlet;
-import java.io.File;
-import java.io.IOException;
-import java.sql.Connection;
-import java.sql.SQLException;
-
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.sql.Connection;
+import java.sql.SQLException;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
import org.apache.log4j.Logger;
-
+
import com.metamatrix.common.util.WSDLServletUtil;
-import com.metamatrix.core.log.FileLogWriter;
-import com.metamatrix.core.log.MessageLevel;
-import com.metamatrix.core.util.StringUtil;
-import com.metamatrix.soap.SOAPPlugin;
-import com.metamatrix.soap.util.ErrorMessageKeys;
-import com.metamatrix.soap.util.SOAPConstants;
+import com.metamatrix.core.util.StringUtil;
+import com.metamatrix.soap.SOAPPlugin;
+import com.metamatrix.soap.util.ErrorMessageKeys;
+import com.metamatrix.soap.util.SOAPConstants;
import com.metamatrix.soap.util.WebServiceUtil;
/**
Modified: trunk/soap/src/main/java/com/metamatrix/soap/servlet/WSDLURLGenerator.java
===================================================================
--- trunk/soap/src/main/java/com/metamatrix/soap/servlet/WSDLURLGenerator.java 2009-06-16 17:20:38 UTC (rev 1055)
+++ trunk/soap/src/main/java/com/metamatrix/soap/servlet/WSDLURLGenerator.java 2009-06-16 18:05:22 UTC (rev 1056)
@@ -22,34 +22,30 @@
package com.metamatrix.soap.servlet;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.net.HttpURLConnection;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLEncoder;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.StringTokenizer;
-
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLEncoder;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.StringTokenizer;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
import org.apache.log4j.Logger;
-
+
import com.metamatrix.common.util.WSDLServletUtil;
-import com.metamatrix.core.log.FileLogWriter;
-import com.metamatrix.core.log.LogListener;
-import com.metamatrix.core.log.MessageLevel;
-import com.metamatrix.soap.SOAPPlugin;
-import com.metamatrix.soap.util.ErrorMessageKeys;
-import com.metamatrix.soap.util.SOAPConstants;
+import com.metamatrix.soap.SOAPPlugin;
+import com.metamatrix.soap.util.ErrorMessageKeys;
+import com.metamatrix.soap.util.SOAPConstants;
/**
* Servlet to build the WSDL URL for the specified VDB
Modified: trunk/soap/src/main/java/com/metamatrix/soap/sqlquerywebservice/log/LogUtil.java
===================================================================
--- trunk/soap/src/main/java/com/metamatrix/soap/sqlquerywebservice/log/LogUtil.java 2009-06-16 17:20:38 UTC (rev 1055)
+++ trunk/soap/src/main/java/com/metamatrix/soap/sqlquerywebservice/log/LogUtil.java 2009-06-16 18:05:22 UTC (rev 1056)
@@ -22,8 +22,9 @@
package com.metamatrix.soap.sqlquerywebservice.log;
+import com.metamatrix.core.log.JavaLogWriter;
+import com.metamatrix.core.log.LogListener;
import com.metamatrix.core.log.LogMessage;
-import com.metamatrix.internal.core.log.PlatformLog;
import com.metamatrix.soap.SOAPPlugin;
/**
@@ -34,22 +35,14 @@
// =========================================================================
// Static Members
// =========================================================================
- private static final LogUtil INSTANCE = new LogUtil();
+ private static final LogListener log = new JavaLogWriter();
- PlatformLog log = new PlatformLog("MetaMatrix SOAP log"); //$NON-NLS-1$
-
- /**
- * Get an instance of this class.
- */
- public static LogUtil getInstance() {
- return INSTANCE;
- }
public static void log(int severity, String message) {
- INSTANCE.log.logMessage(new LogMessage(SOAPPlugin.PLUGIN_ID, severity, new Object[] {message}));
+ log.logMessage(severity, SOAPPlugin.PLUGIN_ID, new LogMessage(null, new Object[] {message}));
}
public static void log(int severity, Throwable t, String message) {
- INSTANCE.log.logMessage(new LogMessage(SOAPPlugin.PLUGIN_ID, severity, t, new Object[] {message}));
+ log.logMessage(severity, SOAPPlugin.PLUGIN_ID, new LogMessage( t, new Object[] {message}));
}
}
15 years, 9 months
teiid SVN: r1055 - in trunk/engine/src: main/java/com/metamatrix/query/function and 3 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2009-06-16 13:20:38 -0400 (Tue, 16 Jun 2009)
New Revision: 1055
Modified:
trunk/engine/src/main/java/com/metamatrix/query/eval/Evaluator.java
trunk/engine/src/main/java/com/metamatrix/query/function/FunctionMethods.java
trunk/engine/src/main/java/com/metamatrix/query/function/source/SystemSource.java
trunk/engine/src/test/java/com/metamatrix/query/function/TestFunctionLibrary.java
trunk/engine/src/test/java/com/metamatrix/query/processor/eval/TestCriteriaEvaluator.java
Log:
TEIID-670 TEIID-671 changed the equality logic to check for compareTo == 0, which ignores precision for bigdecimals. also added bigdecimal function forms to system source for mod, atan2, and all of the "double" functions.
Modified: trunk/engine/src/main/java/com/metamatrix/query/eval/Evaluator.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/eval/Evaluator.java 2009-06-16 15:31:54 UTC (rev 1054)
+++ trunk/engine/src/main/java/com/metamatrix/query/eval/Evaluator.java 2009-06-16 17:20:38 UTC (rev 1055)
@@ -207,9 +207,9 @@
// Compare two non-null values using specified operator
switch(criteria.getOperator()) {
case CompareCriteria.EQ:
- return Boolean.valueOf(leftValue.equals(rightValue));
+ return Boolean.valueOf(compareValues(leftValue, rightValue) == 0);
case CompareCriteria.NE:
- return Boolean.valueOf(! leftValue.equals(rightValue));
+ return Boolean.valueOf(compareValues(leftValue, rightValue) != 0);
case CompareCriteria.LT:
return Boolean.valueOf((compareValues(leftValue, rightValue) < 0));
case CompareCriteria.LE:
Modified: trunk/engine/src/main/java/com/metamatrix/query/function/FunctionMethods.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/function/FunctionMethods.java 2009-06-16 15:31:54 UTC (rev 1054)
+++ trunk/engine/src/main/java/com/metamatrix/query/function/FunctionMethods.java 2009-06-16 17:20:38 UTC (rev 1055)
@@ -197,34 +197,34 @@
// ================== Function = ceiling =====================
- public static Object ceiling(Double x) {
- return new Double(Math.ceil(x));
+ public static Object ceiling(Number x) {
+ return new Double(Math.ceil(x.doubleValue()));
}
// ================== Function = exp =====================
- public static Object exp(Double x) {
- return new Double(Math.exp(x));
+ public static Object exp(Number x) {
+ return new Double(Math.exp(x.doubleValue()));
}
// ================== Function = floor =====================
- public static Object floor(Double x) {
+ public static Object floor(Number x) {
return new Double(Math.floor(x.doubleValue()));
}
// ================== Function = log =====================
- public static Object log(Double x) {
- return new Double(Math.log(x));
+ public static Object log(Number x) {
+ return new Double(Math.log(x.doubleValue()));
}
// ================== Function = log10 =====================
private static final double log10baseE = Math.log(10);
- public static Object log10(Double x) {
- return new Double( Math.log(x) / log10baseE);
+ public static Object log10(Number x) {
+ return new Double( Math.log(x.doubleValue()) / log10baseE);
}
// ================== Function = rand=====================
@@ -272,6 +272,10 @@
if(y instanceof BigInteger) {
return ((BigInteger)x).mod((BigInteger) y);
}
+ } else if(x instanceof BigDecimal) {
+ if(y instanceof BigDecimal) {
+ return ((BigDecimal)x).remainder((BigDecimal) y);
+ }
}
throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0007, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0007, new Object[]{"mod", x.getClass().getName(), y.getClass().getName()})); //$NON-NLS-1$
@@ -1263,37 +1267,37 @@
}
// ================== Function - ACOS =====================
- public static Object acos(Double number) {
+ public static Object acos(Number number) {
return new Double(Math.acos(number.doubleValue()));
}
// ================== Function - ASIN =====================
- public static Object asin(Double number) {
+ public static Object asin(Number number) {
return new Double(Math.asin(number.doubleValue()));
}
// ================== Function - ATAN =====================
- public static Object atan(Double number) {
+ public static Object atan(Number number) {
return new Double(Math.atan(number.doubleValue()));
}
// ================== Function - ATAN2 =====================
- public static Object atan2(Double number1, Double number2) {
+ public static Object atan2(Number number1, Number number2) {
return new Double(Math.atan2(number1.doubleValue(), number2.doubleValue()));
}
// ================== Function - COS =====================
- public static Object cos(Double number) {
+ public static Object cos(Number number) {
return new Double(Math.cos(number.doubleValue()));
}
// ================== Function - COT =====================
- public static Object cot(Double number) {
+ public static Object cot(Number number) {
return new Double(1/Math.tan(number.doubleValue()));
}
// ================== Function - DEGREES =====================
- public static Object degrees(Double number) {
+ public static Object degrees(Number number) {
return new Double(Math.toDegrees(number.doubleValue()));
}
@@ -1303,17 +1307,17 @@
}
// ================== Function - RADIANS =====================
- public static Object radians(Double number) {
+ public static Object radians(Number number) {
return new Double(Math.toRadians(number.doubleValue()));
}
// ================== Function - SIN =====================
- public static Object sin(Double number) {
+ public static Object sin(Number number) {
return new Double(Math.sin(number.doubleValue()));
}
// ================== Function - TAN =====================
- public static Object tan(Double number) {
+ public static Object tan(Number number) {
return new Double(Math.tan(number.doubleValue()));
}
Modified: trunk/engine/src/main/java/com/metamatrix/query/function/source/SystemSource.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/function/source/SystemSource.java 2009-06-16 15:31:54 UTC (rev 1054)
+++ trunk/engine/src/main/java/com/metamatrix/query/function/source/SystemSource.java 2009-06-16 17:20:38 UTC (rev 1055)
@@ -62,11 +62,11 @@
addArithmeticFunction(SourceSystemFunctions.SUBTRACT_OP, QueryPlugin.Util.getString("SystemSource.Subtract_desc"), "minus", QueryPlugin.Util.getString("SystemSource.Subtract_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
addArithmeticFunction(SourceSystemFunctions.MULTIPLY_OP, QueryPlugin.Util.getString("SystemSource.Multiply_desc"), "multiply", QueryPlugin.Util.getString("SystemSource.Multiply_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
addArithmeticFunction(SourceSystemFunctions.DIVIDE_OP, QueryPlugin.Util.getString("SystemSource.Divide_desc"), "divide", QueryPlugin.Util.getString("SystemSource.Divide_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ addArithmeticFunction(SourceSystemFunctions.MOD, QueryPlugin.Util.getString("SystemSource.Mod_desc"), "mod", QueryPlugin.Util.getString("SystemSource.Mod_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
// numeric
addAbsFunction();
addRandFunction();
- addModFunction();
addPowerFunction();
addRoundFunction();
addSignFunction();
@@ -266,6 +266,11 @@
new FunctionParameter[] {
new FunctionParameter("number", DataTypeManager.DefaultDataTypes.DOUBLE, QueryPlugin.Util.getString("SystemSource.Double_arg2")) }, //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("result", DataTypeManager.DefaultDataTypes.DOUBLE, description) ) ); //$NON-NLS-1$
+ functions.add(
+ new FunctionMethod(name, description, NUMERIC, FUNCTION_CLASS, name,
+ new FunctionParameter[] {
+ new FunctionParameter("number", DataTypeManager.DefaultDataTypes.BIG_DECIMAL, QueryPlugin.Util.getString("SystemSource.Double_arg2")) }, //$NON-NLS-1$ //$NON-NLS-2$
+ new FunctionParameter("result", DataTypeManager.DefaultDataTypes.DOUBLE, description) ) ); //$NON-NLS-1$
}
private void addAtan2Function(String name, String description) {
@@ -275,6 +280,12 @@
new FunctionParameter("number1", DataTypeManager.DefaultDataTypes.DOUBLE, QueryPlugin.Util.getString("SystemSource.Atan_arg1")), //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("number2", DataTypeManager.DefaultDataTypes.DOUBLE, QueryPlugin.Util.getString("SystemSource.Atan_arg2")) }, //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("result", DataTypeManager.DefaultDataTypes.DOUBLE, description) ) ); //$NON-NLS-1$
+ functions.add(
+ new FunctionMethod(name, description, NUMERIC, FUNCTION_CLASS, name,
+ new FunctionParameter[] {
+ new FunctionParameter("number1", DataTypeManager.DefaultDataTypes.BIG_DECIMAL, QueryPlugin.Util.getString("SystemSource.Atan_arg1")), //$NON-NLS-1$ //$NON-NLS-2$
+ new FunctionParameter("number2", DataTypeManager.DefaultDataTypes.BIG_DECIMAL, QueryPlugin.Util.getString("SystemSource.Atan_arg2")) }, //$NON-NLS-1$ //$NON-NLS-2$
+ new FunctionParameter("result", DataTypeManager.DefaultDataTypes.DOUBLE, description) ) ); //$NON-NLS-1$
}
private void addPiFunction(String name, String description) {
@@ -284,14 +295,6 @@
new FunctionParameter("result", DataTypeManager.DefaultDataTypes.DOUBLE, description) ) ); //$NON-NLS-1$
}
- private void addModFunction() {
- addTypedArithmeticFunction(SourceSystemFunctions.MOD, QueryPlugin.Util.getString("SystemSource.Mod_desc"), "mod", QueryPlugin.Util.getString("SystemSource.Mod_result_desc"), DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- addTypedArithmeticFunction(SourceSystemFunctions.MOD, QueryPlugin.Util.getString("SystemSource.Mod_desc"), "mod", QueryPlugin.Util.getString("SystemSource.Mod_result_desc"), DataTypeManager.DefaultDataTypes.LONG); //$NON-NLS-1$ //$NON-NLS-3$ //$NON-NLS-2$
- addTypedArithmeticFunction(SourceSystemFunctions.MOD, QueryPlugin.Util.getString("SystemSource.Mod_desc"), "mod", QueryPlugin.Util.getString("SystemSource.Mod_result_desc"), DataTypeManager.DefaultDataTypes.FLOAT); //$NON-NLS-1$ //$NON-NLS-3$ //$NON-NLS-2$
- addTypedArithmeticFunction(SourceSystemFunctions.MOD, QueryPlugin.Util.getString("SystemSource.Mod_desc"), "mod", QueryPlugin.Util.getString("SystemSource.Mod_result_desc"), DataTypeManager.DefaultDataTypes.DOUBLE); //$NON-NLS-1$ //$NON-NLS-3$ //$NON-NLS-2$
- addTypedArithmeticFunction(SourceSystemFunctions.MOD, QueryPlugin.Util.getString("SystemSource.Mod_desc"), "mod", QueryPlugin.Util.getString("SystemSource.Mod_result_desc"), DataTypeManager.DefaultDataTypes.BIG_INTEGER); //$NON-NLS-1$ //$NON-NLS-3$ //$NON-NLS-2$
- }
-
private void addPowerFunction() {
addTypedPowerFunction(DataTypeManager.DefaultDataTypes.DOUBLE, DataTypeManager.DefaultDataTypes.DOUBLE);
addTypedPowerFunction(DataTypeManager.DefaultDataTypes.BIG_INTEGER, DataTypeManager.DefaultDataTypes.INTEGER);
@@ -342,6 +345,7 @@
private void addSqrtFunction() {
addTypedSqrtFunction(DataTypeManager.DefaultDataTypes.LONG);
addTypedSqrtFunction(DataTypeManager.DefaultDataTypes.DOUBLE);
+ addTypedSqrtFunction(DataTypeManager.DefaultDataTypes.BIG_DECIMAL);
}
private void addTypedSqrtFunction(String type) {
Modified: trunk/engine/src/test/java/com/metamatrix/query/function/TestFunctionLibrary.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/query/function/TestFunctionLibrary.java 2009-06-16 15:31:54 UTC (rev 1054)
+++ trunk/engine/src/test/java/com/metamatrix/query/function/TestFunctionLibrary.java 2009-06-16 17:20:38 UTC (rev 1055)
@@ -633,6 +633,10 @@
@Test public void testInvokeDivide6() {
helpInvokeMethod("/", new Object[] { new BigDecimal("3"), new BigDecimal("2") }, new BigDecimal("2")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
+
+ @Test public void testInvokeDivideMod() {
+ helpInvokeMethod("mod", new Object[] { new BigDecimal("3.1"), new BigDecimal("2") }, new BigDecimal("1.1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ }
@Test public void testInvokeAbs1() {
helpInvokeMethod("abs", new Object[] { new Integer(-3) }, new Integer(3)); //$NON-NLS-1$
@@ -674,6 +678,14 @@
helpInvokeMethod("atan2", new Object[] { new Double(0.05), new Double(0.07) }, new Double(0.6202494859828215)); //$NON-NLS-1$
}
+ @Test public void testInvokeAtanBigDecimal() {
+ helpInvokeMethod("atan", new Object[] { new BigDecimal(0.05) }, new Double(0.049958395721942765)); //$NON-NLS-1$
+ }
+
+ @Test public void testInvokeAtan2BigDecimal() {
+ helpInvokeMethod("atan2", new Object[] { new BigDecimal(0.05), new BigDecimal(0.07) }, new Double(0.6202494859828215)); //$NON-NLS-1$
+ }
+
@Test public void testInvokeCos() {
helpInvokeMethod("cos", new Object[] { new Double(1.57) }, new Double(7.963267107332633E-4)); //$NON-NLS-1$
}
Modified: trunk/engine/src/test/java/com/metamatrix/query/processor/eval/TestCriteriaEvaluator.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/query/processor/eval/TestCriteriaEvaluator.java 2009-06-16 15:31:54 UTC (rev 1054)
+++ trunk/engine/src/test/java/com/metamatrix/query/processor/eval/TestCriteriaEvaluator.java 2009-06-16 17:20:38 UTC (rev 1055)
@@ -22,6 +22,9 @@
package com.metamatrix.query.processor.eval;
+import static org.junit.Assert.*;
+
+import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@@ -30,7 +33,7 @@
import java.util.List;
import java.util.Map;
-import junit.framework.TestCase;
+import org.junit.Test;
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
@@ -38,6 +41,7 @@
import com.metamatrix.common.buffer.BlockedException;
import com.metamatrix.query.eval.Evaluator;
import com.metamatrix.query.sql.lang.CollectionValueIterator;
+import com.metamatrix.query.sql.lang.CompareCriteria;
import com.metamatrix.query.sql.lang.Criteria;
import com.metamatrix.query.sql.lang.ExistsCriteria;
import com.metamatrix.query.sql.lang.IsNullCriteria;
@@ -51,14 +55,8 @@
import com.metamatrix.query.sql.util.ValueIterator;
import com.metamatrix.query.util.CommandContext;
-public class TestCriteriaEvaluator extends TestCase {
+public class TestCriteriaEvaluator {
- // ################################## FRAMEWORK ################################
-
- public TestCriteriaEvaluator(String name) {
- super(name);
- }
-
// ################################## TEST HELPERS ################################
private void helpTestMatch(String value, String pattern, char escape, boolean negated, boolean expectedMatch) throws CriteriaEvaluationException, BlockedException, MetaMatrixComponentException {
@@ -122,218 +120,218 @@
// ################################## ACTUAL TESTS ################################
- public void testIsNull1() throws Exception {
+ @Test public void testIsNull1() throws Exception {
helpTestIsNull(null, false, true);
}
- public void testIsNull2() throws Exception {
+ @Test public void testIsNull2() throws Exception {
helpTestIsNull(null, true, false);
}
- public void testIsNull3() throws Exception {
+ @Test public void testIsNull3() throws Exception {
helpTestIsNull("x", false, false); //$NON-NLS-1$
}
- public void testIsNull4() throws Exception {
+ @Test public void testIsNull4() throws Exception {
helpTestIsNull("x", true, true); //$NON-NLS-1$
}
- public void testMatch1() throws Exception {
+ @Test public void testMatch1() throws Exception {
helpTestMatch("", "", MatchCriteria.NULL_ESCAPE_CHAR, true); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testMatch2() throws Exception {
+ @Test public void testMatch2() throws Exception {
helpTestMatch("x", "", MatchCriteria.NULL_ESCAPE_CHAR, false); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testMatch3() throws Exception {
+ @Test public void testMatch3() throws Exception {
helpTestMatch("", "%", MatchCriteria.NULL_ESCAPE_CHAR, true); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testMatch4() throws Exception {
+ @Test public void testMatch4() throws Exception {
helpTestMatch("x", "%", MatchCriteria.NULL_ESCAPE_CHAR, true); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testMatch5() throws Exception {
+ @Test public void testMatch5() throws Exception {
helpTestMatch("xx", "%", MatchCriteria.NULL_ESCAPE_CHAR, true); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testMatch6() throws Exception {
+ @Test public void testMatch6() throws Exception {
helpTestMatch("xx", "%", MatchCriteria.NULL_ESCAPE_CHAR, true); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testMatch7() throws Exception {
+ @Test public void testMatch7() throws Exception {
helpTestMatch("a", "a%", MatchCriteria.NULL_ESCAPE_CHAR, true); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testMatch8() throws Exception {
+ @Test public void testMatch8() throws Exception {
helpTestMatch("ab", "a%", MatchCriteria.NULL_ESCAPE_CHAR, true); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testMatch9() throws Exception {
+ @Test public void testMatch9() throws Exception {
helpTestMatch("a.", "a%", MatchCriteria.NULL_ESCAPE_CHAR, true); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testMatch10() throws Exception {
+ @Test public void testMatch10() throws Exception {
helpTestMatch("a.", "a%", MatchCriteria.NULL_ESCAPE_CHAR, true); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testMatch11() throws Exception {
+ @Test public void testMatch11() throws Exception {
helpTestMatch("ax.", "a%", MatchCriteria.NULL_ESCAPE_CHAR, true); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testMatch12() throws Exception {
+ @Test public void testMatch12() throws Exception {
helpTestMatch("a..", "a%", MatchCriteria.NULL_ESCAPE_CHAR, true); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testMatch13() throws Exception {
+ @Test public void testMatch13() throws Exception {
// helpTestMatch("x.y", "%.", MatchCriteria.NULL_ESCAPE_CHAR, false);
helpTestMatch("a.b", "a%.", MatchCriteria.NULL_ESCAPE_CHAR, false); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testMatch14() throws Exception {
+ @Test public void testMatch14() throws Exception {
helpTestMatch("aaa", "%aaa", MatchCriteria.NULL_ESCAPE_CHAR, true); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testMatch15() throws Exception {
+ @Test public void testMatch15() throws Exception {
helpTestMatch("baaa", "%aaa", MatchCriteria.NULL_ESCAPE_CHAR, true); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testMatch16() throws Exception {
+ @Test public void testMatch16() throws Exception {
helpTestMatch("aaaa", "%aaa", MatchCriteria.NULL_ESCAPE_CHAR, true); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testMatch17() throws Exception {
+ @Test public void testMatch17() throws Exception {
helpTestMatch("aaxaa", "%aaa", MatchCriteria.NULL_ESCAPE_CHAR, false); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testMatch18() throws Exception {
+ @Test public void testMatch18() throws Exception {
helpTestMatch("", "a%b%", MatchCriteria.NULL_ESCAPE_CHAR, false); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testMatch19() throws Exception {
+ @Test public void testMatch19() throws Exception {
helpTestMatch("a", "a%b%", MatchCriteria.NULL_ESCAPE_CHAR, false); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testMatch20() throws Exception {
+ @Test public void testMatch20() throws Exception {
helpTestMatch("ab", "a%b%", MatchCriteria.NULL_ESCAPE_CHAR, true); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testMatch21() throws Exception {
+ @Test public void testMatch21() throws Exception {
helpTestMatch("axb", "a%b%", MatchCriteria.NULL_ESCAPE_CHAR, true); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testMatch22() throws Exception {
+ @Test public void testMatch22() throws Exception {
helpTestMatch("abx", "a%b%", MatchCriteria.NULL_ESCAPE_CHAR, true); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testMatch23() throws Exception {
+ @Test public void testMatch23() throws Exception {
helpTestMatch("", "X%", 'X', false); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testMatch24() throws Exception {
+ @Test public void testMatch24() throws Exception {
helpTestMatch("x", "X%", 'X', false); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testMatch25() throws Exception {
+ @Test public void testMatch25() throws Exception {
helpTestMatch("xx", "X%", 'X', false); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testMatch26() throws Exception {
+ @Test public void testMatch26() throws Exception {
helpTestMatch("a%", "aX%", 'X', true); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testMatch27() throws Exception {
+ @Test public void testMatch27() throws Exception {
helpTestMatch("aX%", "aX%", 'X', false); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testMatch28() throws Exception {
+ @Test public void testMatch28() throws Exception {
helpTestMatch("a%bb", "aX%b%", 'X', true); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testMatch29() throws Exception {
+ @Test public void testMatch29() throws Exception {
helpTestMatch("aX%bb", "aX%b%", 'X', false); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testMatch30() throws Exception {
+ @Test public void testMatch30() throws Exception {
helpTestMatch("", "_", MatchCriteria.NULL_ESCAPE_CHAR, false); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testMatch31() throws Exception {
+ @Test public void testMatch31() throws Exception {
helpTestMatch("X", "_", MatchCriteria.NULL_ESCAPE_CHAR, true); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testMatch32() throws Exception {
+ @Test public void testMatch32() throws Exception {
helpTestMatch("XX", "_", MatchCriteria.NULL_ESCAPE_CHAR, false); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testMatch33() throws Exception {
+ @Test public void testMatch33() throws Exception {
helpTestMatch("", "__", MatchCriteria.NULL_ESCAPE_CHAR, false); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testMatch34() throws Exception {
+ @Test public void testMatch34() throws Exception {
helpTestMatch("X", "__", MatchCriteria.NULL_ESCAPE_CHAR, false); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testMatch35() throws Exception {
+ @Test public void testMatch35() throws Exception {
helpTestMatch("XX", "__", MatchCriteria.NULL_ESCAPE_CHAR, true); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testMatch36() throws Exception {
+ @Test public void testMatch36() throws Exception {
helpTestMatch("XX", "_%_", MatchCriteria.NULL_ESCAPE_CHAR, true); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testMatch37() throws Exception {
+ @Test public void testMatch37() throws Exception {
helpTestMatch("XaaY", "_%_", MatchCriteria.NULL_ESCAPE_CHAR, true); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testMatch38() throws Exception {
+ @Test public void testMatch38() throws Exception {
helpTestMatch("a.b.c", "a.b.c", MatchCriteria.NULL_ESCAPE_CHAR, true); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testMatch39() throws Exception {
+ @Test public void testMatch39() throws Exception {
helpTestMatch("a.b.c", "a%.c", MatchCriteria.NULL_ESCAPE_CHAR, true); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testMatch40() throws Exception {
+ @Test public void testMatch40() throws Exception {
helpTestMatch("a.b.", "a.b.", MatchCriteria.NULL_ESCAPE_CHAR, true); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testMatch41() throws Exception {
+ @Test public void testMatch41() throws Exception {
helpTestMatch("asjdfajsdf (&). asdfasdf\nkjhkjh", "%&%", MatchCriteria.NULL_ESCAPE_CHAR, true); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testMatch42() throws Exception {
+ @Test public void testMatch42() throws Exception {
helpTestMatch("x", "", MatchCriteria.NULL_ESCAPE_CHAR, true, true); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testMatch43() throws Exception {
+ @Test public void testMatch43() throws Exception {
helpTestMatch("a.b.", "a.b.", MatchCriteria.NULL_ESCAPE_CHAR, true, false); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testMatch44() throws Exception {
+ @Test public void testMatch44() throws Exception {
helpTestMatch(null, "a.b.", MatchCriteria.NULL_ESCAPE_CHAR, false); //$NON-NLS-1$
}
- public void testMatch45() throws Exception {
+ @Test public void testMatch45() throws Exception {
helpTestMatch("a.b.", null, MatchCriteria.NULL_ESCAPE_CHAR, false); //$NON-NLS-1$
}
- public void testMatch46() throws Exception {
+ @Test public void testMatch46() throws Exception {
helpTestMatch("ab\r\n", "ab%", MatchCriteria.NULL_ESCAPE_CHAR, true); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testMatch47() throws Exception {
+ @Test public void testMatch47() throws Exception {
helpTestMatch("", "", 'a', true); //$NON-NLS-1$ //$NON-NLS-2$
}
//should succeed - should be able to escape the escape char
- public void testMatch48() throws Exception {
+ @Test public void testMatch48() throws Exception {
helpTestMatch("abc", "aa%", 'a', true); //$NON-NLS-1$ //$NON-NLS-2$
}
//should fail - invalid match sequence
- public void testMatch49() throws Exception {
+ @Test public void testMatch49() throws Exception {
try {
helpTestMatch("abc", "a", 'a', true); //$NON-NLS-1$ //$NON-NLS-2$
} catch (CriteriaEvaluationException cee) {
@@ -342,7 +340,7 @@
}
//should fail - can't escape a non match char
- public void testMatch50() throws Exception {
+ @Test public void testMatch50() throws Exception {
try {
helpTestMatch("abc", "ab", 'a', true); //$NON-NLS-1$ //$NON-NLS-2$
} catch (CriteriaEvaluationException cee) {
@@ -351,43 +349,43 @@
}
//should be able to use a regex reserved char as the escape char
- public void testMatch51() throws Exception {
+ @Test public void testMatch51() throws Exception {
helpTestMatch("$", "$$", '$', true); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testMatch52() throws Exception {
+ @Test public void testMatch52() throws Exception {
helpTestMatch("abc\nde", "a%e", MatchCriteria.NULL_ESCAPE_CHAR, true); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testMatch53() throws Exception {
+ @Test public void testMatch53() throws Exception {
helpTestMatch("\\", "\\%", MatchCriteria.NULL_ESCAPE_CHAR, true); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testSetCriteria1() throws Exception {
+ @Test public void testSetCriteria1() throws Exception {
helpTestSetCriteria(1000, false, true);
}
- public void testSetCriteria2() throws Exception {
+ @Test public void testSetCriteria2() throws Exception {
helpTestSetCriteria(1, false, false);
}
- public void testSetCriteria3() throws Exception {
+ @Test public void testSetCriteria3() throws Exception {
helpTestSetCriteria(1000, true, false);
}
- public void testSetCriteria4() throws Exception {
+ @Test public void testSetCriteria4() throws Exception {
helpTestSetCriteria(1, true, true);
}
- public void testSetCriteria5() throws Exception {
+ @Test public void testSetCriteria5() throws Exception {
helpTestSetCriteria(null, true, false);
}
- public void testSetCriteria6() throws Exception {
+ @Test public void testSetCriteria6() throws Exception {
helpTestSetCriteria(null, false, false);
}
- public void testExistsCriteria() throws Exception {
+ @Test public void testExistsCriteria() throws Exception {
ExistsCriteria crit = new ExistsCriteria(new Query());
ArrayList values = new ArrayList();
values.add("a"); //$NON-NLS-1$
@@ -396,7 +394,7 @@
helpTestCompareSubqueryCriteria(crit, true, values);
}
- public void testExistsCriteria2() throws Exception {
+ @Test public void testExistsCriteria2() throws Exception {
ExistsCriteria crit = new ExistsCriteria(new Query());
helpTestCompareSubqueryCriteria(crit, false, Collections.emptyList());
}
@@ -405,7 +403,7 @@
* If rows are returned but they contain null, the result should
* still be true.
*/
- public void testExistsCriteria3() throws Exception {
+ @Test public void testExistsCriteria3() throws Exception {
ExistsCriteria crit = new ExistsCriteria(new Query());
ArrayList values = new ArrayList();
values.add(null);
@@ -418,7 +416,7 @@
* Special case: if ALL is specified and the subquery returns no rows,
* the result is true.
*/
- public void testCompareSubqueryCriteriaNoRows() throws Exception {
+ @Test public void testCompareSubqueryCriteriaNoRows() throws Exception {
SubqueryCompareCriteria crit = helpGetCompareSubqueryCriteria(SubqueryCompareCriteria.EQ, SubqueryCompareCriteria.ALL);
helpTestCompareSubqueryCriteria(crit, true, Collections.emptyList());
}
@@ -427,7 +425,7 @@
* Special case: if ANY/SOME is specified and the subquery returns no rows,
* the result is false.
*/
- public void testCompareSubqueryCriteriaNoRows2() throws Exception {
+ @Test public void testCompareSubqueryCriteriaNoRows2() throws Exception {
SubqueryCompareCriteria crit = helpGetCompareSubqueryCriteria(SubqueryCompareCriteria.EQ, SubqueryCompareCriteria.SOME);
helpTestCompareSubqueryCriteria(crit, false, Collections.emptyList());
}
@@ -436,12 +434,12 @@
* Special case: if no predicate quantifier is specified and the subquery returns no rows,
* the result is false.
*/
- public void testCompareSubqueryCriteriaNoRows3() throws Exception {
+ @Test public void testCompareSubqueryCriteriaNoRows3() throws Exception {
SubqueryCompareCriteria crit = helpGetCompareSubqueryCriteria(SubqueryCompareCriteria.EQ, SubqueryCompareCriteria.NO_QUANTIFIER);
helpTestCompareSubqueryCriteria(crit, false, Collections.emptyList());
}
- public void testCompareSubqueryCriteria2() throws Exception {
+ @Test public void testCompareSubqueryCriteria2() throws Exception {
SubqueryCompareCriteria crit = helpGetCompareSubqueryCriteria(SubqueryCompareCriteria.EQ, SubqueryCompareCriteria.ALL);
ArrayList values = new ArrayList();
values.add("a"); //$NON-NLS-1$
@@ -450,7 +448,7 @@
helpTestCompareSubqueryCriteria(crit, false, values);
}
- public void testCompareSubqueryCriteria3() throws Exception {
+ @Test public void testCompareSubqueryCriteria3() throws Exception {
SubqueryCompareCriteria crit = helpGetCompareSubqueryCriteria(SubqueryCompareCriteria.EQ, SubqueryCompareCriteria.SOME);
ArrayList values = new ArrayList();
values.add("a"); //$NON-NLS-1$
@@ -459,7 +457,7 @@
helpTestCompareSubqueryCriteria(crit, true, values);
}
- public void testCompareSubqueryCriteria4() throws Exception {
+ @Test public void testCompareSubqueryCriteria4() throws Exception {
SubqueryCompareCriteria crit = helpGetCompareSubqueryCriteria(SubqueryCompareCriteria.EQ, SubqueryCompareCriteria.SOME);
ArrayList values = new ArrayList();
values.add("b"); //$NON-NLS-1$
@@ -467,7 +465,7 @@
helpTestCompareSubqueryCriteria(crit, false, values);
}
- public void testCompareSubqueryCriteria5() throws Exception {
+ @Test public void testCompareSubqueryCriteria5() throws Exception {
SubqueryCompareCriteria crit = helpGetCompareSubqueryCriteria(SubqueryCompareCriteria.EQ, SubqueryCompareCriteria.SOME);
ArrayList values = new ArrayList();
values.add("a"); //$NON-NLS-1$
@@ -476,14 +474,14 @@
helpTestCompareSubqueryCriteria(crit, true, values);
}
- public void testCompareSubqueryCriteria6() throws Exception {
+ @Test public void testCompareSubqueryCriteria6() throws Exception {
SubqueryCompareCriteria crit = helpGetCompareSubqueryCriteria(SubqueryCompareCriteria.EQ, SubqueryCompareCriteria.NO_QUANTIFIER);
ArrayList values = new ArrayList();
values.add("a"); //$NON-NLS-1$
helpTestCompareSubqueryCriteria(crit, true, values);
}
- public void testCompareSubqueryCriteria7() throws Exception {
+ @Test public void testCompareSubqueryCriteria7() throws Exception {
SubqueryCompareCriteria crit = helpGetCompareSubqueryCriteria(SubqueryCompareCriteria.EQ, SubqueryCompareCriteria.NO_QUANTIFIER);
ArrayList values = new ArrayList();
values.add("b"); //$NON-NLS-1$
@@ -496,7 +494,7 @@
* have a predicate quantifier, but there is more than one value in the
* ValueIterator
*/
- public void testCompareSubqueryCriteriaFails1() throws Exception {
+ @Test public void testCompareSubqueryCriteriaFails1() throws Exception {
SubqueryCompareCriteria crit = helpGetCompareSubqueryCriteria(SubqueryCompareCriteria.EQ, SubqueryCompareCriteria.NO_QUANTIFIER);
ArrayList values = new ArrayList();
values.add("a"); //$NON-NLS-1$
@@ -509,14 +507,14 @@
}
}
- public void testCompareSubqueryCriteriaNulls2() throws Exception {
+ @Test public void testCompareSubqueryCriteriaNulls2() throws Exception {
SubqueryCompareCriteria crit = helpGetCompareSubqueryCriteria(SubqueryCompareCriteria.EQ, SubqueryCompareCriteria.NO_QUANTIFIER);
ArrayList values = new ArrayList();
values.add(null);
helpTestCompareSubqueryCriteria(crit, false, values);
}
- public void testCompareSubqueryCriteriaNulls3() throws Exception {
+ @Test public void testCompareSubqueryCriteriaNulls3() throws Exception {
SubqueryCompareCriteria crit = helpGetCompareSubqueryCriteria(SubqueryCompareCriteria.EQ, SubqueryCompareCriteria.ALL);
ArrayList values = new ArrayList();
values.add(null);
@@ -524,7 +522,7 @@
helpTestCompareSubqueryCriteria(crit, false, values);
}
- public void testCompareSubqueryCriteriaNulls4() throws Exception {
+ @Test public void testCompareSubqueryCriteriaNulls4() throws Exception {
SubqueryCompareCriteria crit = helpGetCompareSubqueryCriteria(SubqueryCompareCriteria.EQ, SubqueryCompareCriteria.SOME);
ArrayList values = new ArrayList();
values.add(null);
@@ -532,7 +530,7 @@
helpTestCompareSubqueryCriteria(crit, false, values);
}
- public void testCompareSubqueryCriteriaNulls5() throws Exception {
+ @Test public void testCompareSubqueryCriteriaNulls5() throws Exception {
SubqueryCompareCriteria crit = helpGetCompareSubqueryCriteria(SubqueryCompareCriteria.EQ, SubqueryCompareCriteria.SOME);
ArrayList values = new ArrayList();
values.add(null);
@@ -541,7 +539,7 @@
helpTestCompareSubqueryCriteria(crit, true, values);
}
- public void testCompareSubqueryCriteriaNulls6() throws Exception {
+ @Test public void testCompareSubqueryCriteriaNulls6() throws Exception {
SubqueryCompareCriteria crit = helpGetCompareSubqueryCriteria(SubqueryCompareCriteria.EQ, SubqueryCompareCriteria.SOME);
ArrayList values = new ArrayList();
values.add("a"); //$NON-NLS-1$
@@ -553,7 +551,7 @@
/**
* null is unknown
*/
- public void testCompareSubqueryCriteriaNulls7() throws Exception{
+ @Test public void testCompareSubqueryCriteriaNulls7() throws Exception{
SubqueryCompareCriteria crit = helpGetCompareSubqueryCriteria(SubqueryCompareCriteria.LT, SubqueryCompareCriteria.ALL);
ArrayList values = new ArrayList();
values.add(null);
@@ -564,11 +562,20 @@
/**
* null is unknown
*/
- public void testCompareSubqueryCriteriaNulls8() throws Exception {
+ @Test public void testCompareSubqueryCriteriaNulls8() throws Exception {
SubqueryCompareCriteria crit = helpGetCompareSubqueryCriteria(SubqueryCompareCriteria.GT, SubqueryCompareCriteria.ALL);
ArrayList values = new ArrayList();
values.add(null);
values.add(null);
helpTestCompareSubqueryCriteria(crit, false, values);
}
+
+ /**
+ * Big decimal comparisons should ignore precision.
+ */
+ @Test public void testBigDecimalEquality() throws Exception {
+ CompareCriteria crit = new CompareCriteria(new Constant(new BigDecimal("3.10")), CompareCriteria.EQ, new Constant(new BigDecimal("3.1"))); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue(Evaluator.evaluate(crit));
+ }
+
}
15 years, 9 months