org.mule.config.i18n
Class MessageFactory

java.lang.Object
  extended by org.mule.config.i18n.MessageFactory
Direct Known Subclasses:
AcegiMessages, AxisMessages, BuildersMessages, ClientMessages, CoreMessages, CxfMessages, EjbMessages, EmailMessages, FileMessages, HttpMessages, JcaMessages, JdbcMessages, JmsMessages, LocaleMessage, LocaleMessage, LocaleMessage, LocaleMessage, ManagementMessages, PGPMessages, QuartzMessages, RmiMessages, ServletMessages, SoapMessages, SpringMessages, SpringSecurityMessages, StdioMessages, TcpMessages, UdpMessages, VMMessages, XmlMessages, XmppMessages

public abstract class MessageFactory
extends Object


Field Summary
protected  Log logger
           
 
Constructor Summary
MessageFactory()
           
 
Method Summary
protected  Message createMessage(String bundlePath, int code)
          Factory method to create a new Message instance that is filled with the formatted message with id code from the resource bundle bundlePath.
protected  Message createMessage(String bundlePath, int code, Object... arguments)
          Factory method to create a new Message instance that is filled with the formatted message with id code from the resource bundle bundlePath.
protected  Message createMessage(String bundlePath, int code, Object arg)
          Factory method to create a new Message instance that is filled with the formatted message with id code from the resource bundle bundlePath.
protected  Message createMessage(String bundlePath, int code, Object arg1, Object arg2)
          Factory method to create a new Message instance that is filled with the formatted message with id code from the resource bundle bundlePath.
protected  Message createMessage(String bundlePath, int code, Object arg1, Object arg2, Object arg3)
          Factory method to create a new Message instance that is filled with the formatted message with id code from the resource bundle bundlePath.
static Message createStaticMessage(String message)
          Factory method to create a Message instance that is not read from a resource bundle.
protected static String getBundlePath(String bundleName)
          Computes the bundle's full path (META-INF/services/org/mule/i18n/<bundleName>-messages.properties) from bundleName.
protected  ClassLoader getClassLoader()
          Override this method to return the classloader for the bundle/module which contains the needed resource files.
protected  String getString(String bundlePath, int code)
          Factory method to read the message with code code from the resource bundle.
protected  String getString(String bundlePath, int code, Object arg)
          Factory method to read the message with code code from the resource bundle.
protected  String getString(String bundlePath, int code, Object[] args)
           
protected  String getString(String bundlePath, int code, Object arg1, Object arg2)
          Factory method to read the message with code code from the resource bundle.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected transient Log logger
Constructor Detail

MessageFactory

public MessageFactory()
Method Detail

getBundlePath

protected static String getBundlePath(String bundleName)
Computes the bundle's full path (META-INF/services/org/mule/i18n/<bundleName>-messages.properties) from bundleName.

Parameters:
bundleName - Name of the bundle without the "messages" suffix and without file extension.

createMessage

protected Message createMessage(String bundlePath,
                                int code,
                                Object arg)
Factory method to create a new Message instance that is filled with the formatted message with id code from the resource bundle bundlePath.

Parameters:
bundlePath - complete path to the resource bundle for lookup
code - numeric code of the message
arg -
See Also:
getBundlePath(String)

createMessage

protected Message createMessage(String bundlePath,
                                int code,
                                Object arg1,
                                Object arg2)
Factory method to create a new Message instance that is filled with the formatted message with id code from the resource bundle bundlePath.

Parameters:
bundlePath - complete path to the resource bundle for lookup
code - numeric code of the message
arg1 -
arg2 -
See Also:
getBundlePath(String)

createMessage

protected Message createMessage(String bundlePath,
                                int code,
                                Object arg1,
                                Object arg2,
                                Object arg3)
Factory method to create a new Message instance that is filled with the formatted message with id code from the resource bundle bundlePath.

Parameters:
bundlePath - complete path to the resource bundle for lookup
code - numeric code of the message
arg1 -
arg2 -
arg3 -
See Also:
getBundlePath(String)

createMessage

protected Message createMessage(String bundlePath,
                                int code,
                                Object... arguments)
Factory method to create a new Message instance that is filled with the formatted message with id code from the resource bundle bundlePath. Attention: do not confuse this method with createMessage(String, int, Object).

Parameters:
bundlePath - complete path to the resource bundle for lookup
code - numeric code of the message
arguments -
See Also:
getBundlePath(String)

createMessage

protected Message createMessage(String bundlePath,
                                int code)
Factory method to create a new Message instance that is filled with the formatted message with id code from the resource bundle bundlePath.

Parameters:
bundlePath - complete path to the resource bundle for lookup
code - numeric code of the message

createStaticMessage

public static Message createStaticMessage(String message)
Factory method to create a Message instance that is not read from a resource bundle.

Parameters:
message - Message's message text
Returns:
a Messsage instance that has an error code of -1 and no arguments.

getString

protected String getString(String bundlePath,
                           int code)
Factory method to read the message with code code from the resource bundle.

Parameters:
bundlePath - complete path to the resource bundle for lookup
code - numeric code of the message
Returns:
formatted error message as String

getString

protected String getString(String bundlePath,
                           int code,
                           Object arg)
Factory method to read the message with code code from the resource bundle.

Parameters:
bundlePath - complete path to the resource bundle for lookup
code - numeric code of the message
arg -
Returns:
formatted error message as String

getString

protected String getString(String bundlePath,
                           int code,
                           Object arg1,
                           Object arg2)
Factory method to read the message with code code from the resource bundle.

Parameters:
bundlePath - complete path to the resource bundle for lookup
code - numeric code of the message
arg1 -
arg2 -
Returns:
formatted error message as String

getString

protected String getString(String bundlePath,
                           int code,
                           Object[] args)

getClassLoader

protected ClassLoader getClassLoader()
Override this method to return the classloader for the bundle/module which contains the needed resource files.



Copyright © 2003-2009 MuleSource, Inc.. All Rights Reserved.