public class MessageServiceImpl extends Object implements MessageService
| Modifier and Type | Field and Description |
|---|---|
static String |
PROPERTIES_FILE_SUFFIX |
| Constructor and Description |
|---|
MessageServiceImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
destroy() |
String |
getBaseBundleName(String resourceName) |
Locale |
getContentLocale()
Get the content local for the current thread.
This will revert to MessageService.getLocale() if no value has been defined. |
Locale |
getLocale()
Get the general local for the current thread, will revert to the default locale if none
specified for this thread.
|
String |
getMessage(String messageKey) |
String |
getMessage(String messageKey,
Locale locale) |
String |
getMessage(String messageKey,
Locale locale,
Object... params) |
String |
getMessage(String messageKey,
Object... params) |
Locale |
getNearestLocale(Locale templateLocale,
Set<Locale> options)
Searches for the nearest locale from the available options.
|
protected org.alfresco.service.cmr.repository.NodeRef |
getNode(org.alfresco.service.cmr.repository.NodeRef rootNodeRef,
String path) |
Set<String> |
getRegisteredBundles()
Get set of registered message resource bundles
|
ResourceBundle |
getRepoResourceBundle(org.alfresco.service.cmr.repository.StoreRef storeRef,
String path,
Locale locale)
Get message resource bundle from the repository
note: also used by Web Client (ResourceBundleWrapper)
|
void |
init() |
void |
onDisableTenant() |
void |
onEnableTenant() |
Locale |
parseLocale(String localeStr)
Factory method to create a Locale from a lang_country_variant string.
|
void |
register(MessageDeployer messageDeployer)
Register message deployer with message service
|
void |
registerResourceBundle(String resBundlePath)
Register a resource bundle.
|
void |
reset()
Resets the message service
|
protected org.alfresco.service.cmr.repository.NodeRef |
resolveQNamePath(org.alfresco.service.cmr.repository.NodeRef rootNodeRef,
String[] pathPrefixQNameStrings) |
void |
setContentLocale(Locale locale)
Set the content locale for the current thread.
|
void |
setContentService(ContentService contentService) |
void |
setLoadedResourceBundlesCache(org.alfresco.repo.cache.SimpleCache<String,Map<Locale,Set<String>>> loadedResourceBundlesCache) |
void |
setLocale(Locale locale)
Set the locale for the current thread.
|
void |
setMessagesCache(org.alfresco.repo.cache.SimpleCache<String,Map<Locale,Map<String,String>>> messagesCache) |
void |
setNamespaceService(org.alfresco.service.namespace.NamespaceService namespaceService) |
void |
setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService) |
void |
setResourceBundleBaseNamesCache(org.alfresco.repo.cache.SimpleCache<String,Set<String>> resourceBundleBaseNamesCache) |
void |
setTenantService(org.alfresco.repo.tenant.TenantService tenantService) |
void |
setTryLockTimeout(long tryLockTimeout) |
void |
unregisterResourceBundle(String resBundlePath)
Unregister a resource bundle
|
public static final String PROPERTIES_FILE_SUFFIX
public void setNamespaceService(org.alfresco.service.namespace.NamespaceService namespaceService)
public void setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)
public void setTenantService(org.alfresco.repo.tenant.TenantService tenantService)
public void setContentService(ContentService contentService)
public void setResourceBundleBaseNamesCache(org.alfresco.repo.cache.SimpleCache<String,Set<String>> resourceBundleBaseNamesCache)
public void setLoadedResourceBundlesCache(org.alfresco.repo.cache.SimpleCache<String,Map<Locale,Set<String>>> loadedResourceBundlesCache)
public void setMessagesCache(org.alfresco.repo.cache.SimpleCache<String,Map<Locale,Map<String,String>>> messagesCache)
public void setTryLockTimeout(long tryLockTimeout)
public void setLocale(Locale locale)
MessageServicesetLocale in interface MessageServicelocale - the localepublic Locale getLocale()
MessageServicegetLocale in interface MessageServicepublic void setContentLocale(Locale locale)
MessageServicesetContentLocale in interface MessageServicelocale - the content localepublic Locale getContentLocale()
MessageServiceMessageService.getLocale() if no value has been defined.getContentLocale in interface MessageServicepublic Locale getNearestLocale(Locale templateLocale, Set<Locale> options)
MessageServicegetNearestLocale in interface MessageServicetemplateLocale - the template to search for or null to match any localeoptions - the available locales to search frompublic Locale parseLocale(String localeStr)
MessageServiceparseLocale in interface MessageServicelocaleStr - e.g. fr_FRdefault if the
string is invalidpublic void registerResourceBundle(String resBundlePath)
MessageServiceThis should be the bundle base path eg, alfresco/messages/errors or, workspace://SpaceStore/app:company_home/app:dictionary/app:labels/cm:errors
Once registered the messages will be available via getMessage, assuming the bundle resource exists at the given path location.
registerResourceBundle in interface MessageServiceresBundlePath - the bundle base pathpublic String getMessage(String messageKey)
getMessage in interface org.alfresco.service.cmr.i18n.MessageLookuppublic String getMessage(String messageKey, Locale locale)
getMessage in interface org.alfresco.service.cmr.i18n.MessageLookuppublic String getMessage(String messageKey, Object... params)
getMessage in interface org.alfresco.service.cmr.i18n.MessageLookuppublic String getMessage(String messageKey, Locale locale, Object... params)
getMessage in interface org.alfresco.service.cmr.i18n.MessageLookuppublic void unregisterResourceBundle(String resBundlePath)
MessageServiceThis should be the bundle base path eg alfresco/messages/errors or workspace://SpaceStore/app:company_home/app:dictionary/app:labels/cm:errors
Once unregistered the messages will no longer be available via getMessage
unregisterResourceBundle in interface MessageServiceresBundlePath - the bundle base pathpublic ResourceBundle getRepoResourceBundle(org.alfresco.service.cmr.repository.StoreRef storeRef, String path, Locale locale) throws IOException
MessageServicegetRepoResourceBundle in interface MessageServicestoreRef - store refpath - repository path (XPath)locale - localeIOExceptionpublic void onEnableTenant()
onEnableTenant in interface org.alfresco.repo.tenant.TenantDeployerpublic void onDisableTenant()
onDisableTenant in interface org.alfresco.repo.tenant.TenantDeployerpublic void init()
init in interface org.alfresco.repo.tenant.TenantDeployerpublic void destroy()
destroy in interface org.alfresco.repo.tenant.TenantDeployerpublic Set<String> getRegisteredBundles()
MessageServicegetRegisteredBundles in interface MessageServicepublic void register(MessageDeployer messageDeployer)
MessageServiceregister in interface MessageServicemessageDeployer - MessageDeployerpublic void reset()
public String getBaseBundleName(String resourceName)
getBaseBundleName in interface MessageServiceprotected org.alfresco.service.cmr.repository.NodeRef getNode(org.alfresco.service.cmr.repository.NodeRef rootNodeRef,
String path)
protected org.alfresco.service.cmr.repository.NodeRef resolveQNamePath(org.alfresco.service.cmr.repository.NodeRef rootNodeRef,
String[] pathPrefixQNameStrings)
Copyright © 2005–2018 Alfresco Software. All rights reserved.