NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

import com.adventnet.la.i18n.ResourceBundleMgr;

import java.io.File;
import java.io.FileInputStream;
import java.util.*;
import java.util.logging.Logger;

public class ProductBundle
{
private static ProductBundle bundle = null;
private Hashtable<Object,Object> rebrandingHash = null;
private static ResourceBundleMgr rbundleMgr = null;
public String country ="";
private static final Logger LOGGER = Logger.getLogger(ProductBundle.class.getName());
private ProductBundle()
{
rbundleMgr = ResourceBundleMgr.getInstance();
if(rbundleMgr.getServerLocale()!= null)
{
country = rbundleMgr.getServerLocale().getCountry();
}
populateRebrandingHash();
}

public static ProductBundle getInstance()
{
if(bundle == null)
{
bundle = new ProductBundle();
}
return bundle;
}

private synchronized void loadRsBundle(Locale locale)
{
ResourceBundle resBundle = null;

if(locale.getLanguage().equals("--"))
{
resBundle = ResourceBundle.getBundle("resources/MessageResources"); //No I18N
}
else
{
resBundle = ResourceBundle.getBundle("resources/MessageResources", locale); //No I18N
}

rbundleMgr.addServerBundle(resBundle,locale);
}

public ResourceBundle getBundle()
{
Locale locale = rbundleMgr.getLocale();
if(!rbundleMgr.isServerKeypresent(locale))
{
loadRsBundle(locale);
}
return rbundleMgr.getServerBundle(locale);
}

public ResourceBundle getBundle(Locale locale)
{
if(locale == null)
{
return getBundle();
}
if(!rbundleMgr.isServerKeypresent(locale))
{
loadRsBundle(locale);
}
return rbundleMgr.getServerBundle(locale);
}

public ResourceBundle getServerBundle()
{
Locale locale = rbundleMgr.getServerLocale();
if(locale == null)
{
locale = new Locale("--","--");
}
return getBundle(locale);
}

public String getString(Locale locale , String key)
{
ResourceBundle resBundle = getBundle(locale);
return getString(resBundle, key);
}

private String getString(ResourceBundle resBundle, String key )
{
String value = null;
try
{
try
{
value = resBundle.getString(key);
}
catch(MissingResourceException exp)
{
//Postgres will return lowercase column names.I've changed some of the keys to lowercase in MessageResource.properties so that it can be applicable for all DB.
value = resBundle.getString(key.toLowerCase());
}

}
catch(MissingResourceException exp)
{
//Key not found
value = key;
}

return value;
}

public String getString(String key)
{
ResourceBundle resBundle = getBundle();
return getString(resBundle, key);
}


public void populateRebrandingHash()
{
rebrandingHash = null;
String rebrandFile = System.getProperty("server.home")+File.separator+"server"+File.separator+"conf"+File.separator+"Rebranding.txt"; //No I18N

File file = new File(rebrandFile);
if(file.exists())
{
FileInputStream fi = null;
Properties rebrandProp = new Properties();

try
{
fi = new FileInputStream(new File(rebrandFile));
rebrandProp.load(fi);
rebrandingHash = (Hashtable<Object,Object>)rebrandProp;

}catch(Exception e)
{
LOGGER.info("Rebranding file does not exists so it takes the data from the Message Resources");
}finally
{
try
{
if(fi != null)
{
fi.close();
}
}
catch(Exception ee)
{}
}
}
}


public Hashtable<Object,Object> getRebrandingHash()
{
return rebrandingHash;
}

public String getRebrandingString(String rebrandKey)
{

String result = null;
if(rebrandingHash != null&&!rebrandingHash.isEmpty())
{
result = (String)rebrandingHash.get(rebrandKey);
}
else
{
result = getString(rebrandKey);
}

return result;
}
public void refreshString()
{
//commenting out the clear as the new key will be populated via populated() method ....
//rebrandingHash.clear();
populateRebrandingHash();

}


}
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.