Revision: 261 http://mindtreeinsight.svn.sourceforge.net/mindtreeinsight/?rev=261&view=rev Author: bindul Date: 2011-01-07 05:52:38 +0000 (Fri, 07 Jan 2011)
Log Message: ----------- Insight 2... Modified Paths: -------------- insight-core/trunk/insight-core-api/pom.xml insight-core/trunk/insight-core-api/src/main/java/com/mindtree/techworks/insight/core/api/model/LogEvent.java insight-core/trunk/insight-core-api/src/main/java/com/mindtree/techworks/insight/core/api/model/LogEventModel.java insight-core/trunk/insight-core-api/src/main/java/com/mindtree/techworks/insight/core/api/model/LogLevel.java insight-core/trunk/insight-core-api/src/main/java/com/mindtree/techworks/insight/core/api/model/LogLevelStore.java insight-core/trunk/insight-core-api/src/main/resources/com/mindtree/techworks/insight/core/api/api-messages.properties insight-core/trunk/pom.xml parent/trunk/pom.xml Added Paths: ----------- insight-core/trunk/insight-core-api/src/main/java/com/mindtree/techworks/insight/core/api/internal/ insight-core/trunk/insight-core-api/src/main/java/com/mindtree/techworks/insight/core/api/internal/APIMessages.java Modified: insight-core/trunk/insight-core-api/pom.xml =================================================================== --- insight-core/trunk/insight-core-api/pom.xml 2010-11-05 18:11:53 UTC (rev 260) +++ insight-core/trunk/insight-core-api/pom.xml 2011-01-07 05:52:38 UTC (rev 261) @@ -40,7 +40,7 @@ </dependencies> <properties> <insight.project.type-specification>true</insight.project.type-specification> - <insight.project.type-implementation.spectitle>${pom.name}</insight.project.type-implementation.spectitle> - <insight.project.type-implementation.specversion>${pom.version}</insight.project.type-implementation.specversion> + <insight.project.type-implementation.spectitle>${project.name}</insight.project.type-implementation.spectitle> + <insight.project.type-implementation.specversion>${project.version}</insight.project.type-implementation.specversion> </properties> </project> \ No newline at end of file Added: insight-core/trunk/insight-core-api/src/main/java/com/mindtree/techworks/insight/core/api/internal/APIMessages.java =================================================================== --- insight-core/trunk/insight-core-api/src/main/java/com/mindtree/techworks/insight/core/api/internal/APIMessages.java (rev 0) +++ insight-core/trunk/insight-core-api/src/main/java/com/mindtree/techworks/insight/core/api/internal/APIMessages.java 2011-01-07 05:52:38 UTC (rev 261) @@ -0,0 +1,93 @@ +/* + * $HeadURL$ + * + * Copyright (c) 2010 MindTree Ltd. + * + * This file is part of Insight. + * + * Insight is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free + * Software Foundation, either version 3 of the License, or (at your option) + * any later version. + * + * Insight 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 General + * Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * Insight. If not, see <http://www.gnu.org/licenses/>. + */ +package com.mindtree.techworks.insight.core.api.internal; + +import java.text.MessageFormat; +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * Resource accessor for API messages. This class is not intended to be used + * outside the Insight Core API. It derives all its messages from the + * <code>com.mindtree.techworks.insight.core.api.api-messages</code> resource + * bundle. + * + * @since 2.0 + * @author Bindul Bhowmik + */ +public class APIMessages { + + /** + * The resource bundle name + */ + private static final String BUNDLE_NAME = "com.mindtree.techworks.insight.core.api.api-messages"; //$NON-NLS-1$ + + /** + * The resource bundle + */ + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle + .getBundle(BUNDLE_NAME); + + private APIMessages() {} + + /** + * Returns the messages for the keys + * + * @param key + * The key + * @return The message for the key or the key itself + */ + public static String getString(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } + + /** + * Returns the messages for the keys, filling in required parameters + * + * @param key + * The key + * @param params + * The parameters to be filled in the message + * @return The message for the key or the key itself + */ + public static String getString(String key, String... params) { + try { + String message = RESOURCE_BUNDLE.getString(key); + if (null != message && null != params) { + message = MessageFormat.format(message, (Object[]) params); + } + return message; + } catch (MissingResourceException e) { + StringBuilder missingResource = new StringBuilder(); + missingResource.append('!').append(key).append('!'); + if (null != params) { + for (String param : params) { + missingResource.append('~').append(param).append('~'); + } + } + return missingResource.toString(); + } + } +} Property changes on: insight-core/trunk/insight-core-api/src/main/java/com/mindtree/techworks/insight/core/api/internal/APIMessages.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Date Author Id Revision HeadURL Added: svn:eol-style + native Modified: insight-core/trunk/insight-core-api/src/main/java/com/mindtree/techworks/insight/core/api/model/LogEvent.java =================================================================== --- insight-core/trunk/insight-core-api/src/main/java/com/mindtree/techworks/insight/core/api/model/LogEvent.java 2010-11-05 18:11:53 UTC (rev 260) +++ insight-core/trunk/insight-core-api/src/main/java/com/mindtree/techworks/insight/core/api/model/LogEvent.java 2011-01-07 05:52:38 UTC (rev 261) @@ -20,14 +20,11 @@ */ package com.mindtree.techworks.insight.core.api.model; -import java.io.Externalizable; -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; +import java.util.Map; /** * This class represents a single log event from a log source. A log event needs - * to be initialized with a {...@link Namespace} which contains information about + * to be initialized with a {...@link LogSource} which contains information about * how the log event was parsed and also information about the source of the * log event. * <br /> @@ -35,14 +32,19 @@ * independent for Log4j. The <code>LogEvent</code> from this version is * designed to be a generic log event. Certain fields are defined, and the rest * are defined as a generic map where log events can be added. The fields in the - * log event are defined in the {...@link Namespace}. + * log event are defined in the {...@link LogSource}. * - * @since 2.0 + * @since Insight 2.0 * @author Bindul Bhowmik */ -public class LogEvent implements Externalizable { +public abstract class LogEvent { /** + * The sequence number of the log event in the model + */ + private int sequenceNumber; + + /** * The level of the log message */ private LogLevel level; @@ -62,25 +64,9 @@ */ private String message; - - - /* (non-Javadoc) - * @see java.io.Externalizable#writeExternal(java.io.ObjectOutput) + /** + * Other fields in the log event */ - @Override - public void writeExternal(ObjectOutput out) throws IOException { - // TODO Auto-generated method stub + private Map<String, Object> fields; - } - - /* (non-Javadoc) - * @see java.io.Externalizable#readExternal(java.io.ObjectInput) - */ - @Override - public void readExternal(ObjectInput in) throws IOException, - ClassNotFoundException { - // TODO Auto-generated method stub - - } - } Modified: insight-core/trunk/insight-core-api/src/main/java/com/mindtree/techworks/insight/core/api/model/LogEventModel.java =================================================================== --- insight-core/trunk/insight-core-api/src/main/java/com/mindtree/techworks/insight/core/api/model/LogEventModel.java 2010-11-05 18:11:53 UTC (rev 260) +++ insight-core/trunk/insight-core-api/src/main/java/com/mindtree/techworks/insight/core/api/model/LogEventModel.java 2011-01-07 05:52:38 UTC (rev 261) @@ -42,5 +42,5 @@ */ LogLevel getLogLevel(String name); - Log + } Modified: insight-core/trunk/insight-core-api/src/main/java/com/mindtree/techworks/insight/core/api/model/LogLevel.java =================================================================== --- insight-core/trunk/insight-core-api/src/main/java/com/mindtree/techworks/insight/core/api/model/LogLevel.java 2010-11-05 18:11:53 UTC (rev 260) +++ insight-core/trunk/insight-core-api/src/main/java/com/mindtree/techworks/insight/core/api/model/LogLevel.java 2011-01-07 05:52:38 UTC (rev 261) @@ -21,15 +21,19 @@ package com.mindtree.techworks.insight.core.api.model; import java.io.Serializable; -import java.text.MessageFormat; import java.util.HashMap; import java.util.Locale; import java.util.Map; import java.util.ResourceBundle; +import com.mindtree.techworks.insight.core.api.internal.APIMessages; + /** - * @TODO Add docs + * The class represents a <em>rank</em> level for a <code>LogEvent</code>. Each + * level in Insight has a numeric <code>priority</code> associated with the + * level as well as a <code>name</code> for the level. The <code>priority</code> + * may be used to sort or compare the levels, specially in a display. * * This was a good enough candidate to be defined as an enum, however that would * prevent runtime definition of new log levels, hence levels have been defined @@ -38,7 +42,7 @@ * @see http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/Level.html * @see http://download.oracle.com/javase/6/docs/api/java/util/logging/Level.html * @see http://httpd.apache.org/docs/current/mod/core.html#loglevel - * @since 2.0 + * @since Insight 2.0 * @author Bindul Bhowmik */ public final class LogLevel implements Serializable, Comparable<LogLevel> { @@ -51,63 +55,57 @@ /** * Resource bundle name for getting log names */ - private static final String LOG_LEVEL_RESOURCE_BUNDLE = "com.mindtree.techworks.insight.core.api.model.log-level-names"; + private static final String LOG_LEVEL_RESOURCE_BUNDLE = "com.mindtree.techworks.insight.core.api.model.log-level-names"; //$NON-NLS-1$ /** - * API Resource Bundle - */ - private static ResourceBundle apiMessages = ResourceBundle - .getBundle("com.mindtree.techworks.insight.core.api.api-messages"); - - /** * The global log level store */ private static GlobalLogLevelStore GLOBAL_STORE = new GlobalLogLevelStore(); /** # Level from [1] java.util.logging.Level [2] org.apache.log4j.Level */ - public static final LogLevel OFF = new LogLevel(Integer.MAX_VALUE, "OFF", GLOBAL_STORE); + public static final LogLevel OFF = new LogLevel(Integer.MAX_VALUE, "OFF", GLOBAL_STORE); //$NON-NLS-1$ /** # Level from [2] org.apache.log4j.Level */ - public static final LogLevel FATAL = new LogLevel(12500, "FATAL", GLOBAL_STORE); + public static final LogLevel FATAL = new LogLevel(12500, "FATAL", GLOBAL_STORE); //$NON-NLS-1$ /** # Level from [3] Apache HTTPD LogLevel */ - public static final LogLevel emerg = new LogLevel(12000, "emerg", GLOBAL_STORE); + public static final LogLevel emerg = new LogLevel(12000, "emerg", GLOBAL_STORE); //$NON-NLS-1$ /** # Level from [3] Apache HTTPD LogLevel */ - public static final LogLevel alert = new LogLevel (11000, "alert", GLOBAL_STORE); + public static final LogLevel alert = new LogLevel (11000, "alert", GLOBAL_STORE); //$NON-NLS-1$ /** # Level from [1] java.util.logging.Level */ - public static final LogLevel SEVERE = new LogLevel(10500, "SEVERE", GLOBAL_STORE); + public static final LogLevel SEVERE = new LogLevel(10500, "SEVERE", GLOBAL_STORE); //$NON-NLS-1$ /** # Level from [3] Apache HTTPD LogLevel */ - public static final LogLevel crit = new LogLevel(10000, "crit", GLOBAL_STORE); + public static final LogLevel crit = new LogLevel(10000, "crit", GLOBAL_STORE); //$NON-NLS-1$ /** # Level from [2] org.apache.log4j.Level */ - public static final LogLevel ERROR = new LogLevel(9000, "ERROR", GLOBAL_STORE); + public static final LogLevel ERROR = new LogLevel(9000, "ERROR", GLOBAL_STORE); //$NON-NLS-1$ /** # Level from [3] Apache HTTPD LogLevel */ - public static final LogLevel error = new LogLevel(ERROR.priority, "error", GLOBAL_STORE); + public static final LogLevel error = new LogLevel(ERROR.priority, "error", GLOBAL_STORE); //$NON-NLS-1$ /** # Level from [1] java.util.logging.Level */ - public static final LogLevel WARNING = new LogLevel(8000, "WARNING", GLOBAL_STORE); + public static final LogLevel WARNING = new LogLevel(8000, "WARNING", GLOBAL_STORE); //$NON-NLS-1$ /** # Level from [2] org.apache.log4j.Level */ - public static final LogLevel WARN = new LogLevel(WARNING.priority, "WARN", GLOBAL_STORE); + public static final LogLevel WARN = new LogLevel(WARNING.priority, "WARN", GLOBAL_STORE); //$NON-NLS-1$ /** # Level from [3] Apache HTTPD LogLevel */ - public static final LogLevel warn = new LogLevel(WARNING.priority, "warn", GLOBAL_STORE); + public static final LogLevel warn = new LogLevel(WARNING.priority, "warn", GLOBAL_STORE); //$NON-NLS-1$ /** # Level from [3] Apache HTTPD LogLevel */ - public static final LogLevel notice = new LogLevel(7000, "notice", GLOBAL_STORE); + public static final LogLevel notice = new LogLevel(7000, "notice", GLOBAL_STORE); //$NON-NLS-1$ /** # Level from [1] java.util.logging.Level [2] org.apache.log4j.Level */ - public static final LogLevel INFO = new LogLevel(6000, "INFO", GLOBAL_STORE); + public static final LogLevel INFO = new LogLevel(6000, "INFO", GLOBAL_STORE); //$NON-NLS-1$ /** # Level from [3] Apache HTTPD LogLevel */ - public static final LogLevel info = new LogLevel(INFO.priority, "info", GLOBAL_STORE); + public static final LogLevel info = new LogLevel(INFO.priority, "info", GLOBAL_STORE); //$NON-NLS-1$ /** # Level from [1] java.util.logging.Level */ - public static final LogLevel CONFIG = new LogLevel(5000, "CONFIG", GLOBAL_STORE); + public static final LogLevel CONFIG = new LogLevel(5000, "CONFIG", GLOBAL_STORE); //$NON-NLS-1$ /** # Level from [1] java.util.logging.Level */ - public static final LogLevel FINE = new LogLevel(4500, "FINE", GLOBAL_STORE); + public static final LogLevel FINE = new LogLevel(4500, "FINE", GLOBAL_STORE); //$NON-NLS-1$ /** # Level from [2] org.apache.log4j.Level */ - public static final LogLevel DEBUG = new LogLevel(4000, "DEBUG", GLOBAL_STORE); + public static final LogLevel DEBUG = new LogLevel(4000, "DEBUG", GLOBAL_STORE); //$NON-NLS-1$ /** # Level from [3] Apache HTTPD LogLevel */ - public static final LogLevel debug = new LogLevel(DEBUG.priority, "debug", GLOBAL_STORE); + public static final LogLevel debug = new LogLevel(DEBUG.priority, "debug", GLOBAL_STORE); //$NON-NLS-1$ /** # Level from [1] java.util.logging.Level */ - public static final LogLevel FINER = new LogLevel (2500, "FINER", GLOBAL_STORE); + public static final LogLevel FINER = new LogLevel (2500, "FINER", GLOBAL_STORE); //$NON-NLS-1$ /** # Level from [2] org.apache.log4j.Level */ - public static final LogLevel TRACE = new LogLevel (2000, "TRACE", GLOBAL_STORE); + public static final LogLevel TRACE = new LogLevel (2000, "TRACE", GLOBAL_STORE); //$NON-NLS-1$ /** # Level from [1] java.util.logging.Level */ - public static final LogLevel FINEST = new LogLevel (1000, "FINEST", GLOBAL_STORE); + public static final LogLevel FINEST = new LogLevel (1000, "FINEST", GLOBAL_STORE); //$NON-NLS-1$ /** # Level from [2] org.apache.log4j.Level */ - public static final LogLevel ALL = new LogLevel(Integer.MIN_VALUE, "ALL", GLOBAL_STORE); + public static final LogLevel ALL = new LogLevel(Integer.MIN_VALUE, "ALL", GLOBAL_STORE); //$NON-NLS-1$ /** * The integer priority for log levels, used for comparison @@ -129,7 +127,7 @@ private LogLevel(int priority, String name, LogLevelStore store) { if (null == name) { throw new NullPointerException( - apiMessages.getString("model.exception.loglevelnmnull")); + APIMessages.getString("model.exception.loglevelnmnull")); //$NON-NLS-1$ } this.priority = priority; this.name = name; @@ -251,7 +249,7 @@ */ public static LogLevel registerLogLevel (int priority, String name, LogLevelStore store) { if (null == store) { - throw new NullPointerException(apiMessages.getString("model.exception.nullstore")); + throw new NullPointerException(APIMessages.getString("model.exception.nullstore")); //$NON-NLS-1$ } return new LogLevel(priority, name, store); } @@ -300,7 +298,7 @@ * interface, with a check to throw an <code>IllegalStateException</code> if * duplicate registrations are attempted. * - * @since 2.0 + * @since Insight 2.0 * @author Bindul Bhowmik */ private static class GlobalLogLevelStore implements LogLevelStore { @@ -314,9 +312,7 @@ public void storeLogLevel(LogLevel logLevel) { // The global store does not allow overwrite if (store.containsKey(logLevel.name)) { - throw new IllegalStateException( - MessageFormat.format( - apiMessages.getString("model.exception.duplicateglobal"), + throw new IllegalStateException(APIMessages.getString("model.exception.duplicateglobal", //$NON-NLS-1$ logLevel.name)); } store.put(logLevel.name, logLevel); Modified: insight-core/trunk/insight-core-api/src/main/java/com/mindtree/techworks/insight/core/api/model/LogLevelStore.java =================================================================== --- insight-core/trunk/insight-core-api/src/main/java/com/mindtree/techworks/insight/core/api/model/LogLevelStore.java 2010-11-05 18:11:53 UTC (rev 260) +++ insight-core/trunk/insight-core-api/src/main/java/com/mindtree/techworks/insight/core/api/model/LogLevelStore.java 2011-01-07 05:52:38 UTC (rev 261) @@ -24,7 +24,7 @@ * Represents a local / contextual store where {...@link LogLevel}s can be stored. * * @see LogLevel - * @since 2.0 + * @since Insight 2.0 * @author Bindul Bhowmik */ public interface LogLevelStore { Modified: insight-core/trunk/insight-core-api/src/main/resources/com/mindtree/techworks/insight/core/api/api-messages.properties =================================================================== --- insight-core/trunk/insight-core-api/src/main/resources/com/mindtree/techworks/insight/core/api/api-messages.properties 2010-11-05 18:11:53 UTC (rev 260) +++ insight-core/trunk/insight-core-api/src/main/resources/com/mindtree/techworks/insight/core/api/api-messages.properties 2011-01-07 05:52:38 UTC (rev 261) @@ -5,4 +5,5 @@ #--# model.exception.loglevelnmnull=Log Level name cannot be null model.exception.duplicateglobal=Attempt to register a global log level with non-unique log level name: {0} -model.exception.nullstore=Store cannot be null \ No newline at end of file +model.exception.nullstore=Store cannot be null +#--# \ No newline at end of file Modified: insight-core/trunk/pom.xml =================================================================== --- insight-core/trunk/pom.xml 2010-11-05 18:11:53 UTC (rev 260) +++ insight-core/trunk/pom.xml 2011-01-07 05:52:38 UTC (rev 261) @@ -24,7 +24,7 @@ <modelVersion>4.0.0</modelVersion> <parent> <groupId>com.mindtree.techworks.insight</groupId> - <artifactId>parent</artifactId> + <artifactId>insight-parent</artifactId> <version>2.0.0-SNAPSHOT</version> </parent> <groupId>com.mindtree.techworks.insight.core</groupId> Modified: parent/trunk/pom.xml =================================================================== --- parent/trunk/pom.xml 2010-11-05 18:11:53 UTC (rev 260) +++ parent/trunk/pom.xml 2011-01-07 05:52:38 UTC (rev 261) @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- | - | Copyright (c) 2009 - 2010 MindTree Ltd. + | Copyright (c) 2009 - 2011 MindTree Ltd. | | This file is part of Insight. | @@ -23,7 +23,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.mindtree.techworks.insight</groupId> - <artifactId>parent</artifactId> + <artifactId>insight-parent</artifactId> <packaging>pom</packaging> <version>2.0.0-SNAPSHOT</version> <name>MindTree Insight</name> @@ -90,6 +90,9 @@ <system>sourceforge</system> <url>https://sourceforge.net/tracker2/index.php?group_id=212019</url> </issueManagement> + <prerequisites> + <maven>3.0+</maven> + </prerequisites> <developers> <developer> <id>bindul</id> @@ -148,6 +151,7 @@ </contributor> </contributors> <build> + <!-- <resources> <resource> <directory>${basedir}</directory> @@ -158,6 +162,7 @@ </includes> </resource> </resources> + --> <!-- TODO Set up resource filtering on each component for version.properties --> <pluginManagement> <plugins> @@ -199,7 +204,7 @@ <Specification-Vendor>${project.organization.name}</Specification-Vendor> <X-Compile-Source-JDK>${maven.compile.source}</X-Compile-Source-JDK> <X-Compile-Target-JDK>${maven.compile.target}</X-Compile-Target-JDK> - <Implementation-Build>${pom.version}-${maven.build.timestamp}</Implementation-Build> + <Implementation-Build>${project.version}-${maven.build.timestamp}</Implementation-Build> </manifestEntries> </archive> </configuration> @@ -252,6 +257,18 @@ </execution> </executions> </plugin> + <plugin> + <groupId>org.apache.httpcomponents</groupId> + <artifactId>maven-notice-plugin</artifactId> + <executions> + <execution> + <id>attach-notice-license</id> + <goals> + <goal>generate</goal> + </goals> + </execution> + </executions> + </plugin> </plugins> </pluginManagement> <sourceDirectory>src/main/java</sourceDirectory> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Gaining the trust of online customers is vital for the success of any company that requires sensitive data to be transmitted over the Web. Learn how to best implement a security strategy that keeps consumers' information secure and instills the confidence they need to proceed with transactions. http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ MindTreeInsight-commits mailing list MindTreeInsight-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mindtreeinsight-commits