diff options
45 files changed, 2854 insertions, 586 deletions
diff --git a/java/broker-plugins/experimental/slowconsumerdetection/build.xml b/java/broker-plugins/experimental/slowconsumerdetection/build.xml index 340d749ecc..06ebc58030 100644 --- a/java/broker-plugins/experimental/slowconsumerdetection/build.xml +++ b/java/broker-plugins/experimental/slowconsumerdetection/build.xml @@ -29,64 +29,6 @@ nn - or more contributor license agreements. See the NOTICE file <target name="bundle" depends="bundle-tasks"/> - - <target name="precompile" depends="gen_logging"/> - - <property name="velocity.properties.dir" value="src/main/java/org/apache/qpid/server/virtualhost/plugin/logging"/> - - <property name="gentools.home" location="${project.root}/../gentools" /> - - <property name="generated.package" value="org/apache/qpid/server/virtualhost/plugin/logging" /> - <property name="generated.dir" location="${module.precompiled}" /> - <property name="velocity.compile.dir" value="${build.scratch}/broker/velocity"/> - <property name="velocity.timestamp" location="${generated.dir}/velocity.timestamp" /> - - - <target name="check_velocity_deps"> - <uptodate property="velocity.notRequired" targetfile="${velocity.timestamp}"> - <srcfiles dir="${velocity.properties.dir}" includes="LogMessages**" /> - <srcfiles dir="${project.root}/broker/src/velocity/" includes="**/*.java **/*.vm" /> - </uptodate> - </target> - - - - - <target name="gen_logging" depends="check_velocity_deps" unless="velocity.notRequired"> - <mkdir dir="${generated.dir}"/> - - <path id="logmessages.path"> - <fileset dir="${module.src}"> - <include name="**/*_logmessages.properties"/> - </fileset> - </path> - - <pathconvert property="logmessages" - refid="logmessages.path" - pathsep=" "/> - - <echo message="logmessages is ${logmessages}"/> - - <java classname="org.apache.qpid.server.logging.GenerateLogMessages" fork="true" dir="${gentools.home}/src" failonerror="true"> - <arg line="-r ${logmessages}"/> - <arg value="-j"/> - <arg value="-o"/> - <arg value="${generated.dir}"/> - <arg value="-t"/> - <arg value="${project.root}/broker/src/velocity/templates/org/apache/qpid/server/logging/messages"/> - <classpath> - <pathelement path="${project.root}/broker-plugins/experimental/slowconsumerdetection/src/main/java"/> - <pathelement path="${velocity.compile.dir}" /> - <fileset dir="${project.root}/lib"> - <include name="**/*.jar"/> - </fileset> - <pathelement path="${gentools.home}/lib/velocity-1.4.jar" /> - </classpath> - </java> - <touch file="${velocity.timestamp}" /> - </target> - - </project> diff --git a/java/broker/build.xml b/java/broker/build.xml index 598097e4ae..f22972384d 100644 --- a/java/broker/build.xml +++ b/java/broker/build.xml @@ -33,12 +33,6 @@ <property name="qmf.output.dir" value="${module.precompiled}/org/apache/qpid/qmf/schema"/> <property name="qmf.output.file" value="BrokerSchema.java"/> - <property name="gentools.home" location="${project.root}/../gentools" /> - <property name="generated.package" value="org/apache/qpid/server/logging/messages" /> - <property name="generated.dir" location="${module.precompiled}/${generated.package}" /> - <property name="velocity.compile.dir" value="${module.build}/velocity"/> - <property name="velocity.timestamp" location="${generated.dir}/velocity.timestamp" /> - <target name="precompile" depends="gen_logging,gen_qmf"> <mkdir dir="${output.dir}"/> @@ -48,50 +42,6 @@ javacchome="${project.root}/lib"/> </target> - <target name="compile_velocity" > - <mkdir dir="${velocity.compile.dir}" /> - <!-- Compile LogMessages Velocity Generator --> - <javac source="${java.source}" target="${java.target}" - destdir="${velocity.compile.dir}" debug="on" includeantruntime="false" - deprecation="${javac.deprecation}" - srcdir="src/velocity/java" > - <classpath> - <pathelement path="${gentools.home}/lib/velocity-1.4.jar" /> - </classpath> - <compilerarg line="${javac.compiler.args}"/> - </javac> - </target> - - <property name="velocity.properties.dir" value="${project.root}/broker/src/main/java/org/apache/qpid/server/logging/messages"/> - - <target name="check_velocity_deps"> - <uptodate property="velocity.notRequired" targetfile="${velocity.timestamp}"> - <srcfiles dir="${velocity.properties.dir}" includes="LogMessages**" /> - <srcfiles dir="src/velocity/" includes="**/*.java **/*.vm" /> - </uptodate> - </target> - - <target name="gen_logging" depends="compile_velocity,check_velocity_deps" unless="velocity.notRequired"> - <mkdir dir="${generated.dir}"/> - <java classname="org.apache.qpid.server.logging.GenerateLogMessages" fork="true" dir="${gentools.home}/src" failonerror="true"> - <arg value="-j"/> - <arg value="-o"/> - <arg value="${generated.dir}"/> - <arg value="-t"/> - <arg value="${project.root}/broker/src/velocity/templates/org/apache/qpid/server/logging/messages"/> - <arg value="-r"/> - <arg value="org.apache.qpid.server.logging.messages.LogMessages"/> - <classpath> - <pathelement path="${project.root}/broker/src/main/java"/> - <pathelement path="${velocity.compile.dir}" /> - <fileset dir="${project.root}/lib"> - <include name="**/*.jar"/> - </fileset> - <pathelement path="${gentools.home}/lib/velocity-1.4.jar" /> - </classpath> - </java> - <touch file="${velocity.timestamp}" /> - </target> <target name="check_qmf_deps"> <uptodate property="gen_qmf.notRequired" targetfile="${qmf.output.dir}/${qmf.output.file}"> diff --git a/java/broker/src/main/java/org/apache/qpid/server/AMQChannel.java b/java/broker/src/main/java/org/apache/qpid/server/AMQChannel.java index 9d90694f55..3e31115dcb 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/AMQChannel.java +++ b/java/broker/src/main/java/org/apache/qpid/server/AMQChannel.java @@ -170,7 +170,7 @@ public class AMQChannel implements SessionConfig, AMQSessionModel _actor = new AMQPChannelActor(this, session.getLogActor().getRootMessageLogger()); _logSubject = new ChannelLogSubject(this); _id = getConfigStore().createId(); - _actor.message(ChannelMessages.CHN_CREATE()); + _actor.message(ChannelMessages.CREATE()); getConfigStore().addConfiguredObject(this); @@ -492,7 +492,7 @@ public class AMQChannel implements SessionConfig, AMQSessionModel return; } - CurrentActor.get().message(_logSubject, ChannelMessages.CHN_CLOSE()); + CurrentActor.get().message(_logSubject, ChannelMessages.CLOSE()); unsubscribeAllConsumers(); _transaction.rollback(); @@ -827,7 +827,7 @@ public class AMQChannel implements SessionConfig, AMQSessionModel // Log Flow Started before we start the subscriptions if (!suspended) { - _actor.message(_logSubject, ChannelMessages.CHN_FLOW("Started")); + _actor.message(_logSubject, ChannelMessages.FLOW("Started")); } @@ -878,7 +878,7 @@ public class AMQChannel implements SessionConfig, AMQSessionModel // stopped. if (suspended) { - _actor.message(_logSubject, ChannelMessages.CHN_FLOW("Stopped")); + _actor.message(_logSubject, ChannelMessages.FLOW("Stopped")); } } @@ -1001,7 +1001,7 @@ public class AMQChannel implements SessionConfig, AMQSessionModel public void setCredit(final long prefetchSize, final int prefetchCount) { - _actor.message(ChannelMessages.CHN_PREFETCH_SIZE(prefetchSize, prefetchCount)); + _actor.message(ChannelMessages.PREFETCH_SIZE(prefetchSize, prefetchCount)); _creditManager.setCreditLimits(prefetchSize, prefetchCount); } @@ -1306,7 +1306,7 @@ public class AMQChannel implements SessionConfig, AMQSessionModel if(_blocking.compareAndSet(false,true)) { - _actor.message(_logSubject, ChannelMessages.CHN_FLOW_ENFORCED(queue.getNameShortString().toString())); + _actor.message(_logSubject, ChannelMessages.FLOW_ENFORCED(queue.getNameShortString().toString())); flow(false); } } @@ -1318,7 +1318,7 @@ public class AMQChannel implements SessionConfig, AMQSessionModel { if(_blocking.compareAndSet(true,false)) { - _actor.message(_logSubject, ChannelMessages.CHN_FLOW_REMOVED()); + _actor.message(_logSubject, ChannelMessages.FLOW_REMOVED()); flow(true); } diff --git a/java/broker/src/main/java/org/apache/qpid/server/Main.java b/java/broker/src/main/java/org/apache/qpid/server/Main.java index d52267ad57..4bca4e5161 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/Main.java +++ b/java/broker/src/main/java/org/apache/qpid/server/Main.java @@ -25,7 +25,6 @@ import java.io.IOException; import java.io.InputStream; import java.net.InetAddress; import java.net.InetSocketAddress; -import java.util.Arrays; import java.util.EnumSet; import java.util.HashSet; import java.util.List; @@ -268,7 +267,7 @@ public class Main } else { - CurrentActor.get().message(BrokerMessages.BRK_CONFIG(configFile.getAbsolutePath())); + CurrentActor.get().message(BrokerMessages.CONFIG(configFile.getAbsolutePath())); } String logConfig = commandLine.getOptionValue("l"); @@ -427,7 +426,7 @@ public class Main serverConfig.getNetworkConfiguration(), null); ApplicationRegistry.getInstance().addAcceptor(new InetSocketAddress(bindAddress, port), new QpidAcceptor(driver,"TCP")); - CurrentActor.get().message(BrokerMessages.BRK_LISTENING("TCP", port)); + CurrentActor.get().message(BrokerMessages.LISTENING("TCP", port)); } @@ -441,14 +440,14 @@ public class Main new AMQProtocolEngineFactory(), serverConfig.getNetworkConfiguration(), sslFactory); ApplicationRegistry.getInstance().addAcceptor(new InetSocketAddress(bindAddress, serverConfig.getSSLPort()), new QpidAcceptor(driver,"TCP")); - CurrentActor.get().message(BrokerMessages.BRK_LISTENING("TCP/SSL", serverConfig.getSSLPort())); + CurrentActor.get().message(BrokerMessages.LISTENING("TCP/SSL", serverConfig.getSSLPort())); } //fixme qpid.AMQP should be using qpidproperties to get value _brokerLogger.info("Qpid Broker Ready :" + QpidProperties.getReleaseVersion() + " build: " + QpidProperties.getBuildVersion()); - CurrentActor.get().message(BrokerMessages.BRK_READY()); + CurrentActor.get().message(BrokerMessages.READY()); } finally @@ -568,7 +567,7 @@ public class Main { if (logConfigFile.exists() && logConfigFile.canRead()) { - CurrentActor.get().message(BrokerMessages.BRK_LOG_CONFIG(logConfigFile.getAbsolutePath())); + CurrentActor.get().message(BrokerMessages.LOG_CONFIG(logConfigFile.getAbsolutePath())); System.out.println("Configuring logger using configuration file " + logConfigFile.getAbsolutePath()); if (logWatchTime > 0) { diff --git a/java/broker/src/main/java/org/apache/qpid/server/binding/BindingFactory.java b/java/broker/src/main/java/org/apache/qpid/server/binding/BindingFactory.java index 59626a7b13..50377eaf52 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/binding/BindingFactory.java +++ b/java/broker/src/main/java/org/apache/qpid/server/binding/BindingFactory.java @@ -101,12 +101,12 @@ public class BindingFactory void logCreation() { - CurrentActor.get().message(_logSubject, BindingMessages.BND_CREATED(String.valueOf(getArguments()), getArguments() != null && !getArguments().isEmpty())); + CurrentActor.get().message(_logSubject, BindingMessages.CREATED(String.valueOf(getArguments()), getArguments() != null && !getArguments().isEmpty())); } void logDestruction() { - CurrentActor.get().message(_logSubject, BindingMessages.BND_DELETED()); + CurrentActor.get().message(_logSubject, BindingMessages.DELETED()); } public String getOrigin() diff --git a/java/broker/src/main/java/org/apache/qpid/server/exchange/AbstractExchange.java b/java/broker/src/main/java/org/apache/qpid/server/exchange/AbstractExchange.java index 7f6eccdc64..3aa9178d5d 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/exchange/AbstractExchange.java +++ b/java/broker/src/main/java/org/apache/qpid/server/exchange/AbstractExchange.java @@ -150,7 +150,7 @@ public abstract class AbstractExchange implements Exchange, Managable _logSubject = new ExchangeLogSubject(this, this.getVirtualHost()); // Log Exchange creation - CurrentActor.get().message(ExchangeMessages.EXH_CREATED(String.valueOf(getTypeShortString()), String.valueOf(name), durable)); + CurrentActor.get().message(ExchangeMessages.CREATED(String.valueOf(getTypeShortString()), String.valueOf(name), durable)); } public ConfigStore getConfigStore() @@ -190,7 +190,7 @@ public abstract class AbstractExchange implements Exchange, Managable _alternateExchange.removeReference(this); } - CurrentActor.get().message(_logSubject, ExchangeMessages.EXH_DELETED()); + CurrentActor.get().message(_logSubject, ExchangeMessages.DELETED()); for(Task task : _closeTaskList) { diff --git a/java/broker/src/main/java/org/apache/qpid/server/logging/actors/SubscriptionActor.java b/java/broker/src/main/java/org/apache/qpid/server/logging/actors/SubscriptionActor.java index 542984e76c..612074fbe9 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/logging/actors/SubscriptionActor.java +++ b/java/broker/src/main/java/org/apache/qpid/server/logging/actors/SubscriptionActor.java @@ -21,15 +21,12 @@ package org.apache.qpid.server.logging.actors; import org.apache.qpid.server.logging.RootMessageLogger; -import org.apache.qpid.server.logging.subjects.QueueLogSubject; import org.apache.qpid.server.logging.subjects.SubscriptionLogSubject; import org.apache.qpid.server.subscription.Subscription; -import java.text.MessageFormat; - /** * The subscription actor provides formatted logging for actions that are - * performed by the subsciption. Such as SUB_STATE changes. + * performed by the subsciption. Such as STATE changes. */ public class SubscriptionActor extends AbstractActor { diff --git a/java/broker/src/main/java/org/apache/qpid/server/logging/messages/Binding_logmessages.properties b/java/broker/src/main/java/org/apache/qpid/server/logging/messages/Binding_logmessages.properties new file mode 100644 index 0000000000..6956a396b0 --- /dev/null +++ b/java/broker/src/main/java/org/apache/qpid/server/logging/messages/Binding_logmessages.properties @@ -0,0 +1,213 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# Default File used for all non-defined locales. +# +# This file was derivied from LogMessages used within the Java Broker and +# originally defined on the wiki: +# http://cwiki.apache.org/confluence/display/qpid/Status+Update+Design#StatusUpdateDesign-InitialStatusMessages +# +# Technical Notes: +# This is a standard Java Properties file so white space is respected at the +# end of the lines. This file is processed in a number of ways. +# 1) ResourceBundle +# This file is loaded as a ResourceBundle. The en_US +# addition to the file is the localisation. Additional localisations can be +# provided and will automatically be selected based on the <locale> value in +# the config.xml. The default is en_US. +# +# 2) MessasgeFormat +# Each entry is prepared with the Java Core MessageFormat methods. Therefore +# most functionality you can do via MessageFormat can be done here: +# +# http://java.sun.com/javase/6/docs/api/java/text/MessageFormat.html +# +# The cavet here is that only default String and number FormatTypes can be used. +# This is due to the processing described in 3 below. If support for date, time +# or choice is required then the GenerateLogMessages class should be updated to +# provide support. +# +# Format Note: +# As mentioned earlier white space in this file is very important. One thing +# in particular to note is the way MessageFormat performs its replacements. +# The replacement text will totally replace the {xxx} section so there will be +# no addition of white space or removal e.g. +# MSG = Text----{0}---- +# When given parameter 'Hello' result in text: +# Text----Hello---- +# +# For simple arguments this is expected however when using Style formats then +# it can be a little unexpected. In particular a common pattern is used for +# number replacements : {0,number,#}. This is used in the Broker to display an +# Integer simply as the Integer with no formatting. e.g new Integer(1234567) +# becomes the String "1234567" which is can be contrasted with the pattern +# without a style format field : {0,number} which becomes string "1,234,567". +# +# What you may not expect is that {0,number, #} would produce the String " 1234567" +# note the space after the ',' here /\ has resulted in a space /\ in +# the output. +# +# More details on the SubformatPattern can be found on the API link above. +# +# 3) GenerateLogMessage/Velocity Macro +# This is the only processing that this file goes through. +# 1) Class Generation: +# The GenerateLogMessage processes this file and uses the velocity Macro +# to create classes with static methods to perform the logging and give us +# compile time validation. +# +# 2) Property Processing: +# During the class generation the message properties ({x}) are identified +# and used to create the method signature. +# +# 3) Option Processing: +# The Classes perform final formatting of the messages at runtime based on +# optional parameters that are defined within the message. Optional +# parameters are enclosed in square brackets e.g. [optional]. +# +# To provide fixed log messages as required by the Technical Specification: +# http://cwiki.apache.org/confluence/display/qpid/Operational+Logging+-+Status+Update+-+Technical+Specification#OperationalLogging-StatusUpdate-TechnicalSpecification-Howtoprovidefixedlogmessages +# +# This file is processed by Velocity to create a number of classes that contain +# static methods that provide LogMessages in the code to provide compile time +# validation. +# +# For details of what processing is done see GenerateLogMessages. +# +# What a localiser or developer need know is the following: +# +# The Property structure is important as it defines how the class and methods +# will be built. +# +# Class Generation: +# ================= +# +# Each class of messages will be split in to their own <Class>Messages.java. +# Each logmessage file contains only one class of messages the <Class> name +# is derived from the name of the logmessages file e.g. <Class>_logmessages.properties. +# +# Property Format +# =============== +# The property format MUST adhere to the follow format to make it easier to +# use the logging API as a developer but also so that operations staff can +# easily locate log messages in the output. +# +# The property file should contain entries in the following format +# +# <Log Identifier, developer focused> = <Log Identifier, Operate focus> : <Log Message> +# +# eg: +# SHUTTING_DOWN = BRK-1003 : Shutting down : {0} port {1,number,#} +# +# Note: the developer focused identifier will become a method name so only a +# valid method name should be used. Currently only '-' are converted to '_'. +# +# That said properties generate the logging code at build time so any error +# can be easily identified. +# +# The three character identifier show above in BRK-1003 should ideally be unique. +# This is the only requirement, limiting to 3 characters is not required. +# That said the current broker contains the following mappings. +# +# Class | Type +# ---------------------|-------- +# Broker | BKR +# ManagementConsole | MNG +# VirtualHost | VHT +# MessageStore | MST +# ConfigStore | CFG +# TransactionLog | TXN +# Connection | CON +# Channel | CHN +# Queue | QUE +# Exchange | EXH +# Binding | BND +# Subscription | SUB +# +# +# Property Processing: +# ==================== +# +# Each property is then processed by the GenerateLogMessages class to identify +# The number and type of parameters, {x} entries. Parameters are defaulted to +# String types but the use of FormatType number (e.g.{0,number}) will result +# in a Number type being used. These parameters are then used to build the +# method parameter list. e.g: +# Property: +# SHUTTING_DOWN = BRK-1003 : Shuting down : {0} port {1,number,#} +# becomes Method: +# public static LogMessage SHUTTING_DOWN(String param1, Number param2) +# +# This improves our compile time validation of log message content and +# ensures that change in the message format does not accidentally cause +# erroneous messages. +# +# Option Processing: +# ==================== +# +# Options are identified in the log message as being surrounded by square +# brackets ([ ]). These optional values can themselves contain parameters +# however nesting of options is not permitted. Identification is performed on +# first matching so given the message: +# Msg = Log Message [option1] [option2] +# Two options will be identified and enabled to select text 'option1' and +# 'option2'. +# +# The nesting of a options is not supported and will provide +# unexpected results. e.g. Using Message: +# Msg = Log Message [option1 [sub-option2]] +# +# The options will be 'option1 [sub-option2' and 'sub-option2'. The first +# option includes the second option as the nesting is not detected. +# +# The detected options are presented in the method signature as boolean options +# numerically identified by their position in the message. e.g. +# Property: +# CON-1001 = Open : Client ID {0} [: Protocol Version : {1}] +# becomes Method: +# public static LogMessage CON_1001(String param1, String param2, boolean opt1) +# +# The value of 'opt1' will show/hide the option in the message. Note that +# 'param2' is still required however a null value can be used if the optional +# section is not desired. +# +# Again here the importance of white space needs to be highlighted. +# Looking at the QUE-1001 message as an example. The first thought on how this +# would look would be as follows: +# QUE-1001 = Create : Owner: {0} [AutoDelete] [Durable] [Transient] [Priority: {1,number,#}] +# Each option is correctly defined so the text that is defined will appear when +# selected. e.g. 'AutoDelete'. However, what may not be immediately apparent is +# the white space. Using the above definition of QUE-1001 if we were to print +# the message with only the Priority option displayed it would appear as this: +# "Create : Owner: guest Priority: 1" +# Note the spaces here /\ This is because only the text between the brackets +# has been removed. +# +# Each option needs to include white space to correctly format the message. So +# the correct definition of QUE-1001 is as follows: +# QUE-1001 = Create : Owner: {0}[ AutoDelete][ Durable][ Transient][ Priority: {1,number,#}] +# Note that white space is included with each option and there is no extra +# white space between the options. As a result the output with just Priority +# enabled is as follows: +# "Create : Owner: guest Priority: 1" +# +# +# Default File used for all non-defined locales. + +CREATED = BND-1001 : Create[ : Arguments : {0}] +DELETED = BND-1002 : Deleted diff --git a/java/broker/src/main/java/org/apache/qpid/server/logging/messages/Broker_logmessages.properties b/java/broker/src/main/java/org/apache/qpid/server/logging/messages/Broker_logmessages.properties new file mode 100644 index 0000000000..9a0bdec929 --- /dev/null +++ b/java/broker/src/main/java/org/apache/qpid/server/logging/messages/Broker_logmessages.properties @@ -0,0 +1,226 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# Default File used for all non-defined locales. +# +# This file was derivied from LogMessages used within the Java Broker and +# originally defined on the wiki: +# http://cwiki.apache.org/confluence/display/qpid/Status+Update+Design#StatusUpdateDesign-InitialStatusMessages +# +# Technical Notes: +# This is a standard Java Properties file so white space is respected at the +# end of the lines. This file is processed in a number of ways. +# 1) ResourceBundle +# This file is loaded as a ResourceBundle. The en_US +# addition to the file is the localisation. Additional localisations can be +# provided and will automatically be selected based on the <locale> value in +# the config.xml. The default is en_US. +# +# 2) MessasgeFormat +# Each entry is prepared with the Java Core MessageFormat methods. Therefore +# most functionality you can do via MessageFormat can be done here: +# +# http://java.sun.com/javase/6/docs/api/java/text/MessageFormat.html +# +# The cavet here is that only default String and number FormatTypes can be used. +# This is due to the processing described in 3 below. If support for date, time +# or choice is required then the GenerateLogMessages class should be updated to +# provide support. +# +# Format Note: +# As mentioned earlier white space in this file is very important. One thing +# in particular to note is the way MessageFormat performs its replacements. +# The replacement text will totally replace the {xxx} section so there will be +# no addition of white space or removal e.g. +# MSG = Text----{0}---- +# When given parameter 'Hello' result in text: +# Text----Hello---- +# +# For simple arguments this is expected however when using Style formats then +# it can be a little unexpected. In particular a common pattern is used for +# number replacements : {0,number,#}. This is used in the Broker to display an +# Integer simply as the Integer with no formatting. e.g new Integer(1234567) +# becomes the String "1234567" which is can be contrasted with the pattern +# without a style format field : {0,number} which becomes string "1,234,567". +# +# What you may not expect is that {0,number, #} would produce the String " 1234567" +# note the space after the ',' here /\ has resulted in a space /\ in +# the output. +# +# More details on the SubformatPattern can be found on the API link above. +# +# 3) GenerateLogMessage/Velocity Macro +# This is the only processing that this file goes through. +# 1) Class Generation: +# The GenerateLogMessage processes this file and uses the velocity Macro +# to create classes with static methods to perform the logging and give us +# compile time validation. +# +# 2) Property Processing: +# During the class generation the message properties ({x}) are identified +# and used to create the method signature. +# +# 3) Option Processing: +# The Classes perform final formatting of the messages at runtime based on +# optional parameters that are defined within the message. Optional +# parameters are enclosed in square brackets e.g. [optional]. +# +# To provide fixed log messages as required by the Technical Specification: +# http://cwiki.apache.org/confluence/display/qpid/Operational+Logging+-+Status+Update+-+Technical+Specification#OperationalLogging-StatusUpdate-TechnicalSpecification-Howtoprovidefixedlogmessages +# +# This file is processed by Velocity to create a number of classes that contain +# static methods that provide LogMessages in the code to provide compile time +# validation. +# +# For details of what processing is done see GenerateLogMessages. +# +# What a localiser or developer need know is the following: +# +# The Property structure is important as it defines how the class and methods +# will be built. +# +# Class Generation: +# ================= +# +# Each class of messages will be split in to their own <Class>Messages.java. +# Each logmessage file contains only one class of messages the <Class> name +# is derived from the name of the logmessages file e.g. <Class>_logmessages.properties. +# +# Property Format +# =============== +# The property format MUST adhere to the follow format to make it easier to +# use the logging API as a developer but also so that operations staff can +# easily locate log messages in the output. +# +# The property file should contain entries in the following format +# +# <Log Identifier, developer focused> = <Log Identifier, Operate focus> : <Log Message> +# +# eg: +# SHUTTING_DOWN = BRK-1003 : Shutting down : {0} port {1,number,#} +# +# Note: the developer focused identifier will become a method name so only a +# valid method name should be used. Currently only '-' are converted to '_'. +# +# That said properties generate the logging code at build time so any error +# can be easily identified. +# +# The three character identifier show above in BRK-1003 should ideally be unique. +# This is the only requirement, limiting to 3 characters is not required. +# That said the current broker contains the following mappings. +# +# Class | Type +# ---------------------|-------- +# Broker | BKR +# ManagementConsole | MNG +# VirtualHost | VHT +# MessageStore | MST +# ConfigStore | CFG +# TransactionLog | TXN +# Connection | CON +# Channel | CHN +# Queue | QUE +# Exchange | EXH +# Binding | BND +# Subscription | SUB +# +# +# Property Processing: +# ==================== +# +# Each property is then processed by the GenerateLogMessages class to identify +# The number and type of parameters, {x} entries. Parameters are defaulted to +# String types but the use of FormatType number (e.g.{0,number}) will result +# in a Number type being used. These parameters are then used to build the +# method parameter list. e.g: +# Property: +# SHUTTING_DOWN = BRK-1003 : Shuting down : {0} port {1,number,#} +# becomes Method: +# public static LogMessage SHUTTING_DOWN(String param1, Number param2) +# +# This improves our compile time validation of log message content and +# ensures that change in the message format does not accidentally cause +# erroneous messages. +# +# Option Processing: +# ==================== +# +# Options are identified in the log message as being surrounded by square +# brackets ([ ]). These optional values can themselves contain parameters +# however nesting of options is not permitted. Identification is performed on +# first matching so given the message: +# Msg = Log Message [option1] [option2] +# Two options will be identified and enabled to select text 'option1' and +# 'option2'. +# +# The nesting of a options is not supported and will provide +# unexpected results. e.g. Using Message: +# Msg = Log Message [option1 [sub-option2]] +# +# The options will be 'option1 [sub-option2' and 'sub-option2'. The first +# option includes the second option as the nesting is not detected. +# +# The detected options are presented in the method signature as boolean options +# numerically identified by their position in the message. e.g. +# Property: +# CON-1001 = Open : Client ID {0} [: Protocol Version : {1}] +# becomes Method: +# public static LogMessage CON_1001(String param1, String param2, boolean opt1) +# +# The value of 'opt1' will show/hide the option in the message. Note that +# 'param2' is still required however a null value can be used if the optional +# section is not desired. +# +# Again here the importance of white space needs to be highlighted. +# Looking at the QUE-1001 message as an example. The first thought on how this +# would look would be as follows: +# QUE-1001 = Create : Owner: {0} [AutoDelete] [Durable] [Transient] [Priority: {1,number,#}] +# Each option is correctly defined so the text that is defined will appear when +# selected. e.g. 'AutoDelete'. However, what may not be immediately apparent is +# the white space. Using the above definition of QUE-1001 if we were to print +# the message with only the Priority option displayed it would appear as this: +# "Create : Owner: guest Priority: 1" +# Note the spaces here /\ This is because only the text between the brackets +# has been removed. +# +# Each option needs to include white space to correctly format the message. So +# the correct definition of QUE-1001 is as follows: +# QUE-1001 = Create : Owner: {0}[ AutoDelete][ Durable][ Transient][ Priority: {1,number,#}] +# Note that white space is included with each option and there is no extra +# white space between the options. As a result the output with just Priority +# enabled is as follows: +# "Create : Owner: guest Priority: 1" +# +# +# Default File used for all non-defined locales. + +# 0 - Version +# 1 = Build +STARTUP = BRK-1001 : Startup : Version: {0} Build: {1} +# 0 - Transport +# 1 - Port +LISTENING = BRK-1002 : Starting : Listening on {0} port {1,number,#} +# 0 - Transport +# 1 - Port +SHUTTING_DOWN = BRK-1003 : Shuting down : {0} port {1,number,#} +READY = BRK-1004 : Ready +STOPPED = BRK-1005 : Stopped +# 0 - path +CONFIG = BRK-1006 : Using configuration : {0} +# 0 - path +LOG_CONFIG = BRK-1007 : Using logging configuration : {0}
\ No newline at end of file diff --git a/java/broker/src/main/java/org/apache/qpid/server/logging/messages/Channel_logmessages.properties b/java/broker/src/main/java/org/apache/qpid/server/logging/messages/Channel_logmessages.properties new file mode 100644 index 0000000000..53b8e995f4 --- /dev/null +++ b/java/broker/src/main/java/org/apache/qpid/server/logging/messages/Channel_logmessages.properties @@ -0,0 +1,221 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# Default File used for all non-defined locales. +# +# This file was derivied from LogMessages used within the Java Broker and +# originally defined on the wiki: +# http://cwiki.apache.org/confluence/display/qpid/Status+Update+Design#StatusUpdateDesign-InitialStatusMessages +# +# Technical Notes: +# This is a standard Java Properties file so white space is respected at the +# end of the lines. This file is processed in a number of ways. +# 1) ResourceBundle +# This file is loaded as a ResourceBundle. The en_US +# addition to the file is the localisation. Additional localisations can be +# provided and will automatically be selected based on the <locale> value in +# the config.xml. The default is en_US. +# +# 2) MessasgeFormat +# Each entry is prepared with the Java Core MessageFormat methods. Therefore +# most functionality you can do via MessageFormat can be done here: +# +# http://java.sun.com/javase/6/docs/api/java/text/MessageFormat.html +# +# The cavet here is that only default String and number FormatTypes can be used. +# This is due to the processing described in 3 below. If support for date, time +# or choice is required then the GenerateLogMessages class should be updated to +# provide support. +# +# Format Note: +# As mentioned earlier white space in this file is very important. One thing +# in particular to note is the way MessageFormat performs its replacements. +# The replacement text will totally replace the {xxx} section so there will be +# no addition of white space or removal e.g. +# MSG = Text----{0}---- +# When given parameter 'Hello' result in text: +# Text----Hello---- +# +# For simple arguments this is expected however when using Style formats then +# it can be a little unexpected. In particular a common pattern is used for +# number replacements : {0,number,#}. This is used in the Broker to display an +# Integer simply as the Integer with no formatting. e.g new Integer(1234567) +# becomes the String "1234567" which is can be contrasted with the pattern +# without a style format field : {0,number} which becomes string "1,234,567". +# +# What you may not expect is that {0,number, #} would produce the String " 1234567" +# note the space after the ',' here /\ has resulted in a space /\ in +# the output. +# +# More details on the SubformatPattern can be found on the API link above. +# +# 3) GenerateLogMessage/Velocity Macro +# This is the only processing that this file goes through. +# 1) Class Generation: +# The GenerateLogMessage processes this file and uses the velocity Macro +# to create classes with static methods to perform the logging and give us +# compile time validation. +# +# 2) Property Processing: +# During the class generation the message properties ({x}) are identified +# and used to create the method signature. +# +# 3) Option Processing: +# The Classes perform final formatting of the messages at runtime based on +# optional parameters that are defined within the message. Optional +# parameters are enclosed in square brackets e.g. [optional]. +# +# To provide fixed log messages as required by the Technical Specification: +# http://cwiki.apache.org/confluence/display/qpid/Operational+Logging+-+Status+Update+-+Technical+Specification#OperationalLogging-StatusUpdate-TechnicalSpecification-Howtoprovidefixedlogmessages +# +# This file is processed by Velocity to create a number of classes that contain +# static methods that provide LogMessages in the code to provide compile time +# validation. +# +# For details of what processing is done see GenerateLogMessages. +# +# What a localiser or developer need know is the following: +# +# The Property structure is important as it defines how the class and methods +# will be built. +# +# Class Generation: +# ================= +# +# Each class of messages will be split in to their own <Class>Messages.java. +# Each logmessage file contains only one class of messages the <Class> name +# is derived from the name of the logmessages file e.g. <Class>_logmessages.properties. +# +# Property Format +# =============== +# The property format MUST adhere to the follow format to make it easier to +# use the logging API as a developer but also so that operations staff can +# easily locate log messages in the output. +# +# The property file should contain entries in the following format +# +# <Log Identifier, developer focused> = <Log Identifier, Operate focus> : <Log Message> +# +# eg: +# SHUTTING_DOWN = BRK-1003 : Shutting down : {0} port {1,number,#} +# +# Note: the developer focused identifier will become a method name so only a +# valid method name should be used. Currently only '-' are converted to '_'. +# +# That said properties generate the logging code at build time so any error +# can be easily identified. +# +# The three character identifier show above in BRK-1003 should ideally be unique. +# This is the only requirement, limiting to 3 characters is not required. +# That said the current broker contains the following mappings. +# +# Class | Type +# ---------------------|-------- +# Broker | BKR +# ManagementConsole | MNG +# VirtualHost | VHT +# MessageStore | MST +# ConfigStore | CFG +# TransactionLog | TXN +# Connection | CON +# Channel | CHN +# Queue | QUE +# Exchange | EXH +# Binding | BND +# Subscription | SUB +# +# +# Property Processing: +# ==================== +# +# Each property is then processed by the GenerateLogMessages class to identify +# The number and type of parameters, {x} entries. Parameters are defaulted to +# String types but the use of FormatType number (e.g.{0,number}) will result +# in a Number type being used. These parameters are then used to build the +# method parameter list. e.g: +# Property: +# SHUTTING_DOWN = BRK-1003 : Shuting down : {0} port {1,number,#} +# becomes Method: +# public static LogMessage SHUTTING_DOWN(String param1, Number param2) +# +# This improves our compile time validation of log message content and +# ensures that change in the message format does not accidentally cause +# erroneous messages. +# +# Option Processing: +# ==================== +# +# Options are identified in the log message as being surrounded by square +# brackets ([ ]). These optional values can themselves contain parameters +# however nesting of options is not permitted. Identification is performed on +# first matching so given the message: +# Msg = Log Message [option1] [option2] +# Two options will be identified and enabled to select text 'option1' and +# 'option2'. +# +# The nesting of a options is not supported and will provide +# unexpected results. e.g. Using Message: +# Msg = Log Message [option1 [sub-option2]] +# +# The options will be 'option1 [sub-option2' and 'sub-option2'. The first +# option includes the second option as the nesting is not detected. +# +# The detected options are presented in the method signature as boolean options +# numerically identified by their position in the message. e.g. +# Property: +# CON-1001 = Open : Client ID {0} [: Protocol Version : {1}] +# becomes Method: +# public static LogMessage CON_1001(String param1, String param2, boolean opt1) +# +# The value of 'opt1' will show/hide the option in the message. Note that +# 'param2' is still required however a null value can be used if the optional +# section is not desired. +# +# Again here the importance of white space needs to be highlighted. +# Looking at the QUE-1001 message as an example. The first thought on how this +# would look would be as follows: +# QUE-1001 = Create : Owner: {0} [AutoDelete] [Durable] [Transient] [Priority: {1,number,#}] +# Each option is correctly defined so the text that is defined will appear when +# selected. e.g. 'AutoDelete'. However, what may not be immediately apparent is +# the white space. Using the above definition of QUE-1001 if we were to print +# the message with only the Priority option displayed it would appear as this: +# "Create : Owner: guest Priority: 1" +# Note the spaces here /\ This is because only the text between the brackets +# has been removed. +# +# Each option needs to include white space to correctly format the message. So +# the correct definition of QUE-1001 is as follows: +# QUE-1001 = Create : Owner: {0}[ AutoDelete][ Durable][ Transient][ Priority: {1,number,#}] +# Note that white space is included with each option and there is no extra +# white space between the options. As a result the output with just Priority +# enabled is as follows: +# "Create : Owner: guest Priority: 1" +# +# +# Default File used for all non-defined locales. + +CREATE = CHN-1001 : Create +# 0 - flow +FLOW = CHN-1002 : Flow {0} +CLOSE = CHN-1003 : Close +# 0 - bytes allowed in prefetch +# 1 - number of messagse. +PREFETCH_SIZE = CHN-1004 : Prefetch Size (bytes) {0,number} : Count {1,number} +# 0 - queue causing flow control +FLOW_ENFORCED = CHN-1005 : Flow Control Enforced (Queue {0}) +FLOW_REMOVED = CHN-1006 : Flow Control Removed diff --git a/java/broker/src/main/java/org/apache/qpid/server/logging/messages/ConfigStore_logmessages.properties b/java/broker/src/main/java/org/apache/qpid/server/logging/messages/ConfigStore_logmessages.properties new file mode 100644 index 0000000000..a6a36b15fe --- /dev/null +++ b/java/broker/src/main/java/org/apache/qpid/server/logging/messages/ConfigStore_logmessages.properties @@ -0,0 +1,218 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# Default File used for all non-defined locales. +# +# This file was derivied from LogMessages used within the Java Broker and +# originally defined on the wiki: +# http://cwiki.apache.org/confluence/display/qpid/Status+Update+Design#StatusUpdateDesign-InitialStatusMessages +# +# Technical Notes: +# This is a standard Java Properties file so white space is respected at the +# end of the lines. This file is processed in a number of ways. +# 1) ResourceBundle +# This file is loaded as a ResourceBundle. The en_US +# addition to the file is the localisation. Additional localisations can be +# provided and will automatically be selected based on the <locale> value in +# the config.xml. The default is en_US. +# +# 2) MessasgeFormat +# Each entry is prepared with the Java Core MessageFormat methods. Therefore +# most functionality you can do via MessageFormat can be done here: +# +# http://java.sun.com/javase/6/docs/api/java/text/MessageFormat.html +# +# The cavet here is that only default String and number FormatTypes can be used. +# This is due to the processing described in 3 below. If support for date, time +# or choice is required then the GenerateLogMessages class should be updated to +# provide support. +# +# Format Note: +# As mentioned earlier white space in this file is very important. One thing +# in particular to note is the way MessageFormat performs its replacements. +# The replacement text will totally replace the {xxx} section so there will be +# no addition of white space or removal e.g. +# MSG = Text----{0}---- +# When given parameter 'Hello' result in text: +# Text----Hello---- +# +# For simple arguments this is expected however when using Style formats then +# it can be a little unexpected. In particular a common pattern is used for +# number replacements : {0,number,#}. This is used in the Broker to display an +# Integer simply as the Integer with no formatting. e.g new Integer(1234567) +# becomes the String "1234567" which is can be contrasted with the pattern +# without a style format field : {0,number} which becomes string "1,234,567". +# +# What you may not expect is that {0,number, #} would produce the String " 1234567" +# note the space after the ',' here /\ has resulted in a space /\ in +# the output. +# +# More details on the SubformatPattern can be found on the API link above. +# +# 3) GenerateLogMessage/Velocity Macro +# This is the only processing that this file goes through. +# 1) Class Generation: +# The GenerateLogMessage processes this file and uses the velocity Macro +# to create classes with static methods to perform the logging and give us +# compile time validation. +# +# 2) Property Processing: +# During the class generation the message properties ({x}) are identified +# and used to create the method signature. +# +# 3) Option Processing: +# The Classes perform final formatting of the messages at runtime based on +# optional parameters that are defined within the message. Optional +# parameters are enclosed in square brackets e.g. [optional]. +# +# To provide fixed log messages as required by the Technical Specification: +# http://cwiki.apache.org/confluence/display/qpid/Operational+Logging+-+Status+Update+-+Technical+Specification#OperationalLogging-StatusUpdate-TechnicalSpecification-Howtoprovidefixedlogmessages +# +# This file is processed by Velocity to create a number of classes that contain +# static methods that provide LogMessages in the code to provide compile time +# validation. +# +# For details of what processing is done see GenerateLogMessages. +# +# What a localiser or developer need know is the following: +# +# The Property structure is important as it defines how the class and methods +# will be built. +# +# Class Generation: +# ================= +# +# Each class of messages will be split in to their own <Class>Messages.java. +# Each logmessage file contains only one class of messages the <Class> name +# is derived from the name of the logmessages file e.g. <Class>_logmessages.properties. +# +# Property Format +# =============== +# The property format MUST adhere to the follow format to make it easier to +# use the logging API as a developer but also so that operations staff can +# easily locate log messages in the output. +# +# The property file should contain entries in the following format +# +# <Log Identifier, developer focused> = <Log Identifier, Operate focus> : <Log Message> +# +# eg: +# SHUTTING_DOWN = BRK-1003 : Shutting down : {0} port {1,number,#} +# +# Note: the developer focused identifier will become a method name so only a +# valid method name should be used. Currently only '-' are converted to '_'. +# +# That said properties generate the logging code at build time so any error +# can be easily identified. +# +# The three character identifier show above in BRK-1003 should ideally be unique. +# This is the only requirement, limiting to 3 characters is not required. +# That said the current broker contains the following mappings. +# +# Class | Type +# ---------------------|-------- +# Broker | BKR +# ManagementConsole | MNG +# VirtualHost | VHT +# MessageStore | MST +# ConfigStore | CFG +# TransactionLog | TXN +# Connection | CON +# Channel | CHN +# Queue | QUE +# Exchange | EXH +# Binding | BND +# Subscription | SUB +# +# +# Property Processing: +# ==================== +# +# Each property is then processed by the GenerateLogMessages class to identify +# The number and type of parameters, {x} entries. Parameters are defaulted to +# String types but the use of FormatType number (e.g.{0,number}) will result +# in a Number type being used. These parameters are then used to build the +# method parameter list. e.g: +# Property: +# SHUTTING_DOWN = BRK-1003 : Shuting down : {0} port {1,number,#} +# becomes Method: +# public static LogMessage SHUTTING_DOWN(String param1, Number param2) +# +# This improves our compile time validation of log message content and +# ensures that change in the message format does not accidentally cause +# erroneous messages. +# +# Option Processing: +# ==================== +# +# Options are identified in the log message as being surrounded by square +# brackets ([ ]). These optional values can themselves contain parameters +# however nesting of options is not permitted. Identification is performed on +# first matching so given the message: +# Msg = Log Message [option1] [option2] +# Two options will be identified and enabled to select text 'option1' and +# 'option2'. +# +# The nesting of a options is not supported and will provide +# unexpected results. e.g. Using Message: +# Msg = Log Message [option1 [sub-option2]] +# +# The options will be 'option1 [sub-option2' and 'sub-option2'. The first +# option includes the second option as the nesting is not detected. +# +# The detected options are presented in the method signature as boolean options +# numerically identified by their position in the message. e.g. +# Property: +# CON-1001 = Open : Client ID {0} [: Protocol Version : {1}] +# becomes Method: +# public static LogMessage CON_1001(String param1, String param2, boolean opt1) +# +# The value of 'opt1' will show/hide the option in the message. Note that +# 'param2' is still required however a null value can be used if the optional +# section is not desired. +# +# Again here the importance of white space needs to be highlighted. +# Looking at the QUE-1001 message as an example. The first thought on how this +# would look would be as follows: +# QUE-1001 = Create : Owner: {0} [AutoDelete] [Durable] [Transient] [Priority: {1,number,#}] +# Each option is correctly defined so the text that is defined will appear when +# selected. e.g. 'AutoDelete'. However, what may not be immediately apparent is +# the white space. Using the above definition of QUE-1001 if we were to print +# the message with only the Priority option displayed it would appear as this: +# "Create : Owner: guest Priority: 1" +# Note the spaces here /\ This is because only the text between the brackets +# has been removed. +# +# Each option needs to include white space to correctly format the message. So +# the correct definition of QUE-1001 is as follows: +# QUE-1001 = Create : Owner: {0}[ AutoDelete][ Durable][ Transient][ Priority: {1,number,#}] +# Note that white space is included with each option and there is no extra +# white space between the options. As a result the output with just Priority +# enabled is as follows: +# "Create : Owner: guest Priority: 1" +# +# +# Default File used for all non-defined locales. + +# 0 - name +CREATED = CFG-1001 : Created : {0} +# 0 - path +STORE_LOCATION = CFG-1002 : Store location : {0} +CLOSE = CFG-1003 : Closed +RECOVERY_START = CFG-1004 : Recovery Start +RECOVERY_COMPLETE = CFG-1005 : Recovery Complete diff --git a/java/broker/src/main/java/org/apache/qpid/server/logging/messages/Connection_logmessages.properties b/java/broker/src/main/java/org/apache/qpid/server/logging/messages/Connection_logmessages.properties new file mode 100644 index 0000000000..08393f5e00 --- /dev/null +++ b/java/broker/src/main/java/org/apache/qpid/server/logging/messages/Connection_logmessages.properties @@ -0,0 +1,215 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# Default File used for all non-defined locales. +# +# This file was derivied from LogMessages used within the Java Broker and +# originally defined on the wiki: +# http://cwiki.apache.org/confluence/display/qpid/Status+Update+Design#StatusUpdateDesign-InitialStatusMessages +# +# Technical Notes: +# This is a standard Java Properties file so white space is respected at the +# end of the lines. This file is processed in a number of ways. +# 1) ResourceBundle +# This file is loaded as a ResourceBundle. The en_US +# addition to the file is the localisation. Additional localisations can be +# provided and will automatically be selected based on the <locale> value in +# the config.xml. The default is en_US. +# +# 2) MessasgeFormat +# Each entry is prepared with the Java Core MessageFormat methods. Therefore +# most functionality you can do via MessageFormat can be done here: +# +# http://java.sun.com/javase/6/docs/api/java/text/MessageFormat.html +# +# The cavet here is that only default String and number FormatTypes can be used. +# This is due to the processing described in 3 below. If support for date, time +# or choice is required then the GenerateLogMessages class should be updated to +# provide support. +# +# Format Note: +# As mentioned earlier white space in this file is very important. One thing +# in particular to note is the way MessageFormat performs its replacements. +# The replacement text will totally replace the {xxx} section so there will be +# no addition of white space or removal e.g. +# MSG = Text----{0}---- +# When given parameter 'Hello' result in text: +# Text----Hello---- +# +# For simple arguments this is expected however when using Style formats then +# it can be a little unexpected. In particular a common pattern is used for +# number replacements : {0,number,#}. This is used in the Broker to display an +# Integer simply as the Integer with no formatting. e.g new Integer(1234567) +# becomes the String "1234567" which is can be contrasted with the pattern +# without a style format field : {0,number} which becomes string "1,234,567". +# +# What you may not expect is that {0,number, #} would produce the String " 1234567" +# note the space after the ',' here /\ has resulted in a space /\ in +# the output. +# +# More details on the SubformatPattern can be found on the API link above. +# +# 3) GenerateLogMessage/Velocity Macro +# This is the only processing that this file goes through. +# 1) Class Generation: +# The GenerateLogMessage processes this file and uses the velocity Macro +# to create classes with static methods to perform the logging and give us +# compile time validation. +# +# 2) Property Processing: +# During the class generation the message properties ({x}) are identified +# and used to create the method signature. +# +# 3) Option Processing: +# The Classes perform final formatting of the messages at runtime based on +# optional parameters that are defined within the message. Optional +# parameters are enclosed in square brackets e.g. [optional]. +# +# To provide fixed log messages as required by the Technical Specification: +# http://cwiki.apache.org/confluence/display/qpid/Operational+Logging+-+Status+Update+-+Technical+Specification#OperationalLogging-StatusUpdate-TechnicalSpecification-Howtoprovidefixedlogmessages +# +# This file is processed by Velocity to create a number of classes that contain +# static methods that provide LogMessages in the code to provide compile time +# validation. +# +# For details of what processing is done see GenerateLogMessages. +# +# What a localiser or developer need know is the following: +# +# The Property structure is important as it defines how the class and methods +# will be built. +# +# Class Generation: +# ================= +# +# Each class of messages will be split in to their own <Class>Messages.java. +# Each logmessage file contains only one class of messages the <Class> name +# is derived from the name of the logmessages file e.g. <Class>_logmessages.properties. +# +# Property Format +# =============== +# The property format MUST adhere to the follow format to make it easier to +# use the logging API as a developer but also so that operations staff can +# easily locate log messages in the output. +# +# The property file should contain entries in the following format +# +# <Log Identifier, developer focused> = <Log Identifier, Operate focus> : <Log Message> +# +# eg: +# SHUTTING_DOWN = BRK-1003 : Shutting down : {0} port {1,number,#} +# +# Note: the developer focused identifier will become a method name so only a +# valid method name should be used. Currently only '-' are converted to '_'. +# +# That said properties generate the logging code at build time so any error +# can be easily identified. +# +# The three character identifier show above in BRK-1003 should ideally be unique. +# This is the only requirement, limiting to 3 characters is not required. +# That said the current broker contains the following mappings. +# +# Class | Type +# ---------------------|-------- +# Broker | BKR +# ManagementConsole | MNG +# VirtualHost | VHT +# MessageStore | MST +# ConfigStore | CFG +# TransactionLog | TXN +# Connection | CON +# Channel | CHN +# Queue | QUE +# Exchange | EXH +# Binding | BND +# Subscription | SUB +# +# +# Property Processing: +# ==================== +# +# Each property is then processed by the GenerateLogMessages class to identify +# The number and type of parameters, {x} entries. Parameters are defaulted to +# String types but the use of FormatType number (e.g.{0,number}) will result +# in a Number type being used. These parameters are then used to build the +# method parameter list. e.g: +# Property: +# SHUTTING_DOWN = BRK-1003 : Shuting down : {0} port {1,number,#} +# becomes Method: +# public static LogMessage SHUTTING_DOWN(String param1, Number param2) +# +# This improves our compile time validation of log message content and +# ensures that change in the message format does not accidentally cause +# erroneous messages. +# +# Option Processing: +# ==================== +# +# Options are identified in the log message as being surrounded by square +# brackets ([ ]). These optional values can themselves contain parameters +# however nesting of options is not permitted. Identification is performed on +# first matching so given the message: +# Msg = Log Message [option1] [option2] +# Two options will be identified and enabled to select text 'option1' and +# 'option2'. +# +# The nesting of a options is not supported and will provide +# unexpected results. e.g. Using Message: +# Msg = Log Message [option1 [sub-option2]] +# +# The options will be 'option1 [sub-option2' and 'sub-option2'. The first +# option includes the second option as the nesting is not detected. +# +# The detected options are presented in the method signature as boolean options +# numerically identified by their position in the message. e.g. +# Property: +# CON-1001 = Open : Client ID {0} [: Protocol Version : {1}] +# becomes Method: +# public static LogMessage CON_1001(String param1, String param2, boolean opt1) +# +# The value of 'opt1' will show/hide the option in the message. Note that +# 'param2' is still required however a null value can be used if the optional +# section is not desired. +# +# Again here the importance of white space needs to be highlighted. +# Looking at the QUE-1001 message as an example. The first thought on how this +# would look would be as follows: +# QUE-1001 = Create : Owner: {0} [AutoDelete] [Durable] [Transient] [Priority: {1,number,#}] +# Each option is correctly defined so the text that is defined will appear when +# selected. e.g. 'AutoDelete'. However, what may not be immediately apparent is +# the white space. Using the above definition of QUE-1001 if we were to print +# the message with only the Priority option displayed it would appear as this: +# "Create : Owner: guest Priority: 1" +# Note the spaces here /\ This is because only the text between the brackets +# has been removed. +# +# Each option needs to include white space to correctly format the message. So +# the correct definition of QUE-1001 is as follows: +# QUE-1001 = Create : Owner: {0}[ AutoDelete][ Durable][ Transient][ Priority: {1,number,#}] +# Note that white space is included with each option and there is no extra +# white space between the options. As a result the output with just Priority +# enabled is as follows: +# "Create : Owner: guest Priority: 1" +# +# +# Default File used for all non-defined locales. + +# 0 - Client id +# 1 - Protocol Version +OPEN = CON-1001 : Open[ : Client ID : {0}][ : Protocol Version : {1}] +CLOSE = CON-1002 : Close
\ No newline at end of file diff --git a/java/broker/src/main/java/org/apache/qpid/server/logging/messages/Exchange_logmessages.properties b/java/broker/src/main/java/org/apache/qpid/server/logging/messages/Exchange_logmessages.properties new file mode 100644 index 0000000000..6df7c5862c --- /dev/null +++ b/java/broker/src/main/java/org/apache/qpid/server/logging/messages/Exchange_logmessages.properties @@ -0,0 +1,215 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# Default File used for all non-defined locales. +# +# This file was derivied from LogMessages used within the Java Broker and +# originally defined on the wiki: +# http://cwiki.apache.org/confluence/display/qpid/Status+Update+Design#StatusUpdateDesign-InitialStatusMessages +# +# Technical Notes: +# This is a standard Java Properties file so white space is respected at the +# end of the lines. This file is processed in a number of ways. +# 1) ResourceBundle +# This file is loaded as a ResourceBundle. The en_US +# addition to the file is the localisation. Additional localisations can be +# provided and will automatically be selected based on the <locale> value in +# the config.xml. The default is en_US. +# +# 2) MessasgeFormat +# Each entry is prepared with the Java Core MessageFormat methods. Therefore +# most functionality you can do via MessageFormat can be done here: +# +# http://java.sun.com/javase/6/docs/api/java/text/MessageFormat.html +# +# The cavet here is that only default String and number FormatTypes can be used. +# This is due to the processing described in 3 below. If support for date, time +# or choice is required then the GenerateLogMessages class should be updated to +# provide support. +# +# Format Note: +# As mentioned earlier white space in this file is very important. One thing +# in particular to note is the way MessageFormat performs its replacements. +# The replacement text will totally replace the {xxx} section so there will be +# no addition of white space or removal e.g. +# MSG = Text----{0}---- +# When given parameter 'Hello' result in text: +# Text----Hello---- +# +# For simple arguments this is expected however when using Style formats then +# it can be a little unexpected. In particular a common pattern is used for +# number replacements : {0,number,#}. This is used in the Broker to display an +# Integer simply as the Integer with no formatting. e.g new Integer(1234567) +# becomes the String "1234567" which is can be contrasted with the pattern +# without a style format field : {0,number} which becomes string "1,234,567". +# +# What you may not expect is that {0,number, #} would produce the String " 1234567" +# note the space after the ',' here /\ has resulted in a space /\ in +# the output. +# +# More details on the SubformatPattern can be found on the API link above. +# +# 3) GenerateLogMessage/Velocity Macro +# This is the only processing that this file goes through. +# 1) Class Generation: +# The GenerateLogMessage processes this file and uses the velocity Macro +# to create classes with static methods to perform the logging and give us +# compile time validation. +# +# 2) Property Processing: +# During the class generation the message properties ({x}) are identified +# and used to create the method signature. +# +# 3) Option Processing: +# The Classes perform final formatting of the messages at runtime based on +# optional parameters that are defined within the message. Optional +# parameters are enclosed in square brackets e.g. [optional]. +# +# To provide fixed log messages as required by the Technical Specification: +# http://cwiki.apache.org/confluence/display/qpid/Operational+Logging+-+Status+Update+-+Technical+Specification#OperationalLogging-StatusUpdate-TechnicalSpecification-Howtoprovidefixedlogmessages +# +# This file is processed by Velocity to create a number of classes that contain +# static methods that provide LogMessages in the code to provide compile time +# validation. +# +# For details of what processing is done see GenerateLogMessages. +# +# What a localiser or developer need know is the following: +# +# The Property structure is important as it defines how the class and methods +# will be built. +# +# Class Generation: +# ================= +# +# Each class of messages will be split in to their own <Class>Messages.java. +# Each logmessage file contains only one class of messages the <Class> name +# is derived from the name of the logmessages file e.g. <Class>_logmessages.properties. +# +# Property Format +# =============== +# The property format MUST adhere to the follow format to make it easier to +# use the logging API as a developer but also so that operations staff can +# easily locate log messages in the output. +# +# The property file should contain entries in the following format +# +# <Log Identifier, developer focused> = <Log Identifier, Operate focus> : <Log Message> +# +# eg: +# SHUTTING_DOWN = BRK-1003 : Shutting down : {0} port {1,number,#} +# +# Note: the developer focused identifier will become a method name so only a +# valid method name should be used. Currently only '-' are converted to '_'. +# +# That said properties generate the logging code at build time so any error +# can be easily identified. +# +# The three character identifier show above in BRK-1003 should ideally be unique. +# This is the only requirement, limiting to 3 characters is not required. +# That said the current broker contains the following mappings. +# +# Class | Type +# ---------------------|-------- +# Broker | BKR +# ManagementConsole | MNG +# VirtualHost | VHT +# MessageStore | MST +# ConfigStore | CFG +# TransactionLog | TXN +# Connection | CON +# Channel | CHN +# Queue | QUE +# Exchange | EXH +# Binding | BND +# Subscription | SUB +# +# +# Property Processing: +# ==================== +# +# Each property is then processed by the GenerateLogMessages class to identify +# The number and type of parameters, {x} entries. Parameters are defaulted to +# String types but the use of FormatType number (e.g.{0,number}) will result +# in a Number type being used. These parameters are then used to build the +# method parameter list. e.g: +# Property: +# SHUTTING_DOWN = BRK-1003 : Shuting down : {0} port {1,number,#} +# becomes Method: +# public static LogMessage SHUTTING_DOWN(String param1, Number param2) +# +# This improves our compile time validation of log message content and +# ensures that change in the message format does not accidentally cause +# erroneous messages. +# +# Option Processing: +# ==================== +# +# Options are identified in the log message as being surrounded by square +# brackets ([ ]). These optional values can themselves contain parameters +# however nesting of options is not permitted. Identification is performed on +# first matching so given the message: +# Msg = Log Message [option1] [option2] +# Two options will be identified and enabled to select text 'option1' and +# 'option2'. +# +# The nesting of a options is not supported and will provide +# unexpected results. e.g. Using Message: +# Msg = Log Message [option1 [sub-option2]] +# +# The options will be 'option1 [sub-option2' and 'sub-option2'. The first +# option includes the second option as the nesting is not detected. +# +# The detected options are presented in the method signature as boolean options +# numerically identified by their position in the message. e.g. +# Property: +# CON-1001 = Open : Client ID {0} [: Protocol Version : {1}] +# becomes Method: +# public static LogMessage CON_1001(String param1, String param2, boolean opt1) +# +# The value of 'opt1' will show/hide the option in the message. Note that +# 'param2' is still required however a null value can be used if the optional +# section is not desired. +# +# Again here the importance of white space needs to be highlighted. +# Looking at the QUE-1001 message as an example. The first thought on how this +# would look would be as follows: +# QUE-1001 = Create : Owner: {0} [AutoDelete] [Durable] [Transient] [Priority: {1,number,#}] +# Each option is correctly defined so the text that is defined will appear when +# selected. e.g. 'AutoDelete'. However, what may not be immediately apparent is +# the white space. Using the above definition of QUE-1001 if we were to print +# the message with only the Priority option displayed it would appear as this: +# "Create : Owner: guest Priority: 1" +# Note the spaces here /\ This is because only the text between the brackets +# has been removed. +# +# Each option needs to include white space to correctly format the message. So +# the correct definition of QUE-1001 is as follows: +# QUE-1001 = Create : Owner: {0}[ AutoDelete][ Durable][ Transient][ Priority: {1,number,#}] +# Note that white space is included with each option and there is no extra +# white space between the options. As a result the output with just Priority +# enabled is as follows: +# "Create : Owner: guest Priority: 1" +# +# +# Default File used for all non-defined locales. + +# 0 - type +# 1 - name +CREATED = EXH-1001 : Create :[ Durable] Type: {0} Name: {1} +DELETED = EXH-1002 : Deleted
\ No newline at end of file diff --git a/java/broker/src/main/java/org/apache/qpid/server/logging/messages/LogMessages.properties b/java/broker/src/main/java/org/apache/qpid/server/logging/messages/LogMessages.properties deleted file mode 100644 index 9e19b44430..0000000000 --- a/java/broker/src/main/java/org/apache/qpid/server/logging/messages/LogMessages.properties +++ /dev/null @@ -1,325 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -# Default File used for all non-defined locales. -# -# LogMessages used within the Java Broker as originally defined on the wiki: -# http://cwiki.apache.org/confluence/display/qpid/Status+Update+Design#StatusUpdateDesign-InitialStatusMessages -# -# Technical Notes: -# This is a standard Java Properties file so white space is respected at the -# end of the lines. This file is processed in a number of ways. -# 1) ResourceBundle -# This file is loaded through a ResourceBundle named LogMessages. the en_US -# addition to the file is the localisation. Additional localisations can be -# provided and will automatically be selected based on the <locale> value in -# the config.xml. The default is en_US. -# -# 2) MessasgeFormat -# Each entry is prepared with the Java Core MessageFormat methods. Therefore -# most functionality you can do via MessageFormat can be done here: -# -# http://java.sun.com/javase/6/docs/api/java/text/MessageFormat.html -# -# The cavet here is that only default String and number FormatTypes can be used. -# This is due to the processing described in 3 below. If support for date, time -# or choice is requried then the GenerateLogMessages class should be updated to -# provide support. -# -# Format Note: -# As mentioned earlier white space in this file is very important. One thing -# in particular to note is the way MessageFormat peforms its replacements. -# The replacement text will totally replace the {xxx} section so there will be -# no addtion of white space or removal e.g. -# MSG = Text----{0}---- -# When given parameter 'Hello' result in text: -# Text----Hello---- -# -# For simple arguments this is expected however when using Style formats then -# it can be a little unexepcted. In particular a common pattern is used for -# number replacements : {0,number,#}. This is used in the Broker to display an -# Integer simply as the Integer with no formating. e.g new Integer(1234567) -# becomes the String "1234567" which is can be contrasted with the pattern -# without a style format field : {0,number} which becomes string "1,234,567". -# -# What you may not expect is that {0,number, #} would produce the String " 1234567" -# note the space after the ',' here /\ has resulted in a space /\ in -# the output. -# -# More details on the SubformatPattern can be found on the API link above. -# -# 3) GenerateLogMessage/Velocity Macro -# This is the first and final stage of processing that this file goes through. -# 1) Class Generation: -# The GenerateLogMessage processes this file and uses the velocity Macro -# to create classes with static methods to perform the logging and give us -# compile time validation. -# -# 2) Property Processing: -# During the class generation the message properties ({x}) are identified -# and used to create the method signature. -# -# 3) Option Processing: -# The Classes perform final formatting of the messages at runtime based on -# optional parameters that are defined within the message. Optional -# paramters are enclosed in square brackets e.g. [optional]. -# -# To provide fixed log messages as required by the Technical Specification: -# http://cwiki.apache.org/confluence/display/qpid/Operational+Logging+-+Status+Update+-+Technical+Specification#OperationalLogging-StatusUpdate-TechnicalSpecification-Howtoprovidefixedlogmessages -# -# This file is processed by Velocity to create a number of classes that contain -# static methods that provide LogMessages in the code to provide compile time -# validation. -# -# For details of what processing is done see GenerateLogMessages. -# -# What a localiser or developer need know is the following: -# -# The Property structure is important is it defines how the class and methods -# will be built. -# -# Class Generation: -# ================= -# -# Each class of messages will be split in to their own <Class>Messages.java -# Currently the following classes are created and are populated with the -# messages that bear their 3-digit type identifier: -# -# Class | Type -# ---------------------|-------- -# Broker | BKR -# ManagementConsole | MNG -# VirtualHost | VHT -# MessageStore | MST -# ConfigStore | CFG -# TransactionLog | TXN -# Connection | CON -# Channel | CHN -# Queue | QUE -# Exchange | EXH -# Binding | BND -# Subscription | SUB -# -# Property Format -# =============== -# The property format MUST adhere to the follow format to make it easier to -# use the logging API as a developer but also so that operations staff can -# easily locate log messages in the output. -# -# The property file should contain entries in the following format -# -# <Log Identifier, developer focused> = <Log Identifier, Operate focus> : <Log Message> -# -# eg: -# BRK_SHUTTING_DOWN = BRK-1003 : Shuting down : {0} port {1,number,#} -# -# Note: the developer focused identifier will become a method name so only a -# valid method name should be used. Currently only '-' are converted to '_'. -# -# That said properties generate the logging code at build time so any error -# can be easily identified. -# -# Property Processing: -# ==================== -# -# Each property is then processed by the GenerateLogMessages class to identify -# The number and type of parameters, {x} entries. Parameters are defaulted to -# String types but the use of FormatType number (e.g.{0,number}) will result -# in a Number type being used. These parameters are then used to build the -# method parameter list. e.g: -# Property: -# BRK_SHUTTING_DOWN = BRK-1003 : Shuting down : {0} port {1,number,#} -# becomes Method: -# public static LogMessage BRK_SHUTTING_DOWN(String param1, Number param2) -# -# This improves our compile time validation of log message content and -# ensures that change in the message format does not accidentally cause -# erroneous messages. -# -# Option Processing: -# ==================== -# -# Options are identified in the log message as being surrounded by square -# brackets ([ ]). These optional values can themselves contain paramters -# however nesting of options is not permitted. Identification is performed on -# first matchings so give the message: -# Msg = Log Message [option1] [option2] -# Two options will be identifed and enabled to select text 'option1 and -# 'option2'. -# -# The nesting of a options is not supported and will provide -# unexpected results. e.g. Using Message: -# Msg = Log Message [option1 [sub-option2]] -# -# The options will be 'option1 [sub-option2' and 'sub-option2'. The first -# option includes the second option as the nesting is not detected. -# -# The detected options are presented in the method signature as boolean options -# numerically identified by their position in the message. e.g. -# Property: -# CON-1001 = Open : Client ID {0} [: Protocol Version : {1}] -# becomes Method: -# public static LogMessage CON_1001(String param1, String param2, boolean opt1) -# -# The value of 'opt1' will show/hide the option in the message. Note that -# 'param2' is still required however a null value can be used if the optional -# section is not desired. -# -# Again here the importance of white space needs to be highlighted. -# Looking at the QUE-1001 message as an example. The first thought on how this -# would look would be as follows: -# QUE-1001 = Create : Owner: {0} [AutoDelete] [Durable] [Transient] [Priority: {1,number,#}] -# Each option is correctly defined so the text that is defined will appear when -# selected. e.g. 'AutoDelete'. However, what may not be immediately apparent is -# the white space. Using the above definition of QUE-1001 if we were to print -# the message with only the Priority option displayed it would appear as this: -# "Create : Owner: guest Priority: 1" -# Note the spaces here /\ This is because only the text between the brackets -# has been removed. -# -# Each option needs to include white space to correctly format the message. So -# the correct definition of QUE-1001 is as follows: -# QUE-1001 = Create : Owner: {0}[ AutoDelete][ Durable][ Transient][ Priority: {1,number,#}] -# Note that white space is included with each option and there is no extra -# white space between the options. As a result the output with just Priority -# enabled is as follows: -# "Create : Owner: guest Priority: 1" -# -# The final processing that is done in the generation is the conversion of the -# property name. As a '-' is an illegal character in the method name it is -# converted to '_' This processing gives the final method signature as follows: -# <Class>Message.<Type>_<Number>(<parmaters>,<options>) -# -# -# Default File used for all non-defined locales. -BRK=Broker -# 0 - Version -# 1 = Build -BRK_STARTUP = BRK-1001 : Startup : Version: {0} Build: {1} -# 0 - Transport -# 1 - Port -BRK_LISTENING = BRK-1002 : Starting : Listening on {0} port {1,number,#} -# 0 - Transport -# 1 - Port -BRK_SHUTTING_DOWN = BRK-1003 : Shuting down : {0} port {1,number,#} -BRK_READY = BRK-1004 : Ready -BRK_STOPPED = BRK-1005 : Stopped -# 0 - path -BRK_CONFIG = BRK-1006 : Using configuration : {0} -# 0 - path -BRK_LOG_CONFIG = BRK-1007 : Using logging configuration : {0} - - -MNG=ManagementConsole -MNG_STARTUP = MNG-1001 : Startup -# 0 - Service -# 1 - Port -MNG_LISTENING = MNG-1002 : Starting : {0} : Listening on port {1,number,#} -# 0 - Service -# 1 - Port -MNG_SHUTTING_DOWN = MNG-1003 : Shuting down : {0} : port {1,number,#} -MNG_READY = MNG-1004 : Ready -MNG_STOPPED = MNG-1005 : Stopped -# 0 - Path -MNG_SSL_KEYSTORE = MNG-1006 : Using SSL Keystore : {0} -MNG_OPEN = MNG-1007 : Open : User {0} -MNG_CLOSE = MNG-1008 : Close - - -VHT=VirtualHost - -# 0 - name -VHT_CREATED = VHT-1001 : Created : {0} -VHT_CLOSED = VHT-1002 : Closed - -MST=MessageStore -# 0 - name -MST_CREATED = MST-1001 : Created : {0} -# 0 - path -MST_STORE_LOCATION = MST-1002 : Store location : {0} -MST_CLOSED = MST-1003 : Closed -MST_RECOVERY_START = MST-1004 : Recovery Start -MST_RECOVERED = MST-1005 : Recovered {0,number} messages -MST_RECOVERY_COMPLETE = MST-1006 : Recovery Complete - -CFG=ConfigStore -# 0 - name -CFG_1001 = CFG-1001 : Created : {0} -# 0 - path -CFG_1002 = CFG-1002 : Store location : {0} -CFG_1003 = CFG-1003 : Closed -CFG_1004 = CFG-1004 : Recovery Start -CFG_1005 = CFG-1005 : Recovery Complete - -TXN=TransactionLog -# 0 - name -TXN_1001 = TXN-1001 : Created : {0} -# 0 - path -TXN_1002 = TXN-1002 : Store location : {0} -TXN_1003 = TXN-1003 : Closed -# 0 - queue name -TXN_1004 = TXN-1004 : Recovery Start[ : {0}] -# 0 - count -# 1 - queue count -TXN_1005 = TXN-1005 : Recovered {0,number} messages for queue {1} -# 0 - queue name -TXN_1006 = TXN-1006 : Recovery Complete[ : {0}] - -CON=Connection -# 0 - Client id -# 1 - Protocol Version -CON_OPEN = CON-1001 : Open[ : Client ID : {0}][ : Protocol Version : {1}] -CON_CLOSE = CON-1002 : Close - -CHN=Channel -CHN_CREATE = CHN-1001 : Create -# 0 - flow -CHN_FLOW = CHN-1002 : Flow {0} -CHN_CLOSE = CHN-1003 : Close -# 0 - bytes allowed in prefetch -# 1 - number of messagse. -CHN_PREFETCH_SIZE = CHN-1004 : Prefetch Size (bytes) {0,number} : Count {1,number} -# 0 - queue causing flow control -CHN_FLOW_ENFORCED = CHN-1005 : Flow Control Enforced (Queue {0}) -CHN_FLOW_REMOVED = CHN-1006 : Flow Control Removed - -QUE=Queue -# 0 - owner -# 1 - priority -QUE_CREATED = QUE-1001 : Create :[ Owner: {0}][ AutoDelete][ Durable][ Transient][ Priority: {1,number,#}] -QUE_DELETED = QUE-1002 : Deleted -QUE_OVERFULL = QUE-1003 : Overfull : Size : {0,number} bytes, Capacity : {1,number} -QUE_UNDERFULL = QUE-1004 : Underfull : Size : {0,number} bytes, Resume Capacity : {1,number} - - -EXH=Exchange -# 0 - type -# 1 - name -EXH_CREATED = EXH-1001 : Create :[ Durable] Type: {0} Name: {1} -EXH_DELETED = EXH-1002 : Deleted - -BND=Binding -BND_CREATED = BND-1001 : Create[ : Arguments : {0}] -BND_DELETED = BND-1002 : Deleted - -SUB=Subscription -SUB_CREATE = SUB-1001 : Create[ : Durable][ : Arguments : {0}] -SUB_CLOSE = SUB-1002 : Close -# 0 - The current subscription state -SUB_STATE = SUB-1003 : State : {0} - diff --git a/java/broker/src/main/java/org/apache/qpid/server/logging/messages/ManagementConsole_logmessages.properties b/java/broker/src/main/java/org/apache/qpid/server/logging/messages/ManagementConsole_logmessages.properties new file mode 100644 index 0000000000..910706a250 --- /dev/null +++ b/java/broker/src/main/java/org/apache/qpid/server/logging/messages/ManagementConsole_logmessages.properties @@ -0,0 +1,224 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# Default File used for all non-defined locales. +# +# This file was derivied from LogMessages used within the Java Broker and +# originally defined on the wiki: +# http://cwiki.apache.org/confluence/display/qpid/Status+Update+Design#StatusUpdateDesign-InitialStatusMessages +# +# Technical Notes: +# This is a standard Java Properties file so white space is respected at the +# end of the lines. This file is processed in a number of ways. +# 1) ResourceBundle +# This file is loaded as a ResourceBundle. The en_US +# addition to the file is the localisation. Additional localisations can be +# provided and will automatically be selected based on the <locale> value in +# the config.xml. The default is en_US. +# +# 2) MessasgeFormat +# Each entry is prepared with the Java Core MessageFormat methods. Therefore +# most functionality you can do via MessageFormat can be done here: +# +# http://java.sun.com/javase/6/docs/api/java/text/MessageFormat.html +# +# The cavet here is that only default String and number FormatTypes can be used. +# This is due to the processing described in 3 below. If support for date, time +# or choice is required then the GenerateLogMessages class should be updated to +# provide support. +# +# Format Note: +# As mentioned earlier white space in this file is very important. One thing +# in particular to note is the way MessageFormat performs its replacements. +# The replacement text will totally replace the {xxx} section so there will be +# no addition of white space or removal e.g. +# MSG = Text----{0}---- +# When given parameter 'Hello' result in text: +# Text----Hello---- +# +# For simple arguments this is expected however when using Style formats then +# it can be a little unexpected. In particular a common pattern is used for +# number replacements : {0,number,#}. This is used in the Broker to display an +# Integer simply as the Integer with no formatting. e.g new Integer(1234567) +# becomes the String "1234567" which is can be contrasted with the pattern +# without a style format field : {0,number} which becomes string "1,234,567". +# +# What you may not expect is that {0,number, #} would produce the String " 1234567" +# note the space after the ',' here /\ has resulted in a space /\ in +# the output. +# +# More details on the SubformatPattern can be found on the API link above. +# +# 3) GenerateLogMessage/Velocity Macro +# This is the only processing that this file goes through. +# 1) Class Generation: +# The GenerateLogMessage processes this file and uses the velocity Macro +# to create classes with static methods to perform the logging and give us +# compile time validation. +# +# 2) Property Processing: +# During the class generation the message properties ({x}) are identified +# and used to create the method signature. +# +# 3) Option Processing: +# The Classes perform final formatting of the messages at runtime based on +# optional parameters that are defined within the message. Optional +# parameters are enclosed in square brackets e.g. [optional]. +# +# To provide fixed log messages as required by the Technical Specification: +# http://cwiki.apache.org/confluence/display/qpid/Operational+Logging+-+Status+Update+-+Technical+Specification#OperationalLogging-StatusUpdate-TechnicalSpecification-Howtoprovidefixedlogmessages +# +# This file is processed by Velocity to create a number of classes that contain +# static methods that provide LogMessages in the code to provide compile time +# validation. +# +# For details of what processing is done see GenerateLogMessages. +# +# What a localiser or developer need know is the following: +# +# The Property structure is important as it defines how the class and methods +# will be built. +# +# Class Generation: +# ================= +# +# Each class of messages will be split in to their own <Class>Messages.java. +# Each logmessage file contains only one class of messages the <Class> name +# is derived from the name of the logmessages file e.g. <Class>_logmessages.properties. +# +# Property Format +# =============== +# The property format MUST adhere to the follow format to make it easier to +# use the logging API as a developer but also so that operations staff can +# easily locate log messages in the output. +# +# The property file should contain entries in the following format +# +# <Log Identifier, developer focused> = <Log Identifier, Operate focus> : <Log Message> +# +# eg: +# SHUTTING_DOWN = BRK-1003 : Shutting down : {0} port {1,number,#} +# +# Note: the developer focused identifier will become a method name so only a +# valid method name should be used. Currently only '-' are converted to '_'. +# +# That said properties generate the logging code at build time so any error +# can be easily identified. +# +# The three character identifier show above in BRK-1003 should ideally be unique. +# This is the only requirement, limiting to 3 characters is not required. +# That said the current broker contains the following mappings. +# +# Class | Type +# ---------------------|-------- +# Broker | BKR +# ManagementConsole | MNG +# VirtualHost | VHT +# MessageStore | MST +# ConfigStore | CFG +# TransactionLog | TXN +# Connection | CON +# Channel | CHN +# Queue | QUE +# Exchange | EXH +# Binding | BND +# Subscription | SUB +# +# +# Property Processing: +# ==================== +# +# Each property is then processed by the GenerateLogMessages class to identify +# The number and type of parameters, {x} entries. Parameters are defaulted to +# String types but the use of FormatType number (e.g.{0,number}) will result +# in a Number type being used. These parameters are then used to build the +# method parameter list. e.g: +# Property: +# SHUTTING_DOWN = BRK-1003 : Shuting down : {0} port {1,number,#} +# becomes Method: +# public static LogMessage SHUTTING_DOWN(String param1, Number param2) +# +# This improves our compile time validation of log message content and +# ensures that change in the message format does not accidentally cause +# erroneous messages. +# +# Option Processing: +# ==================== +# +# Options are identified in the log message as being surrounded by square +# brackets ([ ]). These optional values can themselves contain parameters +# however nesting of options is not permitted. Identification is performed on +# first matching so given the message: +# Msg = Log Message [option1] [option2] +# Two options will be identified and enabled to select text 'option1' and +# 'option2'. +# +# The nesting of a options is not supported and will provide +# unexpected results. e.g. Using Message: +# Msg = Log Message [option1 [sub-option2]] +# +# The options will be 'option1 [sub-option2' and 'sub-option2'. The first +# option includes the second option as the nesting is not detected. +# +# The detected options are presented in the method signature as boolean options +# numerically identified by their position in the message. e.g. +# Property: +# CON-1001 = Open : Client ID {0} [: Protocol Version : {1}] +# becomes Method: +# public static LogMessage CON_1001(String param1, String param2, boolean opt1) +# +# The value of 'opt1' will show/hide the option in the message. Note that +# 'param2' is still required however a null value can be used if the optional +# section is not desired. +# +# Again here the importance of white space needs to be highlighted. +# Looking at the QUE-1001 message as an example. The first thought on how this +# would look would be as follows: +# QUE-1001 = Create : Owner: {0} [AutoDelete] [Durable] [Transient] [Priority: {1,number,#}] +# Each option is correctly defined so the text that is defined will appear when +# selected. e.g. 'AutoDelete'. However, what may not be immediately apparent is +# the white space. Using the above definition of QUE-1001 if we were to print +# the message with only the Priority option displayed it would appear as this: +# "Create : Owner: guest Priority: 1" +# Note the spaces here /\ This is because only the text between the brackets +# has been removed. +# +# Each option needs to include white space to correctly format the message. So +# the correct definition of QUE-1001 is as follows: +# QUE-1001 = Create : Owner: {0}[ AutoDelete][ Durable][ Transient][ Priority: {1,number,#}] +# Note that white space is included with each option and there is no extra +# white space between the options. As a result the output with just Priority +# enabled is as follows: +# "Create : Owner: guest Priority: 1" +# +# +# Default File used for all non-defined locales. + +STARTUP = MNG-1001 : Startup +# 0 - Service +# 1 - Port +LISTENING = MNG-1002 : Starting : {0} : Listening on port {1,number,#} +# 0 - Service +# 1 - Port +SHUTTING_DOWN = MNG-1003 : Shuting down : {0} : port {1,number,#} +READY = MNG-1004 : Ready +STOPPED = MNG-1005 : Stopped +# 0 - Path +SSL_KEYSTORE = MNG-1006 : Using SSL Keystore : {0} +OPEN = MNG-1007 : Open : User {0} +CLOSE = MNG-1008 : Close
\ No newline at end of file diff --git a/java/broker/src/main/java/org/apache/qpid/server/logging/messages/MessageStore_logmessages.properties b/java/broker/src/main/java/org/apache/qpid/server/logging/messages/MessageStore_logmessages.properties new file mode 100644 index 0000000000..d60fafd196 --- /dev/null +++ b/java/broker/src/main/java/org/apache/qpid/server/logging/messages/MessageStore_logmessages.properties @@ -0,0 +1,219 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# Default File used for all non-defined locales. +# +# This file was derivied from LogMessages used within the Java Broker and +# originally defined on the wiki: +# http://cwiki.apache.org/confluence/display/qpid/Status+Update+Design#StatusUpdateDesign-InitialStatusMessages +# +# Technical Notes: +# This is a standard Java Properties file so white space is respected at the +# end of the lines. This file is processed in a number of ways. +# 1) ResourceBundle +# This file is loaded as a ResourceBundle. The en_US +# addition to the file is the localisation. Additional localisations can be +# provided and will automatically be selected based on the <locale> value in +# the config.xml. The default is en_US. +# +# 2) MessasgeFormat +# Each entry is prepared with the Java Core MessageFormat methods. Therefore +# most functionality you can do via MessageFormat can be done here: +# +# http://java.sun.com/javase/6/docs/api/java/text/MessageFormat.html +# +# The cavet here is that only default String and number FormatTypes can be used. +# This is due to the processing described in 3 below. If support for date, time +# or choice is required then the GenerateLogMessages class should be updated to +# provide support. +# +# Format Note: +# As mentioned earlier white space in this file is very important. One thing +# in particular to note is the way MessageFormat performs its replacements. +# The replacement text will totally replace the {xxx} section so there will be +# no addition of white space or removal e.g. +# MSG = Text----{0}---- +# When given parameter 'Hello' result in text: +# Text----Hello---- +# +# For simple arguments this is expected however when using Style formats then +# it can be a little unexpected. In particular a common pattern is used for +# number replacements : {0,number,#}. This is used in the Broker to display an +# Integer simply as the Integer with no formatting. e.g new Integer(1234567) +# becomes the String "1234567" which is can be contrasted with the pattern +# without a style format field : {0,number} which becomes string "1,234,567". +# +# What you may not expect is that {0,number, #} would produce the String " 1234567" +# note the space after the ',' here /\ has resulted in a space /\ in +# the output. +# +# More details on the SubformatPattern can be found on the API link above. +# +# 3) GenerateLogMessage/Velocity Macro +# This is the only processing that this file goes through. +# 1) Class Generation: +# The GenerateLogMessage processes this file and uses the velocity Macro +# to create classes with static methods to perform the logging and give us +# compile time validation. +# +# 2) Property Processing: +# During the class generation the message properties ({x}) are identified +# and used to create the method signature. +# +# 3) Option Processing: +# The Classes perform final formatting of the messages at runtime based on +# optional parameters that are defined within the message. Optional +# parameters are enclosed in square brackets e.g. [optional]. +# +# To provide fixed log messages as required by the Technical Specification: +# http://cwiki.apache.org/confluence/display/qpid/Operational+Logging+-+Status+Update+-+Technical+Specification#OperationalLogging-StatusUpdate-TechnicalSpecification-Howtoprovidefixedlogmessages +# +# This file is processed by Velocity to create a number of classes that contain +# static methods that provide LogMessages in the code to provide compile time +# validation. +# +# For details of what processing is done see GenerateLogMessages. +# +# What a localiser or developer need know is the following: +# +# The Property structure is important as it defines how the class and methods +# will be built. +# +# Class Generation: +# ================= +# +# Each class of messages will be split in to their own <Class>Messages.java. +# Each logmessage file contains only one class of messages the <Class> name +# is derived from the name of the logmessages file e.g. <Class>_logmessages.properties. +# +# Property Format +# =============== +# The property format MUST adhere to the follow format to make it easier to +# use the logging API as a developer but also so that operations staff can +# easily locate log messages in the output. +# +# The property file should contain entries in the following format +# +# <Log Identifier, developer focused> = <Log Identifier, Operate focus> : <Log Message> +# +# eg: +# SHUTTING_DOWN = BRK-1003 : Shutting down : {0} port {1,number,#} +# +# Note: the developer focused identifier will become a method name so only a +# valid method name should be used. Currently only '-' are converted to '_'. +# +# That said properties generate the logging code at build time so any error +# can be easily identified. +# +# The three character identifier show above in BRK-1003 should ideally be unique. +# This is the only requirement, limiting to 3 characters is not required. +# That said the current broker contains the following mappings. +# +# Class | Type +# ---------------------|-------- +# Broker | BKR +# ManagementConsole | MNG +# VirtualHost | VHT +# MessageStore | MST +# ConfigStore | CFG +# TransactionLog | TXN +# Connection | CON +# Channel | CHN +# Queue | QUE +# Exchange | EXH +# Binding | BND +# Subscription | SUB +# +# +# Property Processing: +# ==================== +# +# Each property is then processed by the GenerateLogMessages class to identify +# The number and type of parameters, {x} entries. Parameters are defaulted to +# String types but the use of FormatType number (e.g.{0,number}) will result +# in a Number type being used. These parameters are then used to build the +# method parameter list. e.g: +# Property: +# SHUTTING_DOWN = BRK-1003 : Shuting down : {0} port {1,number,#} +# becomes Method: +# public static LogMessage SHUTTING_DOWN(String param1, Number param2) +# +# This improves our compile time validation of log message content and +# ensures that change in the message format does not accidentally cause +# erroneous messages. +# +# Option Processing: +# ==================== +# +# Options are identified in the log message as being surrounded by square +# brackets ([ ]). These optional values can themselves contain parameters +# however nesting of options is not permitted. Identification is performed on +# first matching so given the message: +# Msg = Log Message [option1] [option2] +# Two options will be identified and enabled to select text 'option1' and +# 'option2'. +# +# The nesting of a options is not supported and will provide +# unexpected results. e.g. Using Message: +# Msg = Log Message [option1 [sub-option2]] +# +# The options will be 'option1 [sub-option2' and 'sub-option2'. The first +# option includes the second option as the nesting is not detected. +# +# The detected options are presented in the method signature as boolean options +# numerically identified by their position in the message. e.g. +# Property: +# CON-1001 = Open : Client ID {0} [: Protocol Version : {1}] +# becomes Method: +# public static LogMessage CON_1001(String param1, String param2, boolean opt1) +# +# The value of 'opt1' will show/hide the option in the message. Note that +# 'param2' is still required however a null value can be used if the optional +# section is not desired. +# +# Again here the importance of white space needs to be highlighted. +# Looking at the QUE-1001 message as an example. The first thought on how this +# would look would be as follows: +# QUE-1001 = Create : Owner: {0} [AutoDelete] [Durable] [Transient] [Priority: {1,number,#}] +# Each option is correctly defined so the text that is defined will appear when +# selected. e.g. 'AutoDelete'. However, what may not be immediately apparent is +# the white space. Using the above definition of QUE-1001 if we were to print +# the message with only the Priority option displayed it would appear as this: +# "Create : Owner: guest Priority: 1" +# Note the spaces here /\ This is because only the text between the brackets +# has been removed. +# +# Each option needs to include white space to correctly format the message. So +# the correct definition of QUE-1001 is as follows: +# QUE-1001 = Create : Owner: {0}[ AutoDelete][ Durable][ Transient][ Priority: {1,number,#}] +# Note that white space is included with each option and there is no extra +# white space between the options. As a result the output with just Priority +# enabled is as follows: +# "Create : Owner: guest Priority: 1" +# +# +# Default File used for all non-defined locales. + +# 0 - name +CREATED = MST-1001 : Created : {0} +# 0 - path +STORE_LOCATION = MST-1002 : Store location : {0} +CLOSED = MST-1003 : Closed +RECOVERY_START = MST-1004 : Recovery Start +RECOVERED = MST-1005 : Recovered {0,number} messages +RECOVERY_COMPLETE = MST-1006 : Recovery Complete
\ No newline at end of file diff --git a/java/broker/src/main/java/org/apache/qpid/server/logging/messages/Queue_logmessages.properties b/java/broker/src/main/java/org/apache/qpid/server/logging/messages/Queue_logmessages.properties new file mode 100644 index 0000000000..59a8c87f76 --- /dev/null +++ b/java/broker/src/main/java/org/apache/qpid/server/logging/messages/Queue_logmessages.properties @@ -0,0 +1,217 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# Default File used for all non-defined locales. +# +# This file was derivied from LogMessages used within the Java Broker and +# originally defined on the wiki: +# http://cwiki.apache.org/confluence/display/qpid/Status+Update+Design#StatusUpdateDesign-InitialStatusMessages +# +# Technical Notes: +# This is a standard Java Properties file so white space is respected at the +# end of the lines. This file is processed in a number of ways. +# 1) ResourceBundle +# This file is loaded as a ResourceBundle. The en_US +# addition to the file is the localisation. Additional localisations can be +# provided and will automatically be selected based on the <locale> value in +# the config.xml. The default is en_US. +# +# 2) MessasgeFormat +# Each entry is prepared with the Java Core MessageFormat methods. Therefore +# most functionality you can do via MessageFormat can be done here: +# +# http://java.sun.com/javase/6/docs/api/java/text/MessageFormat.html +# +# The cavet here is that only default String and number FormatTypes can be used. +# This is due to the processing described in 3 below. If support for date, time +# or choice is required then the GenerateLogMessages class should be updated to +# provide support. +# +# Format Note: +# As mentioned earlier white space in this file is very important. One thing +# in particular to note is the way MessageFormat performs its replacements. +# The replacement text will totally replace the {xxx} section so there will be +# no addition of white space or removal e.g. +# MSG = Text----{0}---- +# When given parameter 'Hello' result in text: +# Text----Hello---- +# +# For simple arguments this is expected however when using Style formats then +# it can be a little unexpected. In particular a common pattern is used for +# number replacements : {0,number,#}. This is used in the Broker to display an +# Integer simply as the Integer with no formatting. e.g new Integer(1234567) +# becomes the String "1234567" which is can be contrasted with the pattern +# without a style format field : {0,number} which becomes string "1,234,567". +# +# What you may not expect is that {0,number, #} would produce the String " 1234567" +# note the space after the ',' here /\ has resulted in a space /\ in +# the output. +# +# More details on the SubformatPattern can be found on the API link above. +# +# 3) GenerateLogMessage/Velocity Macro +# This is the only processing that this file goes through. +# 1) Class Generation: +# The GenerateLogMessage processes this file and uses the velocity Macro +# to create classes with static methods to perform the logging and give us +# compile time validation. +# +# 2) Property Processing: +# During the class generation the message properties ({x}) are identified +# and used to create the method signature. +# +# 3) Option Processing: +# The Classes perform final formatting of the messages at runtime based on +# optional parameters that are defined within the message. Optional +# parameters are enclosed in square brackets e.g. [optional]. +# +# To provide fixed log messages as required by the Technical Specification: +# http://cwiki.apache.org/confluence/display/qpid/Operational+Logging+-+Status+Update+-+Technical+Specification#OperationalLogging-StatusUpdate-TechnicalSpecification-Howtoprovidefixedlogmessages +# +# This file is processed by Velocity to create a number of classes that contain +# static methods that provide LogMessages in the code to provide compile time +# validation. +# +# For details of what processing is done see GenerateLogMessages. +# +# What a localiser or developer need know is the following: +# +# The Property structure is important as it defines how the class and methods +# will be built. +# +# Class Generation: +# ================= +# +# Each class of messages will be split in to their own <Class>Messages.java. +# Each logmessage file contains only one class of messages the <Class> name +# is derived from the name of the logmessages file e.g. <Class>_logmessages.properties. +# +# Property Format +# =============== +# The property format MUST adhere to the follow format to make it easier to +# use the logging API as a developer but also so that operations staff can +# easily locate log messages in the output. +# +# The property file should contain entries in the following format +# +# <Log Identifier, developer focused> = <Log Identifier, Operate focus> : <Log Message> +# +# eg: +# SHUTTING_DOWN = BRK-1003 : Shutting down : {0} port {1,number,#} +# +# Note: the developer focused identifier will become a method name so only a +# valid method name should be used. Currently only '-' are converted to '_'. +# +# That said properties generate the logging code at build time so any error +# can be easily identified. +# +# The three character identifier show above in BRK-1003 should ideally be unique. +# This is the only requirement, limiting to 3 characters is not required. +# That said the current broker contains the following mappings. +# +# Class | Type +# ---------------------|-------- +# Broker | BKR +# ManagementConsole | MNG +# VirtualHost | VHT +# MessageStore | MST +# ConfigStore | CFG +# TransactionLog | TXN +# Connection | CON +# Channel | CHN +# Queue | QUE +# Exchange | EXH +# Binding | BND +# Subscription | SUB +# +# +# Property Processing: +# ==================== +# +# Each property is then processed by the GenerateLogMessages class to identify +# The number and type of parameters, {x} entries. Parameters are defaulted to +# String types but the use of FormatType number (e.g.{0,number}) will result +# in a Number type being used. These parameters are then used to build the +# method parameter list. e.g: +# Property: +# SHUTTING_DOWN = BRK-1003 : Shuting down : {0} port {1,number,#} +# becomes Method: +# public static LogMessage SHUTTING_DOWN(String param1, Number param2) +# +# This improves our compile time validation of log message content and +# ensures that change in the message format does not accidentally cause +# erroneous messages. +# +# Option Processing: +# ==================== +# +# Options are identified in the log message as being surrounded by square +# brackets ([ ]). These optional values can themselves contain parameters +# however nesting of options is not permitted. Identification is performed on +# first matching so given the message: +# Msg = Log Message [option1] [option2] +# Two options will be identified and enabled to select text 'option1' and +# 'option2'. +# +# The nesting of a options is not supported and will provide +# unexpected results. e.g. Using Message: +# Msg = Log Message [option1 [sub-option2]] +# +# The options will be 'option1 [sub-option2' and 'sub-option2'. The first +# option includes the second option as the nesting is not detected. +# +# The detected options are presented in the method signature as boolean options +# numerically identified by their position in the message. e.g. +# Property: +# CON-1001 = Open : Client ID {0} [: Protocol Version : {1}] +# becomes Method: +# public static LogMessage CON_1001(String param1, String param2, boolean opt1) +# +# The value of 'opt1' will show/hide the option in the message. Note that +# 'param2' is still required however a null value can be used if the optional +# section is not desired. +# +# Again here the importance of white space needs to be highlighted. +# Looking at the QUE-1001 message as an example. The first thought on how this +# would look would be as follows: +# QUE-1001 = Create : Owner: {0} [AutoDelete] [Durable] [Transient] [Priority: {1,number,#}] +# Each option is correctly defined so the text that is defined will appear when +# selected. e.g. 'AutoDelete'. However, what may not be immediately apparent is +# the white space. Using the above definition of QUE-1001 if we were to print +# the message with only the Priority option displayed it would appear as this: +# "Create : Owner: guest Priority: 1" +# Note the spaces here /\ This is because only the text between the brackets +# has been removed. +# +# Each option needs to include white space to correctly format the message. So +# the correct definition of QUE-1001 is as follows: +# QUE-1001 = Create : Owner: {0}[ AutoDelete][ Durable][ Transient][ Priority: {1,number,#}] +# Note that white space is included with each option and there is no extra +# white space between the options. As a result the output with just Priority +# enabled is as follows: +# "Create : Owner: guest Priority: 1" +# +# +# Default File used for all non-defined locales. + +# 0 - owner +# 1 - priority +CREATED = QUE-1001 : Create :[ Owner: {0}][ AutoDelete][ Durable][ Transient][ Priority: {1,number,#}] +DELETED = QUE-1002 : Deleted +OVERFULL = QUE-1003 : Overfull : Size : {0,number} bytes, Capacity : {1,number} +UNDERFULL = QUE-1004 : Underfull : Size : {0,number} bytes, Resume Capacity : {1,number} diff --git a/java/broker/src/main/java/org/apache/qpid/server/logging/messages/Subscription_logmessages.properties b/java/broker/src/main/java/org/apache/qpid/server/logging/messages/Subscription_logmessages.properties new file mode 100644 index 0000000000..7ad62d2049 --- /dev/null +++ b/java/broker/src/main/java/org/apache/qpid/server/logging/messages/Subscription_logmessages.properties @@ -0,0 +1,215 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# Default File used for all non-defined locales. +# +# This file was derivied from LogMessages used within the Java Broker and +# originally defined on the wiki: +# http://cwiki.apache.org/confluence/display/qpid/Status+Update+Design#StatusUpdateDesign-InitialStatusMessages +# +# Technical Notes: +# This is a standard Java Properties file so white space is respected at the +# end of the lines. This file is processed in a number of ways. +# 1) ResourceBundle +# This file is loaded as a ResourceBundle. The en_US +# addition to the file is the localisation. Additional localisations can be +# provided and will automatically be selected based on the <locale> value in +# the config.xml. The default is en_US. +# +# 2) MessasgeFormat +# Each entry is prepared with the Java Core MessageFormat methods. Therefore +# most functionality you can do via MessageFormat can be done here: +# +# http://java.sun.com/javase/6/docs/api/java/text/MessageFormat.html +# +# The cavet here is that only default String and number FormatTypes can be used. +# This is due to the processing described in 3 below. If support for date, time +# or choice is required then the GenerateLogMessages class should be updated to +# provide support. +# +# Format Note: +# As mentioned earlier white space in this file is very important. One thing +# in particular to note is the way MessageFormat performs its replacements. +# The replacement text will totally replace the {xxx} section so there will be +# no addition of white space or removal e.g. +# MSG = Text----{0}---- +# When given parameter 'Hello' result in text: +# Text----Hello---- +# +# For simple arguments this is expected however when using Style formats then +# it can be a little unexpected. In particular a common pattern is used for +# number replacements : {0,number,#}. This is used in the Broker to display an +# Integer simply as the Integer with no formatting. e.g new Integer(1234567) +# becomes the String "1234567" which is can be contrasted with the pattern +# without a style format field : {0,number} which becomes string "1,234,567". +# +# What you may not expect is that {0,number, #} would produce the String " 1234567" +# note the space after the ',' here /\ has resulted in a space /\ in +# the output. +# +# More details on the SubformatPattern can be found on the API link above. +# +# 3) GenerateLogMessage/Velocity Macro +# This is the only processing that this file goes through. +# 1) Class Generation: +# The GenerateLogMessage processes this file and uses the velocity Macro +# to create classes with static methods to perform the logging and give us +# compile time validation. +# +# 2) Property Processing: +# During the class generation the message properties ({x}) are identified +# and used to create the method signature. +# +# 3) Option Processing: +# The Classes perform final formatting of the messages at runtime based on +# optional parameters that are defined within the message. Optional +# parameters are enclosed in square brackets e.g. [optional]. +# +# To provide fixed log messages as required by the Technical Specification: +# http://cwiki.apache.org/confluence/display/qpid/Operational+Logging+-+Status+Update+-+Technical+Specification#OperationalLogging-StatusUpdate-TechnicalSpecification-Howtoprovidefixedlogmessages +# +# This file is processed by Velocity to create a number of classes that contain +# static methods that provide LogMessages in the code to provide compile time +# validation. +# +# For details of what processing is done see GenerateLogMessages. +# +# What a localiser or developer need know is the following: +# +# The Property structure is important as it defines how the class and methods +# will be built. +# +# Class Generation: +# ================= +# +# Each class of messages will be split in to their own <Class>Messages.java. +# Each logmessage file contains only one class of messages the <Class> name +# is derived from the name of the logmessages file e.g. <Class>_logmessages.properties. +# +# Property Format +# =============== +# The property format MUST adhere to the follow format to make it easier to +# use the logging API as a developer but also so that operations staff can +# easily locate log messages in the output. +# +# The property file should contain entries in the following format +# +# <Log Identifier, developer focused> = <Log Identifier, Operate focus> : <Log Message> +# +# eg: +# SHUTTING_DOWN = BRK-1003 : Shutting down : {0} port {1,number,#} +# +# Note: the developer focused identifier will become a method name so only a +# valid method name should be used. Currently only '-' are converted to '_'. +# +# That said properties generate the logging code at build time so any error +# can be easily identified. +# +# The three character identifier show above in BRK-1003 should ideally be unique. +# This is the only requirement, limiting to 3 characters is not required. +# That said the current broker contains the following mappings. +# +# Class | Type +# ---------------------|-------- +# Broker | BKR +# ManagementConsole | MNG +# VirtualHost | VHT +# MessageStore | MST +# ConfigStore | CFG +# TransactionLog | TXN +# Connection | CON +# Channel | CHN +# Queue | QUE +# Exchange | EXH +# Binding | BND +# Subscription | SUB +# +# +# Property Processing: +# ==================== +# +# Each property is then processed by the GenerateLogMessages class to identify +# The number and type of parameters, {x} entries. Parameters are defaulted to +# String types but the use of FormatType number (e.g.{0,number}) will result +# in a Number type being used. These parameters are then used to build the +# method parameter list. e.g: +# Property: +# SHUTTING_DOWN = BRK-1003 : Shuting down : {0} port {1,number,#} +# becomes Method: +# public static LogMessage SHUTTING_DOWN(String param1, Number param2) +# +# This improves our compile time validation of log message content and +# ensures that change in the message format does not accidentally cause +# erroneous messages. +# +# Option Processing: +# ==================== +# +# Options are identified in the log message as being surrounded by square +# brackets ([ ]). These optional values can themselves contain parameters +# however nesting of options is not permitted. Identification is performed on +# first matching so given the message: +# Msg = Log Message [option1] [option2] +# Two options will be identified and enabled to select text 'option1' and +# 'option2'. +# +# The nesting of a options is not supported and will provide +# unexpected results. e.g. Using Message: +# Msg = Log Message [option1 [sub-option2]] +# +# The options will be 'option1 [sub-option2' and 'sub-option2'. The first +# option includes the second option as the nesting is not detected. +# +# The detected options are presented in the method signature as boolean options +# numerically identified by their position in the message. e.g. +# Property: +# CON-1001 = Open : Client ID {0} [: Protocol Version : {1}] +# becomes Method: +# public static LogMessage CON_1001(String param1, String param2, boolean opt1) +# +# The value of 'opt1' will show/hide the option in the message. Note that +# 'param2' is still required however a null value can be used if the optional +# section is not desired. +# +# Again here the importance of white space needs to be highlighted. +# Looking at the QUE-1001 message as an example. The first thought on how this +# would look would be as follows: +# QUE-1001 = Create : Owner: {0} [AutoDelete] [Durable] [Transient] [Priority: {1,number,#}] +# Each option is correctly defined so the text that is defined will appear when +# selected. e.g. 'AutoDelete'. However, what may not be immediately apparent is +# the white space. Using the above definition of QUE-1001 if we were to print +# the message with only the Priority option displayed it would appear as this: +# "Create : Owner: guest Priority: 1" +# Note the spaces here /\ This is because only the text between the brackets +# has been removed. +# +# Each option needs to include white space to correctly format the message. So +# the correct definition of QUE-1001 is as follows: +# QUE-1001 = Create : Owner: {0}[ AutoDelete][ Durable][ Transient][ Priority: {1,number,#}] +# Note that white space is included with each option and there is no extra +# white space between the options. As a result the output with just Priority +# enabled is as follows: +# "Create : Owner: guest Priority: 1" +# +# +# Default File used for all non-defined locales. + +CREATE = SUB-1001 : Create[ : Durable][ : Arguments : {0}] +CLOSE = SUB-1002 : Close +# 0 - The current subscription state +STATE = SUB-1003 : State : {0}
\ No newline at end of file diff --git a/java/broker/src/main/java/org/apache/qpid/server/logging/messages/TransactionLog_logmessages.properties b/java/broker/src/main/java/org/apache/qpid/server/logging/messages/TransactionLog_logmessages.properties new file mode 100644 index 0000000000..fe50134cdd --- /dev/null +++ b/java/broker/src/main/java/org/apache/qpid/server/logging/messages/TransactionLog_logmessages.properties @@ -0,0 +1,223 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# Default File used for all non-defined locales. +# +# This file was derivied from LogMessages used within the Java Broker and +# originally defined on the wiki: +# http://cwiki.apache.org/confluence/display/qpid/Status+Update+Design#StatusUpdateDesign-InitialStatusMessages +# +# Technical Notes: +# This is a standard Java Properties file so white space is respected at the +# end of the lines. This file is processed in a number of ways. +# 1) ResourceBundle +# This file is loaded as a ResourceBundle. The en_US +# addition to the file is the localisation. Additional localisations can be +# provided and will automatically be selected based on the <locale> value in +# the config.xml. The default is en_US. +# +# 2) MessasgeFormat +# Each entry is prepared with the Java Core MessageFormat methods. Therefore +# most functionality you can do via MessageFormat can be done here: +# +# http://java.sun.com/javase/6/docs/api/java/text/MessageFormat.html +# +# The cavet here is that only default String and number FormatTypes can be used. +# This is due to the processing described in 3 below. If support for date, time +# or choice is required then the GenerateLogMessages class should be updated to +# provide support. +# +# Format Note: +# As mentioned earlier white space in this file is very important. One thing +# in particular to note is the way MessageFormat performs its replacements. +# The replacement text will totally replace the {xxx} section so there will be +# no addition of white space or removal e.g. +# MSG = Text----{0}---- +# When given parameter 'Hello' result in text: +# Text----Hello---- +# +# For simple arguments this is expected however when using Style formats then +# it can be a little unexpected. In particular a common pattern is used for +# number replacements : {0,number,#}. This is used in the Broker to display an +# Integer simply as the Integer with no formatting. e.g new Integer(1234567) +# becomes the String "1234567" which is can be contrasted with the pattern +# without a style format field : {0,number} which becomes string "1,234,567". +# +# What you may not expect is that {0,number, #} would produce the String " 1234567" +# note the space after the ',' here /\ has resulted in a space /\ in +# the output. +# +# More details on the SubformatPattern can be found on the API link above. +# +# 3) GenerateLogMessage/Velocity Macro +# This is the only processing that this file goes through. +# 1) Class Generation: +# The GenerateLogMessage processes this file and uses the velocity Macro +# to create classes with static methods to perform the logging and give us +# compile time validation. +# +# 2) Property Processing: +# During the class generation the message properties ({x}) are identified +# and used to create the method signature. +# +# 3) Option Processing: +# The Classes perform final formatting of the messages at runtime based on +# optional parameters that are defined within the message. Optional +# parameters are enclosed in square brackets e.g. [optional]. +# +# To provide fixed log messages as required by the Technical Specification: +# http://cwiki.apache.org/confluence/display/qpid/Operational+Logging+-+Status+Update+-+Technical+Specification#OperationalLogging-StatusUpdate-TechnicalSpecification-Howtoprovidefixedlogmessages +# +# This file is processed by Velocity to create a number of classes that contain +# static methods that provide LogMessages in the code to provide compile time +# validation. +# +# For details of what processing is done see GenerateLogMessages. +# +# What a localiser or developer need know is the following: +# +# The Property structure is important as it defines how the class and methods +# will be built. +# +# Class Generation: +# ================= +# +# Each class of messages will be split in to their own <Class>Messages.java. +# Each logmessage file contains only one class of messages the <Class> name +# is derived from the name of the logmessages file e.g. <Class>_logmessages.properties. +# +# Property Format +# =============== +# The property format MUST adhere to the follow format to make it easier to +# use the logging API as a developer but also so that operations staff can +# easily locate log messages in the output. +# +# The property file should contain entries in the following format +# +# <Log Identifier, developer focused> = <Log Identifier, Operate focus> : <Log Message> +# +# eg: +# SHUTTING_DOWN = BRK-1003 : Shutting down : {0} port {1,number,#} +# +# Note: the developer focused identifier will become a method name so only a +# valid method name should be used. Currently only '-' are converted to '_'. +# +# That said properties generate the logging code at build time so any error +# can be easily identified. +# +# The three character identifier show above in BRK-1003 should ideally be unique. +# This is the only requirement, limiting to 3 characters is not required. +# That said the current broker contains the following mappings. +# +# Class | Type +# ---------------------|-------- +# Broker | BKR +# ManagementConsole | MNG +# VirtualHost | VHT +# MessageStore | MST +# ConfigStore | CFG +# TransactionLog | TXN +# Connection | CON +# Channel | CHN +# Queue | QUE +# Exchange | EXH +# Binding | BND +# Subscription | SUB +# +# +# Property Processing: +# ==================== +# +# Each property is then processed by the GenerateLogMessages class to identify +# The number and type of parameters, {x} entries. Parameters are defaulted to +# String types but the use of FormatType number (e.g.{0,number}) will result +# in a Number type being used. These parameters are then used to build the +# method parameter list. e.g: +# Property: +# SHUTTING_DOWN = BRK-1003 : Shuting down : {0} port {1,number,#} +# becomes Method: +# public static LogMessage SHUTTING_DOWN(String param1, Number param2) +# +# This improves our compile time validation of log message content and +# ensures that change in the message format does not accidentally cause +# erroneous messages. +# +# Option Processing: +# ==================== +# +# Options are identified in the log message as being surrounded by square +# brackets ([ ]). These optional values can themselves contain parameters +# however nesting of options is not permitted. Identification is performed on +# first matching so given the message: +# Msg = Log Message [option1] [option2] +# Two options will be identified and enabled to select text 'option1' and +# 'option2'. +# +# The nesting of a options is not supported and will provide +# unexpected results. e.g. Using Message: +# Msg = Log Message [option1 [sub-option2]] +# +# The options will be 'option1 [sub-option2' and 'sub-option2'. The first +# option includes the second option as the nesting is not detected. +# +# The detected options are presented in the method signature as boolean options +# numerically identified by their position in the message. e.g. +# Property: +# CON-1001 = Open : Client ID {0} [: Protocol Version : {1}] +# becomes Method: +# public static LogMessage CON_1001(String param1, String param2, boolean opt1) +# +# The value of 'opt1' will show/hide the option in the message. Note that +# 'param2' is still required however a null value can be used if the optional +# section is not desired. +# +# Again here the importance of white space needs to be highlighted. +# Looking at the QUE-1001 message as an example. The first thought on how this +# would look would be as follows: +# QUE-1001 = Create : Owner: {0} [AutoDelete] [Durable] [Transient] [Priority: {1,number,#}] +# Each option is correctly defined so the text that is defined will appear when +# selected. e.g. 'AutoDelete'. However, what may not be immediately apparent is +# the white space. Using the above definition of QUE-1001 if we were to print +# the message with only the Priority option displayed it would appear as this: +# "Create : Owner: guest Priority: 1" +# Note the spaces here /\ This is because only the text between the brackets +# has been removed. +# +# Each option needs to include white space to correctly format the message. So +# the correct definition of QUE-1001 is as follows: +# QUE-1001 = Create : Owner: {0}[ AutoDelete][ Durable][ Transient][ Priority: {1,number,#}] +# Note that white space is included with each option and there is no extra +# white space between the options. As a result the output with just Priority +# enabled is as follows: +# "Create : Owner: guest Priority: 1" +# +# +# Default File used for all non-defined locales. + +# 0 - name +CREATED = TXN-1001 : Created : {0} +# 0 - path +STORE_LOCATION = TXN-1002 : Store location : {0} +CLOSED = TXN-1003 : Closed +# 0 - queue name +RECOVERY_START = TXN-1004 : Recovery Start[ : {0}] +# 0 - count +# 1 - queue count +RECOVERED = TXN-1005 : Recovered {0,number} messages for queue {1} +# 0 - queue name +RECOVERY_COMPLETE = TXN-1006 : Recovery Complete[ : {0}] diff --git a/java/broker/src/main/java/org/apache/qpid/server/logging/messages/VirtualHost_logmessages.properties b/java/broker/src/main/java/org/apache/qpid/server/logging/messages/VirtualHost_logmessages.properties new file mode 100644 index 0000000000..3129844495 --- /dev/null +++ b/java/broker/src/main/java/org/apache/qpid/server/logging/messages/VirtualHost_logmessages.properties @@ -0,0 +1,214 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# Default File used for all non-defined locales. +# +# This file was derivied from LogMessages used within the Java Broker and +# originally defined on the wiki: +# http://cwiki.apache.org/confluence/display/qpid/Status+Update+Design#StatusUpdateDesign-InitialStatusMessages +# +# Technical Notes: +# This is a standard Java Properties file so white space is respected at the +# end of the lines. This file is processed in a number of ways. +# 1) ResourceBundle +# This file is loaded as a ResourceBundle. The en_US +# addition to the file is the localisation. Additional localisations can be +# provided and will automatically be selected based on the <locale> value in +# the config.xml. The default is en_US. +# +# 2) MessasgeFormat +# Each entry is prepared with the Java Core MessageFormat methods. Therefore +# most functionality you can do via MessageFormat can be done here: +# +# http://java.sun.com/javase/6/docs/api/java/text/MessageFormat.html +# +# The cavet here is that only default String and number FormatTypes can be used. +# This is due to the processing described in 3 below. If support for date, time +# or choice is required then the GenerateLogMessages class should be updated to +# provide support. +# +# Format Note: +# As mentioned earlier white space in this file is very important. One thing +# in particular to note is the way MessageFormat performs its replacements. +# The replacement text will totally replace the {xxx} section so there will be +# no addition of white space or removal e.g. +# MSG = Text----{0}---- +# When given parameter 'Hello' result in text: +# Text----Hello---- +# +# For simple arguments this is expected however when using Style formats then +# it can be a little unexpected. In particular a common pattern is used for +# number replacements : {0,number,#}. This is used in the Broker to display an +# Integer simply as the Integer with no formatting. e.g new Integer(1234567) +# becomes the String "1234567" which is can be contrasted with the pattern +# without a style format field : {0,number} which becomes string "1,234,567". +# +# What you may not expect is that {0,number, #} would produce the String " 1234567" +# note the space after the ',' here /\ has resulted in a space /\ in +# the output. +# +# More details on the SubformatPattern can be found on the API link above. +# +# 3) GenerateLogMessage/Velocity Macro +# This is the only processing that this file goes through. +# 1) Class Generation: +# The GenerateLogMessage processes this file and uses the velocity Macro +# to create classes with static methods to perform the logging and give us +# compile time validation. +# +# 2) Property Processing: +# During the class generation the message properties ({x}) are identified +# and used to create the method signature. +# +# 3) Option Processing: +# The Classes perform final formatting of the messages at runtime based on +# optional parameters that are defined within the message. Optional +# parameters are enclosed in square brackets e.g. [optional]. +# +# To provide fixed log messages as required by the Technical Specification: +# http://cwiki.apache.org/confluence/display/qpid/Operational+Logging+-+Status+Update+-+Technical+Specification#OperationalLogging-StatusUpdate-TechnicalSpecification-Howtoprovidefixedlogmessages +# +# This file is processed by Velocity to create a number of classes that contain +# static methods that provide LogMessages in the code to provide compile time +# validation. +# +# For details of what processing is done see GenerateLogMessages. +# +# What a localiser or developer need know is the following: +# +# The Property structure is important as it defines how the class and methods +# will be built. +# +# Class Generation: +# ================= +# +# Each class of messages will be split in to their own <Class>Messages.java. +# Each logmessage file contains only one class of messages the <Class> name +# is derived from the name of the logmessages file e.g. <Class>_logmessages.properties. +# +# Property Format +# =============== +# The property format MUST adhere to the follow format to make it easier to +# use the logging API as a developer but also so that operations staff can +# easily locate log messages in the output. +# +# The property file should contain entries in the following format +# +# <Log Identifier, developer focused> = <Log Identifier, Operate focus> : <Log Message> +# +# eg: +# SHUTTING_DOWN = BRK-1003 : Shutting down : {0} port {1,number,#} +# +# Note: the developer focused identifier will become a method name so only a +# valid method name should be used. Currently only '-' are converted to '_'. +# +# That said properties generate the logging code at build time so any error +# can be easily identified. +# +# The three character identifier show above in BRK-1003 should ideally be unique. +# This is the only requirement, limiting to 3 characters is not required. +# That said the current broker contains the following mappings. +# +# Class | Type +# ---------------------|-------- +# Broker | BKR +# ManagementConsole | MNG +# VirtualHost | VHT +# MessageStore | MST +# ConfigStore | CFG +# TransactionLog | TXN +# Connection | CON +# Channel | CHN +# Queue | QUE +# Exchange | EXH +# Binding | BND +# Subscription | SUB +# +# +# Property Processing: +# ==================== +# +# Each property is then processed by the GenerateLogMessages class to identify +# The number and type of parameters, {x} entries. Parameters are defaulted to +# String types but the use of FormatType number (e.g.{0,number}) will result +# in a Number type being used. These parameters are then used to build the +# method parameter list. e.g: +# Property: +# SHUTTING_DOWN = BRK-1003 : Shuting down : {0} port {1,number,#} +# becomes Method: +# public static LogMessage SHUTTING_DOWN(String param1, Number param2) +# +# This improves our compile time validation of log message content and +# ensures that change in the message format does not accidentally cause +# erroneous messages. +# +# Option Processing: +# ==================== +# +# Options are identified in the log message as being surrounded by square +# brackets ([ ]). These optional values can themselves contain parameters +# however nesting of options is not permitted. Identification is performed on +# first matching so given the message: +# Msg = Log Message [option1] [option2] +# Two options will be identified and enabled to select text 'option1' and +# 'option2'. +# +# The nesting of a options is not supported and will provide +# unexpected results. e.g. Using Message: +# Msg = Log Message [option1 [sub-option2]] +# +# The options will be 'option1 [sub-option2' and 'sub-option2'. The first +# option includes the second option as the nesting is not detected. +# +# The detected options are presented in the method signature as boolean options +# numerically identified by their position in the message. e.g. +# Property: +# CON-1001 = Open : Client ID {0} [: Protocol Version : {1}] +# becomes Method: +# public static LogMessage CON_1001(String param1, String param2, boolean opt1) +# +# The value of 'opt1' will show/hide the option in the message. Note that +# 'param2' is still required however a null value can be used if the optional +# section is not desired. +# +# Again here the importance of white space needs to be highlighted. +# Looking at the QUE-1001 message as an example. The first thought on how this +# would look would be as follows: +# QUE-1001 = Create : Owner: {0} [AutoDelete] [Durable] [Transient] [Priority: {1,number,#}] +# Each option is correctly defined so the text that is defined will appear when +# selected. e.g. 'AutoDelete'. However, what may not be immediately apparent is +# the white space. Using the above definition of QUE-1001 if we were to print +# the message with only the Priority option displayed it would appear as this: +# "Create : Owner: guest Priority: 1" +# Note the spaces here /\ This is because only the text between the brackets +# has been removed. +# +# Each option needs to include white space to correctly format the message. So +# the correct definition of QUE-1001 is as follows: +# QUE-1001 = Create : Owner: {0}[ AutoDelete][ Durable][ Transient][ Priority: {1,number,#}] +# Note that white space is included with each option and there is no extra +# white space between the options. As a result the output with just Priority +# enabled is as follows: +# "Create : Owner: guest Priority: 1" +# +# +# Default File used for all non-defined locales. + +# 0 - name +CREATED = VHT-1001 : Created : {0} +CLOSED = VHT-1002 : Closed
\ No newline at end of file diff --git a/java/broker/src/main/java/org/apache/qpid/server/management/JMXManagedObjectRegistry.java b/java/broker/src/main/java/org/apache/qpid/server/management/JMXManagedObjectRegistry.java index 7ce0f6022b..90e0bba6f7 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/management/JMXManagedObjectRegistry.java +++ b/java/broker/src/main/java/org/apache/qpid/server/management/JMXManagedObjectRegistry.java @@ -102,7 +102,7 @@ public class JMXManagedObjectRegistry implements ManagedObjectRegistry public void start() throws IOException, ConfigurationException { - CurrentActor.get().message(ManagementConsoleMessages.MNG_STARTUP()); + CurrentActor.get().message(ManagementConsoleMessages.STARTUP()); //check if system properties are set to use the JVM's out-of-the-box JMXAgent if (areOutOfTheBoxJMXOptionsSet()) @@ -173,7 +173,7 @@ public class JMXManagedObjectRegistry implements ManagedObjectRegistry _log.info("JMX ConnectorServer using SSL keystore file " + ksf.getAbsolutePath()); _startupLog.info("JMX ConnectorServer using SSL keystore file " + ksf.getAbsolutePath()); - CurrentActor.get().message(ManagementConsoleMessages.MNG_SSL_KEYSTORE(ksf.getAbsolutePath())); + CurrentActor.get().message(ManagementConsoleMessages.SSL_KEYSTORE(ksf.getAbsolutePath())); } //check the key store password is set @@ -201,8 +201,8 @@ public class JMXManagedObjectRegistry implements ManagedObjectRegistry _startupLog.warn("Starting JMX ConnectorServer on port '"+ port + "' (+" + (port +PORT_EXPORT_OFFSET) + ") with SSL"); - CurrentActor.get().message(ManagementConsoleMessages.MNG_LISTENING("SSL RMI Registry", port)); - CurrentActor.get().message(ManagementConsoleMessages.MNG_LISTENING("SSL RMI ConnectorServer", port + PORT_EXPORT_OFFSET)); + CurrentActor.get().message(ManagementConsoleMessages.LISTENING("SSL RMI Registry", port)); + CurrentActor.get().message(ManagementConsoleMessages.LISTENING("SSL RMI ConnectorServer", port + PORT_EXPORT_OFFSET)); } else @@ -213,8 +213,8 @@ public class JMXManagedObjectRegistry implements ManagedObjectRegistry _log.warn("Starting JMX ConnectorServer on port '" + port + "' (+" + (port +PORT_EXPORT_OFFSET) + ")"); _startupLog.warn("Starting JMX ConnectorServer on port '" + port + "' (+" + (port +PORT_EXPORT_OFFSET) + ")"); - CurrentActor.get().message(ManagementConsoleMessages.MNG_LISTENING("RMI Registry", port)); - CurrentActor.get().message(ManagementConsoleMessages.MNG_LISTENING("RMI ConnectorServer", port + PORT_EXPORT_OFFSET)); + CurrentActor.get().message(ManagementConsoleMessages.LISTENING("RMI Registry", port)); + CurrentActor.get().message(ManagementConsoleMessages.LISTENING("RMI ConnectorServer", port + PORT_EXPORT_OFFSET)); } //add a JMXAuthenticator implementation the env map to authenticate the RMI based JMX connector server @@ -329,7 +329,7 @@ public class JMXManagedObjectRegistry implements ManagedObjectRegistry _cs.start(); - CurrentActor.get().message(ManagementConsoleMessages.MNG_READY()); + CurrentActor.get().message(ManagementConsoleMessages.READY()); } /* @@ -410,7 +410,7 @@ public class JMXManagedObjectRegistry implements ManagedObjectRegistry // Stopping the JMX ConnectorServer try { - CurrentActor.get().message(ManagementConsoleMessages.MNG_SHUTTING_DOWN("RMI ConnectorServer", _cs.getAddress().getPort())); + CurrentActor.get().message(ManagementConsoleMessages.SHUTTING_DOWN("RMI ConnectorServer", _cs.getAddress().getPort())); _cs.stop(); } catch (IOException e) @@ -422,7 +422,7 @@ public class JMXManagedObjectRegistry implements ManagedObjectRegistry if (_rmiRegistry != null) { // Stopping the RMI registry - CurrentActor.get().message(ManagementConsoleMessages.MNG_SHUTTING_DOWN("RMI Registry", _cs.getAddress().getPort() - PORT_EXPORT_OFFSET)); + CurrentActor.get().message(ManagementConsoleMessages.SHUTTING_DOWN("RMI Registry", _cs.getAddress().getPort() - PORT_EXPORT_OFFSET)); try { UnicastRemoteObject.unexportObject(_rmiRegistry, false); @@ -456,7 +456,7 @@ public class JMXManagedObjectRegistry implements ManagedObjectRegistry } } - CurrentActor.get().message(ManagementConsoleMessages.MNG_STOPPED()); + CurrentActor.get().message(ManagementConsoleMessages.STOPPED()); } } diff --git a/java/broker/src/main/java/org/apache/qpid/server/management/MBeanInvocationHandlerImpl.java b/java/broker/src/main/java/org/apache/qpid/server/management/MBeanInvocationHandlerImpl.java index 7e7ac94d06..e0a7c9c756 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/management/MBeanInvocationHandlerImpl.java +++ b/java/broker/src/main/java/org/apache/qpid/server/management/MBeanInvocationHandlerImpl.java @@ -301,12 +301,12 @@ public class MBeanInvocationHandlerImpl implements InvocationHandler, Notificati if (notification.getType().equals(JMXConnectionNotification.OPENED)) { - _logActor.message(ManagementConsoleMessages.MNG_OPEN(user)); + _logActor.message(ManagementConsoleMessages.OPEN(user)); } else if (notification.getType().equals(JMXConnectionNotification.CLOSED) || notification.getType().equals(JMXConnectionNotification.FAILED)) { - _logActor.message(ManagementConsoleMessages.MNG_CLOSE()); + _logActor.message(ManagementConsoleMessages.CLOSE()); } } } diff --git a/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQProtocolEngine.java b/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQProtocolEngine.java index 25571f1022..5d1346ffd8 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQProtocolEngine.java +++ b/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQProtocolEngine.java @@ -196,7 +196,7 @@ public class AMQProtocolEngine implements ProtocolEngine, Managable, AMQProtocol _id = _configStore.createId(); - _actor.message(ConnectionMessages.CON_OPEN(null, null, false, false)); + _actor.message(ConnectionMessages.OPEN(null, null, false, false)); } @@ -347,7 +347,7 @@ public class AMQProtocolEngine implements ProtocolEngine, Managable, AMQProtocol try { // Log incomming protocol negotiation request - _actor.message(ConnectionMessages.CON_OPEN(null, pi._protocolMajor + "-" + pi._protocolMinor, false, true)); + _actor.message(ConnectionMessages.OPEN(null, pi._protocolMajor + "-" + pi._protocolMinor, false, true)); ProtocolVersion pv = pi.checkVersion(); // Fails if not correct @@ -746,7 +746,7 @@ public class AMQProtocolEngine implements ProtocolEngine, Managable, AMQProtocol notifyAll(); } _poolReference.releaseExecutorService(); - CurrentActor.get().message(_logSubject, ConnectionMessages.CON_CLOSE()); + CurrentActor.get().message(_logSubject, ConnectionMessages.CLOSE()); } } else @@ -866,7 +866,7 @@ public class AMQProtocolEngine implements ProtocolEngine, Managable, AMQProtocol setContextKey(new AMQShortString(clientID)); // Log the Opening of the connection for this client - _actor.message(ConnectionMessages.CON_OPEN(clientID, _protocolVersion.toString(), true, true)); + _actor.message(ConnectionMessages.OPEN(clientID, _protocolVersion.toString(), true, true)); } if (_clientProperties.getString(ClientProperties.version.toString()) != null) diff --git a/java/broker/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java b/java/broker/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java index b3e0b4fba9..f81a4a6911 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java +++ b/java/broker/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java @@ -25,9 +25,7 @@ import org.apache.qpid.AMQSecurityException; import org.apache.qpid.framing.AMQShortString; import org.apache.qpid.pool.ReadWriteRunnable; import org.apache.qpid.pool.ReferenceCountingExecutorService; -import org.apache.qpid.protocol.AMQConstant; import org.apache.qpid.server.AMQChannel; -import org.apache.qpid.server.protocol.AMQConnectionModel; import org.apache.qpid.server.protocol.AMQSessionModel; import org.apache.qpid.server.binding.Binding; import org.apache.qpid.server.configuration.ConfigStore; @@ -256,7 +254,7 @@ public class SimpleAMQQueue implements AMQQueue, Subscription.StateListener // Log the creation of this Queue. // The priorities display is toggled on if we set priorities > 0 CurrentActor.get().message(_logSubject, - QueueMessages.QUE_CREATED(String.valueOf(_owner), + QueueMessages.CREATED(String.valueOf(_owner), priorities, _owner != null, autoDelete, @@ -1467,7 +1465,7 @@ public class SimpleAMQQueue implements AMQQueue, Subscription.StateListener stop(); //Log Queue Deletion - CurrentActor.get().message(_logSubject, QueueMessages.QUE_DELETED()); + CurrentActor.get().message(_logSubject, QueueMessages.DELETED()); } return getMessageCount(); @@ -1490,7 +1488,7 @@ public class SimpleAMQQueue implements AMQQueue, Subscription.StateListener { _overfull.set(true); //Overfull log message - _logActor.message(_logSubject, QueueMessages.QUE_OVERFULL(_atomicQueueSize.get(), _capacity)); + _logActor.message(_logSubject, QueueMessages.OVERFULL(_atomicQueueSize.get(), _capacity)); if(_blockedChannels.putIfAbsent(channel, Boolean.TRUE)==null) { @@ -1501,7 +1499,7 @@ public class SimpleAMQQueue implements AMQQueue, Subscription.StateListener { //Underfull log message - _logActor.message(_logSubject, QueueMessages.QUE_UNDERFULL(_atomicQueueSize.get(), _flowResumeCapacity)); + _logActor.message(_logSubject, QueueMessages.UNDERFULL(_atomicQueueSize.get(), _flowResumeCapacity)); channel.unblock(this); _blockedChannels.remove(channel); @@ -1523,7 +1521,7 @@ public class SimpleAMQQueue implements AMQQueue, Subscription.StateListener { if(_overfull.compareAndSet(true,false)) {//Underfull log message - _logActor.message(_logSubject, QueueMessages.QUE_UNDERFULL(_atomicQueueSize.get(), _flowResumeCapacity)); + _logActor.message(_logSubject, QueueMessages.UNDERFULL(_atomicQueueSize.get(), _flowResumeCapacity)); } diff --git a/java/broker/src/main/java/org/apache/qpid/server/registry/ApplicationRegistry.java b/java/broker/src/main/java/org/apache/qpid/server/registry/ApplicationRegistry.java index 2164ef1b30..bc68fa0c79 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/registry/ApplicationRegistry.java +++ b/java/broker/src/main/java/org/apache/qpid/server/registry/ApplicationRegistry.java @@ -259,7 +259,7 @@ public abstract class ApplicationRegistry implements IApplicationRegistry _qmfService = new QMFService(getConfigStore(), this); - CurrentActor.get().message(BrokerMessages.BRK_STARTUP(QpidProperties.getReleaseVersion(), QpidProperties.getBuildVersion())); + CurrentActor.get().message(BrokerMessages.STARTUP(QpidProperties.getReleaseVersion(), QpidProperties.getBuildVersion())); initialiseManagedObjectRegistry(); @@ -367,7 +367,7 @@ public abstract class ApplicationRegistry implements IApplicationRegistry close(_pluginManager); - CurrentActor.get().message(BrokerMessages.BRK_STOPPED()); + CurrentActor.get().message(BrokerMessages.STOPPED()); } private void unbind() @@ -387,7 +387,7 @@ public abstract class ApplicationRegistry implements IApplicationRegistry _logger.error("Unable to close network driver due to:" + e.getMessage()); } - CurrentActor.get().message(BrokerMessages.BRK_SHUTTING_DOWN(acceptor.toString(), bindAddress.getPort())); + CurrentActor.get().message(BrokerMessages.SHUTTING_DOWN(acceptor.toString(), bindAddress.getPort())); } } } diff --git a/java/broker/src/main/java/org/apache/qpid/server/store/AbstractMessageStore.java b/java/broker/src/main/java/org/apache/qpid/server/store/AbstractMessageStore.java index ef8f1ab70e..b9adaeacdf 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/store/AbstractMessageStore.java +++ b/java/broker/src/main/java/org/apache/qpid/server/store/AbstractMessageStore.java @@ -21,7 +21,6 @@ package org.apache.qpid.server.store; import org.apache.qpid.server.virtualhost.VirtualHost; -import org.apache.qpid.server.configuration.VirtualHostConfiguration; import org.apache.qpid.server.logging.actors.CurrentActor; import org.apache.qpid.server.logging.messages.MessageStoreMessages; import org.apache.qpid.server.logging.subjects.MessageStoreLogSubject; @@ -34,11 +33,11 @@ public abstract class AbstractMessageStore implements MessageStore public void configure(VirtualHost virtualHost) throws Exception { _logSubject = new MessageStoreLogSubject(virtualHost, this); - CurrentActor.get().message(_logSubject, MessageStoreMessages.MST_CREATED(this.getClass().getName())); + CurrentActor.get().message(_logSubject, MessageStoreMessages.CREATED(this.getClass().getName())); } public void close() throws Exception { - CurrentActor.get().message(_logSubject,MessageStoreMessages.MST_CLOSED()); + CurrentActor.get().message(_logSubject,MessageStoreMessages.CLOSED()); } } diff --git a/java/broker/src/main/java/org/apache/qpid/server/store/DerbyMessageStore.java b/java/broker/src/main/java/org/apache/qpid/server/store/DerbyMessageStore.java index bea4648b30..40f265e00f 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/store/DerbyMessageStore.java +++ b/java/broker/src/main/java/org/apache/qpid/server/store/DerbyMessageStore.java @@ -152,7 +152,7 @@ public class DerbyMessageStore implements MessageStore { stateTransition(State.INITIAL, State.CONFIGURING); _logSubject = logSubject; - CurrentActor.get().message(_logSubject, ConfigStoreMessages.CFG_1001(this.getClass().getName())); + CurrentActor.get().message(_logSubject, ConfigStoreMessages.CREATED(this.getClass().getName())); if(!_configured) { @@ -174,7 +174,7 @@ public class DerbyMessageStore implements MessageStore Configuration storeConfiguration, LogSubject logSubject) throws Exception { - CurrentActor.get().message(_logSubject, MessageStoreMessages.MST_CREATED(this.getClass().getName())); + CurrentActor.get().message(_logSubject, MessageStoreMessages.CREATED(this.getClass().getName())); if(!_configured) { @@ -196,7 +196,7 @@ public class DerbyMessageStore implements MessageStore Configuration storeConfiguration, LogSubject logSubject) throws Exception { - CurrentActor.get().message(_logSubject, TransactionLogMessages.TXN_1001(this.getClass().getName())); + CurrentActor.get().message(_logSubject, TransactionLogMessages.CREATED(this.getClass().getName())); if(!_configured) { @@ -232,7 +232,7 @@ public class DerbyMessageStore implements MessageStore } } - CurrentActor.get().message(_logSubject, MessageStoreMessages.MST_STORE_LOCATION(environmentPath.getAbsolutePath())); + CurrentActor.get().message(_logSubject, MessageStoreMessages.STORE_LOCATION(environmentPath.getAbsolutePath())); createOrOpenDatabase(name, databasePath); } @@ -370,7 +370,7 @@ public class DerbyMessageStore implements MessageStore { stateTransition(State.CONFIGURING, State.RECOVERING); - CurrentActor.get().message(_logSubject,MessageStoreMessages.MST_RECOVERY_START()); + CurrentActor.get().message(_logSubject,MessageStoreMessages.RECOVERY_START()); try { @@ -517,7 +517,7 @@ public class DerbyMessageStore implements MessageStore public void close() throws Exception { - CurrentActor.get().message(_logSubject,MessageStoreMessages.MST_CLOSED()); + CurrentActor.get().message(_logSubject,MessageStoreMessages.CLOSED()); _closed.getAndSet(true); } diff --git a/java/broker/src/main/java/org/apache/qpid/server/store/MemoryMessageStore.java b/java/broker/src/main/java/org/apache/qpid/server/store/MemoryMessageStore.java index e3e9432e6b..565afd2539 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/store/MemoryMessageStore.java +++ b/java/broker/src/main/java/org/apache/qpid/server/store/MemoryMessageStore.java @@ -24,25 +24,17 @@ import org.apache.log4j.Logger; import org.apache.qpid.AMQException; import org.apache.qpid.framing.AMQShortString; import org.apache.qpid.framing.FieldTable; -import org.apache.qpid.framing.abstraction.ContentChunk; -import org.apache.qpid.server.message.MessageMetaData; import org.apache.qpid.server.exchange.Exchange; import org.apache.qpid.server.queue.AMQQueue; import org.apache.qpid.server.logging.LogSubject; import org.apache.qpid.server.logging.messages.MessageStoreMessages; import org.apache.qpid.server.logging.messages.ConfigStoreMessages; import org.apache.qpid.server.logging.actors.CurrentActor; -import org.apache.qpid.server.message.ServerMessage; import org.apache.commons.configuration.Configuration; -import java.util.ArrayList; -import java.util.Collections; import java.util.List; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicLong; -import java.nio.ByteBuffer; /** A simple message store that stores the messages in a threadsafe structure in memory. */ public class MemoryMessageStore implements MessageStore @@ -86,7 +78,7 @@ public class MemoryMessageStore implements MessageStore public void configureConfigStore(String name, ConfigurationRecoveryHandler handler, Configuration configuration, LogSubject logSubject) throws Exception { _logSubject = logSubject; - CurrentActor.get().message(_logSubject, ConfigStoreMessages.CFG_1001(this.getClass().getName())); + CurrentActor.get().message(_logSubject, ConfigStoreMessages.CREATED(this.getClass().getName())); } @@ -102,13 +94,13 @@ public class MemoryMessageStore implements MessageStore } int hashtableCapacity = config.getInt(name + "." + HASHTABLE_CAPACITY_CONFIG, DEFAULT_HASHTABLE_CAPACITY); _log.info("Using capacity " + hashtableCapacity + " for hash tables"); - CurrentActor.get().message(_logSubject, MessageStoreMessages.MST_CREATED(this.getClass().getName())); + CurrentActor.get().message(_logSubject, MessageStoreMessages.CREATED(this.getClass().getName())); } public void close() throws Exception { _closed.getAndSet(true); - CurrentActor.get().message(_logSubject,MessageStoreMessages.MST_CLOSED()); + CurrentActor.get().message(_logSubject,MessageStoreMessages.CLOSED()); } diff --git a/java/broker/src/main/java/org/apache/qpid/server/subscription/SubscriptionImpl.java b/java/broker/src/main/java/org/apache/qpid/server/subscription/SubscriptionImpl.java index eed57fbf39..1740e3db1a 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/subscription/SubscriptionImpl.java +++ b/java/broker/src/main/java/org/apache/qpid/server/subscription/SubscriptionImpl.java @@ -392,7 +392,7 @@ public abstract class SubscriptionImpl implements Subscription, FlowCreditManage CurrentActor.get(). message(_logSubject, - SubscriptionMessages.SUB_CREATE(filterLogString, + SubscriptionMessages.CREATE(filterLogString, queue.isDurable() && exclusive, filterLogString != null)); } @@ -535,7 +535,7 @@ public abstract class SubscriptionImpl implements Subscription, FlowCreditManage getConfigStore().removeConfiguredObject(this); //Log Subscription closed - CurrentActor.get().message(_logSubject, SubscriptionMessages.SUB_CLOSE()); + CurrentActor.get().message(_logSubject, SubscriptionMessages.CLOSE()); } public boolean isClosed() @@ -623,7 +623,7 @@ public abstract class SubscriptionImpl implements Subscription, FlowCreditManage _stateListener.stateChange(this, State.ACTIVE, State.SUSPENDED); } } - CurrentActor.get().message(_logSubject,SubscriptionMessages.SUB_STATE(_state.get().toString())); + CurrentActor.get().message(_logSubject,SubscriptionMessages.STATE(_state.get().toString())); } public State getState() diff --git a/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostConfigRecoveryHandler.java b/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostConfigRecoveryHandler.java index a1d0f62348..635155d1b0 100755 --- a/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostConfigRecoveryHandler.java +++ b/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostConfigRecoveryHandler.java @@ -87,7 +87,7 @@ public class VirtualHostConfigRecoveryHandler implements ConfigurationRecoveryHa { _logSubject = new MessageStoreLogSubject(_virtualHost,store); _store = store; - CurrentActor.get().message(_logSubject, TransactionLogMessages.TXN_1004(null, false)); + CurrentActor.get().message(_logSubject, TransactionLogMessages.RECOVERY_START(null, false)); return this; } @@ -107,7 +107,7 @@ public class VirtualHostConfigRecoveryHandler implements ConfigurationRecoveryHa _virtualHost.getQueueRegistry().registerQueue(q); } - CurrentActor.get().message(_logSubject, TransactionLogMessages.TXN_1004(queueName, true)); + CurrentActor.get().message(_logSubject, TransactionLogMessages.RECOVERY_START(queueName, true)); //Record that we have a queue for recovery _queueRecoveries.put(queueName, 0); @@ -348,12 +348,12 @@ public class VirtualHostConfigRecoveryHandler implements ConfigurationRecoveryHa for(Map.Entry<String,Integer> entry : _queueRecoveries.entrySet()) { - CurrentActor.get().message(_logSubject, TransactionLogMessages.TXN_1005(entry.getValue(), entry.getKey())); + CurrentActor.get().message(_logSubject, TransactionLogMessages.RECOVERED(entry.getValue(), entry.getKey())); - CurrentActor.get().message(_logSubject, TransactionLogMessages.TXN_1006(entry.getKey(), true)); + CurrentActor.get().message(_logSubject, TransactionLogMessages.RECOVERY_COMPLETE(entry.getKey(), true)); } - CurrentActor.get().message(_logSubject, TransactionLogMessages.TXN_1006(null, false)); + CurrentActor.get().message(_logSubject, TransactionLogMessages.RECOVERY_COMPLETE(null, false)); } } diff --git a/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostImpl.java b/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostImpl.java index 5ea4ade559..fcb06f56bf 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostImpl.java +++ b/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostImpl.java @@ -198,7 +198,7 @@ public class VirtualHostImpl implements VirtualHost _id = _appRegistry.getConfigStore().createId(); - CurrentActor.get().message(VirtualHostMessages.VHT_CREATED(_name)); + CurrentActor.get().message(VirtualHostMessages.CREATED(_name)); if (_name == null || _name.length() == 0) { @@ -596,7 +596,7 @@ public class VirtualHostImpl implements VirtualHost } } - CurrentActor.get().message(VirtualHostMessages.VHT_CLOSED()); + CurrentActor.get().message(VirtualHostMessages.CLOSED()); } public ManagedObject getBrokerMBean() diff --git a/java/broker/src/test/java/org/apache/qpid/server/logging/LogMessageTest.java b/java/broker/src/test/java/org/apache/qpid/server/logging/LogMessageTest.java index 9663ea4539..7a8cabf512 100644 --- a/java/broker/src/test/java/org/apache/qpid/server/logging/LogMessageTest.java +++ b/java/broker/src/test/java/org/apache/qpid/server/logging/LogMessageTest.java @@ -118,7 +118,7 @@ public class LogMessageTest extends TestCase * Inner class used by testSimultaneousLogging. * * This class creates a given number of LogMessages using the BrokerMessages package. - * BRK_CONFIG and BRK_LISTENING messages are both created per count. + * CONFIG and LISTENING messages are both created per count. * * This class is run multiple times simultaneously so that we increase the chance of * reproducing QPID-2137. This is reproduced when the pattern string used in the MessageFormat @@ -145,8 +145,8 @@ public class LogMessageTest extends TestCase // try and generate _count iterations of Config & Listening messages. for (int i = 0; i < _count; i++) { - BrokerMessages.BRK_CONFIG("Config"); - BrokerMessages.BRK_LISTENING("TCP", 1234); + BrokerMessages.CONFIG("Config"); + BrokerMessages.LISTENING("TCP", 1234); } } catch (Exception e) diff --git a/java/broker/src/test/java/org/apache/qpid/server/logging/messages/BindingMessagesTest.java b/java/broker/src/test/java/org/apache/qpid/server/logging/messages/BindingMessagesTest.java index 7a750baf06..22de8349c6 100644 --- a/java/broker/src/test/java/org/apache/qpid/server/logging/messages/BindingMessagesTest.java +++ b/java/broker/src/test/java/org/apache/qpid/server/logging/messages/BindingMessagesTest.java @@ -30,7 +30,7 @@ public class BindingMessagesTest extends AbstractTestMessages public void testBindCreate_NoArgs() { - _logMessage = BindingMessages.BND_CREATED(null, false); + _logMessage = BindingMessages.CREATED(null, false); List<Object> log = performLog(); String[] expected = {"Create"}; @@ -42,7 +42,7 @@ public class BindingMessagesTest extends AbstractTestMessages { String arguments = "arguments"; - _logMessage = BindingMessages.BND_CREATED(arguments, true); + _logMessage = BindingMessages.CREATED(arguments, true); List<Object> log = performLog(); String[] expected = {"Create", ": Arguments :", arguments}; @@ -52,7 +52,7 @@ public class BindingMessagesTest extends AbstractTestMessages public void testBindDelete() { - _logMessage = BindingMessages.BND_DELETED(); + _logMessage = BindingMessages.DELETED(); List<Object> log = performLog(); diff --git a/java/broker/src/test/java/org/apache/qpid/server/logging/messages/BrokerMessagesTest.java b/java/broker/src/test/java/org/apache/qpid/server/logging/messages/BrokerMessagesTest.java index 17306b2e2a..a3d46f5716 100644 --- a/java/broker/src/test/java/org/apache/qpid/server/logging/messages/BrokerMessagesTest.java +++ b/java/broker/src/test/java/org/apache/qpid/server/logging/messages/BrokerMessagesTest.java @@ -32,7 +32,7 @@ public class BrokerMessagesTest extends AbstractTestMessages String version = "Qpid 0.6"; String build = "796936M"; - _logMessage = BrokerMessages.BRK_STARTUP(version, build); + _logMessage = BrokerMessages.STARTUP(version, build); List<Object> log = performLog(); String[] expected = {"Startup :", "Version:", version, "Build:", build}; @@ -45,7 +45,7 @@ public class BrokerMessagesTest extends AbstractTestMessages String transport = "TCP"; Integer port = 2765; - _logMessage = BrokerMessages.BRK_LISTENING(transport, port); + _logMessage = BrokerMessages.LISTENING(transport, port); List<Object> log = performLog(); @@ -60,7 +60,7 @@ public class BrokerMessagesTest extends AbstractTestMessages String transport = "TCP"; Integer port = 2765; - _logMessage = BrokerMessages.BRK_SHUTTING_DOWN(transport, port); + _logMessage = BrokerMessages.SHUTTING_DOWN(transport, port); List<Object> log = performLog(); @@ -71,7 +71,7 @@ public class BrokerMessagesTest extends AbstractTestMessages public void testBrokerReady() { - _logMessage = BrokerMessages.BRK_READY(); + _logMessage = BrokerMessages.READY(); List<Object> log = performLog(); String[] expected = {"Ready"}; @@ -81,7 +81,7 @@ public class BrokerMessagesTest extends AbstractTestMessages public void testBrokerStopped() { - _logMessage = BrokerMessages.BRK_STOPPED(); + _logMessage = BrokerMessages.STOPPED(); List<Object> log = performLog(); String[] expected = {"Stopped"}; @@ -93,7 +93,7 @@ public class BrokerMessagesTest extends AbstractTestMessages { String path = "/file/path/to/configuration.xml"; - _logMessage = BrokerMessages.BRK_CONFIG(path); + _logMessage = BrokerMessages.CONFIG(path); List<Object> log = performLog(); String[] expected = {"Using configuration :", path}; @@ -105,7 +105,7 @@ public class BrokerMessagesTest extends AbstractTestMessages { String path = "/file/path/to/configuration.xml"; - _logMessage = BrokerMessages.BRK_LOG_CONFIG(path); + _logMessage = BrokerMessages.LOG_CONFIG(path); List<Object> log = performLog(); String[] expected = {"Using logging configuration :", path}; diff --git a/java/broker/src/test/java/org/apache/qpid/server/logging/messages/ChannelMessagesTest.java b/java/broker/src/test/java/org/apache/qpid/server/logging/messages/ChannelMessagesTest.java index 2d414e9e95..e94b79ba95 100644 --- a/java/broker/src/test/java/org/apache/qpid/server/logging/messages/ChannelMessagesTest.java +++ b/java/broker/src/test/java/org/apache/qpid/server/logging/messages/ChannelMessagesTest.java @@ -29,7 +29,7 @@ public class ChannelMessagesTest extends AbstractTestMessages { public void testChannelCreate() { - _logMessage = ChannelMessages.CHN_CREATE(); + _logMessage = ChannelMessages.CREATE(); List<Object> log = performLog(); // We use the MessageFormat here as that is what the ChannelMessage @@ -43,7 +43,7 @@ public class ChannelMessagesTest extends AbstractTestMessages { String flow = "ON"; - _logMessage = ChannelMessages.CHN_FLOW(flow); + _logMessage = ChannelMessages.FLOW(flow); List<Object> log = performLog(); String[] expected = {"Flow", flow}; @@ -53,7 +53,7 @@ public class ChannelMessagesTest extends AbstractTestMessages public void testChannelClose() { - _logMessage = ChannelMessages.CHN_CLOSE(); + _logMessage = ChannelMessages.CLOSE(); List<Object> log = performLog(); String[] expected = {"Close"}; diff --git a/java/broker/src/test/java/org/apache/qpid/server/logging/messages/ConnectionMessagesTest.java b/java/broker/src/test/java/org/apache/qpid/server/logging/messages/ConnectionMessagesTest.java index 6003cafc95..24fccf8446 100644 --- a/java/broker/src/test/java/org/apache/qpid/server/logging/messages/ConnectionMessagesTest.java +++ b/java/broker/src/test/java/org/apache/qpid/server/logging/messages/ConnectionMessagesTest.java @@ -32,7 +32,7 @@ public class ConnectionMessagesTest extends AbstractTestMessages String clientID = "client"; String protocolVersion = "8-0"; - _logMessage = ConnectionMessages.CON_OPEN(clientID, protocolVersion, true , true); + _logMessage = ConnectionMessages.OPEN(clientID, protocolVersion, true , true); List<Object> log = performLog(); String[] expected = {"Open :", "Client ID", clientID, @@ -45,7 +45,7 @@ public class ConnectionMessagesTest extends AbstractTestMessages { String clientID = "client"; - _logMessage = ConnectionMessages.CON_OPEN(clientID, null,true, false); + _logMessage = ConnectionMessages.OPEN(clientID, null,true, false); List<Object> log = performLog(); String[] expected = {"Open :", "Client ID", clientID}; @@ -57,7 +57,7 @@ public class ConnectionMessagesTest extends AbstractTestMessages { String protocolVersion = "8-0"; - _logMessage = ConnectionMessages.CON_OPEN(null, protocolVersion, false , true); + _logMessage = ConnectionMessages.OPEN(null, protocolVersion, false , true); List<Object> log = performLog(); String[] expected = {"Open", ": Protocol Version :", protocolVersion}; @@ -67,7 +67,7 @@ public class ConnectionMessagesTest extends AbstractTestMessages public void testConnectionOpen_WithNoClientIDNoProtocolVersion() { - _logMessage = ConnectionMessages.CON_OPEN(null, null,false, false); + _logMessage = ConnectionMessages.OPEN(null, null,false, false); List<Object> log = performLog(); String[] expected = {"Open"}; @@ -79,7 +79,7 @@ public class ConnectionMessagesTest extends AbstractTestMessages public void testConnectionClose() { - _logMessage = ConnectionMessages.CON_CLOSE(); + _logMessage = ConnectionMessages.CLOSE(); List<Object> log = performLog(); String[] expected = {"Close"}; diff --git a/java/broker/src/test/java/org/apache/qpid/server/logging/messages/ExchangeMessagesTest.java b/java/broker/src/test/java/org/apache/qpid/server/logging/messages/ExchangeMessagesTest.java index 174576b473..728a98e009 100644 --- a/java/broker/src/test/java/org/apache/qpid/server/logging/messages/ExchangeMessagesTest.java +++ b/java/broker/src/test/java/org/apache/qpid/server/logging/messages/ExchangeMessagesTest.java @@ -40,7 +40,7 @@ public class ExchangeMessagesTest extends AbstractTestMessages String type = exchange.getTypeShortString().toString(); String name = exchange.getNameShortString().toString(); - _logMessage = ExchangeMessages.EXH_CREATED(type, name, false); + _logMessage = ExchangeMessages.CREATED(type, name, false); List<Object> log = performLog(); String[] expected = {"Create :", "Type:", type, "Name:", name}; @@ -58,7 +58,7 @@ public class ExchangeMessagesTest extends AbstractTestMessages String type = exchange.getTypeShortString().toString(); String name = exchange.getNameShortString().toString(); - _logMessage = ExchangeMessages.EXH_CREATED(type, name, true); + _logMessage = ExchangeMessages.CREATED(type, name, true); List<Object> log = performLog(); String[] expected = {"Create :", "Durable", "Type:", type, "Name:", name}; @@ -69,7 +69,7 @@ public class ExchangeMessagesTest extends AbstractTestMessages public void testExchangeDeleted() { - _logMessage = ExchangeMessages.EXH_DELETED(); + _logMessage = ExchangeMessages.DELETED(); List<Object> log = performLog(); String[] expected = {"Deleted"}; diff --git a/java/broker/src/test/java/org/apache/qpid/server/logging/messages/ManagementConsoleMessagesTest.java b/java/broker/src/test/java/org/apache/qpid/server/logging/messages/ManagementConsoleMessagesTest.java index 9b1ab2c14d..ce0e9bb232 100644 --- a/java/broker/src/test/java/org/apache/qpid/server/logging/messages/ManagementConsoleMessagesTest.java +++ b/java/broker/src/test/java/org/apache/qpid/server/logging/messages/ManagementConsoleMessagesTest.java @@ -29,7 +29,7 @@ public class ManagementConsoleMessagesTest extends AbstractTestMessages { public void testManagementStartup() { - _logMessage = ManagementConsoleMessages.MNG_STARTUP(); + _logMessage = ManagementConsoleMessages.STARTUP(); List<Object> log = performLog(); String[] expected = {"Startup"}; @@ -42,7 +42,7 @@ public class ManagementConsoleMessagesTest extends AbstractTestMessages String transport = "JMX"; Integer port = 8889; - _logMessage = ManagementConsoleMessages.MNG_LISTENING(transport, port); + _logMessage = ManagementConsoleMessages.LISTENING(transport, port); List<Object> log = performLog(); String[] expected = {"Starting :", transport, ": Listening on port", String.valueOf(port)}; @@ -55,7 +55,7 @@ public class ManagementConsoleMessagesTest extends AbstractTestMessages String transport = "JMX"; Integer port = 8889; - _logMessage = ManagementConsoleMessages.MNG_SHUTTING_DOWN(transport, port); + _logMessage = ManagementConsoleMessages.SHUTTING_DOWN(transport, port); List<Object> log = performLog(); String[] expected = {"Shuting down :", transport, ": port", String.valueOf(port)}; @@ -65,7 +65,7 @@ public class ManagementConsoleMessagesTest extends AbstractTestMessages public void testManagementReady() { - _logMessage = ManagementConsoleMessages.MNG_READY(); + _logMessage = ManagementConsoleMessages.READY(); List<Object> log = performLog(); String[] expected = {"Ready"}; @@ -75,7 +75,7 @@ public class ManagementConsoleMessagesTest extends AbstractTestMessages public void testManagementStopped() { - _logMessage = ManagementConsoleMessages.MNG_STOPPED(); + _logMessage = ManagementConsoleMessages.STOPPED(); List<Object> log = performLog(); String[] expected = {"Stopped"}; @@ -87,7 +87,7 @@ public class ManagementConsoleMessagesTest extends AbstractTestMessages { String path = "/path/to/the/keystore/files.jks"; - _logMessage = ManagementConsoleMessages.MNG_SSL_KEYSTORE(path); + _logMessage = ManagementConsoleMessages.SSL_KEYSTORE(path); List<Object> log = performLog(); String[] expected = {"Using SSL Keystore :", path}; diff --git a/java/broker/src/test/java/org/apache/qpid/server/logging/messages/MessageStoreMessagesTest.java b/java/broker/src/test/java/org/apache/qpid/server/logging/messages/MessageStoreMessagesTest.java index 21041fc611..cc032a0430 100644 --- a/java/broker/src/test/java/org/apache/qpid/server/logging/messages/MessageStoreMessagesTest.java +++ b/java/broker/src/test/java/org/apache/qpid/server/logging/messages/MessageStoreMessagesTest.java @@ -20,7 +20,6 @@ */ package org.apache.qpid.server.logging.messages; -import java.text.MessageFormat; import java.util.List; /** @@ -32,7 +31,7 @@ public class MessageStoreMessagesTest extends AbstractTestMessages { String name = "DerbyMessageStore"; - _logMessage = MessageStoreMessages.MST_CREATED(name); + _logMessage = MessageStoreMessages.CREATED(name); List<Object> log = performLog(); String[] expected = {"Created :", name}; @@ -44,7 +43,7 @@ public class MessageStoreMessagesTest extends AbstractTestMessages { String location = "/path/to/the/message/store.files"; - _logMessage = MessageStoreMessages.MST_STORE_LOCATION(location); + _logMessage = MessageStoreMessages.STORE_LOCATION(location); List<Object> log = performLog(); String[] expected = {"Store location :", location}; @@ -54,7 +53,7 @@ public class MessageStoreMessagesTest extends AbstractTestMessages public void testMessageStoreClosed() { - _logMessage = MessageStoreMessages.MST_CLOSED(); + _logMessage = MessageStoreMessages.CLOSED(); List<Object> log = performLog(); String[] expected = {"Closed"}; @@ -64,7 +63,7 @@ public class MessageStoreMessagesTest extends AbstractTestMessages public void testMessageStoreRecoveryStart() { - _logMessage = MessageStoreMessages.MST_RECOVERY_START(); + _logMessage = MessageStoreMessages.RECOVERY_START(); List<Object> log = performLog(); String[] expected = {"Recovery Start"}; @@ -76,7 +75,7 @@ public class MessageStoreMessagesTest extends AbstractTestMessages { String queueName = "testQueue"; - _logMessage = MessageStoreMessages.MST_RECOVERY_START(queueName, true); + _logMessage = MessageStoreMessages.RECOVERY_START(queueName, true); List<Object> log = performLog(); String[] expected = {"Recovery Start :", queueName}; diff --git a/java/broker/src/test/java/org/apache/qpid/server/logging/messages/QueueMessagesTest.java b/java/broker/src/test/java/org/apache/qpid/server/logging/messages/QueueMessagesTest.java index 417ae31d13..d51e6a6bb7 100644 --- a/java/broker/src/test/java/org/apache/qpid/server/logging/messages/QueueMessagesTest.java +++ b/java/broker/src/test/java/org/apache/qpid/server/logging/messages/QueueMessagesTest.java @@ -32,7 +32,7 @@ public class QueueMessagesTest extends AbstractTestMessages String owner = "guest"; Integer priority = 3; - _logMessage = QueueMessages.QUE_CREATED(owner, priority, true, true, true, true, true); + _logMessage = QueueMessages.CREATED(owner, priority, true, true, true, true, true); List<Object> log = performLog(); String[] expected = {"Create :", "Owner:", owner, "AutoDelete", @@ -46,7 +46,7 @@ public class QueueMessagesTest extends AbstractTestMessages { String owner = "guest"; - _logMessage = QueueMessages.QUE_CREATED(owner, null, true, true, false, false, false); + _logMessage = QueueMessages.CREATED(owner, null, true, true, false, false, false); List<Object> log = performLog(); String[] expected = {"Create :", "Owner:", owner, "AutoDelete"}; @@ -59,7 +59,7 @@ public class QueueMessagesTest extends AbstractTestMessages String owner = "guest"; Integer priority = 3; - _logMessage = QueueMessages.QUE_CREATED(owner, priority, true, false, false, false, true); + _logMessage = QueueMessages.CREATED(owner, priority, true, false, false, false, true); List<Object> log = performLog(); String[] expected = {"Create :", "Owner:", owner, "Priority:", @@ -73,7 +73,7 @@ public class QueueMessagesTest extends AbstractTestMessages String owner = "guest"; Integer priority = 3; - _logMessage = QueueMessages.QUE_CREATED(owner, priority, true, true, false, false, true); + _logMessage = QueueMessages.CREATED(owner, priority, true, true, false, false, true); List<Object> log = performLog(); String[] expected = {"Create :", "Owner:", owner, "AutoDelete", @@ -87,7 +87,7 @@ public class QueueMessagesTest extends AbstractTestMessages { String owner = "guest"; - _logMessage = QueueMessages.QUE_CREATED(owner, null, true, true, false, true, false); + _logMessage = QueueMessages.CREATED(owner, null, true, true, false, true, false); List<Object> log = performLog(); String[] expected = {"Create :", "Owner:", owner, "AutoDelete", @@ -101,7 +101,7 @@ public class QueueMessagesTest extends AbstractTestMessages String owner = "guest"; Integer priority = 3; - _logMessage = QueueMessages.QUE_CREATED(owner, priority, true, true, false, true, true); + _logMessage = QueueMessages.CREATED(owner, priority, true, true, false, true, true); List<Object> log = performLog(); String[] expected = {"Create :", "Owner:", owner, "AutoDelete", @@ -115,7 +115,7 @@ public class QueueMessagesTest extends AbstractTestMessages { String owner = "guest"; - _logMessage = QueueMessages.QUE_CREATED(owner, null, true, true, true, false, false); + _logMessage = QueueMessages.CREATED(owner, null, true, true, true, false, false); List<Object> log = performLog(); String[] expected = {"Create :", "Owner:", owner, "AutoDelete", @@ -129,7 +129,7 @@ public class QueueMessagesTest extends AbstractTestMessages String owner = "guest"; Integer priority = 3; - _logMessage = QueueMessages.QUE_CREATED(owner, priority, true, true, true, false, true); + _logMessage = QueueMessages.CREATED(owner, priority, true, true, true, false, true); List<Object> log = performLog(); String[] expected = {"Create :", "Owner:", owner, "AutoDelete", @@ -141,7 +141,7 @@ public class QueueMessagesTest extends AbstractTestMessages public void testQueueCreatedAutoDelete() { - _logMessage = QueueMessages.QUE_CREATED(null, null, false, true, false, false, false); + _logMessage = QueueMessages.CREATED(null, null, false, true, false, false, false); List<Object> log = performLog(); String[] expected = {"Create :", "AutoDelete"}; @@ -153,7 +153,7 @@ public class QueueMessagesTest extends AbstractTestMessages { Integer priority = 3; - _logMessage = QueueMessages.QUE_CREATED(null, priority, false, false, false, false, true); + _logMessage = QueueMessages.CREATED(null, priority, false, false, false, false, true); List<Object> log = performLog(); String[] expected = {"Create :", "Priority:", @@ -166,7 +166,7 @@ public class QueueMessagesTest extends AbstractTestMessages { Integer priority = 3; - _logMessage = QueueMessages.QUE_CREATED(null, priority, false, true, false, false, true); + _logMessage = QueueMessages.CREATED(null, priority, false, true, false, false, true); List<Object> log = performLog(); String[] expected = {"Create :", "AutoDelete", @@ -178,7 +178,7 @@ public class QueueMessagesTest extends AbstractTestMessages public void testQueueCreatedAutoDeleteTransient() { - _logMessage = QueueMessages.QUE_CREATED(null, null, false, true, false, true, false); + _logMessage = QueueMessages.CREATED(null, null, false, true, false, true, false); List<Object> log = performLog(); String[] expected = {"Create :", "AutoDelete", @@ -191,7 +191,7 @@ public class QueueMessagesTest extends AbstractTestMessages { Integer priority = 3; - _logMessage = QueueMessages.QUE_CREATED(null, priority, false, true, false, true, true); + _logMessage = QueueMessages.CREATED(null, priority, false, true, false, true, true); List<Object> log = performLog(); String[] expected = {"Create :", "AutoDelete", @@ -203,7 +203,7 @@ public class QueueMessagesTest extends AbstractTestMessages public void testQueueCreatedAutoDeleteDurable() { - _logMessage = QueueMessages.QUE_CREATED(null, null, false, true, true, false, false); + _logMessage = QueueMessages.CREATED(null, null, false, true, true, false, false); List<Object> log = performLog(); String[] expected = {"Create :", "AutoDelete", @@ -216,7 +216,7 @@ public class QueueMessagesTest extends AbstractTestMessages { Integer priority = 3; - _logMessage = QueueMessages.QUE_CREATED(null, priority, false, true, true, false, true); + _logMessage = QueueMessages.CREATED(null, priority, false, true, true, false, true); List<Object> log = performLog(); String[] expected = {"Create :", "AutoDelete", @@ -228,7 +228,7 @@ public class QueueMessagesTest extends AbstractTestMessages public void testQueueDeleted() { - _logMessage = QueueMessages.QUE_DELETED(); + _logMessage = QueueMessages.DELETED(); List<Object> log = performLog(); String[] expected = {"Deleted"}; diff --git a/java/broker/src/test/java/org/apache/qpid/server/logging/messages/SubscriptionMessagesTest.java b/java/broker/src/test/java/org/apache/qpid/server/logging/messages/SubscriptionMessagesTest.java index b22f2e0b85..b2bc351f8f 100644 --- a/java/broker/src/test/java/org/apache/qpid/server/logging/messages/SubscriptionMessagesTest.java +++ b/java/broker/src/test/java/org/apache/qpid/server/logging/messages/SubscriptionMessagesTest.java @@ -31,7 +31,7 @@ public class SubscriptionMessagesTest extends AbstractTestMessages { String arguments = "arguments"; - _logMessage = SubscriptionMessages.SUB_CREATE(arguments, true, true); + _logMessage = SubscriptionMessages.CREATE(arguments, true, true); List<Object> log = performLog(); String[] expected = {"Create :", "Durable", "Arguments :", arguments}; @@ -41,7 +41,7 @@ public class SubscriptionMessagesTest extends AbstractTestMessages public void testSubscriptionCreateDurable() { - _logMessage = SubscriptionMessages.SUB_CREATE(null, true, false); + _logMessage = SubscriptionMessages.CREATE(null, true, false); List<Object> log = performLog(); String[] expected = {"Create :", "Durable"}; @@ -53,7 +53,7 @@ public class SubscriptionMessagesTest extends AbstractTestMessages { String arguments = "arguments"; - _logMessage = SubscriptionMessages.SUB_CREATE(arguments, false, true); + _logMessage = SubscriptionMessages.CREATE(arguments, false, true); List<Object> log = performLog(); String[] expected = {"Create :","Arguments :", arguments}; @@ -64,7 +64,7 @@ public class SubscriptionMessagesTest extends AbstractTestMessages public void testSubscriptionClose() { - _logMessage = SubscriptionMessages.SUB_CLOSE(); + _logMessage = SubscriptionMessages.CLOSE(); List<Object> log = performLog(); String[] expected = {"Close"}; @@ -76,7 +76,7 @@ public class SubscriptionMessagesTest extends AbstractTestMessages { String state = "ACTIVE"; - _logMessage = SubscriptionMessages.SUB_STATE(state); + _logMessage = SubscriptionMessages.STATE(state); List<Object> log = performLog(); String[] expected = {"State :", state}; diff --git a/java/broker/src/test/java/org/apache/qpid/server/logging/messages/VirtualHostMessagesTest.java b/java/broker/src/test/java/org/apache/qpid/server/logging/messages/VirtualHostMessagesTest.java index 06a8acac29..17d68ef7c3 100644 --- a/java/broker/src/test/java/org/apache/qpid/server/logging/messages/VirtualHostMessagesTest.java +++ b/java/broker/src/test/java/org/apache/qpid/server/logging/messages/VirtualHostMessagesTest.java @@ -30,7 +30,7 @@ public class VirtualHostMessagesTest extends AbstractTestMessages public void testVirtualhostCreated() { String name = "test"; - _logMessage = VirtualHostMessages.VHT_CREATED(name); + _logMessage = VirtualHostMessages.CREATED(name); List<Object> log = performLog(); String[] expected = {"Created :", name}; @@ -40,7 +40,7 @@ public class VirtualHostMessagesTest extends AbstractTestMessages public void testSubscriptionClosed() { - _logMessage = VirtualHostMessages.VHT_CLOSED(); + _logMessage = VirtualHostMessages.CLOSED(); List<Object> log = performLog(); String[] expected = {"Closed"}; diff --git a/java/broker/src/velocity/java/org/apache/qpid/server/logging/GenerateLogMessages.java b/java/broker/src/velocity/java/org/apache/qpid/server/logging/GenerateLogMessages.java index f9de5543cb..672c869f77 100644 --- a/java/broker/src/velocity/java/org/apache/qpid/server/logging/GenerateLogMessages.java +++ b/java/broker/src/velocity/java/org/apache/qpid/server/logging/GenerateLogMessages.java @@ -36,13 +36,14 @@ import java.util.ResourceBundle; public class GenerateLogMessages { + private boolean DEBUG = false; private static String _tmplDir; private String _outputDir; private List<String> _logMessages = new LinkedList<String>(); + private String _packageSource; public static void main(String[] args) { - System.out.println("Starting LogMessage Generator"); GenerateLogMessages generator = null; try { @@ -84,7 +85,7 @@ public class GenerateLogMessages processArgs(args); // We need the template and input files to run. - if (_tmplDir == null || _outputDir == null || _logMessages.size() == 0) + if (_tmplDir == null || _outputDir == null || _logMessages.size() == 0 || _packageSource == null) { showUsage(); throw new IllegalAccessException(); @@ -98,18 +99,20 @@ public class GenerateLogMessages private void showUsage() { - System.out.println("Broker LogMessageGenerator v.0.0"); - System.out.println("Usage: GenerateLogMessages: -t tmplDir"); - System.out.println(" where -t tmplDir: Find templates in tmplDir."); - System.out.println(" -o outDir: Use outDir as the output dir."); + System.out.println("Broker LogMessageGenerator v.2.0"); + System.out.println("Usage: GenerateLogMessages: [-d] -t <Template Dir> -o <Output Root> -s <Source Directory> <List of _logmessage.property files to process>"); + System.out.println(" where -d : Additional debug loggin.\n" + + " Template Dir: Is the base template to use."); + System.out.println(" Output Root: The root form where the LogMessage Classes will be placed."); + System.out.println(" Source Dir : The root form where the logmessasge.property files can be found."); + System.out.println(" _logmessage.property files must include the full package structure."); } public void run() throws InvalidTypeException, Exception { - for (String file : _logMessages) { - System.out.println("Processing File:" + file); + debug("Processing File:" + file); createMessageClass(file); } @@ -150,6 +153,17 @@ public class GenerateLogMessages _tmplDir = args[i]; } break; + case 's': + case 'S': + if (++i < args.length) + { + _packageSource = args[i]; + } + break; + case 'd': + case 'D': + DEBUG=true; + break; } } } @@ -173,20 +187,22 @@ public class GenerateLogMessages String bundle = file.replace(File.separator, "."); - bundle = bundle.substring(bundle.indexOf("org."), bundle.indexOf(".properties")); + int packageStartIndex = bundle.indexOf(_packageSource) + _packageSource.length() + 2; + + bundle = bundle.substring(packageStartIndex, bundle.indexOf(".properties")); - System.out.println("Creating Classes for bundle:" + bundle); + System.out.println("Creating Class for bundle:" + bundle); ResourceBundle fileBundle = ResourceBundle.getBundle(bundle, Locale.US); // Pull the bit from /os/path/<className>.logMessages from the bundle name String className = file.substring(file.lastIndexOf(File.separator) + 1, file.lastIndexOf("_")); - System.out.println("Creating ClassName form file:" + className); + debug("Creating ClassName form file:" + className); String packageString = bundle.substring(0, bundle.indexOf(className)); String packagePath = packageString.replace(".", File.separator); - System.out.println("Package path:" + packagePath); + debug("Package path:" + packagePath); File outputDirectory = new File(_outputDir + File.separator + packagePath); if (!outputDirectory.exists()) @@ -209,7 +225,7 @@ public class GenerateLogMessages // Create the file writer to put the finished file in String outputFile = _outputDir + File.separator + packagePath + className + "Messages.java"; - System.out.println("Creating Java file:" + outputFile); + debug("Creating Java file:" + outputFile); FileWriter output = new FileWriter(outputFile); // Run Velocity to create the output file. @@ -291,7 +307,7 @@ public class GenerateLogMessages if (!message.equals("package")) { // Method names can't have a '-' in them so lets make it '_' - // e.g. BRK-STARTUP -> BRK_STARTUP + // e.g. RECOVERY-STARTUP -> RECOVERY_STARTUP logEntryData.put("methodName", message.replace('-', '_')); // Store the real name so we can use that in the actual log. logEntryData.put("name", message); @@ -306,7 +322,7 @@ public class GenerateLogMessages // Add the parameters for this message logEntryData.put("parameters", extractParameters(logMessage)); - //Add the options for this messagse + //Add the options for this messages logEntryData.put("options", extractOptions(logMessage)); //Add this entry to the list for this class @@ -499,4 +515,13 @@ public class GenerateLogMessages super(message); } } + + public void debug(String msg) + { + if (DEBUG) + { + System.out.println(msg); + } + } + } diff --git a/java/module.xml b/java/module.xml index 0aa4a8f109..f89a1a21ae 100644 --- a/java/module.xml +++ b/java/module.xml @@ -666,4 +666,77 @@ qpid.name=${project.name} </echo> </target> + <!-- Additions to perform LogMessage generation + To activate for your plugin add the following to your plugin build.xml + + <target name="precompile" depends="gen_logging"/> + + --> + + <property name="gentools.home" location="${project.root}/../gentools" /> + <property name="generated.dir" location="${module.precompiled}" /> + <property name="velocity.compile.dir" value="${build.scratch}/broker/velocity"/> + <property name="velocity.timestamp" location="${generated.dir}/velocity.timestamp" /> + + <target name="compile_velocity" > + <mkdir dir="${velocity.compile.dir}" /> + <!-- Compile LogMessages Velocity Generator --> + <javac source="${java.source}" target="${java.target}" + destdir="${velocity.compile.dir}" debug="on" includeantruntime="false" + deprecation="${javac.deprecation}" + srcdir="${project.root}/broker/src/velocity/java" > + <classpath> + <pathelement path="${gentools.home}/lib/velocity-1.4.jar" /> + </classpath> + <compilerarg line="${javac.compiler.args}"/> + </javac> + </target> + + + <target name="check_velocity_deps"> + <uptodate property="velocity.notRequired" targetfile="${velocity.timestamp}"> + <srcfiles dir="${module.src}" includes="**/*_logmessages.properties" /> + <srcfiles dir="${project.root}/broker/src/velocity/" includes="**/*.java **/*.vm" /> + </uptodate> + </target> + + + <target name="gen_logging" depends="compile_velocity,check_velocity_deps" unless="velocity.notRequired"> + <mkdir dir="${generated.dir}"/> + + <path id="logmessages.path"> + <fileset dir="${module.src}"> + <include name="**/*_logmessages.properties"/> + </fileset> + </path> + + <pathconvert property="logmessages" + refid="logmessages.path" + pathsep=" "/> + + <echo message="logmessages is ${logmessages}"/> + + <java classname="org.apache.qpid.server.logging.GenerateLogMessages" fork="true" dir="${gentools.home}/src" failonerror="true"> + <arg line="${logmessages}"/> + <arg value="-j"/> + <arg value="-o"/> + <arg value="${generated.dir}"/> + <arg value="-t"/> + <arg value="${project.root}/broker/src/velocity/templates/org/apache/qpid/server/logging/messages"/> + <arg value="-s"/> + <arg value="${module.src}"/> + + + <classpath> + <pathelement path="${module.src}"/> + <pathelement path="${velocity.compile.dir}" /> + <fileset dir="${project.root}/lib"> + <include name="**/*.jar"/> + </fileset> + <pathelement path="${gentools.home}/lib/velocity-1.4.jar" /> + </classpath> + </java> + <touch file="${velocity.timestamp}" /> + </target> + </project> diff --git a/java/systests/src/main/java/org/apache/qpid/server/queue/ProducerFlowControlTest.java b/java/systests/src/main/java/org/apache/qpid/server/queue/ProducerFlowControlTest.java index cd0de76981..58350a0538 100644 --- a/java/systests/src/main/java/org/apache/qpid/server/queue/ProducerFlowControlTest.java +++ b/java/systests/src/main/java/org/apache/qpid/server/queue/ProducerFlowControlTest.java @@ -22,7 +22,6 @@ package org.apache.qpid.server.queue; import org.apache.log4j.Logger; import org.apache.qpid.client.AMQSession; -import org.apache.qpid.client.AMQQueue; import org.apache.qpid.client.AMQDestination; import org.apache.qpid.AMQException; import org.apache.qpid.management.common.mbeans.ManagedQueue; @@ -172,7 +171,7 @@ public class ProducerFlowControlTest extends AbstractTestLogging results = _monitor.waitAndFindMatches("QUE-1004", DEFAULT_LOG_WAIT); - assertEquals("Did not find correct number of QUE_UNDERFULL queue underfull messages", 1, results.size()); + assertEquals("Did not find correct number of UNDERFULL queue underfull messages", 1, results.size()); |