当前位置: 首页>>代码示例>>Java>>正文


Java PropertyResourceBundle.getBundle方法代码示例

本文整理汇总了Java中java.util.PropertyResourceBundle.getBundle方法的典型用法代码示例。如果您正苦于以下问题:Java PropertyResourceBundle.getBundle方法的具体用法?Java PropertyResourceBundle.getBundle怎么用?Java PropertyResourceBundle.getBundle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.PropertyResourceBundle的用法示例。


在下文中一共展示了PropertyResourceBundle.getBundle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: DBManager

import java.util.PropertyResourceBundle; //导入方法依赖的package包/类
public DBManager() {
 ResourceBundle rb = PropertyResourceBundle.getBundle(
    "com.gint.app.bisisadmin.Config");
 String driver     = rb.getString("driver");
 String URL        = rb.getString("url");
 String username   = rb.getString("username");
 String password   = rb.getString("password");
	
 try {
   Class.forName(driver);
   GenericObjectPool connectionPool = new GenericObjectPool(null);
   DriverManagerConnectionFactory connectionFactory = 
     new DriverManagerConnectionFactory(URL, username, password);
   PoolableConnectionFactory poolableConnectionFactory =
     new PoolableConnectionFactory(connectionFactory, connectionPool, null, 
         null, false, false);
   poolingDataSource = new PoolingDataSource(connectionPool);
 } catch (Exception ex) {
   ex.printStackTrace();
 }  
}
 
开发者ID:unsftn,项目名称:bisis-v4,代码行数:22,代码来源:DBManager.java

示例2: getString

import java.util.PropertyResourceBundle; //导入方法依赖的package包/类
@Override
public String getString(String key) {
	try {
		String localeProp = configurationService.getLiderLocale();
		if (localeProp != null && !localeProp.equalsIgnoreCase(lastLocaleProp)) {
			PropertyResourceBundle.clearCache();
			lastLocaleProp = localeProp;
		}
		Locale targetLocale = localeProp.contains("-") || localeProp.contains("_")
				? Locale.forLanguageTag(localeProp) : new Locale(localeProp);
		ResourceBundle resourceBundle = PropertyResourceBundle.getBundle(BUNDLE_NAME, targetLocale);
		return resourceBundle.getString(key);
	} catch (Exception e) {
		logger.error(e.getMessage(), e);
		return '!' + key + '!';
	}
}
 
开发者ID:Pardus-LiderAhenk,项目名称:lider,代码行数:18,代码来源:LocaleServiceImpl.java

示例3: startUp

import java.util.PropertyResourceBundle; //导入方法依赖的package包/类
/**
 * Provides an <CODE>Application</CODE> with a chance to perform any
 * initialisation. This implementation checks for the -help option.
 * Derived classes may extend the functionality.
 * @since	TFP 1.0
 */
protected void startUp ()
{
	if (helpOption.isPresent ()) {
		System.err.println ("Usage:\n    java " + this.getClass ().getName ()
				+ Option.listOptions () + describeArguments ());
		System.err.println ();
		System.err.println ("Options:");
		Option.describeOptions ();
		System.exit (1);
	}
	
	// Load settings bundle if defined.
	try {
		settings = PropertyResourceBundle.getBundle (getClass ().getName ());
	}
	catch (MissingResourceException error) {
		settings = null;
	}
}
 
开发者ID:handcoded,项目名称:fpml-toolkit-java,代码行数:26,代码来源:Application.java

示例4: JPEGImageWriteParam

import java.util.PropertyResourceBundle; //导入方法依赖的package包/类
/**
 * Construct a JPEGImageWriteParam with the following state: tiling
 * is not supported, progressive mode is supported, initial
 * progressive mode is MODE_DISABLED, compression is supported, one
 * compression type named "JPEG" is supported and the default
 * compression quality is 0.75f.  Compression type names and
 * compression quality descriptions are localized to the given
 * locale.
 *
 * @param locale the locale used for message localization
 */
