View Javadoc

1   /*
2    * $Id: LocaleMessage.java 19191 2010-08-25 21:05:23Z tcarlson $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.example.stockquote;
12  
13  import org.mule.config.i18n.MessageFactory;
14  
15  /**
16   * <code>LocaleMessage</code> is a convenience interface for retrieving
17   * internationalised strings from resource bundles. The actual work is done by
18   * the {@link MessageFactory} in core.
19   */
20  public class LocaleMessage extends MessageFactory
21  {
22      private static final LocaleMessage factory = new LocaleMessage();
23      
24      /**
25       * Note that the messages for this example are not in mule's standard
26       * META-INF/services/org/mule/i18n folder but in a different resource bundle.
27       */
28      private static final String BUNDLE_PATH = "messages.stockquote-example-messages";
29  
30      public static String getStockQuoteMessage(String symbol, String name, String date, String last, 
31          String change, String open, String high, String low, String volume, String previousClose)
32      {
33          String[] params = { symbol, name, date, last, change, open, high,
34              low, volume, previousClose };
35          return factory.getString(BUNDLE_PATH, 1, params);
36      }
37  
38      @Override
39      protected ClassLoader getClassLoader()
40      {
41          return getClass().getClassLoader();
42      }
43  }