use of com.sun.identity.shared.locale.AMResourceBundleCache in project OpenAM by OpenRock.
the class PWResetResBundleCacher method getBundle.
/**
* Gets resource bundle
*
* @param name of bundle
* @param locale of bundle
* @return resource bundle
*/
public static ResourceBundle getBundle(String name, Locale locale) {
AMResourceBundleCache cache = AMResourceBundleCache.getInstance();
ResourceBundle rb = cache.getResBundle(name, locale);
if (rb == null) {
rb = cache.getResBundle(PWResetModel.DEFAULT_RB, locale);
}
return rb;
}
use of com.sun.identity.shared.locale.AMResourceBundleCache in project OpenAM by OpenRock.
the class SMSEmbeddedLdapObject method initialize.
/**
* Synchronized initialized method
*/
private synchronized void initialize() throws SMSException {
auditorFactory = InjectorHolder.getInstance(ConfigAuditorFactory.class);
if (initialized) {
return;
}
// Obtain the I18N resource bundle & Debug
debug = Debug.getInstance("amSMSEmbeddedLdap");
AMResourceBundleCache amCache = AMResourceBundleCache.getInstance();
bundle = amCache.getResBundle(IUMSConstants.UMS_BUNDLE_NAME, java.util.Locale.ENGLISH);
orgUnitAttr = new LinkedHashSet<>(1);
orgUnitAttr.add(getNamingAttribute());
orgAttr = new LinkedHashSet<>(1);
orgAttr.add(getOrgNamingAttribute());
icConn = InternalClientConnection.getRootConnection();
try {
String serviceDN = SMSEntry.SERVICES_RDN + SMSEntry.COMMA + getRootSuffix();
if (!entryExists(serviceDN)) {
Map attrs = new HashMap();
Set attrValues = new HashSet();
attrValues.add(SMSEntry.OC_TOP);
attrValues.add(SMSEntry.OC_ORG_UNIT);
attrs.put(SMSEntry.ATTR_OBJECTCLASS, attrValues);
internalCreate(null, serviceDN, attrs);
}
} catch (Exception e) {
// Unable to initialize (trouble!!)
debug.error("SMSEmbeddedLdapObject.initialize: " + "Unable to initalize(exception):", e);
throw (new SMSException(IUMSConstants.UMS_BUNDLE_NAME, IUMSConstants.CONFIG_MGR_ERROR, null));
}
String[] smsAttrs = getAttributeNames();
smsAttributes = new LinkedHashSet(smsAttrs.length);
for (int i = 0; i < smsAttrs.length; i++) {
smsAttributes.add(smsAttrs[i]);
}
initialized = true;
}
use of com.sun.identity.shared.locale.AMResourceBundleCache in project OpenAM by OpenRock.
the class SMSLdapObject method initialize.
/**
* Synchronized initialized method
*/
private synchronized void initialize() throws SMSException {
if (initialized) {
return;
}
// Obtain the I18N resource bundle & Debug
debug = Debug.getInstance("amSMSLdap");
AMResourceBundleCache amCache = AMResourceBundleCache.getInstance();
bundle = amCache.getResBundle(IUMSConstants.UMS_BUNDLE_NAME, java.util.Locale.ENGLISH);
OU_ATTR[0] = getNamingAttribute();
O_ATTR[0] = getOrgNamingAttribute();
String enableP = SystemProperties.get(SMSEntry.DB_PROXY_ENABLE);
enableProxy = (enableP != null) && enableP.equalsIgnoreCase("true");
if (debug.messageEnabled()) {
debug.message("SMSLdapObject: proxy enable value: " + enableProxy);
}
try {
if (enableProxy) {
// Initialize the principal, used only with AMSDK
// for proxy connections
adminPrincipal = new AuthPrincipal((String) AccessController.doPrivileged(new AdminDNAction()));
// Get UMS datalayer
dlayer = DataLayer.getInstance();
if (debug.messageEnabled()) {
debug.message("SMSLdapObject: DataLayer instance " + "obtained.");
}
} else {
// Get SM datalayer
smdlayer = SMDataLayer.getInstance();
if (debug.messageEnabled()) {
debug.message("SMSLdapObject: SMDataLayer instance " + "obtained.");
}
}
if ((dlayer == null) && (smdlayer == null)) {
debug.error("SMSLdapObject: Unable to initialize LDAP");
throw (new SMSException(IUMSConstants.UMS_BUNDLE_NAME, IUMSConstants.CONFIG_MGR_ERROR, null));
}
debug.message("SMSLdapObject: LDAP Initialized successfully");
// Get connection retry parameters
DataLayer.initConnectionParams();
connNumRetry = DataLayer.getConnNumRetry();
connRetryInterval = DataLayer.getConnRetryInterval();
retryErrorCodes = DataLayer.getRetryErrorCodes();
// Need to check if the root nodes exists. If not, create them
String serviceDN = SMSEntry.SERVICES_RDN + SMSEntry.COMMA + getRootSuffix();
if (!entryExists(serviceDN)) {
Map attrs = new HashMap();
Set attrValues = new HashSet();
attrValues.add(SMSEntry.OC_TOP);
attrValues.add(SMSEntry.OC_ORG_UNIT);
attrs.put(SMSEntry.ATTR_OBJECTCLASS, attrValues);
create(adminPrincipal, serviceDN, attrs);
}
} catch (Exception e) {
// Unable to initialize (trouble!!)
debug.error("SMSEntry: Unable to initalize(exception):", e);
throw (new SMSException(IUMSConstants.UMS_BUNDLE_NAME, IUMSConstants.CONFIG_MGR_ERROR, null));
}
initialized = true;
}
Aggregations