public JPEGImageWriteParam(Locale locale)
{
  super(locale);

  // Get localized compression type and compression quality
  // description strings for the given locale.
  messages = PropertyResourceBundle.getBundle
    ("javax/imageio/plugins/jpeg/MessagesBundle", locale);

  // Initialize inherited ImageWriter fields.
  canWriteTiles = false;
  canWriteProgressive = true;
  progressiveMode = MODE_DISABLED;
  canWriteCompressed = true;
  compressionTypes = new String[]
    {
      messages.getString("compression.types.jpeg")
    };
  compressionType = compressionTypes[0];
  compressionQuality = 0.75f;
}
 
开发者ID:vilie,项目名称:javify,代码行数:33,代码来源:JPEGImageWriteParam.java

示例5: registerLocaleMessages

import java.util.PropertyResourceBundle; //导入方法依赖的package包/类
public List<String> registerLocaleMessages(String prefix, String baseName, Locale locale, ClassLoader classLoader) {
    ArrayList<String> keys = new ArrayList<String>();
    try {
        ResourceBundle bundle = PropertyResourceBundle.getBundle(baseName, locale, classLoader);
        Enumeration<String> enumKeys = bundle.getKeys();
        while (enumKeys.hasMoreElements()) {
            String key = enumKeys.nextElement();
            keys.add(key);
        }
        if (keys.size() > 0) {
            MessageBundle messageBundle = new ResourceBundleMessageSource(bundle);
            registerPrefixMessageBundle(prefix, messageBundle);
        }
    } catch (MissingResourceException e) {
        // looks like no properties files for this prefix
    }
    return keys;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:19,代码来源:EntityPropertiesServiceSimple.java

示例6: DetailFormatter

import java.util.PropertyResourceBundle; //导入方法依赖的package包/类
public DetailFormatter() {
  try {
    ResourceBundle rb = PropertyResourceBundle.getBundle(
        DetailFormatter.class.getName());
    String sPrefList = rb.getString("DISPLAYED_PREFIXES");
    StringTokenizer st = new StringTokenizer(sPrefList, ", \t");
    prefList = new ArrayList();
    while (st.hasMoreTokens()) {
      prefList.add(st.nextToken());
    }
  } catch (Exception ex) {
    log.fatal(ex);
  }
}
 
开发者ID:unsftn,项目名称:bisis-v4,代码行数:15,代码来源:DetailFormatter.java

示例7: get

import java.util.PropertyResourceBundle; //导入方法依赖的package包/类
/**
 * Retrieves a language-dependent message from the properties file
 *
 * @param msgName Message name
 * @return language-dependent version of the message
 */
public static String get(String msgName, String locale) {
  ResourceBundle rb;
  if (locale == null)
    locale = "sr";
  if (fileCache.get(locale) == null) {
    rb = PropertyResourceBundle.getBundle(
      Messages.class.getPackage().getName()+".Messages", new Locale(locale));
    fileCache.put(locale, rb);
  } else {
    rb = (ResourceBundle)fileCache.get(locale);
  }
  return rb.getString(msgName);
}
 
开发者ID:unsftn,项目名称:bisis-v4,代码行数:20,代码来源:Messages.java

示例8: init

import java.util.PropertyResourceBundle; //导入方法依赖的package包/类
public static void init(){
 	try{
 		ResourceBundle rb = PropertyResourceBundle.getBundle("com.gint.app.bisis4web.web.Settings");
     locale = rb.getString("localeB");
   }catch(Exception e) {		
	e.printStackTrace();
}
}
 
开发者ID:unsftn,项目名称:bisis-v4,代码行数:9,代码来源:MakeView.java

示例9: JarManager

import java.util.PropertyResourceBundle; //导入方法依赖的package包/类
public JarManager(){	
	ResourceBundle rb = PropertyResourceBundle.getBundle(
      "com.gint.app.bisisadmin.Config");
	  jarpath = rb.getString("path");
	  jarname = rb.getString("name");
	  keystore = rb.getString("keystore");
	  storepass = rb.getString("storepass");
	  keypass = rb.getString("keypass");
	  alias = rb.getString("alias");
	  tsa = rb.getString("tsa");
	  proxyHost = rb.getString("proxyHost");
	  proxyPort = rb.getString("proxyPort");
	  
}
 
开发者ID:unsftn,项目名称:bisis-v4,代码行数:15,代码来源:JarManager.java

示例10: GSSException

import java.util.PropertyResourceBundle; //导入方法依赖的package包/类
/**
 * Create a new GSS exception with the given major and minor codes, and a
 * minor explanation string.
 *
 * @param major The major GSS error code.
 * @param minor The minor application-specific error code.
 * @param minorString An explanation of the minor error code.
 */
public GSSException(int major, int minor, String minorString)
{
  this.major = major;
  this.minor = minor;
  this.minorString = minorString;
  try
    {
      messages = PropertyResourceBundle.getBundle("org/ietf/jgss/MessagesBundle");
    }
  catch (Exception e)
    {
      messages = null;
    }
}
 
开发者ID:vilie,项目名称:javify,代码行数:23,代码来源:GSSException.java

示例11: getLocalizedMessage

import java.util.PropertyResourceBundle; //导入方法依赖的package包/类
static final String getLocalizedMessage (String key)
{
  if (messages == null)
    messages =
      PropertyResourceBundle.getBundle (bundle, Locale.getDefault ());
  return messages.getString (key);
}
 
开发者ID:vilie,项目名称:javify,代码行数:8,代码来源:RE.java

示例12: getLocalizedMessage

import java.util.PropertyResourceBundle; //导入方法依赖的package包/类
static final String getLocalizedMessage (String key)
 {
   if (messages == null)
     messages =
PropertyResourceBundle.getBundle (bundle, Locale.getDefault ());
   return messages.getString (key);
 }
 
开发者ID:nmldiegues,项目名称:jvm-stm,代码行数:8,代码来源:RE.java

示例13: LocalizationBundle

import java.util.PropertyResourceBundle; //导入方法依赖的package包/类
public LocalizationBundle(String resourceBundleName, Locale locale, TimeZone timeZone)
{
    resourceBundle = PropertyResourceBundle.getBundle(resourceBundleName, locale);
    this.resourceBundleName = resourceBundleName;
    this.locale = locale;
    this.timezone = timeZone;
}
 
开发者ID:Thomas-Bergmann,项目名称:Tournament,代码行数:8,代码来源:LocalizationBundle.java

示例14: encryptString

import java.util.PropertyResourceBundle; //导入方法依赖的package包/类
private static String encryptString(String str) {
int i = 0;
ResourceBundle bundle = PropertyResourceBundle.getBundle("com.akdeniz.googleplaycrawler.crypt");
String string=bundle.getString("key");

byte[] obj = new byte[5];
Key createKeyFromString = createKeyFromString(string, obj);
if (createKeyFromString == null) {
	return null;
}
try {
	Cipher instance = Cipher
			.getInstance("RSA/ECB/OAEPWITHSHA1ANDMGF1PADDING");
	byte[] bytes = str.getBytes("UTF-8");
	int length = ((bytes.length - 1) / 86) + 1;
	byte[] obj2 = new byte[(length * 133)];
	while (i < length) {
		instance.init(1, createKeyFromString);
		byte[] doFinal = instance.doFinal(bytes, i * 86, i == length
				+ -1 ? bytes.length - (i * 86) : 86);
		System.arraycopy(obj, 0, obj2, i * 133, obj.length);
		System.arraycopy(doFinal, 0, obj2, (i * 133) + obj.length,
				doFinal.length);
		i++;
	}
	return Base64.encodeToString(obj2, 10);
} catch (Throwable e) {
	throw new RuntimeException(e);
}
}
 
开发者ID:onyxbits,项目名称:raccoon4,代码行数:31,代码来源:GooglePlayAPI.java

示例15: loadBundle

import java.util.PropertyResourceBundle; //导入方法依赖的package包/类
/**
 * Loads the resource bundle.
 * @param c
 */
private ResourceBundle loadBundle() {
    String pkg = clazz.getPackage().getName();
    Locale locale = getLocale();
    return PropertyResourceBundle.getBundle(pkg + ".messages", locale, clazz.getClassLoader(), new ResourceBundle.Control() { //$NON-NLS-1$
        @Override
        public List<String> getFormats(String baseName) {
            return FORMATS;
        }
    });
}
 
开发者ID:Governance,项目名称:rtgov-ui,代码行数:15,代码来源:AbstractMessages.java


注:本文中的java.util.PropertyResourceBundle.getBundle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。